State
in package
Table of Contents
- OVERWRITABLE = ["SERVER", "GET", "POST", "FILES", "REQUEST", "SESSION", "COOKIE"]
- $body : string|null
- $COOKIE : array<string|int, mixed>
- $FILES : array<string|int, mixed>
- $GET : array<string|int, mixed>
- $POST : array<string|int, mixed>
- $previous : State|null
- $REQUEST : array<string|int, mixed>
- $SERVER : array<string|int, mixed>
- $SESSION : array<string|int, mixed>
- fromOverwrite() : State
- fromRequest() : State
- withArgs() : State
- withBody() : State
- withCookies() : State
- withFiles() : State
- withGet() : State
- withMethod() : State
- withPath() : State
- Replaces the path and nothing else: the query stays. This is what an internal reroute uses, the action it reaches still sees the query of the request. withUrl() drops the query like a link would.
- withPost() : State
- withPreviousAsReferer() : State
- withReferer() : State
- withSession() : State
- withUrl() : State
- Points the state to a url, resolved against the current one like a browser resolves a link (RFC 3986, section 5.2):
- requestOrder() : string
- Which of GET, POST and COOKIE make up REQUEST, as letters in the order they are applied, so a later one wins. PHP fills $_REQUEST by its request_order setting; php.ini-production ships "GP", which keeps the cookies out.
- removeDotSegments() : string
- splitUrl() : array<string, string|int>
- updateRequest() : mixed
- writeQuery() : void
- writeQueryString() : void
Constants
OVERWRITABLE
private
mixed
OVERWRITABLE
= ["SERVER", "GET", "POST", "FILES", "REQUEST", "SESSION", "COOKIE"]
Properties
$body
public
string|null
$body
$COOKIE
public
array<string|int, mixed>
$COOKIE
$FILES
public
array<string|int, mixed>
$FILES
$GET
public
array<string|int, mixed>
$GET
$POST
public
array<string|int, mixed>
$POST
$previous
public
State|null
$previous
= null
$REQUEST
public
array<string|int, mixed>
$REQUEST
$SERVER
public
array<string|int, mixed>
$SERVER
$SESSION
public
array<string|int, mixed>
$SESSION
Methods
fromOverwrite()
public
static fromOverwrite(State $input[, array<string|int, mixed> $overwriteData = [] ]) : State
Parameters
- $input : State
- $overwriteData : array<string|int, mixed> = []
Return values
State —fromRequest()
public
static fromRequest() : State
Return values
State —withArgs()
public
withArgs(array<string|int, mixed> $args) : State
Parameters
- $args : array<string|int, mixed>
Return values
State —withBody()
public
withBody(string $body) : State
Parameters
- $body : string
Return values
State —withCookies()
public
withCookies([array<string|int, mixed> $cookie = [] ]) : State
Parameters
- $cookie : array<string|int, mixed> = []
Return values
State —withFiles()
public
withFiles([array<string|int, mixed> $files = [] ]) : State
Parameters
- $files : array<string|int, mixed> = []
Return values
State —withGet()
public
withGet([array<string|int, mixed> $get = [] ]) : State
Parameters
- $get : array<string|int, mixed> = []
Return values
State —withMethod()
public
withMethod(string $method) : State
Parameters
- $method : string
Return values
State —withPath()
Replaces the path and nothing else: the query stays. This is what an internal reroute uses, the action it reaches still sees the query of the request. withUrl() drops the query like a link would.
public
withPath(string $path) : State
Parameters
- $path : string
Return values
State —withPost()
public
withPost([array<string|int, mixed> $post = [] ]) : State
Parameters
- $post : array<string|int, mixed> = []
Return values
State —withPreviousAsReferer()
public
withPreviousAsReferer() : State
Return values
State —withReferer()
public
withReferer(string $referer) : State
Parameters
- $referer : string
Return values
State —withSession()
public
withSession([array<string|int, mixed> $session = [] ]) : State
Parameters
- $session : array<string|int, mixed> = []
Return values
State —withUrl()
Points the state to a url, resolved against the current one like a browser resolves a link (RFC 3986, section 5.2):
public
withUrl(string $url) : State
- a url with a scheme or a host replaces path and query, without a path it points to the start page
- a path replaces the path and drops the query, unless the url brings a new one
- a path without a leading slash is relative to the current one,
.and..are resolved - a query alone replaces the query and keeps the path
To change the path and keep the query, use withPath().
Parameters
- $url : string
Tags
Return values
State —requestOrder()
Which of GET, POST and COOKIE make up REQUEST, as letters in the order they are applied, so a later one wins. PHP fills $_REQUEST by its request_order setting; php.ini-production ships "GP", which keeps the cookies out.
protected
requestOrder() : string
Return values
string —removeDotSegments()
private
static removeDotSegments(string $path) : string
Parameters
- $path : string
Return values
string —splitUrl()
private
static splitUrl(string $url) : array<string, string|int>
Parameters
- $url : string
Return values
array<string, string|int> —The parts of the url as parse_url() names them
updateRequest()
private
updateRequest() : mixed
Return values
mixed —writeQuery()
private
writeQuery(string $query) : void
Parameters
- $query : string
Return values
void —writeQueryString()
private
writeQueryString(string $query) : void
Parameters
- $query : string