예제 #1
0
 /**
  * Construct this command line library
  * @param null|array $arguments
  */
 public function __construct(array $arguments = null)
 {
     $this->isCli = php_sapi_name() == self::SAPI_CLI;
     if (!$this->isCli) {
         $this->arguments = array();
         return;
     }
     if ($arguments === null) {
         $arguments = $_SERVER['argv'];
     }
     $this->arguments = ArgumentParser::parseArguments($arguments);
 }
예제 #2
0
 /**
  * Construct this command line library
  * @param null|array $arguments
  */
 public function __construct(array $arguments = null)
 {
     $this->isCli = php_sapi_name() == self::SAPI_CLI;
     if (!$this->isCli) {
         $this->arguments = array();
         return;
     }
     if ($arguments === null) {
         $arguments = $_SERVER['argv'];
         array_shift($arguments);
         // remove first element, always the script name
     }
     $this->arguments = ArgumentParser::parseArguments($arguments);
 }