|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/account.appointkrypt.com/vendor/spatie/url/src/ |
Upload File : |
<?php
namespace Spatie\Url;
use Spatie\Macroable\Macroable;
use Stringable;
class Scheme implements Stringable
{
use Macroable;
protected string $scheme;
protected SchemeValidator $validator;
public function __construct(
string $scheme = '',
array|null $allowedSchemes = null,
) {
$this->validator = new SchemeValidator($allowedSchemes);
$this->setScheme($scheme);
}
protected function validate(string $scheme): void
{
$this->validator->setScheme($scheme);
$this->validator->validate();
}
public function getScheme(): string
{
return $this->scheme;
}
public function setScheme(string $scheme): void
{
$sanitizedScheme = $this->validator::sanitizeScheme($scheme);
$this->validate($sanitizedScheme);
$this->scheme = $sanitizedScheme;
}
public function getAllowedSchemes(): array
{
return $this->validator->getAllowedSchemes();
}
public function setAllowedSchemes(array $allowedSchemes): void
{
$this->validator->setAllowedSchemes($allowedSchemes);
}
public function __toString(): string
{
return $this->getScheme();
}
public function __clone()
{
$this->validator = clone $this->validator;
}
}