/** * Class constructor. * * @param Input $input An optional argument to provide dependency injection for the application's * input object. If the argument is a Input object that object will become * the application's input object, otherwise a default input object is created. * @param Registry $config An optional argument to provide dependency injection for the application's * config object. If the argument is a Registry object that object will become * the application's config object, otherwise a default config object is created. * @param Web\WebClient $client An optional argument to provide dependency injection for the application's * client object. If the argument is a Web\WebClient object that object will become * the application's client object, otherwise a default client object is created. * * @since 1.0 */ public function __construct(Input $input = null, Registry $config = null, Web\WebClient $client = null) { parent::__construct($input, $config); $this->client = $client instanceof Web\WebClient ? $client : new Web\WebClient(); // Set the execution datetime and timestamp; $this->set('execution.datetime', gmdate('Y-m-d H:i:s')); $this->set('execution.timestamp', time()); // Setup the response object. $this->response = new \stdClass(); $this->response->cachable = false; $this->response->headers = array(); $this->response->body = array(); // Set the system URIs. $this->loadSystemUris(); }
/** * Class constructor. * * @param Input\Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is a InputCli object that object will become * the application's input object, otherwise a default input object is created. * @param Registry $config An optional argument to provide dependency injection for the application's * config object. If the argument is a Registry object that object will become * the application's config object, otherwise a default config object is created. * * @param CliOutput $output The output handler. * * @since 1.0 */ public function __construct(Input\Cli $input = null, Registry $config = null, CliOutput $output = null) { // Close the application if we are not executed from the command line. // @codeCoverageIgnoreStart if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv'])) { $this->close(); } // @codeCoverageIgnoreEnd parent::__construct($input instanceof Input\Input ? $input : new Input\Cli(), $config); // Set the execution datetime and timestamp; $this->set('execution.datetime', gmdate('Y-m-d H:i:s')); $this->set('execution.timestamp', time()); // Set the current directory. $this->set('cwd', getcwd()); $this->output = $output instanceof CliOutput ? $output : new Cli\Output\Stdout(); }
/** * Class constructor. * * @param Input\Cli $input An optional argument to provide dependency injection for the application's * input object. If the argument is an InputCli object that object will become * the application's input object, otherwise a default input object is created. * @param Registry $config An optional argument to provide dependency injection for the application's * config object. If the argument is a Registry object that object will become * the application's config object, otherwise a default config object is created. * @param Cli\CliOutput $output The output handler. * @param Cli\CliInput $cliInput The CLI input handler. * * @since 1.0 */ public function __construct(Input\Cli $input = null, Registry $config = null, Cli\CliOutput $output = null, Cli\CliInput $cliInput = null) { // Close the application if we are not executed from the command line. // @codeCoverageIgnoreStart if (!defined('STDOUT') || !defined('STDIN') || !isset($_SERVER['argv'])) { $this->close(); } // @codeCoverageIgnoreEnd $this->output = $output instanceof Cli\CliOutput ? $output : new Cli\Output\Stdout(); // Set the CLI input object. $this->cliInput = $cliInput instanceof Cli\CliInput ? $cliInput : new Cli\CliInput(); // Call the constructor as late as possible (it runs `initialise`). parent::__construct($input instanceof Input\Input ? $input : new Input\Cli(), $config); // Set the current directory. $this->set('cwd', getcwd()); }
/** * Class constructor. * * @param Input $input An optional argument to provide dependency injection for the application's * input object. If the argument is an Input object that object will become * the application's input object, otherwise a default input object is created. * @param Registry $config An optional argument to provide dependency injection for the application's * config object. If the argument is a Registry object that object will become * the application's config object, otherwise a default config object is created. * @param Web\WebClient $client An optional argument to provide dependency injection for the application's * client object. If the argument is a Web\WebClient object that object will become * the application's client object, otherwise a default client object is created. * * @since 1.0 */ public function __construct(Input $input = null, Registry $config = null, Web\WebClient $client = null) { $this->client = $client instanceof Web\WebClient ? $client : new Web\WebClient(); // Setup the response object. $this->response = new \stdClass(); $this->response->cachable = false; $this->response->headers = array(); $this->response->body = array(); // Call the constructor as late as possible (it runs `initialise`). parent::__construct($input, $config); // Set the system URIs. $this->loadSystemUris(); }