EditProducto   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
eloc 15
c 1
b 1
f 1
dl 0
loc 43
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createViews() 0 7 1
A execAfterAction() 0 3 1
A loadData() 0 14 2
A execPreviousAction() 0 3 1
1
<?php
2
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller;
3
4
use Closure;
5
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Core\Base\DataBase\DataBaseWhere 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...
6
use FacturaScripts\Core\Tools;
7
8
9
class EditProducto
10
{
11
    public function createViews(): Closure
12
    {
13
        return function () {
14
            // tu código aquí
15
            // createViews() se ejecuta una vez realizado el createViews() del controlador.
16
            parent::createViews();
17
            $this->addListView('ListImpuestoProducto', 'ImpuestoProducto', 'taxes', 'fa-solid fa-money-check-alt');
0 ignored issues
show
Bug introduced by
The method addListView() does not exist on FacturaScripts\Plugins\f...Controller\EditProducto. ( Ignorable by Annotation )

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

17
            $this->/** @scrutinizer ignore-call */ 
18
                   addListView('ListImpuestoProducto', 'ImpuestoProducto', 'taxes', 'fa-solid fa-money-check-alt');

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...
18
        };
19
    }
20
21
    public function execAfterAction(): Closure
22
    {
23
        return function ($action) {
0 ignored issues
show
Unused Code introduced by
The parameter $action is not used and could be removed. ( Ignorable by Annotation )

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

23
        return function (/** @scrutinizer ignore-unused */ $action) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
            // tu código aquí
25
            // execAfterAction() se ejecuta tras el execAfterAction() del controlador.
26
        };
27
    }
28
29
    public function execPreviousAction(): Closure
30
    {
31
        return function ($action) {
0 ignored issues
show
Unused Code introduced by
The parameter $action is not used and could be removed. ( Ignorable by Annotation )

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

31
        return function (/** @scrutinizer ignore-unused */ $action) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
            // tu código aquí
33
            // execPreviousAction() se ejecuta después del execPreviousAction() del controlador.
34
            // Si devolvemos false detenemos la ejecución del controlador.
35
        };
36
    }
37
38
    public function loadData(): Closure
39
    {
40
        return function ($viewName, $view) {
41
            // tu código aquí
42
            // loadData() se ejecuta tras el loadData() del controlador. Recibe los parámetros $viewName y $view.
43
            switch ($viewName) {
44
                case 'ListImpuestoProducto':
45
                    $where = [new DataBaseWhere('idproducto', $this->getModel()->id())];
0 ignored issues
show
Bug introduced by
The method getModel() does not exist on FacturaScripts\Plugins\f...Controller\EditProducto. ( Ignorable by Annotation )

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

45
                    $where = [new DataBaseWhere('idproducto', $this->/** @scrutinizer ignore-call */ getModel()->id())];

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...
46
                    $view->loadData('', $where);
47
                    break;
48
49
                default:
50
                    parent::loadData($viewName, $view);
51
                    break;
52
            }
53
        };
54
    }
55
}
56