当前位置: 首页>>代码示例>>PHP>>正文


PHP Console类代码示例

本文整理汇总了PHP中Console的典型用法代码示例。如果您正苦于以下问题:PHP Console类的具体用法?PHP Console怎么用?PHP Console使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Console类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processGames

 public function processGames()
 {
     if ($this->site->lookupgames == 1) {
         $console = new Console($this->echooutput);
         $console->processConsoleReleases();
     }
 }
开发者ID:ehsanguru,项目名称:nnplus,代码行数:7,代码来源:postprocess.php

示例2: boot

 /**
  * Bootstrap a server from command line options
  *
  * @param \Aerys\Logger $logger
  * @param \Aerys\Console $console
  * @return \Aerys\Server
  */
 public function boot(Logger $logger, Console $console) : Server
 {
     $configFile = $this->selectConfigFile((string) $console->getArg("config"));
     $logger->info("Using config file found at {$configFile}");
     if (!(include $configFile)) {
         throw new \DomainException("Config file inclusion failure: {$configFile}");
     } elseif (!defined("AERYS_OPTIONS")) {
         $options = [];
     } elseif (is_array(AERYS_OPTIONS)) {
         $options = AERYS_OPTIONS;
     } else {
         throw new \DomainException("Invalid AERYS_OPTIONS constant: array expected, got " . gettype(AERYS_OPTIONS));
     }
     if ($console->isArgDefined("debug")) {
         $options["debug"] = true;
     }
     $options = $this->generateOptionsObjFromArray($options);
     $vhosts = new VhostContainer();
     $ticker = new Ticker($logger);
     $server = new Server($options, $vhosts, $logger, $ticker);
     $bootLoader = function (Bootable $bootable) use($server, $logger) {
         return $bootable->boot($server, $logger);
     };
     $hosts = \call_user_func($this->hostAggregator) ?: [new Host()];
     foreach ($hosts as $host) {
         $vhost = $this->buildVhost($host, $bootLoader);
         $vhosts->use($vhost);
     }
     return $server;
 }
开发者ID:hunslater,项目名称:aerys,代码行数:37,代码来源:Bootstrapper.php

示例3: doStart

 protected function doStart(Console $console) : \Generator
 {
     if ($console->isArgDefined("restart")) {
         $this->logger->critical("You cannot restart a debug aerys instance via command");
         exit(1);
     }
     $server = (yield from $this->bootstrapper->boot($this->logger, $console));
     (yield $server->start());
     $this->server = $server;
 }
开发者ID:beentrill,项目名称:aerys,代码行数:10,代码来源:DebugProcess.php

示例4: __construct

 public function __construct(Console $console, $ipcSock)
 {
     if ($console->isArgDefined("color")) {
         $this->setAnsify($console->getArg("color"));
     }
     $level = $console->getArg("log");
     $level = isset(self::LEVELS[$level]) ? self::LEVELS[$level] : $level;
     $this->setOutputLevel($level);
     $onWritable = $this->makePrivateCallable("onWritable");
     $this->ipcSock = $ipcSock;
     $this->writeWatcherId = \Amp\onWritable($ipcSock, $onWritable, ["enable" => false]);
 }
开发者ID:hunslater,项目名称:aerys,代码行数:12,代码来源:IpcLogger.php

示例5: __construct

 public function __construct(Console $console)
 {
     $this->console = $console;
     if ($console->isArgDefined("color")) {
         $value = $console->getArg("color");
         $this->setAnsiColorOption($value);
     }
     if ($console->isArgDefined("log")) {
         $level = $console->getArg("log");
         $level = isset(self::LEVELS[$level]) ? self::LEVELS[$level] : $level;
         $this->setOutputLevel($level);
     }
 }
开发者ID:beentrill,项目名称:aerys,代码行数:13,代码来源:ConsoleLogger.php

示例6: run

 public function run(Console $console, Db $db)
 {
     $this->db = $db;
     if (!$console->hasParams()) {
         $this->showHelp();
     } else {
         foreach ($console->getParams() as $command => $value) {
             if (method_exists($this, $command)) {
                 $this->{$command}($value);
             }
         }
     }
 }
开发者ID:alexboo,项目名称:traffics-task2,代码行数:13,代码来源:App.php

示例7: Display

 public function Display(Console $con, $resIps, $errorsOnly)
 {
     foreach ($this->GetChangedLines() as $line) {
         $con->WritePart('[' . $con->Colorize('ERROR', Console::C_RED) . ']  ');
         $con->WritePart($con->Colorize($resIps ? substr(str_pad($this->ResolveIP($line->ip), 48), 0, 48) : str_pad($line->ip, 16), Console::C_YELLOW) . ' ');
         $con->WritePart($con->Colorize(str_pad($line->domain, 32), Console::C_BROWN) . ' ');
         $long_mesg = $con->Colorize($line->message, Console::C_RED);
         $con->WriteLine($long_mesg);
     }
 }
开发者ID:gvelchev,项目名称:httpdmon,代码行数:10,代码来源:ErrorlogFileMonitor.php

示例8: doStart

 protected function doStart(Console $console) : \Generator
 {
     if ($console->isArgDefined("restart")) {
         $this->logger->critical("You cannot restart a debug aerys instance via command");
         exit(1);
     }
     if (ini_get("zend.assertions") === "-1") {
         $this->logger->warning("Running aerys in debug mode with assertions disabled is not recommended; " . "enable assertions in php.ini (zend.assertions = 1) " . "or disable debug mode (-d) to hide this warning.");
     } else {
         ini_set("zend.assertions", 1);
     }
     $server = (yield from $this->bootstrapper->boot($this->logger, $console));
     (yield $server->start());
     $this->server = $server;
 }
开发者ID:vlakarados,项目名称:aerys,代码行数:15,代码来源:DebugProcess.php

示例9: __construct

 public function __construct($workingDir = '.', $info, $commandsSeq = array())
 {
     parent::__construct($workingDir, $info, $commandsSeq);
     Console::initCore();
     $this->root_dir = Config::get('ROOT_DIR');
     $this->models_dir = Config::get('models_dir');
 }
开发者ID:point,项目名称:cassea,代码行数:7,代码来源:CmdController.php

示例10: call

 function call($arguments = null)
 {
     Console::debugEx(LOG_DEBUG1, __CLASS__, "Delegate invocation");
     foreach ($this->callable as $classes) {
         @call_user_func_array($classes, (array) $arguments);
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:delegates.php

示例11: create

 /**
  * Comando de consola para crear un modelo
  *
  * @param array $params parametros nombrados de la consola
  * @param string $model modelo
  * @throw KumbiaException
  */
 public function create($params, $model)
 {
     // nombre de archivo
     $file = APP_PATH . 'models';
     // obtiene el path
     $path = explode('/', trim($model, '/'));
     // obtiene el nombre de modelo
     $model_name = array_pop($path);
     if (count($path)) {
         $dir = implode('/', $path);
         $file .= "/{$dir}";
         if (!is_dir($file) && !FileUtil::mkdir($file)) {
             throw new KumbiaException("No se ha logrado crear el directorio \"{$file}\"");
         }
     }
     $file .= "/{$model_name}.php";
     // si no existe o se sobreescribe
     if (!is_file($file) || Console::input("El modelo existe, �desea sobrescribirlo? (s/n): ", array('s', 'n')) == 's') {
         // nombre de clase
         $class = Util::camelcase($model_name);
         // codigo de modelo
         ob_start();
         include CORE_PATH . 'console/generators/model.php';
         $code = '<?php' . PHP_EOL . ob_get_clean();
         // genera el archivo
         if (file_put_contents($file, $code)) {
             echo "-> Creado modelo {$model_name} en: {$file}" . PHP_EOL;
         } else {
             throw new KumbiaException("No se ha logrado crear el archivo \"{$file}\"");
         }
     }
 }
开发者ID:ocidfigueroa,项目名称:sice,代码行数:39,代码来源:model_console.php

示例12: renderRecursive

 private function renderRecursive($nod)
 {
     $ret = '';
     for ($n = 0; $n < $nod->childNodes->length; $n++) {
         $cn = $nod->childNodes->item($n);
         if ($cn->namespaceURI == self::NS_LITEMARKUP) {
             $t = explode(':', $cn->nodeName);
             switch ($t[1]) {
                 case 'debug':
                     $ret .= "THIS IS THE DEBUGGING INFO";
                     break;
                 default:
                     Console::warn("Unknown LiteMarkup tag: %s", $cn->nodeName);
             }
         } else {
             switch ($cn->nodeName) {
                 case '#text':
                     $ret .= $cn->nodeValue;
                     break;
                 default:
                     $ret .= '<' . $cn->nodeName . '>' . $this->renderRecursive($cn) . '</' . $cn->nodeName . '>';
                     break;
             }
         }
     }
     return $ret;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:27,代码来源:templates.php

示例13: getInstance

 /**
  *
  * @return Console
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:NeoCortexBg,项目名称:sitemap_checker,代码行数:11,代码来源:console.php

示例14: exception

 function exception(Exception $e)
 {
     logger::emerg("Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     Console::debugEx(0, get_class($e), "Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     $f = file($e->getFile());
     foreach ($f as $i => $line) {
         $mark = $i + 1 == $e->getLine() ? '=> ' : '   ';
         $f[$i] = sprintf('  %05d. %s', $i + 1, $mark) . $f[$i];
         $f[$i] = str_replace("\n", "", $f[$i]);
     }
     $first = $e->getLine() - 4;
     if ($first < 0) {
         $first = 0;
     }
     $last = $e->getLine() + 3;
     if ($last >= count($f)) {
         $last = count($f) - 1;
     }
     $source = join("\n", array_slice($f, $first, $last - $first));
     Console::debugEx(0, get_class($e), Console::backtrace(0, $e->getTrace(), true));
     Console::debugEx(LOG_LOG, "Exception", "Source dump of %s:\n%s", str_replace(BASE_PATH, '', $e->getFile()), $source);
     $rv = 1;
     logger::emerg("Exiting with return code %d after exception.", $rv);
     Console::debugEx(LOG_BASIC, __CLASS__, "Exiting with return code %d after exception.", $rv);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:25,代码来源:exception.php

示例15: process

 function process()
 {
     Console::initCore();
     if ($r = ArgsHolder::get()->getOption('count')) {
         $this->count = $r;
     }
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         IO::out("");
         $sql = 'SELECT * FROM ' . self::TABLE . ' where not isnull(finished_at) and not 
             isnull(locked_at) and isnull(failed_at) ORDER BY run_at DESC';
         if ($this->count) {
             $list = DB::query($sql . ' LIMIT ' . $this->count);
         } else {
             $list = DB::query($sql);
         }
         if (!count($list)) {
             IO::out("No finished work!", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf("%-10s %-7s %-3s %-20s %-20s %-19s %-4s %-5s", "~CYAN~id", "queue", "pr", "run_at", "locked_at", "finished_at", "att", "call_to~~~"));
         foreach ($list as $l) {
             $handler = unserialize($l["handler"]);
             io::out(sprintf("%-4s %-7s %-3s %-20s %-20s %-20s %-3s %-5s", $l["id"], $l["queue"], $l["priority"], $l["run_at"], $l["locked_at"], $l["finished_at"], $l["attempts"], $handler["class"] . "::" . $handler["method"] . "(...)"));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
开发者ID:point,项目名称:cassea,代码行数:33,代码来源:CmdBgworkCompleted.php


注:本文中的Console类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。