public static function configure(&$config = NULL, LogInterface &$log) { $config = new ControllerConfig($config); $log->info('[ Controller configuration ]'); do { try { $config->setName(Cmd::readInput('name>', $log)); } catch (\Exception $e) { $log->error($e->getMessage()); } } while (!$config->getName()); $controller = new Controller($config, $validate = 'soft'); AssetCli::addAssetsToObject($config, 'Add project assets', 'Add assets at a controller level. This means that every asset you add here will be present in each acton of this controller', $log); do { $log->info('Add actions to your controller.'); $opt = Cmd::selectWithKeys(array('N' => 'New Action', 'E' => 'End adding actions'), '>', $log); if (strtolower($opt) == 'e') { break; } $actionConfig = new ActionConfig(); $actionConfig->setController($controller); $config->addAction(Action::cliConfig($actionConfig, $log)); } while (TRUE); return $controller; }
public function addAction(Action $action) { $this->actions[$action->getName()] = $action; return $this; }