Creates GetHostedServicePropertiesResult from parsed response.

@param array $parsed The parsed response in array representation

@return GetHostedServicePropertiesResult
437842
public static function create($parsed)
    {
        $result = new self();
        $properties = Utilities::tryGetValue(
            $parsed,
            Resources::XTAG_HOSTED_SERVICE_PROPERTIES
        );
        $result->_hostedService = new HostedService($parsed, $properties);

        return $result;
    }
370906
protected function actionGetByAddress($params=array())
    {
        $response = array(
            'errors' => array(),
            'data' => array(
                'count' => 0,
                'items' => array(),
            ),
        );
        $offset = isset($params['offset'])?(int)$params['offset']:0;
        if ($offset < 0) $offset = 0;
        $count = isset($params['count'])?(int)$params['count']:100;
        if ($count < 1) $count = 1;
        if ($count > 100) $count = 100;
        $filter = array(
            'fields' => array(),
            'offset' => $offset,
            'count' => $count,
        );
        $street = isset($params['street'])?trim((string)$params['street']):null;
        $number = isset($params['number'])?trim((string)$params['number']):null;

        if (empty($street)) {
            $response['errors'][] = 'bld01';
        }
        if (empty($number)) {
            $response['errors'][] = 'bld07';
        }
        if (!empty($response['errors'])) {
            return $response;
        }
        $buildsFilter = array(
            'fields' => array(),
        );
        if ($street && $number) {
            $buildsFilter['fields'][] = array(
                'field' => 'id',
                'compare' => '=',
                'value' => $this->build->getId(array('street'=>$street,'number'=>$number)),
            );
        }
        $builds = $this->build->find($buildsFilter);
        $filter['fields'][] = array(
            'field' => 'build',
            'compare' => 'in',
            'value' => array_keys($builds),
        );
        $response['data']['count'] = $this->company->count($filter);
        $companies = $this->company->find($filter);
        $phonesFilter = array(
            'fields' => array(
                array(
                    'field' => 'company',
                    'compare' => 'in',
                    'value' => array_keys($companies),
                )
            ),
        );
        $phones = $this->phone->find($phonesFilter);
        $catalogFilter = array(
            'fields' => array(
                array(
                    'field' => 'company',
                    'compare' => 'in',
                    'value' => array_keys($companies),
                )
            ),
        );
        $catalog = $this->catalog->find($catalogFilter);
        $rubricIds = array();
        foreach ($catalog as $item) {
            $rubricIds[$item['rubric']] = $item['rubric'];
        }
        $rubricsFilter = array(
            'fields' => array(
                array(
                    'field' => 'id',
                    'compare' => 'in',
                    'value' => $rubricIds,
                )
            ),
        );
        $rubrics = $this->rubric->find($rubricsFilter);
        $companiesData = $this->mergeData($companies,$builds,$phones,$rubrics,$catalog);
        $response['data']['items'] = array_values($companiesData);
        return $response;
    }
957714
public static function create(array $parsedResponse)
    {
        $result = new self();
        $result->setLogging(Logging::create($parsedResponse['Logging']));
        $result->setMetrics(Metrics::create($parsedResponse['Metrics']));

        return $result;
    }
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);
    }
568061
public function getReferringSites($parameters = [], $parseResult = true)
    {
        $this->setParams([
            'metrics'    => 'ga:pageviews,ga:sessionDuration,ga:exits',
            'dimensions' => 'ga:source',
            'filters'    => 'ga:medium==referral',
            'sort'       => '-ga:pageviews',
        ]);

        return $this->execute($parameters, $parseResult);
    }
600504
public function prepare(array $parsed): array
    {
        $this->msgs = $this->splitMessages($parsed, $this->errors);
        $groups = [];
        $service = $this->msgs['service'];
        $this->serviceSeg = $this->processService($service);

        foreach ($this->msgs as $k => $msg) {
            if ($k === 'service') {
                continue;
            }
            $grouped = $this->loopMessage($msg, $this->xmlMsg, $this->errors);
            $groups[] = $grouped['message'];
        }
        $this->ediGroups = $groups;

        return $groups;
    }
1278599
protected function queryEntities(
        $table,
        $parsed_filter = '',
        $fields = null,
        $extras = [],
        $parse_results = false
    ) {
        $options = new QueryEntitiesOptions();
        $options->setSelectFields([]);

        if (!empty($fields) && (ApiOptions::FIELDS_ALL != $fields)) {
            if (!is_array($fields)) {
                $fields = array_map('trim', explode(',', trim($fields, ',')));
            }
            $options->setSelectFields($fields);
        }

        $limit = intval(array_get($extras, ApiOptions::LIMIT, 0));
        if ($limit > 0) {
            $options->setTop($limit);
        }

        if (!empty($parsed_filter)) {
            $query = new QueryStringFilter($parsed_filter);
            $options->setFilter($query);
        }

        try {
            /** @var QueryEntitiesResult $result */
            $result = $this->getConnection()->queryEntities($table, $options);

            /** @var Entity[] $entities */
            $entities = $result->getEntities();

            if ($parse_results) {
                return static::parseEntitiesToRecords($entities);
            }

            return $entities;
        } catch (ServiceException $ex) {
            throw new InternalServerErrorException("Failed to filter items from '$table' on Windows Azure Tables service.\n" .
                $ex->getMessage());
        }
    }
1326238
private function createContainer($settings)
    {
        if (is_string($settings)) {
            return $this->createContainerFromString($settings);
        }

        if (is_array($settings)) {
            return $this->createContainerFromArray($settings);
        }

        throw new WrongServicesConfigurationException(
            sprintf('`services` must be either string or an array, but `%s` given.', gettype($settings))
        );
    }
133183
public static function unparse_url($parsed=null) {
		$url = '';
		$parsed = data::parse_args($parsed, constants::URL_PARTS);

		// To simplify, unset anything without length.
		ref\mb::trim($parsed);
		$parsed = \array_filter($parsed, 'strlen');

		// We don't really care about validating url integrity,
		// but if nothing at all was passed then it is trash.
		if (! \count($parsed)) {
			return false;
		}

		if (isset($parsed['scheme'])) {
			$url = "{$parsed['scheme']}:";
		}

		if (isset($parsed['host'])) {
			if ($url) {
				$url .= '//';
			}

			// Is this a user:pass situation?
			if (isset($parsed['user'])) {
				$url .= $parsed['user'];
				if (isset($parsed['pass'])) {
					$url .= ":{$parsed['pass']}";
				}
				$url .= '@';
			}

			// Finally the host.
			$url .= (\filter_var($parsed['host'], \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6) ? "[{$parsed['host']}]" : $parsed['host']);

			if (isset($parsed['port'])) {
				$url .= ":{$parsed['port']}";
			}

			if (isset($parsed['path']) && (0 !== \strpos($parsed['path'], '/'))) {
				$url .= '/';
			}
		}

		if (isset($parsed['path'])) {
			$url .= $parsed['path'];
		}

		if (isset($parsed['query'])) {
			$url .= "?{$parsed['query']}";
		}

		if (isset($parsed['fragment'])) {
			$url .= "#{$parsed['fragment']}";
		}

		return $url ? $url : false;
	}
483816
private function getNestedParams(array $params)
    {
        $query = http_build_query($params, null, '&');
        $params = explode('&', $query);
        $result = [];

        foreach ($params as $param) {
            list($key, $value) = explode('=', $param, 2);
            $result[urldecode($key)] = urldecode($value);
        }

        return $result;
    }
404138
public static function unparse($parsed)
    {
        if (empty($parsed)) return '';

        $parsed = self::checkParsedUrl($parsed);

        $url  = self::getUrl($parsed);
        $url .= self::getQuery($parsed);
        $url .= self::getFragment($parsed);

        return $url;
    }
401990
public function getContextsByRef( $refs )
	{
		$contexts = array();

		if ( is_array( $refs ) )
		foreach ( $refs as $ref )
		{
			if ( ! isset( $this->contexts[ $ref ] ) ) continue;
			$contexts[ $ref ] = $this->contexts[ $ref ];
		}

		return new ContextsFilter( $this->instance, $contexts );
	}
1069791
public function createWebsite(...$params)
    {
        $name      = \array_shift($params);
        $ipAddress = \array_shift($params);
        $https     = \array_shift($params);
        $domains   = \array_shift($params);

        if ($this->version === 1)
        {
            $siteApps = $params;

            return $this->createV1Website($name, $ipAddress, $https, $domains, ...$siteApps);
        }

        $certificate = \array_shift($params);
        $siteApps    = $params;

        return $this->createV2Website($name, $ipAddress, $https, $domains, $certificate, ...$siteApps);

    }
409834
public static function createInstanceList($parsed, $class)
    {
        $list = [];

        foreach ($parsed as $value) {
            $list[] = $class::create($value);
        }

        return $list;
    }
279273
public function listHostedServices()
    {
        $context = new HttpCallContext();
        $context->setMethod(Resources::HTTP_GET);
        $context->setPath($this->_getHostedServicePath());
        $context->addStatusCode(Resources::STATUS_OK);

        $response = $this->sendHttpContext($context);
        $serialized = $this->dataSerializer->unserialize($response->getBody());

        return ListHostedServicesResult::create($serialized);
    }
76932
public static function create($parsed)
    {
        $result = new self();

        $result->setDeployment(Deployment::create($parsed));

        return $result;
    }
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'
        );
    }