Creates GetAffinityGroupPropertiesResult from parsed response into array.

@param array $parsed The parsed HTTP response body

@return GetAffinityGroupPropertiesResult
965489
public static function create($parsed)
    {
        $result = new self();
        $hostedServices = Utilities::tryGetArray(
            Resources::XTAG_HOSTED_SERVICES,
            $parsed
        );
        $storageServices = Utilities::tryGetArray(
            Resources::XTAG_STORAGE_SERVICES,
            $parsed
        );

        $result->_affinityGroup = new AffinityGroup($parsed);

        foreach ($hostedServices as $value) {
            $service = new HostedService($value);
            $result->_hostedServices[] = $service;
        }

        foreach ($storageServices as $value) {
            $service = new StorageService($value);
            $result->_storageServices[] = $service;
        }

        return $result;
    }
603064
public static function fromSuccess(array $params)
    {
        $matchResult = new self();
        $matchResult->type = 'success';
        $matchResult->params = $params;
        return $matchResult;
    }
80958
public static function styles_parse( $css = [] ) {

		// Pass our styles from the kirki_styles_array filter.
		$css = apply_filters( 'kirki_styles_array', $css );

		// Process the array of CSS properties and produce the final CSS.
		$final_css = '';
		if ( ! is_array( $css ) || empty( $css ) ) {
			return '';
		}
		foreach ( $css as $media_query => $styles ) {
			$final_css .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
			foreach ( $styles as $style => $style_array ) {
				$css_for_style = '';

				foreach ( $style_array as $property => $value ) {
					if ( is_string( $value ) && '' !== $value ) {
						$css_for_style .= $property . ':' . $value . ';';
					} elseif ( is_array( $value ) ) {
						foreach ( $value as $subvalue ) {
							if ( is_string( $subvalue ) && '' !== $subvalue ) {
								$css_for_style .= $property . ':' . $subvalue . ';';
							}
						}
					}
					$value = ( is_string( $value ) ) ? $value : '';
				}
				if ( '' !== $css_for_style ) {
					$final_css .= $style . '{' . $css_for_style . '}';
				}
			}
			$final_css .= ( 'global' !== $media_query ) ? '}' : '';
		}
		return $final_css;
	}
722861
protected function runGroupSort($results)
    {
        if (!$results instanceof QueryResultset) {
            return $results;
        }
        $grouped = [];
        $resultTaxOrders = [];
        foreach ($results as $result) {
            $taxGroup = null;
            foreach ($result->getTaxonomy() as $taxonomy) {
                if (in_array($taxonomy->getTaxonomytype(), $result->getTaxonomy()->getGroupingTaxonomies())) {
                    $taxGroup = $taxonomy->getSlug();
                    $taxOrder = $taxonomy->getSortorder();
                    $resultTaxOrders[$result->getId()] = $taxOrder;
                }
            }
            if ($taxGroup !== null) {
                $grouped[$taxGroup][] = $result;
            } else {
                $grouped['ungrouped'][] = $result;
            }
        }

        if (!count($grouped)) {
            return $results;
        }
        if (isset($taxGroup) && $taxGroup !== null) {
            foreach ($grouped as &$group) {
                usort($group, function ($a, $b) use ($resultTaxOrders) {
                    $aOrder = isset($resultTaxOrders[$a->getId()]) ? $resultTaxOrders[$a->getId()] : 0;
                    $bOrder = isset($resultTaxOrders[$b->getId()]) ? $resultTaxOrders[$b->getId()] : 0;

                    return $aOrder - $bOrder;
                });
            }
        }

        return call_user_func_array('array_merge', $grouped);
    }
781350
public static function getProperties($classes)
    {
        array_reverse($classes);
        $properties = array();
        foreach ($classes as $class) {
            foreach ($class->getProperties() as $property) {
                $properties[$property->getName()] = $property;
            }
        }

        return $properties;
    }
269557
public function netstat($parse = true)
    {
        $result = trim(shell_exec('netstat -pant'));

        if ($parse) {
            $lines = explode(PHP_EOL, $result);
            unset($lines[0]);
            unset($lines[1]);

            $columns = [
                'Proto',
                'Recv-Q',
                'Send-Q',
                'Local Address',
                'Foreign Address',
                'State',
                'PID/Program',
                'Process Name',
            ];

            $result = [];
            foreach ($lines as $row => $line) {
                $column = array_values(array_filter(explode(' ', $line), 'strlen'));
                foreach ($columns as $col => $key) {
                    $result[$row][$key] = @$column[$col];
                }
            }
            $result = array_values($result);
        }
        
        return $result;
    }
986157
public function GroupedFeatures($showungrouped = false)
    {
        $features = $this->owner->Features()
            ->innerJoin("Feature","Feature.ID = ProductFeatureValue.FeatureID");

        //figure out feature groups
        $groupids = FeatureGroup::get()
                ->innerJoin("Feature","Feature.GroupID = FeatureGroup.ID")
                ->innerJoin("ProductFeatureValue","Feature.ID = ProductFeatureValue.FeatureID")
                ->filter("ProductID",$this->owner->ID)
                ->getIDList();
        //pack existin features into seperate lists
        $result = new ArrayList();

        foreach($groupids as $groupid) {
            $group = FeatureGroup::get()->byID($groupid);
            $result->push(new ArrayData(array(
                'Group' => $group,
                'Children' => $features->filter("GroupID", $groupid)
            )));
        }

        $ungrouped = $features->filter("GroupID:not", $groupids);

        if ($ungrouped->exists() && $showungrouped) {
            $result->push(new ArrayData(array(
                'Children' => $ungrouped
            )));
        }

        return $result;
    }
1305729
public static function create(array $parsedResponse)
    {
        $result = new self();
        $result->_serviceProperties = ServiceProperties::create($parsedResponse);

        return $result;
    }
673961
public static function create($parsed)
    {
        $result = new self();
        $rowStorageServices = Utilities::tryGetArray(
            Resources::XTAG_STORAGE_SERVICE,
            $parsed
        );

        foreach ($rowStorageServices as $rowStorageService) {
            $result->_storageServices[] = new StorageService($rowStorageService);
        }

        return $result;
    }
37852
protected function parseResult($result) {
 
        if (! property_exists($result, 'return')) {
            return [];
        }

        $result = $result->return;
        
        if (is_null($result)) {
            return [];
        }
        
        if (!is_array($result)) {
            $result = [$result];
        }

        return $this->filterResult($result);
    }
184922
public function getProperties($filter = -1)
    {
        $properties = parent::getProperties($filter);
        foreach ($properties as $key => $val) {
            $properties[$key] = new ReflectionProperty($this->getName(), $val->getName());
        }

        return $properties;
    }
649845
public function setParsed(bool $parsed = true): Result
    {
        $this->parsed = (boolean) $parsed;
        return $this;
    }
1278822
public function toArray($prefixed = true, array $only = null)
    {
        $definition = $this->definition;

        if ($only !== null) {
            $definition = Arr::only($definition, $only);
        }

        $result = [];

        foreach ($definition as $property) {
            if ($prefixed) {
                $result[$this->prefix.$property] = $this->get($property);
            } else {
                $result[$property] = $this->get($property);
            }
        }

        return $result;
    }
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;
    }
409834
public static function createInstanceList($parsed, $class)
    {
        $list = [];

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

        return $list;
    }
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;
    }
1277563
final public function getSuccessMessage($parsed = true) {
        return ($parsed) ? $this->parseMessages($this->successMessages) :
                $this->successMessages;
    }