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)); }
/** * 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); }
/** * @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."); } }
/** * @param string $name * @return ServerInterface */ public function get($name) { return parent::get($name); }
/** * @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; }
/** * Checks if set var exists. * * @param string $name * @return bool */ public function has($name) { return $this->values->has($name); }