| Conditions | 4 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 6 | public function check(): bool |
|
| 27 | { |
||
| 28 | 6 | if ($this->value === false) { |
|
| 29 | 1 | return true; |
|
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | 5 | $file_size = $this->value->getSize() ?? 0; |
|
| 34 | |||
| 35 | 5 | if (is_null($this->message)) { |
|
| 36 | 4 | $this->message = 'Размер файла (' . Binary::bytes($file_size)->format(null, " ") . ')' |
|
| 37 | 4 | . ' превышает допустимый размер: ' . Binary::bytes($this->thresholdSize)->format(null, " "); |
|
| 38 | } |
||
| 39 | |||
| 40 | 4 | if ($file_size > $this->thresholdSize) { |
|
| 41 | 2 | $this->element->setRuleError($this->message); |
|
| 42 | 2 | return false; |
|
| 43 | } |
||
| 44 | 2 | return true; |
|
| 45 | } |
||
| 47 |