Creates GetStorageServicePropertiesResult from parsed response.

@param array $parsed The parsed response in array representation

@return GetStorageServicePropertiesResult
492224
public static function create($parsed)
    {
        $result = new self();
        $properties = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_STORAGE_SERVICE_PROPERTIES
        );
        $result->_storageService = new StorageService($parsed, $properties);

        return $result;
    }
381582
public function data(array $properties = null)
    {
        $data = [];
        $properties = $this->properties($properties);
        foreach ($properties as $propertyIdent => $property) {
            // Ensure objects are properly encoded.
            $val = $this->propertyValue($propertyIdent);
            $val = $this->serializedValue($val);
            $data[$propertyIdent] = $val;
        }

        return $data;
    }
412225
protected static function storage()
    {
        if (self::$storage) {
            return self::$storage;
        }
        $className = self::getStorageClassName();
        if (!class_exists($className)) {
            throw new LaravelSmsException("Generate storage failed, the class [$className] does not exists.");
        }
        $store = new $className();
        if (!($store instanceof Storage)) {
            throw new LaravelSmsException("Generate storage failed, the class [$className] does not implement the interface [Toplan\\Sms\\Storage].");
        }

        return self::$storage = $store;
    }
783261
public function toArray($asAlias = false, $returnHidden = true) {

        $method = $asAlias ? "getAlias" : "getProperty";

        $dados = [];

        foreach (self::$schema->getProperties() as $item) {

            if (!$returnHidden && $item->getBehavior()->isHidden()) {
                continue;
            }

            if (method_exists($this, "get" . $item->getProperty())) {
                $value = $this->{"get" . $item->getProperty()}();
            } else {
                $value = $this->{$item->getProperty()};
            }

            if (is_null($value)) {
                continue;
            }

            if(is_array($value)){
                $dados[$item->{$method}()] = [];

                foreach ($value as $valueItem) {
                    $valueItem = is_object($valueItem) ? $valueItem->toArray($asAlias, $returnHidden) : $valueItem;

                    $dados[$item->{$method}()][] = $valueItem;
                }

                continue;
            }

            switch ($item->getType()) {
                case 'json':
                    $decoded = json_decode($value, true);

                    $dados[$item->{$method}()] = !empty($decoded) ? $decoded : $value;
                    break;
                default:
                    $value = is_object($value) ? $value->toArray($asAlias, $returnHidden) : $value;

                    $dados[$item->{$method}()] = $value;
                    break;
            }
        }

        return $dados;
    }
7493
protected function parsedCodeHasNamespaces(array $parsed)
    {
        // Namespaces can only be on first level in the code,
        // so we make only check on it.
        $node = array_filter(
            $parsed,
            function ($value) {
                return $value instanceof NamespaceNode;
            }
        );

        return !empty($node);
    }
559779
protected static function decompile(array $parsed) : self
    {
        $problem = new static();


        if (!empty($parsed['title'])) {
            $problem->setTitle($parsed['title']);
        }
        if (!empty($parsed['type'])) {
            $problem->setType($parsed['type']);
        }
        if (!empty($parsed['status'])) {
            $problem->setStatus((int) $parsed['status']);
        }
        if (!empty($parsed['detail'])) {
            $problem->setDetail($parsed['detail']);
        }
        if (!empty($parsed['instance'])) {
            $problem->setInstance($parsed['instance']);
        }

        // Remove the defined keys. That means whatever is left must be a custom
        // extension property.
        unset($parsed['title'], $parsed['type'], $parsed['status'], $parsed['detail'], $parsed['instance']);

        foreach ($parsed as $key => $value) {
            $problem[$key] = $value;
        }

        return $problem;
    }
1263921
public function getResultStorage($deliveryId = null)
    {
        if ($deliveryId !== null) {
            $delivery = $this->getResource($deliveryId);
            $deliveryResultServer = $delivery->getOnePropertyValue($this->getProperty(self::PROPERTY_RESULT_SERVER));
        }
        if (!isset($deliveryResultServer) || !$deliveryResultServer) {
            $deliveryResultServer = \taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer();
        }

        if(is_null($deliveryResultServer)){
            throw new \common_exception_Error(__('This delivery has no Result Server'));
        }
        $resultServerModel = $deliveryResultServer->getPropertyValues($this->getProperty(static::PROPERTY_HAS_MODEL));

        if(is_null($resultServerModel)){
            throw new \common_exception_Error(__('This delivery has no readable Result Server'));
        }

        $implementations = array();
        foreach($resultServerModel as $model){
            $model = $this->getClass($model);

            /** @var $implementation \core_kernel_classes_Literal*/
            $implementation = $model->getOnePropertyValue($this->getProperty(static::PROPERTY_MODEL_IMPL));

            if ($implementation !== null) {
                $implementations[] = $this->instantiateResultStorage($implementation->literal);
            }
        }

        if (empty($implementations)) {
            throw new \common_exception_Error(__('This delivery has no readable Result Server'));
        } elseif (count($implementations) == 1) {
            return reset($implementations);
        } else {
            return new StorageAggregation($implementations);
        }
    }
1345113
protected function getResultStorage($delivery)
    {
        /** @var ResultServerService $resultServerService */
        $resultServerService = $this->getServiceManager()->get(ResultServerService::SERVICE_ID);
        $resultStorage = $resultServerService->getResultStorage($delivery->getUri());
        if ($resultStorage instanceof NoResultStorage){
           throw NoResultStorageException::create();
        }

        if (!$resultStorage instanceof \taoResultServer_models_classes_ReadableResultStorage){
           throw new \common_exception_Error('The results storage it is not readable');
        }
        $this->getResultsService()->setImplementation($resultStorage);
        return $resultStorage;
    }
1141439
public function storeData()
    {
        $data = $this->getData();
        $id   = $this->getId();

        try {
            $storageService = $this->getServiceLocator()->get(Storage::SERVICE_ID);
            $storageService->store($id, $data);
            $this->returnJson(array('success' => true, 'type' => 'success'));
        } catch (StorageException $e) {
            $this->logInfo($e->getMessage());
            $this->returnJson(array('success' => false, 'type' => 'error'));
        }
    }
448327
public static function create(array $parsedResponse)
    {
        $result = new self();
        $result->setVersion($parsedResponse['Version']);
        $result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled']));
        if ($result->getEnabled()) {
            $result->setIncludeAPIs(
                Utilities::toBoolean($parsedResponse['IncludeAPIs'])
            );
        }
        $result->setRetentionPolicy(
            RetentionPolicy::create($parsedResponse['RetentionPolicy'])
        );

        return $result;
    }
1181658
public function get($fields = [])
    {
        $fields = empty($fields) ? $this->fields : $fields;

        $this->haveFields($fields);

        $query = $this->createQuery($fields);

        return new ServiceCollection($this->getService(), $this->service->query($query)->getEntries());
    }
198898
public static function create($parsed)
    {
        $result = new self();
        $upgradeType = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_UPGRADE_TYPE
        );
        $currentUpgradeDomainState = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_CURRENT_UPGRADE_DOMAIN_STATE
        );
        $currentUpgradeDomain = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_CURRENT_UPGRADE_DOMAIN
        );

        $result->setCurrentUpgradeDomain(intval($currentUpgradeDomain));
        $result->setCurrentUpgradeDomainState($currentUpgradeDomainState);
        $result->setUpgradeType($upgradeType);

        return $result;
    }
1191699
public function createService(Config $config)
    {
        $options = $config->getCacheOptions();

        $storage = new FileSystem($options->getStorageOptions());

        return $storage;
    }
1317274
public static function create($parsed)
    {
        $result = new self();
        $keys = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_STORAGE_SERVICE_KEYS
        );
        $result->_url = Utilities::tryGetValue($parsed, Resources::XTAG_URL);
        $result->_primary = Utilities::tryGetValue(
            $keys,
            Resources::XTAG_PRIMARY
        );
        $result->_secondary = Utilities::tryGetValue(
            $keys,
            Resources::XTAG_SECONDARY
        );

        return $result;
    }
361886
public function getProperties($modified = false)
    {
        $result = array();

        if($row = $this->getIterator()->current()) {
            $result = $row->getProperties($modified);
        }

        return $result;
    }
827700
final public function getErrorMessage($parsed = true) {
        return ($parsed) ? $this->parseMessages($this->errorMessages) :
                $this->errorMessages;
    }
152781
private static function checkParsedUrl(array $parsed)
    {
        $scheme   =& $parsed['scheme'];
        $user     =& $parsed['user'];
        $pass     =& $parsed['pass'];
        $host     =& $parsed['host'];
        $port     =& $parsed['port'];
        $path     =& $parsed['path'];
        $path     = '/'.ltrim($path, '/'); // If / is missing for path.
        $query    =& $parsed['query'];
        $fragment =& $parsed['fragment'];

        return compact(
            'scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'
        );
    }