src/Application/ApplicationRuntime.php
public function locateRootDirectory()
    {
        $vendorDirectoryName = 'vendor';
        $fileDirectory    = __DIR__;
        $searchDirectories = [
            __DIR__.'/..',
            __DIR__.'/../..',
            __DIR__.'/../../..',
            __DIR__.'/../../../..',
            __DIR__.'/../../../../..'
        ];

        $fileSystem = $this->createNew(FileSystem::class);
        foreach ($searchDirectories as $searchDirectory) {
            if ($fileSystem->fileExists($searchDirectory . '/' . $vendorDirectoryName)) {
                return $fileSystem->getRealPath($searchDirectory);
            }
        }

        throw new FileSystemException('No application root directory found');
    }
public function locateRootDirectory()
    {
        $vendorDirectoryName = 'vendor';
        $fileDirectory    = __DIR__;
        $searchDirectories = [
            __DIR__.'/..',
            __DIR__.'/../..',
            __DIR__.'/../../..',
            __DIR__.'/../../../..',
            __DIR__.'/../../../../..'
        ];

        $fileSystem = $this->createNew(FileSystem::class);
        foreach ($searchDirectories as $searchDirectory) {
            if ($fileSystem->fileExists($searchDirectory . '/' . $vendorDirectoryName)) {
                return $fileSystem->getRealPath($searchDirectory);
            }
        }

        throw new FileSystemException('No application root directory found');
    }
public function locateRootDirectory ( ) { $ vendorDirectoryName = 'vendor' ; $ fileDirectory = __DIR__ ; $ searchDirectories = [ __DIR__ . '/..' , __DIR__ . '/../..' , __DIR__ . '/../../..' , __DIR__ . '/../../../..' , __DIR__ . '/../../../../..' ] ; $ fileSystem = $ this -> createNew ( FileSystem :: class ) ; foreach ( $ searchDirectories as $ searchDirectory ) { if ( $ fileSystem -> fileExists ( $ searchDirectory . '/' . $ vendorDirectoryName ) ) { return $ fileSystem -> getRealPath ( $ searchDirectory ) ; } } throw new FileSystemException ( 'No application root directory found' ) ; }
Attempts to find the root directory

@return string The application root directory
Attempts to find the root directory