| Conditions | 7 |
| Paths | 10 |
| Total Lines | 55 |
| Code Lines | 49 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 62 | public function execAfterAction($action) |
||
| 63 | { |
||
| 64 | parent::execAfterAction($action); |
||
| 65 | $periodStartDate = \date('01-m-Y'); |
||
| 66 | $periodEndDate = \date('d-m-Y'); |
||
| 67 | if ($this->request->request->get('filterfecha') !== null) { |
||
| 68 | PeriodTools::applyPeriod($this->request->request->get('filterfecha'), $periodStartDate, $periodEndDate); |
||
| 69 | } |
||
| 70 | $startDate = $this->request->request->get('filterstartfecha') ?? $periodStartDate; |
||
| 71 | $endDate = $this->request->request->get('filterendfecha') ?? $periodEndDate; |
||
| 72 | $year = substr($startDate, 6, 4); |
||
| 73 | $month = substr($startDate, 3, 2); |
||
| 74 | $commonFunctions = new CommonFunctionsDominicanRepublic(); |
||
| 75 | $option = $this->request->get('option'); |
||
| 76 | if ($action === 'export' and $option === 'dgii') { |
||
| 77 | $actualTab = $this->request->get('activetab'); |
||
| 78 | switch ($actualTab) { |
||
| 79 | case "FiscalReport606": |
||
| 80 | $this->setTemplate(false); |
||
| 81 | $fileName = 'DGII_606_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 82 | $whereReport = [ |
||
| 83 | new DataBaseWhere('facturasprov.fecha', $startDate, '>='), |
||
| 84 | new DataBaseWhere('facturasprov.fecha', $endDate, '<='), |
||
| 85 | ]; |
||
| 86 | $commonFunctions->exportTXT('606', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 87 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 88 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 89 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 90 | break; |
||
| 91 | case "FiscalReport607": |
||
| 92 | $this->setTemplate(false); |
||
| 93 | $whereReport = [ |
||
| 94 | new DataBaseWhere('facturascli.fecha', $startDate, '>='), |
||
| 95 | new DataBaseWhere('facturascli.fecha', $endDate, '<='), |
||
| 96 | ]; |
||
| 97 | $fileName = 'DGII_607_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 98 | $commonFunctions->exportTXT('607', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 99 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 100 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 101 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 102 | break; |
||
| 103 | case "FiscalReport608": |
||
| 104 | $this->setTemplate(false); |
||
| 105 | $whereReport = [ |
||
| 106 | new DataBaseWhere('facturasprov.fecha', $startDate, '>='), |
||
| 107 | new DataBaseWhere('facturasprov.fecha', $endDate, '<='), |
||
| 108 | ]; |
||
| 109 | $fileName = 'DGII_608_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 110 | $commonFunctions->exportTXT('608', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 111 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 112 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 113 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 114 | break; |
||
| 115 | default: |
||
| 116 | break; |
||
| 117 | } |
||
| 232 |
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