Issues (68)

src/Service/NFeService.php (6 issues)

1
<?php
2
3
namespace ControleOnline\Service;
4
5
use ControleOnline\Entity\Order;
6
use ControleOnline\Entity\SalesInvoiceTax;
0 ignored issues
show
The type ControleOnline\Entity\SalesInvoiceTax 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...
7
use ControleOnline\Entity\OrderInvoiceTax;
8
use ControleOnline\Library\NFePHP;
9
10
class NFeService extends NFePHP
11
{
12
    public function createNfe(Order $order, $model, $version =  '4.00')
13
    {
14
15
        $this->model = $model;
16
        $this->version = $version;
17
18
        switch ($this->model) {
19
            case '65':
20
                $this->make = new \NFePHP\NFe\Make();
0 ignored issues
show
The type NFePHP\NFe\Make 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...
21
                $this->tools = new \NFePHP\NFe\Tools($this->getSignData($order), $this->getCertificate($order));
0 ignored issues
show
The type NFePHP\NFe\Tools 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
                $this->cupomFiscal($order);
23
                break;
24
            case '55':
25
                $this->make = new \NFePHP\NFe\Make();
26
                $this->tools = new \NFePHP\NFe\Tools($this->getSignData($order), $this->getCertificate($order));
27
                $this->nfe($order);
28
                break;
29
            case '57':
30
                $this->make = new \NFePHP\CTe\MakeCTe();
0 ignored issues
show
The type NFePHP\CTe\MakeCTe 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...
31
                $this->tools = new \NFePHP\CTe\Tools($this->getSignData($order), $this->getCertificate($order));
0 ignored issues
show
The type NFePHP\CTe\Tools 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...
32
                $this->cte($order);
33
                break;
34
            default:
35
                return;
36
                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
37
        }
38
39
        $xml = $this->sign($order);
40
        //$this->persist($order, $xml);
41
42
        return $xml;
43
    }
44
45
    protected function nfe(Order $order)
46
    {
47
        $this->makeInfNFe($this->version);
48
        $this->makeIde($order);
49
        $this->makeEmit($order);
50
        $this->makeDest($order);
51
        $this->makeProds($order);
52
        $this->makeTransp($order);
53
        $this->makePag($order);
54
        $this->makedetPag($order);
55
    }
56
57
    protected function cte(Order $order)
58
    {
59
        $this->makeInfNFe($this->version);
60
        $this->makeIde($order);
61
        $this->makeEmit($order);
62
        $this->makeDest($order);
63
        $this->makePag($order);
64
        $this->makedetPag($order);
65
        $this->makeTomador($order);
66
    }
67
68
    protected function cupomFiscal(Order $order)
69
    {
70
        $this->makeInfRespTec();
71
        $this->makeInfNFe($this->version);
72
        $this->makeIde($order);
73
        $this->makeEmit($order);
74
        $this->makeDest($order);
75
        $this->makeProds($order);
76
        $this->makeTransp($order);
77
        $this->makePag($order);
78
        $this->makedetPag($order);
79
    }
80
}
81