Scalr\DataType\CloudPlatformSuspensionInfo::__construct PHP Method

__construct() public method

Constructor
public __construct ( integer $envId, string $platform, string $group = null )
$envId integer The identifier of the Client's environment
$platform string The name of the cloud platform
$group string optional The client environment property group
    public function __construct($envId, $platform, $group = null)
    {
        $this->envId = $envId;
        $this->platform = $platform;
        $this->group = $group ?: '';
        $this->cloud = null;
        $this->firstErrorOccurredProp = $platform . '.' . static::NAME_FIRST_ERROR_OCCURRED;
        $this->lastErrorMessageProp = $platform . '.' . static::NAME_LAST_ERROR_MESSAGE;
        $this->suspendedProp = $platform . '.' . static::NAME_SUSPENDED;
        $properties = EnvironmentProperty::find([['envId' => $this->envId], ['group' => $this->group], ['$or' => [["name" => $this->firstErrorOccurredProp], ["name" => $this->lastErrorMessageProp], ["name" => $this->suspendedProp]]]]);
        foreach ($properties as $property) {
            if ($property->name == $this->firstErrorOccurredProp) {
                $this->firstErrorOccurred = $property;
            } elseif ($property->name == $this->lastErrorMessageProp) {
                $this->lastErrorMessage = $property;
            } else {
                $this->suspended = $property;
            }
        }
    }