/** * 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"); }
/** * Application constructor. */ public function __construct() { $this->config = Config::getInstance(__DIR__ . "/../config.php"); $this->log = Log::getInstance(); $app = static::app(); parent::__construct($app->name, $app->version); $prefix = __NAMESPACE__ . '\\Commands\\'; $baseDir = __DIR__ . '/Commands/'; $this->addCommandsByPsr4($prefix, $baseDir); }
/** * 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); }