Ejemplo n.º 1
0
 /**
  * Execute a terminal object using given arguments
  *
  * @param string $name
  * @param mixed  $arguments
  *
  * @return null|\League\CLImate\TerminalObject\Basic\BasicTerminalObjectInterface
  */
 public function execute($name, $arguments)
 {
     $router = $this->getRouter($name);
     $router->output($this->output);
     $obj = $this->getObject($router, $name, $arguments);
     $obj->parser($this->parser);
     $obj->util($this->util);
     // If the object needs any settings, import them
     foreach ($obj->settings() as $obj_setting) {
         $setting = $this->settings->get($obj_setting);
         if ($setting) {
             $obj->importSetting($setting);
         }
     }
     return $router->execute($obj);
 }
Ejemplo n.º 2
0
 /**
  * Execute a terminal object using given arguments
  *
  * @param string $name
  * @param mixed  $arguments
  * @return null|\League\CLImate\TerminalObject\Basic\BasicTerminalObjectInterface
  */
 public function execute($name, $arguments)
 {
     $router = $this->getRouter($name);
     $router->output($this->output);
     $reflection = new \ReflectionClass($router->path($name));
     $obj = $reflection->newInstanceArgs($arguments);
     $obj->parser($this->parser);
     $obj->util($this->util);
     // If the object needs any settings, import them
     foreach ($obj->settings() as $obj_setting) {
         $setting = $this->settings->get($obj_setting);
         if ($setting) {
             $obj->importSetting($setting);
         }
     }
     return $router->execute($obj);
 }
Ejemplo n.º 3
0
 /**
  * Execute a terminal object using given arguments
  *
  * @param string $name
  * @param mixed  $arguments
  */
 public function execute($name, $arguments)
 {
     $class = $this->getClass($name);
     $reflection = new \ReflectionClass($class);
     $obj = $reflection->newInstanceArgs($arguments);
     $obj->parser($this->parser);
     // If the object needs any settings, import them
     foreach ($obj->settings() as $obj_setting) {
         $setting = $this->settings->get($obj_setting);
         if ($setting) {
             $obj->importSetting($setting);
         }
     }
     if ($this->isBasic($name)) {
         $this->executeBasic($obj);
     } else {
         return $this->executeDynamic($obj);
     }
 }