Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 6.6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function check($value): bool |
||
35 | { |
||
36 | 2 | $this->requireParameters(['allowed_values']); |
|
37 | 2 | $this->setAllowedValues($this->parameters = $this->parameter('allowed_values')); |
|
38 | |||
39 | if (! $this->isValidFileInstance($value)) { |
||
40 | return false; |
||
41 | } |
||
42 | |||
43 | if ($this->shouldBlockPhpUpload($value, $this->parameters)) { |
||
44 | return false; |
||
45 | } |
||
46 | |||
47 | return $value->getPath() !== '' |
||
48 | && (in_array($value->getMimeType(), $this->parameters, true) |
||
49 | 2 | || in_array(explode('/', $value->getMimeType())[0] . '/*', $this->parameters, true)); |
|
50 | } |
||
52 |