Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe AssertionChain

Fonctions membres publiques

 __construct ($value, $defaultMessage=null, string $defaultPropertyPath=null)
 
 __call ($methodName, $args)
 
 all ()
 
 nullOr ()
 
 setAssertionClassName ($className)
 

Attributs privés

 $value
 
 $defaultMessage
 
 $defaultPropertyPath
 
 $alwaysValid = false
 
 $all = false
 
 $assertionClassName = 'Assert\Assertion'
 

Description détaillée

Chaining builder for assertions.

Auteur
Benjamin Eberlei konta.nosp@m.kt@b.nosp@m.eberl.nosp@m.ei.d.nosp@m.e

AssertionChain alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric. AssertionChain base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. AssertionChain between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. AssertionChain betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit. AssertionChain betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths. AssertionChain boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean. AssertionChain choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. AssertionChain choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content. AssertionChain classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists. AssertionChain contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars. AssertionChain count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count. AssertionChain date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format. AssertionChain defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. AssertionChain digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit. AssertionChain directory(string|callable $message = null, string $propertyPath = null) Assert that a directory exists. AssertionChain e164(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number. AssertionChain email(string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL). AssertionChain endsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars. AssertionChain eq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==). AssertionChain eqArraySubset(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset. AssertionChain extensionLoaded(string|callable $message = null, string $propertyPath = null) Assert that extension is loaded. AssertionChain extensionVersion(string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed. AssertionChain false(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False. AssertionChain file(string|callable $message = null, string $propertyPath = null) Assert that a file exists. AssertionChain float(string|callable $message = null, string $propertyPath = null) Assert that value is a php float. AssertionChain greaterOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit. AssertionChain greaterThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit. AssertionChain implementsInterface(string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface. AssertionChain inArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice(). AssertionChain integer(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer. AssertionChain integerish(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish. AssertionChain interfaceExists(string|callable $message = null, string $propertyPath = null) Assert that the interface exists. AssertionChain ip(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address. AssertionChain ipv4(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address. AssertionChain ipv6(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address. AssertionChain isArray(string|callable $message = null, string $propertyPath = null) Assert that value is an array. AssertionChain isArrayAccessible(string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object. AssertionChain isCallable(string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable. AssertionChain isCountable(string|callable $message = null, string $propertyPath = null) Assert that value is countable. AssertionChain isInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name. AssertionChain isJsonString(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string. AssertionChain isObject(string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object. AssertionChain isResource(string|callable $message = null, string $propertyPath = null) Assert that value is a resource. AssertionChain isTraversable(string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object. AssertionChain keyExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array. AssertionChain keyIsset(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset(). AssertionChain keyNotExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array. AssertionChain length(int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length. AssertionChain lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit. AssertionChain lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit. AssertionChain max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit. AssertionChain maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements. AssertionChain maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars. AssertionChain methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object. AssertionChain min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit. AssertionChain minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements. AssertionChain minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long. AssertionChain noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty. AssertionChain notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank. AssertionChain notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars. AssertionChain notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty. AssertionChain notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty. AssertionChain notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==). AssertionChain notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices. AssertionChain notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name. AssertionChain notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null. AssertionChain notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex. AssertionChain notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===). AssertionChain null(string|callable $message = null, string $propertyPath = null) Assert that value is null. AssertionChain numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric. AssertionChain objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists. AssertionChain phpVersion(mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version. AssertionChain propertiesExist(array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist. AssertionChain propertyExists(string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists. AssertionChain range(mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers. AssertionChain readable(string|callable $message = null, string $propertyPath = null) Assert that the value is something readable. AssertionChain regex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex. AssertionChain same(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===). AssertionChain satisfy(callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback. AssertionChain scalar(string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar. AssertionChain startsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars. AssertionChain string(string|callable $message = null, string $propertyPath = null) Assert that value is a string. AssertionChain subclassOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name. AssertionChain true(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True. AssertionChain uniqueValues(string|callable $message = null, string $propertyPath = null) Assert that values in array are unique (using strict equality). AssertionChain url(string|callable $message = null, string $propertyPath = null) Assert that value is an URL. AssertionChain uuid(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID. AssertionChain version(string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions. AssertionChain writeable(string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable.

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $value,
  $defaultMessage = null,
string  $defaultPropertyPath = null 
)

AssertionChain constructor.

Paramètres
mixed$value
string | callable | null$defaultMessage

Références $value, et value.

Documentation des fonctions membres

◆ __call()

__call (   $methodName,
  $args 
)

Call assertion on the current value in the chain.

Paramètres
string$methodName
array$args

Références $method, $methodName, $params, $this, et value.

◆ all()

all ( )

Switch chain into validation mode for an array of values.

Références $this.

◆ nullOr()

nullOr ( )

Switch chain into mode allowing nulls, ignoring further assertions.

Références $this, null, et value.

◆ setAssertionClassName()

setAssertionClassName (   $className)
Paramètres
string$className
Renvoie
$this

Références $className, $this, et class.

Documentation des champs

◆ $all

$all = false
private

◆ $alwaysValid

$alwaysValid = false
private

◆ $assertionClassName

$assertionClassName = 'Assert\Assertion'
private

◆ $defaultMessage

$defaultMessage
private

◆ $defaultPropertyPath

$defaultPropertyPath
private

◆ $value

$value
private

La documentation de cette classe a été générée à partir du fichier suivant :