1 | <?php |
||
5 | trait TreeStructureTrait |
||
6 | { |
||
7 | protected $tree; |
||
8 | |||
9 | 3 | public function getTree() |
|
65 | /* |
||
|
|||
66 | public function addMergeCount(&$tree,$id,$count,$is_merge) |
||
67 | { |
||
68 | foreach ( $tree as &$rec ) { |
||
69 | foreach ( $count_data as $count ) { |
||
70 | if (isset($count->id) === false) { |
||
71 | throw new Exception('count data record object does not have property => "id".'); |
||
72 | } |
||
73 | if (isset($count->count) === false) { |
||
74 | throw new Exception('count data record object does not have property => "count".'); |
||
75 | } |
||
76 | if ($rec->id == $count->id) { |
||
77 | $rec->count = $count->count; |
||
78 | if ( isset($rec->parent_id) && $is_merge ) { |
||
79 | $this->addCount($this->tree,$rec->parent_id,$count->count); |
||
80 | } |
||
81 | } elseif ( count($rec->children) ) { |
||
82 | $this->addMergeCount($rec->children,$count_data,$is_merge); |
||
83 | } |
||
84 | } |
||
85 | unset($rec); |
||
86 | } |
||
87 | } |
||
88 | */ |
||
89 | 2 | protected function addCount(&$tree,$id,$count,$is_merge) |
|
106 | } |
||
107 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.