コード例 #1
0
ファイル: ManagerFactory.php プロジェクト: lightster/hodor
 /**
  * @return ManagerInterface
  * @throws Exception
  */
 public function getManager()
 {
     $daemon_config = $this->config->getDaemonConfig();
     $type = $daemon_config['type'];
     if (!isset($this->manager_factories[$type])) {
         throw new Exception("A daemon manager factory is not associated with '{$type}'.");
     }
     $manager_factory = $this->manager_factories[$type];
     return new $manager_factory($this->config);
 }
コード例 #2
0
 /**
  * @return array
  */
 private function getRawDaemonConfig()
 {
     $defaults = ['config_path' => '/etc/supervisord/conf.d/hodor.conf', 'process_owner' => 'apache', 'program_prefix' => 'hodor', 'program_name' => '{{PROGRAM_PREFIX}}-{{WORKER_TYPE}}-{{WORKER_NAME}}', 'logs' => ['error' => ['path' => '/var/log/hodor/%(program_name)s_%(process_num)d.error.log', 'max_size' => '10MB', 'rotate_count' => 2], 'debug' => ['path' => '/var/log/hodor/%(program_name)s_%(process_num)d.debug.log', 'max_size' => '10MB', 'rotate_count' => 2]]];
     return array_replace_recursive($defaults, $this->config->getDaemonConfig());
 }
コード例 #3
0
ファイル: ConfigTest.php プロジェクト: lightster/hodor
 /**
  * @covers ::__construct
  * @covers ::getDaemonConfig
  * @covers ::getOption
  * @dataProvider configProvider
  */
 public function testDaemonConfigCanBeRetrieved($options)
 {
     $config = new Config(__FILE__, $options);
     $this->assertEquals($options['daemon'], $config->getDaemonConfig());
 }