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


PHP Console::isArgDefined方法代码示例

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


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

示例1: __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

示例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: 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

示例6: boot

 /**
  * Bootstrap a server from command line options
  *
  * @param \Aerys\Logger $logger
  * @param \Aerys\Console $console
  * @return \Generator
  */
 public function boot(Logger $logger, Console $console) : \Generator
 {
     $configFile = self::selectConfigFile((string) $console->getArg("config"));
     $logger->info("Using config file found at {$configFile}");
     // may return Promise or Generator for async I/O inside config file
     $returnValue = (include $configFile);
     if (!$returnValue) {
         throw new \DomainException("Config file inclusion failure: {$configFile}");
     }
     if (is_callable($returnValue)) {
         $returnValue = \call_user_func($returnValue);
     }
     if ($returnValue instanceof \Generator) {
         yield from $returnValue;
     } elseif ($returnValue instanceof Promise) {
         (yield $returnValue);
     }
     if (!defined("AERYS_OPTIONS")) {
         $options = [];
     } elseif (is_array(AERYS_OPTIONS)) {
         $options = AERYS_OPTIONS;
     } else {
         throw new \DomainException("Invalid AERYS_OPTIONS constant: expected array, got " . gettype(AERYS_OPTIONS));
     }
     if ($console->isArgDefined("debug")) {
         $options["debug"] = true;
     }
     $options["configPath"] = $configFile;
     $options = $this->generateOptionsObjFromArray($options);
     $vhosts = new VhostContainer();
     $ticker = new Ticker($logger);
     $server = new Server($options, $vhosts, $logger, $ticker, [new Http1Driver(), new Http2Driver()]);
     $bootLoader = function (Bootable $bootable) use($server, $logger) {
         $booted = $bootable->boot($server, $logger);
         if ($booted !== null && !$booted instanceof Middleware && !is_callable($booted)) {
             throw new \InvalidArgumentException("Any return value of " . get_class($bootable) . '::boot() must return an instance of Aerys\\Middleware and/or be callable, got ' . gettype($booted) . ".");
         }
         return $booted ?? $bootable;
     };
     $hosts = \call_user_func($this->hostAggregator) ?: [new Host()];
     foreach ($hosts as $host) {
         $vhost = self::buildVhost($host, $bootLoader);
         $vhosts->use($vhost);
     }
     return $server;
 }
开发者ID:beentrill,项目名称:aerys,代码行数:53,代码来源:Bootstrapper.php

示例7: generateWorkerCommand

 private function generateWorkerCommand(Console $console) : string
 {
     $parts[] = \PHP_BINARY;
     if ($ini = \get_cfg_var("cfg_file_path")) {
         $parts[] = "-c";
         $parts[] = $ini;
     }
     $parts[] = "-d";
     $parts[] = "zend.assertions=" . ini_get("zend.assertions");
     $parts[] = __DIR__ . "/../bin/aerys-worker";
     $parts[] = "-i";
     $parts[] = $this->ipcServerUri;
     if ($console->isArgDefined("config")) {
         $parts[] = "-c";
         $parts[] = $console->getArg("config");
     }
     if ($console->isArgDefined("color")) {
         $parts[] = "--color";
         $parts[] = $console->getArg("color");
     }
     if ($console->isArgDefined("log")) {
         $parts[] = "-l";
         $parts[] = $console->getArg("log");
     }
     return implode(" ", array_map("escapeshellarg", $parts));
 }
开发者ID:beentrill,项目名称:aerys,代码行数:26,代码来源:WatcherProcess.php

示例8: generateWorkerCommand

 private function generateWorkerCommand(Console $console) : string
 {
     $parts[] = \PHP_BINARY;
     if ($ini = \get_cfg_var("cfg_file_path")) {
         $parts[] = "-c \"{$ini}\"";
     }
     $parts[] = "-d zend.assertions=" . ini_get("zend.assertions");
     $parts[] = __DIR__ . "/../bin/aerys-worker";
     $parts[] = "-i {$this->ipcServerUri}";
     if ($console->isArgDefined("config")) {
         $parts[] = "-c " . $console->getArg("config");
     }
     if ($console->isArgDefined("color")) {
         $parts[] = "--color " . $console->getArg("color");
     }
     if ($console->isArgDefined("log")) {
         $parts[] = "-l " . $console->getArg("log");
     }
     return implode(" ", $parts);
 }
开发者ID:hunslater,项目名称:aerys,代码行数:20,代码来源:WatcherProcess.php


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