phpday 2027 - Call for Papers

The Yaf_Request_Abstract class

(Yaf >=1.0.0)

Introduction

Yaf_Request_Abstract is the base class of the request objects. It encapsulates the request environment: the module, controller and action resolved by routing, the request parameters, and accessors for the superglobals (query string, POST, cookie, server, environment and uploaded files).

Two concrete implementations are provided: Yaf_Request_Http, initialized from an actual web request, and Yaf_Request_Simple, a synthetic request used in tests and CLI scripts.

Class synopsis

class Yaf_Request_Abstract {
/* Constants */
const string SCHEME_HTTP = http;
const string SCHEME_HTTPS = https;
/* Properties */
public $module;
public $controller;
public $action;
public $method;
protected $params;
protected $language;
protected $_exception;
protected $_base_uri;
protected $uri;
protected $dispatched;
protected $routed;
/* Methods */
public function get(string $name, mixed $default = ?): mixed
public function getActionName(): ?string
public function getBaseUri(): ?string
public function getControllerName(): ?string
public function getCookie(string $name = ?, mixed $default = ?): mixed
public function getEnv(string $name, mixed $default = ?): mixed
public function getException(): ?Exception
public function getFiles(string $name = ?, mixed $default = ?): mixed
public function getLanguage(): ?string
public function getMethod(): ?string
public function getModuleName(): ?string
public function getParam(string $name, mixed $default = ?): mixed
public function getParams(): ?array
public function getPost(string $name = ?, mixed $default = ?): mixed
public function getQuery(string $name = ?, mixed $default = ?): mixed
public function getRaw(): ?string
public function getRequest(string $name = ?, mixed $default = ?): mixed
public function getRequestUri(): ?string
public function getServer(string $name, mixed $default = ?): mixed
public function isCli(): bool
public function isDelete(): bool
public function isDispatched(): bool
public function isGet(): bool
public function isHead(): bool
public function isOptions(): bool
public function isPatch(): bool
public function isPost(): bool
public function isPut(): bool
public function isRouted(): bool
public function isXmlHttpRequest(): bool
public function setActionName(string $action, bool $format_name = true): ?Yaf_Request_Abstract
public function setControllerName(string $controller, bool $format_name = true): ?Yaf_Request_Abstract
final public function setDispatched(bool $flag = true): Yaf_Request_Abstract
public function setModuleName(string $module, bool $format_name = true): ?Yaf_Request_Abstract
public function setParam(mixed $name, mixed $value = ?): Yaf_Request_Abstract|bool|null
final public function setRouted(bool $flag = true): Yaf_Request_Abstract
}

Properties

module

controller

action

method

params

language

_exception

_base_uri

uri

dispatched

routed

Table of Contents

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top