1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Quantum PHP Framework |
5
|
|
|
* |
6
|
|
|
* An open source software development framework for PHP |
7
|
|
|
* |
8
|
|
|
* @package Quantum |
9
|
|
|
* @author Arman Ag. <[email protected]> |
10
|
|
|
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) |
11
|
|
|
* @link http://quantum.softberg.org/ |
12
|
|
|
* @since 2.9.8 |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Quantum\Libraries\Validation; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Rule class |
19
|
|
|
* @package Quantum |
20
|
|
|
* @category Libraries |
21
|
|
|
* @method static bool required() |
22
|
|
|
* @method static bool email() |
23
|
|
|
* @method static bool creditCard() |
24
|
|
|
* @method static bool iban() |
25
|
|
|
* @method static bool name() |
26
|
|
|
* @method static bool streetAddress() |
27
|
|
|
* @method static bool phoneNumber() |
28
|
|
|
* @method static bool date(?string $format = null) |
29
|
|
|
* @method static bool starts(string $text) |
30
|
|
|
* @method static bool regex(string $pattern) |
31
|
|
|
* @method static bool jsonString() |
32
|
|
|
* @method static bool same(string $text) |
33
|
|
|
* @method static bool unique(string $className) |
34
|
|
|
* @method static bool exists(string $className) |
35
|
|
|
* @method static bool captcha() |
36
|
|
|
* @method static bool alpha() |
37
|
|
|
* @method static bool alphaNumeric() |
38
|
|
|
* @method static bool alphaDash() |
39
|
|
|
* @method static bool alphaSpace() |
40
|
|
|
* @method static bool numeric() |
41
|
|
|
* @method static bool integer() |
42
|
|
|
* @method static bool float() |
43
|
|
|
* @method static bool boolean() |
44
|
|
|
* @method static bool minNumeric(int $number) |
45
|
|
|
* @method static bool maxNumeric(int $number) |
46
|
|
|
* @method static bool fileSize(int $maxSize, ?int $minSize = null) |
47
|
|
|
* @method static bool fileMimeType(string ...$mimeTypes) |
48
|
|
|
* @method static bool fileExtension(string ...$extensions) |
49
|
|
|
* @method static bool imageDimensions(?int $width = null, ?int $height = null) |
50
|
|
|
* @method static bool contains(string $haystack) |
51
|
|
|
* @method static bool containsList(string ...$list) |
52
|
|
|
* @method static bool doesntContainsList(string ...$list) |
53
|
|
|
* @method static bool minLen(int $minLength) |
54
|
|
|
* @method static bool maxLen(int $maxLength) |
55
|
|
|
* @method static bool exactLen(int $exactLength) |
56
|
|
|
* @method static bool url() |
57
|
|
|
* @method static bool urlExists() |
58
|
|
|
* @method static bool ip() |
59
|
|
|
* @method static bool ipv4() |
60
|
|
|
* @method static bool ipv6() |
61
|
|
|
*/ |
62
|
|
|
class Rule |
63
|
|
|
{ |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $name |
67
|
|
|
* @param array $params |
68
|
|
|
* @return array[] |
69
|
|
|
*/ |
70
|
|
|
public static function __callStatic(string $name, array $params): array |
71
|
|
|
{ |
72
|
|
|
return [$name => $params]; |
73
|
|
|
} |
74
|
|
|
} |