Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Ruler\Bin\Assert Class Reference
Inheritance diagram for Hoa\Ruler\Bin\Assert:

Public Member Functions

 main ()
 
 usage ()
 
- Public Member Functions inherited from Hoa\Console\Dispatcher\Kit
 __construct (Router $router, Dispatcher $dispatcher, View\Viewable $view=null)
 
 getOption (&$optionValue, $short=null)
 
 setOptions (Array $options)
 
 makeUsageOptionsList (Array $definitions=[])
 
 resolveOptionAmbiguity (Array $solutions)
 
 status ($text, $status)
 
 readLine ($prefix=null)
 
 readPassword ($prefix=null)
 
- Public Member Functions inherited from Hoa\Dispatcher\Kit
 __construct (Router $router, Dispatcher $dispatcher, View\Viewable $view=null)
 
 construct ()
 

Protected Attributes

 $options
 
- Protected Attributes inherited from Hoa\Console\Dispatcher\Kit
 $options = null
 
 $_options = null
 

Additional Inherited Members

- Public Attributes inherited from Hoa\Console\Dispatcher\Kit
 $parser = null
 
- Public Attributes inherited from Hoa\Dispatcher\Kit
 $router = null
 
 $dispatcher = null
 
 $view = null
 
 $data = null
 

Detailed Description

Class .

Assert rules.

Definition at line 50 of file Assert.php.

Member Function Documentation

Hoa\Ruler\Bin\Assert::main ( )

The entry method.

Returns
int

Definition at line 69 of file Assert.php.

70  {
71  $ruler = new Ruler();
72  $context = new Ruler\Context();
73 
74  while (false !== $c = $this->getOption($v)) {
75  switch ($c) {
76  case '__ambiguous':
77  $context[$v['option']] = $v['value'];
78 
79  break;
80 
81  case 'h':
82  case '?':
83  return $this->usage();
84  }
85  }
86 
87  $this->parser->listInputs($rule);
88 
89  if (empty($rule)) {
90  return $this->usage();
91  }
92 
93  return (int) (!$ruler->assert($rule, $context));
94  }
getOption(&$optionValue, $short=null)
Definition: Kit.php:104

Here is the call graph for this function:

Hoa\Ruler\Bin\Assert::usage ( )

The command usage.

Returns
int

Definition at line 101 of file Assert.php.

102  {
103  echo
104  'Usage : ruler:assert <options> rule', "\n",
105  'Options :', "\n",
106  $this->makeUsageOptionsList([
107  'help' => 'This help.'
108  ]), "\n",
109  'Example : -x=2 -y=6 \'x in [1, 2, 4] and x < y\'.', "\n",
110  'See $? to see the result (0 for true, > 0 for false).', "\n";
111 
112  return;
113  }
makeUsageOptionsList(Array $definitions=[])
Definition: Kit.php:149

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Hoa\Ruler\Bin\Assert::$options
protected
Initial value:

Definition at line 57 of file Assert.php.


The documentation for this class was generated from the following file: