Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
46 | 1 | protected function getByReference($ref, $source, $target) |
|
47 | { |
||
48 | 1 | $subject = $source; |
|
49 | |||
50 | 1 | if ($ref === '$') { |
|
51 | return $source; |
||
52 | 1 | } elseif ($ref === '@') { |
|
53 | return $target; |
||
54 | } |
||
55 | |||
56 | if (substr($ref, 0, 2) === '$.') { |
||
57 | $ref = substr($ref, 2); |
||
58 | } elseif (substr($ref, 0, 2) === '@.') { |
||
59 | $ref = substr($ref, 2); |
||
60 | $subject = $target; |
||
61 | } |
||
62 | |||
63 | return DotKey::on($subject)->get($ref); |
||
64 | } |
||
65 | } |
||
66 |