Inheritance: implements Deployer\Collection\CollectionInterface, implements Countable
Ejemplo n.º 1
0
 public function testWithoutStageAndHasDefault()
 {
     $servers = new ServerCollection();
     $servers['one'] = new \stdClass();
     $servers['two'] = new \stdClass();
     $environments = new EnvironmentCollection();
     $environments['one'] = new Environment();
     $environments['two'] = new Environment();
     $environments['two']->set('stages', ['prod']);
     $parameters = new Collection();
     $parameters->set(StageStrategy::PARAM_DEFAULT_STAGE, 'prod');
     $stage = new StageStrategy($servers, $environments, $parameters);
     $this->assertEquals(['two' => $servers['two']], $stage->getServers(null));
 }
Ejemplo n.º 2
0
 /**
  * Returns the default stage
  *
  * @return string|null
  */
 public function getDefaultStage()
 {
     if (!$this->parameters->has(self::PARAM_DEFAULT_STAGE)) {
         return null;
     }
     return $this->parameters->get(self::PARAM_DEFAULT_STAGE);
 }
Ejemplo n.º 3
0
 /**
  * @param string $name
  * @return mixed
  * @throws \InvalidArgumentException
  */
 public function __get($name)
 {
     if ($this->collections->has($name)) {
         return $this->collections[$name];
     } else {
         throw new \InvalidArgumentException("Property \"{$name}\" does not exist.");
     }
 }
Ejemplo n.º 4
0
 /**
  * @param string $name
  * @return ServerInterface
  */
 public function get($name)
 {
     return parent::get($name);
 }
Ejemplo n.º 5
0
 /**
  * @throws \RuntimeException
  * @return \Deployer\Bootstrap\BootstrapByConfigFile
  */
 public function initClusters()
 {
     foreach ((array) $this->clusterConfig as $name => $config) {
         try {
             $config = new Collection($config);
             $clusterBuilder = $config->has('port') ? $this->clusterBuilders[] = \Deployer\cluster($name, $config['nodes'], $config['port']) : ($this->clusterBuilders[] = \Deployer\cluster($name, $config['nodes']));
             unset($config['local']);
             unset($config['nodes']);
             unset($config['port']);
             $this->executeBuilderMethods($config, $clusterBuilder);
         } catch (\RuntimeException $e) {
             throw new \RuntimeException("Error processing clusters: " . $name);
         }
     }
     return $this;
 }
Ejemplo n.º 6
0
 /**
  * Checks if set var exists.
  *
  * @param string $name
  * @return bool
  */
 public function has($name)
 {
     return $this->values->has($name);
 }