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