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