Conditions | 5 |
Paths | 16 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
41 | 9 | public function getConstraints() |
|
42 | { |
||
43 | 9 | $constraints = parent::getConstraints(); |
|
44 | 9 | if ($this->requirements instanceof Constraint) { |
|
45 | 1 | $constraints[] = $this->requirements; |
|
46 | 1 | } |
|
47 | |||
48 | 9 | $options = is_array($this->requirements) ? $this->requirements : array(); |
|
49 | 9 | if ($this->image) { |
|
50 | 4 | $constraints[] = new Constraints\Image($options); |
|
51 | 4 | } else { |
|
52 | 5 | $constraints[] = new Constraints\File($options); |
|
53 | } |
||
54 | |||
55 | // If the user wants to map the value |
||
56 | 9 | if ($this->map) { |
|
57 | $constraints = array( |
||
58 | 5 | new All(array('constraints' => $constraints)), |
|
59 | 5 | ); |
|
60 | 5 | } |
|
61 | |||
62 | 9 | return $constraints; |
|
63 | } |
||
64 | |||
73 |