Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 15 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
39 | public function fetch() |
||
40 | { |
||
41 | if ($this->cached && isset($this->value)) { |
||
42 | return $this->value; |
||
43 | } |
||
44 | $args = $this->context; |
||
45 | // useで引数を指定した場合、call_user_func_arrayの$argsと |
||
46 | // 引数の数が合わなくなり警告が出るが問題なく実行出来る |
||
47 | $result = @call_user_func_array($this->callback, $args); |
||
48 | if ($this->cached) { |
||
49 | $this->value = $result; |
||
50 | } |
||
51 | |||
52 | return $result; |
||
53 | } |
||
54 | } |
||
55 |
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.