Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
17 | class HtmlPagination extends HtmlNavElement { |
||
1 ignored issue
–
show
|
|||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $from; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $to; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $countVisible; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $active; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $urlMask; |
||
44 | |||
45 | /** |
||
46 | * @param string $identifier |
||
47 | */ |
||
48 | public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
||
61 | |||
62 | private function createElement($num,$content,$disabled=false,$current=false){ |
||
83 | |||
84 | protected function createContent(){ |
||
94 | |||
95 | protected function half(){ |
||
98 | |||
99 | protected function getStart(){ |
||
106 | |||
107 | public function _addEvent($event, $jsCode) { |
||
114 | /** |
||
115 | * set the active page corresponding to request dispatcher : controllerName, actionName, parameters and $urlMask |
||
116 | * @param Dispatcher $dispatcher the request dispatcher |
||
117 | * @return \Ajax\bootstrap\html\HtmlPagination |
||
118 | */ |
||
119 | public function fromDispatcher($dispatcher){ |
||
134 | |||
135 | public function getUrl($index){ |
||
138 | |||
139 | /** |
||
140 | * define the buttons size |
||
141 | * available values : "lg","","sm","xs" |
||
142 | * @param string|int $size |
||
143 | * @return HtmlPagination default : "" |
||
144 | */ |
||
145 | public function setSize($size) { |
||
153 | |||
154 | public function getFrom() { |
||
194 | |||
195 | |||
196 | } |
||
1 ignored issue
–
show
|