public function getRootDir()

in lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php [71:93]


	public function getRootDir() : string
	{
		if ($this->php_root) {
			return $this->php_root;
		}

		/* XXX adapt for any possible PHP variants. */
		$root = getenv("PHP_SDK_PGO_TEST_PHP_ROOT");
		if (!$root) {
			if (!$this->isDist()) {
				$s = file_get_contents("Makefile");
				if (preg_match(",BUILD_DIR=(.+),", $s, $m) > 0) {
					$root = trim($m[1]);
				}
			}
		}

		if (!file_exists($root)) {
			throw new Exception("'$root' doesn't exist.");
		}

		return $root;
	}