Пример #1
0
 protected static function applyOptions(Options $options = null)
 {
     if ($options !== null) {
         self::$options = $options;
     } else {
         self::$options = Options::getInstance();
     }
 }
Пример #2
0
 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);
 }
Пример #3
0
 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));
 }
Пример #4
0
 private function __construct()
 {
     $this->mongoInit();
     $this->types = Options::getInstance()->get('job_types', []);
 }