Passed
Push — master ( d29869...e61a0d )
by Joe Nilson
03:35
created

EditFacturaCliente   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 38
dl 0
loc 57
rs 10
c 1
b 0
f 0
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A ncftipoanulacion() 0 5 1
B execPreviousAction() 0 30 7
A createViews() 0 6 1
A ncftipo() 0 4 1
1
<?php
2
/*
3
 * Copyright (C) 2020 Joe Nilson <[email protected]>
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as
7
 * published by the Free Software Foundation, either version 3 of the
8
 * License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Lesser General Public License for more details.
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller;
19
20
use Closure;
21
use FacturaScripts\Dinamic\Lib\AssetManager;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Lib\AssetManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
use FacturaScripts\Dinamic\Model\NCFRango;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Model\NCFRango was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
use FacturaScripts\Dinamic\Model\NCFTipo;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Model\NCFTipo was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use FacturaScripts\Dinamic\Model\NCFTipoAnulacion;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Model\NCFTipoAnulacion was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\CommonFunctionsDominicanRepublic;
26
27
class EditFacturaCliente
28
{
29
    public function createViews(): Closure
30
    {
31
        return function () {
32
            parent::createViews();
33
            AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonModals.js');
0 ignored issues
show
Bug introduced by
The constant FS_ROUTE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
34
            AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js');
35
        };
36
    }
37
38
    public function execPreviousAction()
39
    {
40
        return function ($action) {
41
            switch ($action) {
42
                case 'busca_infocliente':
43
                    $this->setTemplate(false);
0 ignored issues
show
Bug introduced by
The method setTemplate() does not exist on FacturaScripts\Plugins\f...ller\EditFacturaCliente. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
                    $this->/** @scrutinizer ignore-call */ 
44
                           setTemplate(false);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
                    CommonFunctionsDominicanRepublic::ncfTipoCliente($_REQUEST['codcliente']);
45
                    break;
46
                case 'busca_tipo':
47
                    $this->setTemplate(false);
48
                    CommonFunctionsDominicanRepublic::ncfTipoComprobante($_REQUEST['tipodocumento']);
49
                    break;
50
                case 'busca_movimiento':
51
                    $this->setTemplate(false);
52
                    CommonFunctionsDominicanRepublic::ncfTipoMovimiento($_REQUEST['tipomovimiento']);
53
                    break;
54
                case 'busca_tipoanulacion':
55
                    $this->setTemplate(false);
56
                    CommonFunctionsDominicanRepublic::ncfTipoAnulacion($_REQUEST['tipoanulacion']);
57
                    break;
58
                case 'busca_pago':
59
                    $this->setTemplate(false);
60
                    CommonFunctionsDominicanRepublic::ncfTipoPago($_REQUEST['tipopago']);
61
                    break;
62
                case 'busca_correlativo':
63
                    $this->setTemplate(false);
64
                    CommonFunctionsDominicanRepublic::ncfCorrelativo($_REQUEST['tipocomprobante'], $this->empresa->idempresa);
0 ignored issues
show
Bug Best Practice introduced by
The property empresa does not exist on FacturaScripts\Plugins\f...ller\EditFacturaCliente. Did you maybe forget to declare it?
Loading history...
65
                    break;
66
                default:
67
                    break;
68
            }
69
        };
70
    }
71
72
    public function ncftipo()
73
    {
74
        return function () {
75
            return NCFTipo::allVentas();
76
        };
77
    }
78
79
    public function ncftipoanulacion()
80
    {
81
        return function () {
82
            $tiposAnulacion = new NCFTipoAnulacion();
83
            return $tiposAnulacion->all();
84
        };
85
    }
86
}