| Conditions | 10 | 
| Paths | 1 | 
| Total Lines | 52 | 
| Code Lines | 48 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| 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 | ||
| 40 | public function execPreviousAction() | ||
| 41 |     { | ||
| 42 |         return function ($action) { | ||
| 43 |             switch ($action) { | ||
| 44 | case 'busca_tipo': | ||
| 45 | $this->setTemplate(false); | ||
| 46 | CommonFunctionsDominicanRepublic::ncfTipoComprobante($_REQUEST['tipodocumento']); | ||
| 47 | break; | ||
| 48 | case 'busca_movimiento': | ||
| 49 | $this->setTemplate(false); | ||
| 50 | CommonFunctionsDominicanRepublic::ncfTipoMovimiento($_REQUEST['tipomovimiento']); | ||
| 51 | break; | ||
| 52 | case 'busca_tipoanulacion': | ||
| 53 | $this->setTemplate(false); | ||
| 54 | CommonFunctionsDominicanRepublic::ncfTipoAnulacion($_REQUEST['tipoanulacion']); | ||
| 55 | break; | ||
| 56 | case 'busca_pago': | ||
| 57 | $this->setTemplate(false); | ||
| 58 | CommonFunctionsDominicanRepublic::ncfTipoPago($_REQUEST['tipopago']); | ||
| 59 | break; | ||
| 60 | case "verifica_documento": | ||
| 61 | $this->setTemplate(false); | ||
| 62 | $this->verifyDocument(); | ||
| 63 | break; | ||
| 64 | case 'busca_correlativo': | ||
| 65 | $this->setTemplate(false); | ||
| 66 | CommonFunctionsDominicanRepublic::ncfCorrelativo($_REQUEST['tipocomprobante'], $this->empresa->idempresa); | ||
| 67 | break; | ||
| 68 | case 'busca_rnc': | ||
| 69 | $this->setTemplate(false); | ||
| 70 | $consulta = new WebserviceDgii(); | ||
| 71 |                     $rncNotFound = self::toolBox()->i18n()->trans('rnc-not-found'); | ||
| 72 | $respuesta = $consulta->getExternalAPI($_REQUEST['cifnif']); | ||
| 73 | $registros = $respuesta->totalResults; | ||
| 74 |                     if ($registros !== 0) { | ||
| 75 | $resultado = $respuesta->entry[0]; | ||
| 76 |                         if ($resultado) { | ||
| 77 | $arrayResultado = []; | ||
| 78 | $arrayResultado["RGE_RUC"] = $resultado->rnc; | ||
| 79 | $arrayResultado["RGE_NOMBRE"] = $resultado->nombre; | ||
| 80 | $arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial; | ||
| 81 | $arrayResultado["ESTATUS"] = $resultado->estado; | ||
| 82 | echo json_encode($arrayResultado); | ||
| 83 |                         } else { | ||
| 84 |                             echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; | ||
| 85 | } | ||
| 86 |                     } else { | ||
| 87 |                         echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; | ||
| 88 | } | ||
| 89 | break; | ||
| 90 | default: | ||
| 91 | break; | ||
| 92 | } | ||
| 126 | } | 
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths