public function upMigration() { echo PHP_EOL; Command::run(array('migrate:install')); echo PHP_EOL; Command::run(array('migrate')); }
public function exec(Command $cmd) { $match = NULL; // Get clear shell for work while (true) { switch (expect_expectl($this->__stream, array(array("(.*)[\$|#][ ]\$", SHELL, EXP_REGEXP)), $match)) { case SHELL: $cmd->run($this); return $this; // Chain of commands break 2; case EXP_EOF: case EXP_FULLBUFFER: break 2; case EXP_TIMEOUT: throw new \Exception("Connection time out"); break 2; default: throw new \Exception("Error has occurred!"); break 2; } } return false; }
public static function createAdmin($username, $password) { echo "Publishing Bundle..." . PHP_EOL; Command::run(array('bundle:publish')); echo "Registering administrator..." . PHP_EOL; Command::run(array('admin::setup', $username, $password)); }
<?php if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) { date_default_timezone_set(@date_default_timezone_get()); } require_once 'bootstrap.php'; $shortopts = 'dluce:m:p:r:h:'; $options = getopt($shortopts); if (isset($options['e'])) { $command = new Command($options); $command->run(); } else { CommandHelper::runHelp(); }
{ $this->startTime(); for ($x = 0; $x < 100000; $x++) { new \Congow\Orient\Query\Command\Credential\Grant('OMN'); } $this->stop(); $this->output(); } protected function startTime() { $this->time = microtime(true); } protected function stop() { $this->elapsed = microtime(true) - $this->time; } protected function output() { echo "Elapsed: \n{$this->elapsed}\n"; } } $benchmark = new Command(); $benchmark->run();
<?php /* * Knee framework * Назначение: Работа с командной строкой */ namespace Knee\CLI; try { Command::run($_SERVER['argv']); } catch (\Exception $e) { echo $e->getMessage(); } echo PHP_EOL;
/** * Main entry */ public static function main() { $oCommand = new Command(); return $oCommand->run($_SERVER['argv']); }