Methods summary
public static
array
|
|
protected
|
#
initCli( )
If request is processed via CLI, initialize most of request properties
with empty values and parse CLI params into params array.
If request is processed via CLI, initialize most of request properties
with empty values and parse CLI params into params array.
|
protected
|
#
initUrlSegments( )
Initialize URI segments parsed by parse_url()
php method: port, path, query and fragment.
Initialize URI segments parsed by parse_url()
php method: port, path, query and fragment.
|
protected
|
#
initParams( )
Initialize params from global $_GET and (global $_POST or direct php://input ).
Initialize params from global $_GET and (global $_POST or direct php://input ).
|
protected
|
#
initBody( )
Read and return direct php POST input from php://input or php://stdin .
Read and return direct php POST input from php://input or php://stdin .
|
protected
array
|
#
parseBodyParams( string $contentType )
Parse direct PHP input (php://input ) by Content-Type header.
Parse direct PHP input (php://input ) by Content-Type header.
Parameters
Returns
array
|
protected
string|string[]|integer|int[]|boolean|bool[]|array|mixed
|
#
getParamFromCollection( array & $paramsCollection = [], string $name = "", string|array|boolean $pregReplaceAllowedChars = "a-zA-Z0-9_;, /\-\@\:", mixed $ifNullValue = NULL, string $targetType = NULL )
Get param value from given collection ($_GET , $_POST , php://input or http headers),
filtered by characters defined in second argument through preg_replace() .
Place into second argument only char groups you want to keep.
Get param value from given collection ($_GET , $_POST , php://input or http headers),
filtered by characters defined in second argument through preg_replace() .
Place into second argument only char groups you want to keep.
Parameters
- $paramsCollection
- $collection Array with request params or array with request headers.
- $name
- Parameter string name.
- $pregReplaceAllowedChars
- If String - list of regular expression characters to only keep, if array -
preg_replace() pattern and reverse, if FALSE , raw value is returned.
- $ifNullValue
- Default value returned if given param name is null.
- $targetType
- Target type to retype param value or default if-null value. If param is an array, every param item will be retyped into given target type.
Returns
string|string[]|integer|int[]|boolean|bool[]|array|mixed
Throws
InvalidArgumentException
$name must be a $targetType , not an array .
|
protected
|
#
initScriptNameAndBasePath( )
Init script name from $_SERVER['SCRIPT_NAME'] and request base path.
Init script name from $_SERVER['SCRIPT_NAME'] and request base path.
|
protected
|
#
initLangAndLocale( )
Initialize language code and locale code from global $_SERVER['HTTP_ACCEPT_LANGUAGE']
if any, by Intl extension function locale_accept_from_http() or by custom parsing.
Initialize language code and locale code from global $_SERVER['HTTP_ACCEPT_LANGUAGE']
if any, by Intl extension function locale_accept_from_http() or by custom parsing.
|
protected
|
#
initDomainSegments( )
Initialize domain parts from server name property.
If you need to add exceptional top-level domain names, use method
\MvcCore\Request::AddTwoSegmentTlds('co.uk');
Example:
'any.content.example.co.uk' => ['any.content', 'example', 'co.uk']
Initialize domain parts from server name property.
If you need to add exceptional top-level domain names, use method
\MvcCore\Request::AddTwoSegmentTlds('co.uk');
Example:
'any.content.example.co.uk' => ['any.content', 'example', 'co.uk']
|