public function save(Model\EnvironmentInterface $environment, Model\EnvironmentInterface $cloneFrom = null)
    {
        $content = $this->getEnvironmentHydrator()->extract($environment);
        if ($cloneFrom != null) {
            $content['cloneFrom'] = strval($cloneFrom->getNormalizedName());
        }
        $this->pmProxyClient->put('/environments/' . $environment->getNormalizedName(), $content);
        if ($environment->hasChildren()) {
            foreach ($environment->getChildren() as $child) {
                /** @var Model\EnvironmentInterface $child */
                if ($cloneFrom) {
                    $this->save($child, $cloneFrom->getChildByName($child->getName()));
                } else {
                    $this->save($child);
                }
            }
        }
        return $this;
    }
public function save(Model\EnvironmentInterface $environment, Model\EnvironmentInterface $cloneFrom = null)
    {
        $content = $this->getEnvironmentHydrator()->extract($environment);
        if ($cloneFrom != null) {
            $content['cloneFrom'] = strval($cloneFrom->getNormalizedName());
        }
        $this->pmProxyClient->put('/environments/' . $environment->getNormalizedName(), $content);
        if ($environment->hasChildren()) {
            foreach ($environment->getChildren() as $child) {
                /** @var Model\EnvironmentInterface $child */
                if ($cloneFrom) {
                    $this->save($child, $cloneFrom->getChildByName($child->getName()));
                } else {
                    $this->save($child);
                }
            }
        }
        return $this;
    }
public function save ( Model \ EnvironmentInterface $ environment , Model \ EnvironmentInterface $ cloneFrom = null ) { $ content = $ this -> getEnvironmentHydrator ( ) -> extract ( $ environment ) ; if ( $ cloneFrom != null ) { $ content [ 'cloneFrom' ] = strval ( $ cloneFrom -> getNormalizedName ( ) ) ; } $ this -> pmProxyClient -> put ( '/environments/' . $ environment -> getNormalizedName ( ) , $ content ) ; if ( $ environment -> hasChildren ( ) ) { foreach ( $ environment -> getChildren ( ) as $ child ) { /** @var Model\EnvironmentInterface $child */ if ( $ cloneFrom ) { $ this -> save ( $ child , $ cloneFrom -> getChildByName ( $ child -> getName ( ) ) ) ; } else { $ this -> save ( $ child ) ; } } } return $ this ; }
Create or update an environment on the Puppet Master

@param Model\EnvironmentInterface $environment
@param Model\EnvironmentInterface $cloneFrom
@return Environment
@throws RuntimeException
Create or update an environment on the Puppet Master