public static function configureMode(NetConfig &$config, LogInterface &$log) { $log->debug('[ Specify connection mode ]'); $log->success('1 = Production'); $log->warning('0 = Development'); $config->setIsProduction(Cmd::readInput('mode>', $log)); }
public static function addRoutesToObject(RouteableInterface &$object, LogInterface $log, $title = NULL, $help = NULL) { do { $currentRoutes = $object->getRoutes(); $options = array('N' => 'New route'); if (sizeof($currentRoutes)) { $log->repeat('-', 80, 'white'); $log->debug('Current routes'); $log->repeat('-', 80, 'white'); foreach ($currentRoutes as $type => $routes) { $log->debug("[ Routes ]"); foreach ($routes as $route) { $log->success("> {$route}"); } } $options['E'] = 'Edit routes'; $options['D'] = 'Delete routes'; } $options['F'] = 'Finish adding routes'; $options['H'] = 'Help'; $log->warning($title); $opt = Cmd::selectWithKeys($options, 'route>', $log); switch (strtolower($opt)) { case 'n': $eouteConfig = new RouteConfig(); $object->addRoute(Route::cliConfig($routeConfig, $log)); break; case 'e': $log->debug('Edit routes'); break; case 'd': $log->debug('Delete routes'); break; case 'f': break 2; break; case 'h': $log->debug($help); break; } } while (TRUE); }
/** * * List modules that belong to a project. * * This method allows the end user to view which modules does the project has assigned. * * @params \apf\core\project\Config A project configuration object * @params \apf\iface\Log A log interface so we can display messages and prompts in the command line. * */ public static function listModules(ProjectConfig &$config, LogInterface $log) { $modules = $config->getModules(); if (!sizeof($modules)) { $log->warning('Given project configuration has no modules assigned'); } foreach ($modules as $module) { $log->info($module); } }
public static function listAssets(AssetableInterface &$config, LogInterface $log) { $assets = $config->getAssetsOrderedByType(); if (!$assets) { $log->warning('No assets available'); } $log->repeat('-', 80, 'white'); $log->debug('Current assets'); $log->repeat('-', 80, 'white'); foreach ($assets as $type => $assets) { $log->debug("[ {$type} Assets ]"); foreach ($assets as $asset) { $log->success("> {$asset}"); } } }