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

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 Hoa.

Transform a character into its code. Please, see Hoa::toCode.

Definition at line 50 of file Tocode.php.

Member Function Documentation

Hoa\Ustring\Bin\Tocode::main ( )

The entry method.

Returns
int

Definition at line 70 of file Tocode.php.

71  {
72  $base = 16;
73 
74  while (false !== $c = $this->getOption($v)) {
75  switch ($c) {
76  case 'b':
77  $base = intval($v);
78 
79  break;
80 
81  case '__ambiguous':
82  $this->resolveOptionAmbiguity($v);
83 
84  break;
85 
86  case 'h':
87  case '?':
88  default:
89  return $this->usage();
90  }
91  }
92 
93  $this->parser->listInputs($char);
94 
95  $code = base_convert((string) Ustring::toCode($char), 10, $base);
96 
97  echo $code, "\n";
98 
99  return;
100  }
static toCode($char)
Definition: Ustring.php:943
getOption(&$optionValue, $short=null)
Definition: Kit.php:104
resolveOptionAmbiguity(Array $solutions)
Definition: Kit.php:190

Here is the call graph for this function:

Hoa\Ustring\Bin\Tocode::usage ( )

The command usage.

Returns
int

Definition at line 107 of file Tocode.php.

108  {
109  echo
110  'Usage : string:tocode <char>', "\n",
111  'Options :', "\n",
112  $this->makeUsageOptionsList([
113  'b' => 'Get the code in a specific base (16 by default).',
114  'help' => 'This help.'
115  ]), "\n";
116 
117  return;
118  }
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\Ustring\Bin\Tocode::$options
protected
Initial value:

Definition at line 57 of file Tocode.php.


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