Pressbooks\Modules\Import\Ooxml\Docx::getTargetPath PHP Метод

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

Give it a schema, get back a path(s) that points to a resource
protected getTargetPath ( string $schema, string $id = '' ) : string
$schema string
$id string
Результат string
    protected function getTargetPath($schema, $id = '')
    {
        $path = '';
        // The subfolder name "_rels", the file extension ".rels" are
        // reserved names in an OPC package
        if (empty($id)) {
            $path_to_rel_doc = '_rels/.rels';
        } else {
            $path_to_rel_doc = 'word/_rels/document.xml.rels';
        }
        $relations = simplexml_load_string($this->zip->getFromName($path_to_rel_doc));
        foreach ($relations->Relationship as $rel) {
            if ($rel['Type'] == $schema) {
                switch ($id) {
                    // must be cast as a string to avoid returning SimpleXml Object.
                    case 'footnotes':
                        $path = 'word/' . (string) $rel['Target'];
                        break;
                    case 'endnotes':
                        $path = 'word/' . (string) $rel['Target'];
                        break;
                    case 'hyperlink':
                        $path["{$rel['Id']}"] = (string) $rel['Target'];
                        break;
                    default:
                        $path = (string) $rel['Target'];
                        break;
                }
            }
        }
        return $path;
    }