public static function show() { return TasksTable::load(EcontrolLogger::create(false))->getTasks(true); }
private static function getTasks() { return TasksTable::load(EcontrolLogger::create(false)); }
public function testLogger() { $logger = EcontrolLogger::create(true); $this->assertInstanceOf('\\Monolog\\Logger', $logger); }
/** * econtrol constructor * */ public function __construct() { // check if econtrol is running from cli if (Checks::cli() === false) { echo "Econtrol runs only in php-cli, exiting"; self::end(1); } if (defined('EXTENDER_TIMEZONE')) { date_default_timezone_set(EXTENDER_TIMEZONE); } $this->color = new Console_Color2(); $this->parser = new Console_CommandLine(array('description' => Version::getDescription(), 'version' => Version::getVersion())); // add verbose option $this->parser->addOption('verbose', array('short_name' => '-v', 'long_name' => '--verbose', 'description' => 'turn on verbose output', 'action' => 'StoreTrue')); // add debug option $this->parser->addOption('debug', array('short_name' => '-V', 'long_name' => '--debug', 'description' => 'turn on debug output', 'action' => 'StoreTrue')); try { $check_constants = Checks::constants(); if ($check_constants !== true) { throw new ShellException($check_constants); } if (array_key_exists('V', getopt("V"))) { $verbose = 'DEBUG'; echo $this->color->convert("\n%r(> Debug mode on <)%n\n"); } else { if (array_key_exists('v', getopt("v"))) { $verbose = 'NOTICE'; echo $this->color->convert("\n%y(> Verbose mode on <)%n\n"); } else { $verbose = false; } } $this->logger = EcontrolLogger::create($verbose); $this->tasks = TasksTable::load($this->logger); $this->controller = Controller::load($this->parser, $this->logger); } catch (Console_CommandLine_Exception $ce) { $this->parser->displayError($this->color->convert("\n\n%y" . $ce->getMessage() . "%n\n")); self::end(1); } catch (ShellException $se) { $this->parser->displayError($this->color->convert("\n\n%R" . $se->getMessage() . "%n\n")); self::end(1); } catch (Exception $e) { $this->parser->displayError($this->color->convert("\n\n%r" . $e->getMessage() . "%n\n")); self::end(1); } }