private function get_composer_json_path() {
		static $composer_path;

		if ( null === $composer_path || getenv( 'WP_CLI_TEST_PACKAGE_GET_COMPOSER_JSON_PATH' ) ) {

			if ( getenv( 'WP_CLI_PACKAGES_DIR' ) ) {
				$composer_path = Utils\trailingslashit( getenv( 'WP_CLI_PACKAGES_DIR' ) ) . 'composer.json';
			} else {
				$composer_path = Utils\trailingslashit( Utils\get_home_dir() ) . '.wp-cli/packages/composer.json';
			}

			// `composer.json` and its directory might need to be created
			if ( ! file_exists( $composer_path ) ) {
				$composer_path = $this->create_default_composer_json( $composer_path );
			} else {
				$composer_path = realpath( $composer_path );
				if ( false === $composer_path ) {
					$error = error_get_last();
					WP_CLI::error( sprintf( "Composer path '%s' for packages/composer.json not found: %s", $composer_path, $error['message'] ) );
				}
			}
		}

		return $composer_path;
	}
private function get_composer_json_path() {
		static $composer_path;

		if ( null === $composer_path || getenv( 'WP_CLI_TEST_PACKAGE_GET_COMPOSER_JSON_PATH' ) ) {

			if ( getenv( 'WP_CLI_PACKAGES_DIR' ) ) {
				$composer_path = Utils\trailingslashit( getenv( 'WP_CLI_PACKAGES_DIR' ) ) . 'composer.json';
			} else {
				$composer_path = Utils\trailingslashit( Utils\get_home_dir() ) . '.wp-cli/packages/composer.json';
			}

			// `composer.json` and its directory might need to be created
			if ( ! file_exists( $composer_path ) ) {
				$composer_path = $this->create_default_composer_json( $composer_path );
			} else {
				$composer_path = realpath( $composer_path );
				if ( false === $composer_path ) {
					$error = error_get_last();
					WP_CLI::error( sprintf( "Composer path '%s' for packages/composer.json not found: %s", $composer_path, $error['message'] ) );
				}
			}
		}

		return $composer_path;
	}
private function get_composer_json_path ( ) { static $ composer_path ; if ( null === $ composer_path || getenv ( 'WP_CLI_TEST_PACKAGE_GET_COMPOSER_JSON_PATH' ) ) { if ( getenv ( 'WP_CLI_PACKAGES_DIR' ) ) { $ composer_path = Utils \ trailingslashit ( getenv ( 'WP_CLI_PACKAGES_DIR' ) ) . 'composer.json' ; } else { $ composer_path = Utils \ trailingslashit ( Utils \ get_home_dir ( ) ) . '.wp-cli/packages/composer.json' ; } // `composer.json` and its directory might need to be created if ( ! file_exists ( $ composer_path ) ) { $ composer_path = $ this -> create_default_composer_json ( $ composer_path ) ; } else { $ composer_path = realpath ( $ composer_path ) ; if ( false === $ composer_path ) { $ error = error_get_last ( ) ; WP_CLI :: error ( sprintf ( "Composer path '%s' for packages/composer.json not found: %s" , $ composer_path , $ error [ 'message' ] ) ) ; } } } return $ composer_path ; }
Gets the absolute path to the WP-CLI packages composer.json.
Gets the absolute path to the WP - CLI packages composer . json .