public static function getInstance($pid) { $post = new self($pid); $post->setPost(\WP_Post::get_instance($pid)); $post->fetch(); return $post; }
public static function createFromGlobals() { $request = new self(); $request->setGet(new ParameterBag($_GET)); $request->setPost(new ParameterBag($_POST)); $request->setCookie(new ParameterBag($_COOKIE)); $request->setSession(new ParameterBag($_SESSION)); $request->setServer(new ParameterBag($_SERVER)); $request->setFile(new ParameterBag($_FILES)); return $request; }
/** * @return Request */ public static function fromInput() { global $module; $model = new self(); $model->setMethod(self::getMethodFromInput()); if (isset($module)) { $model->setPath($module); $input = explode('/', $module); $model->setSegments($input); } $model->setBody(InputStream::getInput()); $model->setHeaders(self::getHeadersFromInput()); $model->setParameters($_GET); $model->setCookies($_COOKIE); $model->setPost($_POST); $model->setEnvironment($_SERVER); $model->setStatus(http_response_code()); $model->setUrl(self::getCurrentUri()); $model->parseData(); return $model; }
public static function createPost(array $params = array()) { $request = new self(); $request->setPost($params); return $request; }
/** * Get new instance of this class * * @return VkPostTransformer */ static function getInstance($post) { $instance = new self(); $instance->setPost($post); return $instance; }