Load cache lifetime metadata.

@param $path
@param \DOMXPath $xpath

@return array
345094
private function loadCacheLifetime($path, \DOMXPath $xpath)
    {
        $nodeList = $xpath->query($path);

        if (!$nodeList->length) {
            return [
                'type' => CacheLifetimeResolverInterface::TYPE_SECONDS,
                'value' => 0,
            ];
        }

        // get first node
        $node = $nodeList->item(0);

        $type = $node->getAttribute('type');
        if ('' === $type) {
            $type = CacheLifetimeResolverInterface::TYPE_SECONDS;
        }

        $value = $node->nodeValue;
        if (!$this->cacheLifetimeResolver->supports($type, $value)) {
            throw new \InvalidArgumentException(
                sprintf('CacheLifetime "%s" with type "%s" not supported.', $value, $type)
            );
        }

        return [
            'type' => $type,
            'value' => $value,
        ];
    }
126229
private function loadProperties(&$tags, \DOMXPath $xpath, \DOMNode $context): array
    {
        $result = [];

        /** @var \DOMElement $node */
        foreach ($xpath->query('x:*', $context) as $node) {
            if ('property' === $node->tagName) {
                $value = $this->loadProperty($xpath, $node, $tags);
                $result[$value['name']] = $value;
            } elseif ('block' === $node->tagName) {
                $value = $this->loadBlock($xpath, $node, $tags);
                $result[$value['name']] = $value;
            } elseif ('section' === $node->tagName) {
                $value = $this->loadSection($xpath, $node, $tags);
                $result[$value['name']] = $value;
            }
        }

        return $result;
    }
1013985
public function getNodeForPath($path)
    {
        $path = trim($path, '/');
        if (isset($this->cache[$path])) {
            return $this->cache[$path];
        }

        // Is it the root node?
        if (!strlen($path)) {
            return $this->rootNode;
        }

        // Attempting to fetch its parent
        list($parentName, $baseName) = Uri\split($path);

        // If there was no parent, we must simply ask it from the root node.
        if ('' === $parentName) {
            $node = $this->rootNode->getChild($baseName);
        } else {
            // Otherwise, we recursively grab the parent and ask him/her.
            $parent = $this->getNodeForPath($parentName);

            if (!($parent instanceof ICollection)) {
                throw new Exception\NotFound('Could not find node at path: '.$path);
            }
            $node = $parent->getChild($baseName);
        }

        $this->cache[$path] = $node;

        return $node;
    }
226968
public function getMetadata($path)
    {
        $data = Response::parseResponse(
            $this->getCos()->stat($this->getBucket(), $path)
        );

        return $data['data'];
    }
972792
public function loadSetupFile($path)
	{
		$result = false;

		if ($path)
		{
			if (!file_exists($path))
			{
				return $result;
			}

			$xml = simplexml_load_file($path);

			if ($params = $xml->params)
			{
				foreach ($params as $param)
				{
					$this->setXML($param);
					$result = true;
				}
			}
		}
		else
		{
			$result = true;
		}

		return $result;
	}
995389
protected function loadMigrationFields(DOMXPath $rootPath)
    {
        $fields = $rootPath->query(
            './value[@type="list" and @key="columns"]/value[@type="object" and @struct-name="db.mysql.Column"]'
        );

        if ($fields && $fields->length) {
            /** @var \DOMNode $field */
            foreach ($fields as $field) {
                $fieldName = $rootPath->query('./value[@key="name"]', $field)->item(0)->nodeValue;

                $this->addField($fieldName)->load($field, $rootPath);
            } // foreach
        } // if

        $this->addIndicesToFields($rootPath);

        return $this->addForeignKeys($rootPath);
    }
51071
private function loadTag(\DOMXPath $xpath, \DOMNode $node)
    {
        $tag = [
            'name' => null,
            'priority' => null,
            'attributes' => [],
        ];

        foreach ($node->attributes as $key => $attr) {
            if (in_array($key, ['name', 'priority'])) {
                $tag[$key] = $attr->value;
            } else {
                $tag['attributes'][$key] = $attr->value;
            }
        }

        return $tag;
    }
1226936
public function getMetadata($path)
    {
        $url = self::BASE_URI.$this->getPathUnderRootDrive($path);

        return $this->getResponse('GET', $url);
    }
616304
private static function loadDefinitionsFromPath(string $path): array
    {
        if (!\file_exists($path)) {
            throw new \RuntimeException(\sprintf('Path "%s" does not exist', $path));
        }

        if (!\is_dir($path)) {
            return self::loadDefinitionsFromFile($path);
        }

        $definitions = [];
        foreach (\glob($path . '/*.php', \GLOB_ERR) as $file) {
            if (\is_file($file)) {
                $definitions[] = self::loadDefinitionsFromFile($file);
            }
        }

        return \count($definitions) === 0 ? [] : \array_merge(...$definitions);
    }
1132142
protected function loadFile($path) {
        $path = realpath($path);

        if ($this->matchEnvironment($path)) {
            foreach ($this->getDrivers() as $driver) {
                if ($driver->supports($path)) {
                    return $driver->loadFile($path);
                }
            }
        }

        return [];
    }
455881
protected function loadFile($path): array
    {
        $reader = ReaderFactory::get($this->builder, $path);

        return $reader->read($path);
    }
1171915
private function loadFromCache($file_path)
    {
        $cache_location = $this->getCacheLocationForPath($file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof FileStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof FileStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
1046310
public function seeXmlResponseMatchesXpath($xpath)
    {
        $structure = new XmlStructure($this->connectionModule->_getResponseContent());
        $this->assertTrue($structure->matchesXpath($xpath), 'xpath not matched');
    }
1246262
private function loadPropertyMetadata(\DOMXPath $xpath, \DOMNode $propertyNode)
    {
        $propertyMetadata = null;
        switch ($propertyNode->nodeName) {
            case 'concatenation-property':
                $propertyMetadata = $this->loadConcatenationPropertyMetadata($xpath, $propertyNode);
                break;
            case 'identity-property':
                $propertyMetadata = $this->loadIdentityPropertyMetadata($xpath, $propertyNode);
                break;
            case 'group-concat-property':
                $propertyMetadata = $this->loadGroupConcatPropertyMetadata($xpath, $propertyNode);
                break;
            case 'case-property':
                $propertyMetadata = $this->loadCasePropertyMetadata($xpath, $propertyNode);
                break;
            case 'count-property':
                $propertyMetadata = $this->loadCountPropertyMetadata($xpath, $propertyNode);
                break;
            case 'property':
                $propertyMetadata = $this->loadSinglePropertyMetadata($xpath, $propertyNode);
                break;
            default:
                throw new \InvalidArgumentException(sprintf(
                    'The tag "%s" cannot be handled by this loader',
                    $propertyNode->nodeName
                ));
        }

        if (null !== $translation = XmlUtil::getValueFromXPath('@translation', $xpath, $propertyNode)) {
            $propertyMetadata->setTranslation($translation);
        }

        if (null !== $type = XmlUtil::getValueFromXPath('@type', $xpath, $propertyNode)) {
            $propertyMetadata->setType($type);
        }

        $propertyMetadata->setVisibility(
            XmlUtil::getValueFromXPath(
                '@visibility',
                $xpath,
                $propertyNode,
                FieldDescriptorInterface::VISIBILITY_NO
            )
        );
        $propertyMetadata->setSearchability(
            XmlUtil::getValueFromXPath(
                '@searchability',
                $xpath,
                $propertyNode,
                FieldDescriptorInterface::SEARCHABILITY_NEVER
            )
        );
        $propertyMetadata->setSortable(
            XmlUtil::getBooleanValueFromXPath('@sortable', $xpath, $propertyNode, true)
        );
        $propertyMetadata->setFilterType(XmlUtil::getValueFromXPath('@filter-type', $xpath, $propertyNode));
        $propertyMetadata->setFilterTypeParameters($this->getFilterTypeParameters($xpath, $propertyNode));

        return $propertyMetadata;
    }
422244
private function loadFromCache($path)
    {
        if ($this->getCache()) {
            return $this->getCache()->read(self::CACHE_KEY . md5($path));
        }

        return false;
    }
715668
protected function nodeExists( $path )
    {
        if ( !isset( $this->cachedNodes[$path] ) )
        {
            $this->cachedNodes[$path] = $this->getNodeInfo( $path );
        }

        return $this->cachedNodes[$path]['nodeExists'];
    }
1237499
private function isCached(string $path)
	{
		$views = glob($this->cacheDirectory . $this->DS . '*'. str_replace($this->DS, '___', $path));

		if (count($views) > 0) {
			$this->canRecache($path, $views[0]);
			return file_get_contents($views[0]) == null ? ' ' : file_get_contents($views[0]);
		}
		else {
			$this->cache($path, uniqid());
		}

		$views = glob($this->cacheDirectory . $this->DS . '*'. str_replace($this->DS, '___', $path));
		if (count($views) > 0) {
			return file_get_contents($views[0]) == null ? ' ' : file_get_contents($views[0]);
		}
	}