PressBooks\Modules\Import\Epub\Epub201::getZipContent PHP Метод

getZipContent() защищенный Метод

Locates an entry using its name, returns the entry contents
protected getZipContent ( $file, boolean $as_xml = true ) : string | SimpleXMLElement
$file
$as_xml boolean
Результат string | SimpleXMLElement
    protected function getZipContent($file, $as_xml = true)
    {
        // Locates an entry using its name
        $index = $this->zip->locateName(urldecode($file));
        if (false === $index) {
            return '';
        }
        // returns the contents using its index
        $content = $this->zip->getFromIndex($index);
        // if it's not xml, return
        if (!$as_xml) {
            return $content;
        }
        // if it is xml, then instantiate and return a simplexml object
        return new \SimpleXMLElement($content);
    }