Scalr\Api\Service\Account\V1beta0\Controller\Environments::getEnv PHP Method

getEnv() public method

Gets specified Environment
public getEnv ( string $envId ) : Environment
$envId string Numeric identifier of the Environment
return Scalr\Model\Entity\Account\Environment Returns the Environment Entity on success
    public function getEnv($envId)
    {
        /* @var $env Account\Environment */
        $env = Account\Environment::findOne(array_merge($this->getDefaultCriteria(), [['id' => $envId]]));
        if (!$env) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Environment either does not exist or is not owned by your account.");
        }
        if (!$this->getUser()->hasAccessToEnvironment($envId)) {
            //Checks entity level write access permissions
            throw new ApiErrorException(403, ErrorMessage::ERR_PERMISSION_VIOLATION, "Insufficient permissions");
        }
        return $env;
    }