| @@ 607-624 (lines=18) @@ | ||
| 604 | * @return mixed[] An array with named keys containing the component parts of the supplied |
|
| 605 | * authority |
|
| 606 | */ |
|
| 607 | private function explodeAuthority($authority) |
|
| 608 | { |
|
| 609 | $reg_start = '/^'; |
|
| 610 | $user_info_part = '(?:(?\'user_info\'.+)@)?'; |
|
| 611 | $host_part = '(?\'host\'\[.+\]|.[^:]+)'; |
|
| 612 | $port_part = '(?::(?\'port\'[0-9]+))?'; |
|
| 613 | $reg_end = '/'; |
|
| 614 | ||
| 615 | $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end; |
|
| 616 | ||
| 617 | preg_match($authority_syntax, $authority, $authority_parts); |
|
| 618 | ||
| 619 | if (isset($authority_parts["port"])) { |
|
| 620 | $authority_parts["port"] = (int) $authority_parts["port"]; |
|
| 621 | } |
|
| 622 | ||
| 623 | return $authority_parts; |
|
| 624 | } |
|
| 625 | ||
| 626 | /** |
|
| 627 | * Sanitizes the URI component array by removing redundant key/value pairs |
|
| @@ 135-152 (lines=18) @@ | ||
| 132 | * @return mixed[] An array with named keys containing the component parts of the supplied |
|
| 133 | * authority |
|
| 134 | */ |
|
| 135 | protected function explodeAuthority($authority) |
|
| 136 | { |
|
| 137 | $reg_start = '/^'; |
|
| 138 | $user_info_part = '(?:(?\'user_info\'.+)@)?'; |
|
| 139 | $host_part = '(?\'host\'\[.+\]|.[^:]+)'; |
|
| 140 | $port_part = '(?::(?\'port\'[0-9]+))?'; |
|
| 141 | $reg_end = '/'; |
|
| 142 | ||
| 143 | $authority_syntax = $reg_start . $user_info_part . $host_part . $port_part . $reg_end; |
|
| 144 | ||
| 145 | preg_match($authority_syntax, $authority, $authority_parts); |
|
| 146 | ||
| 147 | if (isset($authority_parts["port"])) { |
|
| 148 | $authority_parts["port"] = (int) $authority_parts["port"]; |
|
| 149 | } |
|
| 150 | ||
| 151 | return $authority_parts; |
|
| 152 | } |
|
| 153 | } |
|
| 154 | ||