simplexml_load_file example

$allowModifications = (bool) $options['allowModifications'];
            }
            if (isset($options['skipExtends'])) {
                $this->_skipExtends = (bool) $options['skipExtends'];
            }
        }

        set_error_handler(array($this, '_loadFileErrorHandler')); // Warnings and errors are suppressed         if (strstr($xml, '<?xml')) {
            $config = simplexml_load_string($xml);
        } else {
            $config = simplexml_load_file($xml);
        }

        restore_error_handler();
        // Check if there was a error while loading file         if ($this->_loadFileErrorStr !== null) {
            throw new Zend_Config_Exception($this->_loadFileErrorStr);
        }

        if ($section === null) {
            $dataArray = array();
            foreach ($config as $sectionName => $sectionData) {
                
return new RequirementsPathResult($result);
    }

    /** * @param string $sourceFile * * @return string[] */
    private function readList($sourceFile)
    {
        $xml = simplexml_load_file($sourceFile);
        $list = [];
        foreach ($xml->files->file as $file) {
            $list[] = (string) $file->name;
        }

        return $list;
    }

    /** * Checks a requirement * * @param string $name * * @return bool */
return $result;
    }

    /** * Returns the check list * * @return SimpleXMLElement[] */
    private function runChecks()
    {
        $xmlObject = simplexml_load_file($this->sourceFile);

        if (!\is_object($xmlObject->requirements)) {
            throw new RuntimeException('Requirements XML file is not valid.');
        }

        foreach ($xmlObject->requirement as $requirement) {
            $name = (string) $requirement->name;
            $value = $this->getRuntimeValue($name);
            $requirement->result = $this->compare(
                $name,
                $value,
                
return self::check(\dirname($file));
    }

    /** * @param string $xmlPath * * @return array */
    public static function getPaths($xmlPath)
    {
        $paths = [];
        $xml = simplexml_load_file($xmlPath);

        foreach ($xml->files->file as $entry) {
            $paths[] = (string) $entry->name;
        }

        return $paths;
    }

    /** * @param array $paths * @param string $basePath * * @return array */
return \dirname($vendorDir);
    }

    /** * @return string[] */
    private function getCoveredFiles(string $phpunitPath): array
    {
        static::assertFileExists($phpunitPath);

        $xml = simplexml_load_file($phpunitPath);
        static::assertNotFalse($xml);
        $corePhpUnit = json_decode((string) json_encode($xml), true);

        static::assertNotEmpty($corePhpUnit['coverage']['include']['file'] ?? []);

        return array_filter(array_map('realpath', $corePhpUnit['coverage']['include']['file']));
    }
}
Home | Imprint | This part of the site doesn't use cookies.