Passed
Push — master ( d65fb2...07d9b9 )
by Roberto
05:56 queued 03:13
created

TraitBlocoVI   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 61
ccs 0
cts 52
cp 0
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B blocoVI() 0 58 1
1
<?php
2
3
namespace NFePHP\DA\NFe\Traits;
4
5
/**
6
 * Bloco VI informações de chave de acesso
7
 */
8
trait TraitBlocoVI
9
{
10
    protected function blocoVI($y)
11
    {
12
        $this->bloco6H = 10;
0 ignored issues
show
Bug introduced by
The property bloco6H does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
        
14
        //$aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => ''];
15
        //$this->pdf->textBox($this->margem, $y, $this->wPrint, $this->bloco6H, '', $aFont, 'T', 'C', false, '', false);
16
        
17
        $texto = "Consulte pela Chave de Acesso em:";
18
        $aFont = ['font'=> $this->fontePadrao, 'size' => 8, 'style' => 'B'];
0 ignored issues
show
Bug introduced by
The property fontePadrao does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
19
        $y1 = $this->pdf->textBox(
0 ignored issues
show
Bug introduced by
The property pdf does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
            $this->margem,
0 ignored issues
show
Bug introduced by
The property margem does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
            $y,
22
            $this->wPrint,
0 ignored issues
show
Bug introduced by
The property wPrint does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
23
            $this->bloco6H,
24
            $texto,
25
            $aFont,
26
            'T',
27
            'C',
28
            false,
29
            '',
30
            false
31
        );
32
        
33
        $texto =  $this->urlChave;
0 ignored issues
show
Bug introduced by
The property urlChave does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
34
        $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => ''];
35
        $y2 = $this->pdf->textBox(
36
            $this->margem,
37
            $y+$y1,
38
            $this->wPrint,
39
            2,
40
            $texto,
41
            $aFont,
42
            'T',
43
            'C',
44
            false,
45
            '',
46
            false
47
        );
48
        
49
        $chave =  str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
0 ignored issues
show
Bug introduced by
The property infNFe does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
50
        $texto = $this->formatField($chave, $this->formatoChave);
0 ignored issues
show
Bug introduced by
The property formatoChave does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like formatField() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
51
        $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => ''];
52
        $y3 = $this->pdf->textBox(
0 ignored issues
show
Unused Code introduced by
$y3 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
53
            $this->margem,
54
            $y+$y1+$y2+1,
55
            $this->wPrint,
56
            2,
57
            $texto,
58
            $aFont,
59
            'T',
60
            'C',
61
            false,
62
            '',
63
            true
64
        );
65
        $this->pdf->dashedHLine($this->margem, $this->bloco6H+$y, $this->wPrint, 0.1, 30);
66
        return $this->bloco6H + $y;
67
    }
68
}
69