protected static function applyOptions(Options $options = null) { if ($options !== null) { self::$options = $options; } else { self::$options = Options::getInstance(); } }
protected function mongoInit($require = true) { $this->mongo = Options::getInstance()->get('mongo'); if ($require && (empty($this->mongo) || !$this->mongo instanceof \MongoDB)) { throw new Exception('Bad database options'); } $this->collection = Options::getInstance()->get('mongo_collection', $this->collection); }
public function __construct() { $this->mongoInit(); $this->cmd = Options::getInstance()->get('worker_cmd'); if (empty($this->cmd)) { throw new Exception('Bad worker command options'); } $this->workerMax = Options::getInstance()->get('worker_max_count', self::WORKERS_MAX); $this->log = Options::getInstance()->get('log', function () { /*do nothing*/ }); $this->timeout = intval(Options::getInstance()->get('hovering_timeout', self::HOVERING_TIMEOUT)); }
private function __construct() { $this->mongoInit(); $this->types = Options::getInstance()->get('job_types', []); }