Conditions | 4 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
46 | public function get($id) |
||
47 | { |
||
48 | if (!$this->has($id)) { |
||
49 | throw ConstraintNotFoundException::forRule($id); |
||
50 | } |
||
51 | |||
52 | $concrete = $this->rules()[$id]; |
||
53 | |||
54 | try { |
||
55 | return is_string($concrete) ? new $concrete() : $concrete(); |
||
56 | } catch (\Exception $e) { |
||
57 | throw ConstraintException::forRule($id, $e); |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 |