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