web/wp-content/plugins/ghost-runner/src/Factories.php
/**
	 * Get the WP_Post object for page with a test, by Ghost inspector ID
	 *
	 * @param int $id Ghost inspector ID for test
 	 * @param Container|null $container
	 *
	 * @return \WP_Post|null
	 */
Get the WP_Post object for page with a test, by Ghost inspector ID
@param int $id Ghost inspector ID for test
@param Container|null $container


Get the WP_Post object for page with a test by Ghost inspector ID @param int $id Ghost inspector ID for test @param Container|null $container
public static function pageByGhostId( $id, Container $container = null  ){
		if( ! $container ){
			$container = calderaGhostRunner();
		}
		$key = 'page' . CGR_VER;
		if( ! $container->offsetExists( $key ) ){
			$query = new \WP_Query(array(
				'post_type' => 'page',
				'meta_field' => 'CGR_ghostInspectorID',
				'meta_value' => $id
			));
			if( 0 < $query->found_posts ){
				$container->offsetSet( $key, $query->posts[0] );
			}else{
				$container->offsetSet( $key, null );
			}
		}
		return $container->offsetGet( $key );
	}
public static function pageByGhostId ( $ id , Container $ container = null ) { if ( ! $ container ) { $ container = calderaGhostRunner ( ) ; } $ key = 'page' . CGR_VER ; if ( ! $ container -> offsetExists ( $ key ) ) { $ query = new \ WP_Query ( array ( 'post_type' => 'page' , 'meta_field' => 'CGR_ghostInspectorID' , 'meta_value' => $ id ) ) ; if ( 0 < $ query -> found_posts ) { $ container -> offsetSet ( $ key , $ query -> posts [ 0 ] ) ; } else { $ container -> offsetSet ( $ key , null ) ; } } return $ container -> offsetGet ( $ key ) ; }
Get the WP_Post object for page with a test, by Ghost inspector ID
 @param int $id Ghost inspector ID for test
 @param Container|null $container
Get the WP_Post object for page with a test by Ghost inspector ID @param int $id Ghost inspector ID for test @param Container|null $container