} return $config; } public static function chroot() { $rootPath = dirname(static::findParentPath('vendor')); chdir($rootPath); } /** * @return ServiceManager */ public static function getServiceManager() { return static::$serviceManager; } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init(); Bootstrap::chroot();