Conditions | 3 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 24 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | View Code Duplication | public function render($_viewFile_, $_data_, $_return_ = false) |
|
|
|||
34 | { |
||
35 | $_viewFile_ = sprintf('%s.php', $_viewFile_); |
||
36 | // we use special variable names here to avoid conflict when extracting data |
||
37 | if (is_array($_data_)) |
||
38 | { |
||
39 | extract($_data_, EXTR_PREFIX_SAME, 'data'); |
||
40 | } |
||
41 | else |
||
42 | { |
||
43 | $data = $_data_; |
||
44 | } |
||
45 | if ($_return_) |
||
46 | { |
||
47 | ob_start(); |
||
48 | ob_implicit_flush(false); |
||
49 | require($_viewFile_); |
||
50 | return ob_get_clean(); |
||
51 | } |
||
52 | else |
||
53 | { |
||
54 | require($_viewFile_); |
||
55 | } |
||
56 | } |
||
57 | |||
59 |
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.