Esempio n. 1
0
 public static function getBase($path, $default = null)
 {
     $cachePath = 'base.' . $path;
     if (empty(self::$cache[$cachePath])) {
         self::$cache[$cachePath] = Helper::array_get(static::$base, $path, $default);
     }
     return self::$cache[$cachePath];
 }
Esempio n. 2
0
 public function __construct(array $config)
 {
     $this->type = Helper::array_get($config, 'type', self::TYPE_UNIX);
     if ($this->type == self::TYPE_UNIX) {
         $this->file = Helper::array_get($config, 'file');
     } elseif ($this->type == self::TYPE_INET) {
         $this->ip = Helper::array_get($config, 'ip');
         $this->port = Helper::array_get($config, 'port');
         if (empty($this->ip) || empty($this->port)) {
             throw new \Exception("Both host and port must be set");
         }
     }
 }