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

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 .

This command resolves some hoa:// paths.

Definition at line 50 of file Resolve.php.

Member Function Documentation

Hoa\Core\Bin\Resolve::main ( )

The entry method.

Returns
int

Definition at line 73 of file Resolve.php.

74  {
75  $exists = true;
76  $unfold = false;
77  $tree = false;
78  $verbose = Console::isDirect(STDOUT);
79 
80  while (false !== $c = $this->getOption($v)) {
81  switch ($c) {
82  case 'E':
83  $exists = false;
84 
85  break;
86 
87  case 'u':
88  $unfold = true;
89 
90  break;
91 
92  case 't':
93  $tree = true;
94 
95  break;
96 
97  case 'V':
98  $verbose = false;
99 
100  break;
101 
102  case 'h':
103  case '?':
104  return $this->usage();
105 
106  case '__ambiguous':
107  $this->resolveOptionAmbiguity($v);
108 
109  break;
110  }
111  }
112 
113  $this->parser->listInputs($path);
114 
115  if (null === $path) {
116  return $this->usage();
117  }
118 
119  if (true === $tree) {
121  $foo = substr($path, 0, 6);
122 
123  if ('hoa://' !== $foo) {
124  return;
125  }
126 
127  $path = substr($path, 6);
128  $current = $protocol;
129 
130  foreach (explode('/', $path) as $component) {
131  if (!isset($current[$component])) {
132  break;
133  }
134 
135  $current = $current[$component];
136  }
137 
138  echo $current;
139 
140  return;
141  }
142 
143  if (true === $verbose) {
144  echo
145  Console\Chrome\Text::colorize($path, 'foreground(yellow)'),
146  ' is equivalent to:', "\n";
147  }
148 
149  $resolved = resolve($path, $exists, $unfold);
150 
151  foreach ((array) $resolved as $r) {
152  echo $r, "\n";
153  }
154 
155  return;
156  }
static getProtocol()
Definition: Core.php:352
getOption(&$optionValue, $short=null)
Definition: Kit.php:104
resolveOptionAmbiguity(Array $solutions)
Definition: Kit.php:190
static colorize($text, $attributesBefore, $attributesAfter= 'normal')
Definition: Text.php:83
static isDirect($pipe)
Definition: Console.php:261

Here is the call graph for this function:

Hoa\Core\Bin\Resolve::usage ( )

The command usage.

Returns
int

Definition at line 163 of file Resolve.php.

164  {
165  echo
166  'Usage : core:resolve <options> path', "\n",
167  'Options :', "\n",
168  $this->makeUsageOptionsList([
169  'E' => 'Do not check if the resolution result exists.',
170  'u' => 'Unfold all possible results.',
171  't' => 'Print the tree from the path.',
172  'V' => 'No-verbose, i.e. be as quiet as possible, just print ' .
173  'essential informations.',
174  'help' => 'This help.'
175  ]), "\n";
176 
177  return;
178  }
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\Core\Bin\Resolve::$options
protected
Initial value:

Definition at line 57 of file Resolve.php.


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