Find document root

@return string
@access public
1725
public function getDocumentRootPath()
    {
        /**
         * The absolute pathname of the currently executing script.
         * Notatka: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
         * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
         */
        if (isset($_SERVER['SCRIPT_FILENAME'])) {
            $sRealPath = dirname($_SERVER['SCRIPT_FILENAME']);
        }
        else {
            /**
             * realpath — Returns canonicalized absolute pathname
             */
            $sRealPath = realpath('.') ;
        }

        $sRealPath = $this->trimPathTrailingSlashes($sRealPath);

        /**
         * The filename of the currently executing script, relative to the document root.
         * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
         * would be /test.php/foo.bar.
         */
        $sSelfPath = dirname($_SERVER['PHP_SELF']);
        $sSelfPath = $this->trimPathTrailingSlashes($sSelfPath);

        return $this->trimPathTrailingSlashes(substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath)));
    }
133417
public function getDocument($document, $rootNode)
	{
		if ($rootNode == null)
		{
			$rootNode = "page";
		}
		return $this->_persistUtil->getDocument($document, $rootNode);
	}
864863
public function getDocumentRoot()
    {
        $documentRoot = '';
        $normalized = $this->getNormalized();
        if (empty($normalized['web']['locations'])) {
            return $documentRoot;
        }
        foreach ($this->getNormalized()['web']['locations'] as $path => $location) {
            if (isset($location['root'])) {
                $documentRoot = $location['root'];
            }
            if ($path === '/') {
                break;
            }
        }

        return ltrim($documentRoot, '/');
    }
74745
public function findOneAbsoluteRoot() : ?Page
    {
        if (!$this->absoluteRoot)
        {
            $this->absoluteRoot = PageQuery::create()
                ->findRoot();
        }

        return $this->absoluteRoot;
    }
698543
protected function getDocumentationDirectory($rootRelative = false)
    {
        $reflectionObject = new \ReflectionObject($this);
        $componentFile    = $reflectionObject->getFileName();
        $docDirectory     = dirname($componentFile).DIRECTORY_SEPARATOR.$this->basename;

        return $rootRelative ? substr($docDirectory, strlen(PATH_site) - 1) : $docDirectory;
    }
1007625
function root()
    {
        // change template to login layout
        $root = $this;
        while( $next = $root->parent() )
            $root = $next;

        return ($root === $this) ? null : $root;
    }
71284
def _document_root(self, fully_qualified=True):
        
        nsmap = {"xsi": utils.NAMESPACES["xsi"], "xlink": utils.NAMESPACES["xlink"]}
        if fully_qualified:
            nsmap["mets"] = utils.NAMESPACES["mets"]
        else:
            nsmap[None] = utils.NAMESPACES["mets"]
        attrib = {
            "{}schemaLocation".format(utils.lxmlns("xsi")): utils.SCHEMA_LOCATIONS
        }
        if self.objid:
            attrib["OBJID"] = self.objid
        return etree.Element(utils.lxmlns("mets") + "mets", nsmap=nsmap, attrib=attrib)
649974
protected function getRootComponent()
    {
        $cur = $this;
        while ($cur->parent !== null) {
            $cur = $cur->parent;
        }
        return $cur;
    }
976750
public function location($trace) {
        $root = substr($_SERVER['DOCUMENT_ROOT'], 0 , strlen(static::$defaults['docroot']) * -1);
        $file = implode('/', array_diff(explode('/', $trace[0]['file']), explode('/', $root)));
        $ret = array(
            'file' => $file,
            'line' => $trace[0]['line']
        );
        if (isset($trace[1]['function'])) $ret['function'] = $trace[1]['function'];
        if (isset($trace[1]['class'])) $ret['class'] = $trace[1]['class'];
        return $ret;
    }
948041
public function getDocument()
    {
        $data = $this->toArray();
        
        // restore document id
        $data['_id'] = $data['__documentId__'];
        
        // unset meta fields
        unset($data['__date__'], $data['__documentId__']);
        
        return $this
            ->baseCollection
            ->hydrate($data);
    }
309151
public function getRootPageId()
    {
        $rootPageId = 0;

        if (empty($this->rootLineArray)) {
            return $rootPageId;
        }

        foreach ($this->rootLineArray as $page) {
            if (Site::isRootPage($page)) {
                $rootPageId = $page['uid'];
            }
        }

        return $rootPageId;
    }
16102
protected function findBaseRootElement()
    {
        $root = $this->findBaseRootElementOrNull();
        if (is_null($root)) {
            $root = $this->createBaseRootElement();
        }
        return $root;
    }
188571
function rootDOMNode()
    {
        if ( !isset( $this->InstallItem['content'] ) || !$this->InstallItem['content'] )
        {
            $filename = $this->InstallItem['filename'];
            $subdirectory = $this->InstallItem['sub-directory'];
            if ( $subdirectory )
                $filepath = $subdirectory . '/' . $filename . '.xml';
            else
                $filepath = $filename . '.xml';

            $filepath = $this->Package->path() . '/' . $filepath;

            $dom = $this->Package->fetchDOMFromFile( $filepath );
            if ( $dom )
            {
                $this->InstallItem['content'] = $dom->documentElement;
            }
            else
            {
                eZDebug::writeError( 'Failed fetching dom from file ' . $filepath, __METHOD__ );
                exit(0);
            }
        }

        return $this->InstallItem['content'];
    }
1227294
private function getRootDirectory()
    {
        static $root;

        if (!$root) {
            $working = getcwd();
            $myself  = __DIR__;

            if (0 === strpos($myself, $working)) {
                // Local installation, the working directory is the root
                $root = $working;
            } else {
                // Global installation, back up above the vendor/ directory
                $root = realpath($myself . '/../../../../../');
            }
        }

        return $root;
    }
473659
private static function docRoot()
    {
        $docRoot = dirname(__DIR__);
        $parts = explode(DIRECTORY_SEPARATOR, $docRoot);
        $path = null;
        foreach ($parts as $idx => $part) {
            $path .= $part . DIRECTORY_SEPARATOR;
            if ($part == 'vendor') {
                break;
            }
        }
        $path = str_replace(DIRECTORY_SEPARATOR . 'vendor', '', $path);

        return $path;
    }
1307489
public static function getRootPath()
        {
            if (is_null(static::$_filePath)) {
                if (defined('APPLICATION_PATH')) {
                    static::$_filePath = APPLICATION_PATH;
                } else {
                    static::$_filePath = dirname(dirname(__FILE__));
                }
            }
            return static::$_filePath;
        }
163667
public function getDocumentClass()
    {
        $documentClass = false;
        if (isset($this->schema->{'x-documentClass'})) {
            $documentClass = $this->schema->{'x-documentClass'};
        }
        return $documentClass;
    }