Total Complexity | 3 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class Size extends AbstractValidator |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * Bytes in KB |
||
20 | * |
||
21 | * @var integer |
||
22 | */ |
||
23 | public const KB = 1024; |
||
24 | |||
25 | /** |
||
26 | * Bytes in MB |
||
27 | * |
||
28 | * @var integer |
||
29 | */ |
||
30 | public const MB = 1048576; |
||
31 | |||
32 | /** |
||
33 | * Bytes in GB |
||
34 | * |
||
35 | * @var integer |
||
36 | */ |
||
37 | public const GB = 1073741824; |
||
38 | |||
39 | /** |
||
40 | * Index in the $_FILES array |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | private $file = ''; |
||
45 | |||
46 | /** |
||
47 | * Required size in bytes |
||
48 | * |
||
49 | * @var integer |
||
50 | */ |
||
51 | private $requiredSize = 0; |
||
52 | |||
53 | /** |
||
54 | * Constructor |
||
55 | * |
||
56 | * @param int $size |
||
57 | * size constraint for the file |
||
58 | * @codeCoverageIgnore |
||
59 | */ |
||
60 | public function __construct(int $size) |
||
61 | { |
||
62 | $this->requiredSize = $size; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * |
||
67 | * {@inheritdoc} |
||
68 | * @see \Mezon\Security\Validators\ValidatorInterface::valid() |
||
69 | */ |
||
70 | public function valid(): bool |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * |
||
79 | * {@inheritdoc} |
||
80 | * @see \Mezon\Security\Validators\ValidatorInterface::setValidatingData() |
||
81 | */ |
||
82 | public function setValidatingData($data): void |
||
85 | } |
||
86 | } |