@param array $xyz

@return array
321966
protected static function xyzToLab($xyz)
    {
        //http://en.wikipedia.org/wiki/Illuminant_D65#Definition
        $Xn = .95047;
        $Yn = 1;
        $Zn = 1.08883;

        // http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions
        return [
            'L' => 116 * self::xyzToLabStep($xyz['Y'] / $Yn) - 16,
            'a' => 500 * (self::xyzToLabStep($xyz['X'] / $Xn) - self::xyzToLabStep($xyz['Y'] / $Yn)),
            'b' => 200 * (self::xyzToLabStep($xyz['Y'] / $Yn) - self::xyzToLabStep($xyz['Z'] / $Zn)),
        ];
    }
1301731
public function parseExdates(array $event)
    {
        if (empty($event['EXDATE_array'])) {
            return array();
        } else {
            $exdates = $event['EXDATE_array'];
        }

        $output          = array();
        $currentTimeZone = $this->defaultTimeZone;

        foreach ($exdates as $subArray) {
            end($subArray);
            $finalKey = key($subArray);

            foreach ($subArray as $key => $value) {
                if ($key === 'TZID') {
                    $checkTimeZone = $subArray[$key];

                    if ($this->isValidIanaTimeZoneId($checkTimeZone)) {
                        $currentTimeZone = $checkTimeZone;
                    } elseif ($this->isValidCldrTimeZoneId($checkTimeZone)) {
                        $currentTimeZone = $this->isValidCldrTimeZoneId($checkTimeZone, true);
                    } else {
                        $currentTimeZone = $this->defaultTimeZone;
                    }
                } elseif (is_numeric($key)) {
                    $icalDate = $subArray[$key];

                    if (substr($icalDate, -1) === 'Z') {
                        $currentTimeZone = self::TIME_ZONE_UTC;
                    }

                    $output[] = new Carbon($icalDate, $currentTimeZone);

                    if ($key === $finalKey) {
                        // Reset to default
                        $currentTimeZone = $this->defaultTimeZone;
                    }
                }
            }
        }

        return $output;
    }
857865
public function fromXSD($xsd): array
    {
        if (!$this->isEmptyValue($xsd)) {
            return $this->fromXml($xsd->output);
        }

        return $this->result;

    }
341493
protected function elementToArray(\SimpleXMLElement $element): array
    {
        $result = [];
        foreach ($element->xpath('*') as $node) {
            if (count($node->xpath('*')) > 0) {
                $value = $this->elementToArray($node);
            } else {
                $value = strval($node);
            }
            $result = array_merge_recursive($result, [$node->getName() => $value]);
        }

        return $result;
    }
1057578
private function getArrayValues($array)
    {
        $out = [];
        $it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));

        foreach ($it as $value) {
            $out[] = $value;
        }
        return $out;
    }
971878
public function transpose($array)
    {
        $return = [];

        if (count($array)) {
            foreach ($array as $key => $values) {
                foreach ($values as $subkey => $value) {
                    $return[$subkey][$key] = $value;
                }
            }
        }

        return $return;
    }
200916
protected function getCoordParams(array $elementRef = null, $x = 0, $y = 0)
    {
        return
            (array) $elementRef + [
                'x' => (int) $x,
                'y' => (int) $y,
            ];
    }
1357067
public static function toArray(string $xml): array
    {
        $backup = libxml_disable_entity_loader(true);
        $result = static::xml2Data(simplexml_load_string(
            $xml,
            'SimpleXMLElement',
            LIBXML_COMPACT | LIBXML_NOCDATA | LIBXML_NOBLANKS
        ));
        libxml_disable_entity_loader($backup);
        return $result;
    }
680027
protected function getDimensionsForUnixLike(): ?array
	{
		// Attempt to get dimensions from environment

		if(($width = getenv('COLUMNS')) !== false && ($height = getenv('LINES')) !== false)
		{
			return ['width' => (int) $width, 'height' => (int) $height];
		}

		// Attempt to get dimensions from stty

		exec('stty size', $output, $status);

		if($status === 0 && preg_match('/^([0-9]+) ([0-9]+)$/', current($output), $matches))
		{
			return ['width' => (int) $matches[2], 'height' => (int) $matches[1]];
		}

		// All attempts failed so we'll just return null

		return null;
	}
504101
public function toArray(
        $ignore = ['additionalDomains', 'domainValidator', 'site']
    ) {
        $data = parent::toArray($ignore);

        if (!in_array('siteId', $ignore)) {
            $data['siteId'] = $this->getSiteId();
        }

        if (!in_array('additionalDomains', $ignore)) {
            $data['additionalDomains'] = $this->modelArrayToArray(
                $this->getAdditionalDomains()->toArray(),
                ['additionalDomains', 'domainValidator', 'site']
            );
        }

        // @bc support
        if (!in_array('domain', $ignore)) {
            $data['domain'] = $this->getDomainName();
        }

        if (!in_array('isPrimary', $ignore)) {
            $data['isPrimary'] = $this->isPrimary();
        }

        if (!in_array('isPrimaryDomain', $ignore)) {
            $data['isPrimaryDomain'] = $this->isPrimaryDomain();
        }

        return $data;
    }
515501
def xyzlim(vmin, vmax=None):
    """"""
    if vmax is None:
        vmin, vmax = -vmin, vmin
    xlim(vmin, vmax)
    ylim(vmin, vmax)
    zlim(vmin, vmax)
824192
public function getXMLValues($fields)
    {
        $result = [];

        foreach ($fields as $field) {
            $result[$field] = $this->XML_val($field);
        }

        return $result;
    }
1244019
protected function sectionYii()
	{
		return [
			'Version'=>Yii::getVersion(),
			'YII_DEBUG'=>$this->valueBool(YII_DEBUG),
			'YII_ENV'=>Html::tag('code', YII_ENV),
			'YII_ENV_DEV'=>$this->valueBool(YII_ENV_DEV),
			'YII_ENV_PROD'=>$this->valueBool(YII_ENV_PROD),
		];
	}
363042
private static function parseTimeZone(string $timeZone): array
    {
        $parts = explode('/', $timeZone);

        if (count($parts) > 2) {
            return [$parts[0], $parts[1] . ' / ' . $parts[2]];
        }

        if (count($parts) > 1) {
            return [$parts[0], $parts[1]];
        }

        return ['Other', $parts[0]];
    }
291417
protected function processLegacyZone(array $zones): array
    {
        $resourceRecords = [];
        foreach ($zones as $domain => $types) {
            $domain = rtrim($domain, '.').'.';
            foreach ($types as $type => $data) {
                $data = (array) $data;
                $type = RecordTypeEnum::getTypeFromName($type);
                foreach ($data as $rdata) {
                    $resourceRecords[] = (new ResourceRecord())
                        ->setName($domain)
                        ->setType($type)
                        ->setClass($this->defaultClass)
                        ->setTtl($this->defaultTtl)
                        ->setRdata($rdata);
                }
            }
        }

        return $resourceRecords;
    }
536058
public function toArray()
    {
        return [
            'name'                  => $this->name,
            'label'                 => $this->label,
            'description'           => $this->description,
            'class_name'            => $this->className,
            'singleton'             => $this->singleton,
            'read_only'             => $this->readOnly,
            'subscription_required' => $this->subscriptionRequired,
        ];
    }
976251
private static function extractExtensions(array &$parts): array
    {
        $extensions = [];
        while (count($parts) > 1 && strlen($parts[0]) == 1 && strtolower($parts[0]) != 'x') {
            $extension = array_shift($parts);
            $extensions[$extension] = [];
            while (count($parts) > 0 && preg_match('/([a-zA-Z]{2,8})/', $parts[0])) {
                $extensions[$extension][] = array_shift($parts);
            }
        }

        return $extensions;
    }