====== RequestPath ======
**Layer:** ''Core'' · **Source:** ''lib/core/RequestPath.php:28'' (lines 28–193)
----
class RequestPath
Improved version with:
\- Replaced deprecated strtok() with parse_url()
\- Enhanced path sanitization
\- Better parameter handling
\- Type safety improvements
======= Docblock Metadata =======
^ Tag ^ Value ^
| ''@category'' | Core Class |
| ''@license'' | MIT |
| ''@version'' | 1.1 |
| ''@since'' | Since Release 1.0 |
======= Inheritance =======
//No parent, interface or trait. This is a root type.//
======= Constants (1) =======
^ Visibility ^ Name ^ Value ^ Line ^
| ''private'' | ''MAX_PARAMS'' | ''4;'' | 31 |
======= Properties (1) =======
^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''array'' | ''$parts'' | ''[]'' | 30 |
======= Methods (12) =======
^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | (undocumented) | 33 |
| private | ''getSanitizedPath()'' | Get and sanitize the request path | 43 |
| private | ''splitPath()'' | Split path into components | 60 |
| private | ''sanitizePath()'' | Sanitize path components | 69 |
| private | ''parsePathBits()'' | Parse path segments into named and sequential parameters | 83 |
| private | ''parseKeyValuePairs()'' | Parse remaining segments as key-value pairs | 118 |
| private | ''sanitizeValue()'' | Sanitize individual values | 138 |
| public | ''setParameters()'' | Sets extracted named route parameters. | 150 |
| public | ''__get()'' | Magic getter with null coalescing | 165 |
| public | ''__set()'' | Magic setter with sanitization | 173 |
| public | ''__isset()'' | Check if parameter exists | 181 |
| public | ''getAll()'' | Get all parameters | 189 |
======== __construct() ========
public function __construct()
//lines 33–38 (6)//
//Takes no parameters.//
======== getSanitizedPath() ========
private function getSanitizedPath(): string
//lines 43–55 (13)//
Get and sanitize the request path
//Takes no parameters.//
**Returns:** ''string''
======== splitPath() ========
private function splitPath(string $path): array
//lines 60–64 (5)//
Split path into components
^ Parameter ^ Type ^ Default ^ Description ^
| ''$path'' | ''string'' | //required// | //none// |
**Returns:** ''array''
======== sanitizePath() ========
private function sanitizePath(string $path): string
//lines 69–78 (10)//
Sanitize path components
^ Parameter ^ Type ^ Default ^ Description ^
| ''$path'' | ''string'' | //required// | //none// |
**Returns:** ''string''
======== parsePathBits() ========
private function parsePathBits(array $bits): array
//lines 83–113 (31)//
Parse path segments into named and sequential parameters
^ Parameter ^ Type ^ Default ^ Description ^
| ''$bits'' | ''array'' | //required// | //none// |
**Returns:** ''array''
======== parseKeyValuePairs() ========
private function parseKeyValuePairs(array $bits, array &$parsed): void
//lines 118–133 (16)//
Parse remaining segments as key-value pairs
^ Parameter ^ Type ^ Default ^ Description ^
| ''$bits'' | ''array'' | //required// | //none// |
| ''$parsed (by reference)'' | ''array'' | //required// | //none// |
**Returns:** ''void''
======== sanitizeValue() ========
private function sanitizeValue(string $value): string
//lines 138–141 (4)//
Sanitize individual values
^ Parameter ^ Type ^ Default ^ Description ^
| ''$value'' | ''string'' | //required// | //none// |
**Returns:** ''string''
======== setParameters() ========
public function setParameters(array $params): void
//lines 150–160 (11)//
Sets extracted named route parameters.
\* Uses the magic __set method for proper sanitization and storage.
\* @param array $params The array of matches from Dispatcher's preg_match.
^ Parameter ^ Type ^ Default ^ Description ^
| ''$params'' | ''array'' | //required// | //none// |
**Returns:** ''void''
======== __get() ========
public function __get(string $key)
//lines 165–168 (4)//
Magic getter with null coalescing
^ Parameter ^ Type ^ Default ^ Description ^
| ''$key'' | ''string'' | //required// | //none// |
**Returns:** ''(none declared)''
======== __set() ========
public function __set(string $key, $value): void
//lines 173–176 (4)//
Magic setter with sanitization
^ Parameter ^ Type ^ Default ^ Description ^
| ''$key'' | ''string'' | //required// | //none// |
| ''$value'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''void''
======== __isset() ========
public function __isset(string $key): bool
//lines 181–184 (4)//
Check if parameter exists
^ Parameter ^ Type ^ Default ^ Description ^
| ''$key'' | ''string'' | //required// | //none// |
**Returns:** ''bool''
======== getAll() ========
public function getAll(): array
//lines 189–192 (4)//
Get all parameters
//Takes no parameters.//
**Returns:** ''array''
----
//This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//