Encoder
in package
Table of Contents
Constants
- REGEXP_CHARS_ENCODED = ',%[A-Fa-f0-9]{2},'
- REGEXP_CHARS_INVALID = '/[\x00-\x1f\x7f]/'
- REGEXP_CHARS_PREVENTS_DECODING = ',% 2[A-F|1-2|4-9]| 3[0-9|B|D]| 4[1-9|A-F]| 5[0-9|A|F]| 6[1-9|A-F]| 7[0-9|E] ,ix'
- REGEXP_PART_ENCODED = '%(?![A-Fa-f\d]{2})'
- REGEXP_PART_SUBDELIM = "\\!\$&'\\(\\)\\*\\+,;\\=%"
- REGEXP_PART_UNRESERVED = 'A-Za-z\d_\-.~'
- REGEXP_UNRESERVED_CHARACTERS = ',%(2[1-9A-Fa-f]|[3-7][0-9A-Fa-f]|61|62|64|65|66|7[AB]|5F),'
- Unreserved characters.
Methods
- decodeAll() : string|null
- Decodes all the URI component characters.
- decodeFragment() : string|null
- Decodes the fragment component while preserving characters that should not be decoded in the context of a full valid URI.
- decodeNecessary() : string|null
- Decodes the URI component without decoding the unreserved characters which are already encoded.
- decodePartial() : string|null
- Decodes the URI component without decoding the unreserved characters which are already encoded.
- decodePath() : string|null
- Decodes the path component while preserving characters that should not be decoded in the context of a full valid URI.
- decodeQuery() : string|null
- Decodes the query component while preserving characters that should not be decoded in the context of a full valid URI.
- decodeUnreservedCharacters() : string|null
- Decodes the component unreserved characters.
- encodePassword() : string|null
- Encode Password.
- encodePath() : string
- Encode Path.
- encodeQueryKeyValue() : string|null
- encodeQueryOrFragment() : string|null
- Encode Query or Fragment.
- encodeUser() : string|null
- Encode User.
- encodeUserInfo() : string|null
- isFragmentEncoded() : bool
- Tell whether the query component is correctly encoded.
- isPasswordEncoded() : bool
- Tell whether the password component is correctly encoded.
- isPathEncoded() : bool
- Tell whether the path component is correctly encoded.
- isQueryEncoded() : bool
- Tell whether the query component is correctly encoded.
- isUserEncoded() : bool
- Tell whether the user component is correctly encoded.
- isUserInfoEncoded() : bool
- Tell whether the userInfo component is correctly encoded.
- normalizeFragment() : string|null
- Normalize the fragment component.
- normalizeHost() : string|null
- Normalize the host component.
- normalizePassword() : string|null
- Normalize password component.
- normalizePath() : string|null
- Normalize path component.
- normalizeQuery() : string|null
- Normalize the query component.
- normalizeUser() : string|null
- Normalize user component.
- normalizeUserInfo() : string|null
- decode() : string|null
- Decodes the URI component characters using a closure.
- encode() : string|null
- Encodes the URI component characters using a regular expression to find which characters need encoding.
- filterComponent() : string|null
- normalize() : string|null
Constants
REGEXP_CHARS_ENCODED
private
mixed
REGEXP_CHARS_ENCODED
= ',%[A-Fa-f0-9]{2},'
REGEXP_CHARS_INVALID
private
mixed
REGEXP_CHARS_INVALID
= '/[\x00-\x1f\x7f]/'
REGEXP_CHARS_PREVENTS_DECODING
private
mixed
REGEXP_CHARS_PREVENTS_DECODING
= ',%
2[A-F|1-2|4-9]|
3[0-9|B|D]|
4[1-9|A-F]|
5[0-9|A|F]|
6[1-9|A-F]|
7[0-9|E]
,ix'
REGEXP_PART_ENCODED
private
mixed
REGEXP_PART_ENCODED
= '%(?![A-Fa-f\d]{2})'
REGEXP_PART_SUBDELIM
private
mixed
REGEXP_PART_SUBDELIM
= "\\!\$&'\\(\\)\\*\\+,;\\=%"
REGEXP_PART_UNRESERVED
private
mixed
REGEXP_PART_UNRESERVED
= 'A-Za-z\d_\-.~'
REGEXP_UNRESERVED_CHARACTERS
Unreserved characters.
private
mixed
REGEXP_UNRESERVED_CHARACTERS
= ',%(2[1-9A-Fa-f]|[3-7][0-9A-Fa-f]|61|62|64|65|66|7[AB]|5F),'
Tags
Methods
decodeAll()
Decodes all the URI component characters.
public
static decodeAll(Stringable|string|null $component) : string|null
Parameters
- $component : Stringable|string|null
Return values
string|nulldecodeFragment()
Decodes the fragment component while preserving characters that should not be decoded in the context of a full valid URI.
public
static decodeFragment(Stringable|string|null $path) : string|null
Parameters
- $path : Stringable|string|null
Return values
string|nulldecodeNecessary()
Decodes the URI component without decoding the unreserved characters which are already encoded.
public
static decodeNecessary(Stringable|string|int|null $component) : string|null
Parameters
- $component : Stringable|string|int|null
Return values
string|nulldecodePartial()
Decodes the URI component without decoding the unreserved characters which are already encoded.
public
static decodePartial(Stringable|string|int|null $component) : string|null
Since version 7.6.0
use League\Uri\Encoder::decodeNecessary() instead
DEPRECATION WARNING! This method will be removed in the next major point release.
Parameters
- $component : Stringable|string|int|null
Tags
Return values
string|nulldecodePath()
Decodes the path component while preserving characters that should not be decoded in the context of a full valid URI.
public
static decodePath(Stringable|string|null $path) : string|null
Parameters
- $path : Stringable|string|null
Return values
string|nulldecodeQuery()
Decodes the query component while preserving characters that should not be decoded in the context of a full valid URI.
public
static decodeQuery(Stringable|string|null $path) : string|null
Parameters
- $path : Stringable|string|null
Return values
string|nulldecodeUnreservedCharacters()
Decodes the component unreserved characters.
public
static decodeUnreservedCharacters(Stringable|string|null $str) : string|null
Parameters
- $str : Stringable|string|null
Return values
string|nullencodePassword()
Encode Password.
public
static encodePassword(Stringable|string|null $component) : string|null
Generic delimiters ":" MUST NOT be encoded
Parameters
- $component : Stringable|string|null
Return values
string|nullencodePath()
Encode Path.
public
static encodePath(Stringable|string|null $component) : string
Generic delimiters ":", "@", and "/" MUST NOT be encoded
Parameters
- $component : Stringable|string|null
Return values
stringencodeQueryKeyValue()
public
static encodeQueryKeyValue(mixed $component) : string|null
Parameters
- $component : mixed
Return values
string|nullencodeQueryOrFragment()
Encode Query or Fragment.
public
static encodeQueryOrFragment(Stringable|string|null $component) : string|null
Generic delimiters ":", "@", "?", and "/" MUST NOT be encoded
Parameters
- $component : Stringable|string|null
Return values
string|nullencodeUser()
Encode User.
public
static encodeUser(Stringable|string|null $component) : string|null
All generic delimiters MUST be encoded
Parameters
- $component : Stringable|string|null
Return values
string|nullencodeUserInfo()
public
static encodeUserInfo(Stringable|string|null $userInfo) : string|null
Parameters
- $userInfo : Stringable|string|null
Return values
string|nullisFragmentEncoded()
Tell whether the query component is correctly encoded.
public
static isFragmentEncoded(Stringable|string|null $encoded) : bool
Parameters
- $encoded : Stringable|string|null
Return values
boolisPasswordEncoded()
Tell whether the password component is correctly encoded.
public
static isPasswordEncoded(Stringable|string|null $encoded) : bool
Parameters
- $encoded : Stringable|string|null
Return values
boolisPathEncoded()
Tell whether the path component is correctly encoded.
public
static isPathEncoded(Stringable|string|null $encoded) : bool
Parameters
- $encoded : Stringable|string|null
Return values
boolisQueryEncoded()
Tell whether the query component is correctly encoded.
public
static isQueryEncoded(Stringable|string|null $encoded) : bool
Parameters
- $encoded : Stringable|string|null
Return values
boolisUserEncoded()
Tell whether the user component is correctly encoded.
public
static isUserEncoded(Stringable|string|null $encoded) : bool
Parameters
- $encoded : Stringable|string|null
Return values
boolisUserInfoEncoded()
Tell whether the userInfo component is correctly encoded.
public
static isUserInfoEncoded(Stringable|string|null $userInfo) : bool
Parameters
- $userInfo : Stringable|string|null
Return values
boolnormalizeFragment()
Normalize the fragment component.
public
static normalizeFragment(Stringable|string|null $fragment) : string|null
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.
Parameters
- $fragment : Stringable|string|null
Return values
string|nullnormalizeHost()
Normalize the host component.
public
static normalizeHost(Stringable|string|null $host) : string|null
Parameters
- $host : Stringable|string|null
Tags
Return values
string|nullnormalizePassword()
Normalize password component.
public
static normalizePassword(Stringable|string|null $password) : string|null
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.
Parameters
- $password : Stringable|string|null
Return values
string|nullnormalizePath()
Normalize path component.
public
static normalizePath(Stringable|string|null $component) : string|null
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.
Parameters
- $component : Stringable|string|null
Return values
string|nullnormalizeQuery()
Normalize the query component.
public
static normalizeQuery(Stringable|string|null $query) : string|null
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.
Parameters
- $query : Stringable|string|null
Return values
string|nullnormalizeUser()
Normalize user component.
public
static normalizeUser(Stringable|string|null $user) : string|null
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.
Parameters
- $user : Stringable|string|null
Return values
string|nullnormalizeUserInfo()
public
static normalizeUserInfo(Stringable|string|null $userInfo) : string|null
Parameters
- $userInfo : Stringable|string|null
Return values
string|nulldecode()
Decodes the URI component characters using a closure.
private
static decode(Stringable|string|int|null $component, Closure $decoder) : string|null
Parameters
- $component : Stringable|string|int|null
- $decoder : Closure
Return values
string|nullencode()
Encodes the URI component characters using a regular expression to find which characters need encoding.
private
static encode(Stringable|string|int|bool|null $component, string $pattern) : string|null
Parameters
- $component : Stringable|string|int|bool|null
- $pattern : string
Return values
string|nullfilterComponent()
private
static filterComponent(mixed $component) : string|null
Parameters
- $component : mixed
Return values
string|nullnormalize()
private
static normalize(string|null $component) : string|null
Parameters
- $component : string|null