| Conditions | 5 | 
| Paths | 6 | 
| Total Lines | 71 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 1 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 148 |     public function listAll() { | 
            ||
| 149 | global $WT_TREE;  | 
            ||
| 150 | |||
| 151 | $controller = new PageController();  | 
            ||
| 152 | $controller  | 
            ||
| 153 |             ->setPageTitle(I18N::translate('Certificates')) | 
            ||
| 154 | ->restrictAccess(  | 
            ||
| 155 |                 $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) | 
            ||
| 156 | );  | 
            ||
| 157 | |||
| 158 |         $city = Filter::get('city'); | 
            ||
| 159 | |||
| 160 |         if(!empty($city) && strlen($city) > 22){ | 
            ||
| 161 | $city = Functions::decryptFromSafeBase64($city);  | 
            ||
| 162 |             $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); | 
            ||
| 163 | }  | 
            ||
| 164 | |||
| 165 | $data = new ViewBag();  | 
            ||
| 166 |         $data->set('title', $controller->getPageTitle()); | 
            ||
| 167 |         $data->set('url_module', $this->module->getName()); | 
            ||
| 168 |         $data->set('url_action', 'Certificate@listAll'); | 
            ||
| 169 |         $data->set('url_ged', $WT_TREE->getNameUrl()); | 
            ||
| 170 | |||
| 171 |         $data->set('cities', $this->provider->getCitiesList()); | 
            ||
| 172 |         $data->set('selected_city', $city); | 
            ||
| 173 | |||
| 174 |         $data->set('has_list', false);         | 
            ||
| 175 |         if(!empty($city)) {             | 
            ||
| 176 | $table_id = 'table-certiflist-' . Uuid::uuid4();  | 
            ||
| 177 | |||
| 178 | $certif_list = $this->provider->getCertificatesList($city);  | 
            ||
| 179 |             if(!empty($certif_list)) {                 | 
            ||
| 180 |                 $data->set('has_list', true); | 
            ||
| 181 |                 $data->set('table_id', $table_id); | 
            ||
| 182 |                 $data->set('certificate_list', $certif_list); | 
            ||
| 183 | |||
| 184 | $controller  | 
            ||
| 185 | ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)  | 
            ||
| 186 |                     ->addInlineJavascript(' | 
            ||
| 187 | /* Initialise datatables */  | 
            ||
| 188 |         				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; | 
            ||
| 189 |         				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; | 
            ||
| 190 |         				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; | 
            ||
| 191 |         				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; | 
            ||
| 192 | |||
| 193 |                         jQuery("#'.$table_id.'").dataTable( { | 
            ||
| 194 | dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',  | 
            ||
| 195 | '.I18N::datatablesI18N().',  | 
            ||
| 196 | jQueryUI: true,  | 
            ||
| 197 | autoWidth: false,  | 
            ||
| 198 | processing: true,  | 
            ||
| 199 | columns: [  | 
            ||
| 200 |         		                    /* 0-Date */  			{ dataSort: 1, width: "15%", class: "center" }, | 
            ||
| 201 |         							/* 1-DateSort */		{ type: "unicode", visible : false }, | 
            ||
| 202 |         		                    /* 2-Type */ 			{ width: "5%", searchable: false, class: "center"}, | 
            ||
| 203 |         		                    /* 3-CertificateSort */ { type: "unicode", visible : false }, | 
            ||
| 204 |         		                    /* 4-Certificate */     { dataSort: 3, class: "left" } | 
            ||
| 205 | ],  | 
            ||
| 206 | sorting: [[0,"asc"], [2,"asc"]],  | 
            ||
| 207 | displayLength: 20,  | 
            ||
| 208 | pagingType: "full_numbers"  | 
            ||
| 209 | });  | 
            ||
| 210 |         				jQuery(".certificate-list").css("visibility", "visible"); | 
            ||
| 211 |         				jQuery(".loading-image").css("display", "none"); | 
            ||
| 212 | ');  | 
            ||
| 213 | }  | 
            ||
| 214 | }  | 
            ||
| 215 | |||
| 216 |         ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); | 
            ||
| 217 | |||
| 218 | }  | 
            ||
| 219 | |||
| 238 | }  | 
            
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.