Ejemplo n.º 1
0
 /**
  * @param Request $request
  * @param Input $input
  * @return self
  */
 public function init(Request $request, Input $input, array $arguments)
 {
     $options = [];
     $path = "";
     foreach ($arguments as $offset => $arg) {
         if ($offset == 0) {
             continue;
         }
         if (substr($arg, 0, 2) == '--') {
             // [option]
             list($n, $v) = $this->parseOption($arg);
             $options[$n] = $v;
         } else {
             // [arguments]
             $path .= '/' . urlencode($arg);
         }
     }
     if (!$path) {
         $path = '/';
     }
     $query = new Query($options);
     $request->setRoot('');
     $request->setUri($path);
     $input->setParams($options);
     $request->getUri()->setQuery($query->toString());
     return $this;
 }