Example #1
0
 /**
  * Log constructor.
  *
  * @param string|null $file
  */
 protected function __construct($file = null)
 {
     $this->file = $file ?: Config::getInstance()->get("log.file");
     if (!file_exists($this->file)) {
         touch($this->file);
     }
     $this->spl = new SplFileObject($this->file, "a");
 }
Example #2
0
 /**
  * Return common option
  *
  * @return InputOption[]
  */
 public function getCommonInputOption()
 {
     static $options;
     if (is_null($options)) {
         $options = [];
         $options[] = new InputOption("--config-file", null, InputOption::VALUE_REQUIRED, "Set config file", $this->config->getFile());
     }
     return $options;
 }
Example #3
0
/**
 * Get config
 *
 * @param string|null $key
 * @param mixed $default
 * @return Config|mixed
 */
function config($key = null, $default = null)
{
    $config = Config::getInstance();
    return $config->get($key, $default);
}
Example #4
0
 /**
  * Get config
  *
  * @param string $key
  * @param mixed $default
  * @return mixed
  */
 protected function config($key, $default = null)
 {
     return $this->config->get($key, $default);
 }