Exemplo n.º 1
0
 /**
  * Gets the manager class for the given environment.
  *
  * @param string $name Environment Name
  * @throws \InvalidArgumentException
  * @return Environment
  */
 public function getEnvironment($name)
 {
     if (isset($this->environments[$name])) {
         return $this->environments[$name];
     }
     // check the environment exists
     if (!$this->getConfig()->hasEnvironment($name)) {
         throw new \InvalidArgumentException(sprintf('The environment "%s" does not exist', $name));
     }
     // create an environment instance and cache it
     $environment = new Environment($name, $this->getConfig()->getEnvironment($name));
     $this->environments[$name] = $environment;
     $environment->setOutput($this->getOutput());
     return $environment;
 }