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
 /**
  * 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);
 }
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);
}