Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 17 |
Ratio | 100 % |
Tests | 8 |
CRAP Score | 3.1825 |
Changes | 4 | ||
Bugs | 2 | Features | 0 |
1 | <?php |
||
21 | 39 | public function __call($name, $arguments) { |
|
22 | 39 | if (count($arguments) != 0) { |
|
23 | # ToDo: This is used in Dicto::__callstatic as well. |
||
24 | throw new \InvalidArgumentException( |
||
25 | "No arguments are allowed for the reference to a variable."); |
||
26 | } |
||
27 | |||
28 | 39 | $left = $this->rt->get_current_var(); |
|
29 | 39 | $right = $this->rt->get_var($name); |
|
30 | 39 | if (!($left instanceof Vars\Variable)) { |
|
31 | throw new \RuntimeException("Could not get current var from runtime."); |
||
32 | } |
||
33 | 39 | $this->rt->current_var_is( |
|
34 | 39 | new Vars\AsWellAs($this->rt->get_current_var_name(), $left, $right)); |
|
35 | |||
36 | 39 | return new ExistingVar($this->rt); |
|
37 | } |
||
38 | } |
||
39 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.