private static function _setupRoot()
	{
		if ( !empty(self::$root) ) {
			// avoid duplicating efforts... only set root if it's not already set 
			return;
		}
		
		if ( defined('ROOT') ) {
			self::$root = rtrim(ROOT, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
		}
		else if ( !empty($GLOBALS['baseDir']) ) {
			self::$root = rtrim($GLOBALS['baseDir'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
		}
		else if ( strpos(__FILE__, DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR) !== false ) {
			// fall back to guessing the project root from the path...
			// we're in /vendor/datto/core-enumerator/src/Core

			$path = __FILE__;
			// up 5 levels
			while (!file_exists("$path/autoload.php")) {
				$path = dirname($path);
			}
			
			$path = dirname($path);

			self::$root = $path . DIRECTORY_SEPARATOR;
		}
		else if ( class_exists("Composer\\Autoload\\ClassLoader") ) {
			// go up until we find vendor/autoload.php - last resort
			$path = dirname(__FILE__);
			while ( $path && !file_exists($path . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php') ) {
				$path = dirname($path);
			}

			if ( !empty($path) ) {
				var_dump($path);
				self::$root = $path . DIRECTORY_SEPARATOR;
			}
		}

		if ( empty(self::$root) ) {
			throw new \Exception("Unable to determine project base directory");
		}
	}
private static function _setupRoot()
	{
		if ( !empty(self::$root) ) {
			// avoid duplicating efforts... only set root if it's not already set 
			return;
		}
		
		if ( defined('ROOT') ) {
			self::$root = rtrim(ROOT, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
		}
		else if ( !empty($GLOBALS['baseDir']) ) {
			self::$root = rtrim($GLOBALS['baseDir'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
		}
		else if ( strpos(__FILE__, DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR) !== false ) {
			// fall back to guessing the project root from the path...
			// we're in /vendor/datto/core-enumerator/src/Core

			$path = __FILE__;
			// up 5 levels
			while (!file_exists("$path/autoload.php")) {
				$path = dirname($path);
			}
			
			$path = dirname($path);

			self::$root = $path . DIRECTORY_SEPARATOR;
		}
		else if ( class_exists("Composer\\Autoload\\ClassLoader") ) {
			// go up until we find vendor/autoload.php - last resort
			$path = dirname(__FILE__);
			while ( $path && !file_exists($path . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php') ) {
				$path = dirname($path);
			}

			if ( !empty($path) ) {
				var_dump($path);
				self::$root = $path . DIRECTORY_SEPARATOR;
			}
		}

		if ( empty(self::$root) ) {
			throw new \Exception("Unable to determine project base directory");
		}
	}
private static function _setupRoot ( ) { if ( ! empty ( self :: $ root ) ) { // avoid duplicating efforts... only set root if it's not already set  return ; } if ( defined ( 'ROOT' ) ) { self :: $ root = rtrim ( ROOT , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; } else if ( ! empty ( $ GLOBALS [ 'baseDir' ] ) ) { self :: $ root = rtrim ( $ GLOBALS [ 'baseDir' ] , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; } else if ( strpos ( __FILE__ , DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR ) !== false ) { // fall back to guessing the project root from the path... // we're in /vendor/datto/core-enumerator/src/Core $ path = __FILE__ ; // up 5 levels while ( ! file_exists ( "$path/autoload.php" ) ) { $ path = dirname ( $ path ) ; } $ path = dirname ( $ path ) ; self :: $ root = $ path . DIRECTORY_SEPARATOR ; } else if ( class_exists ( "Composer\\Autoload\\ClassLoader" ) ) { // go up until we find vendor/autoload.php - last resort $ path = dirname ( __FILE__ ) ; while ( $ path && ! file_exists ( $ path . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php' ) ) { $ path = dirname ( $ path ) ; } if ( ! empty ( $ path ) ) { var_dump ( $ path ) ; self :: $ root = $ path . DIRECTORY_SEPARATOR ; } } if ( empty ( self :: $ root ) ) { throw new \ Exception ( "Unable to determine project base directory" ) ; } }
Determine the project root directory.
Determine the project root directory .