CTeOther   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 43
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generate() 0 21 1
A defaultModel() 0 3 1
1
<?php
2
3
namespace Brazanation\Documents\Sped;
4
5
use Brazanation\Documents\Cnpj;
6
7
final class CTeOther extends AbstractAccessKey
8
{
9
    const LABEL = 'CTeOther';
10
11 5
    protected function defaultModel() : Model
12
    {
13 5
        return Model::CTeOther();
14
    }
15
16
    /**
17
     * Generates a valid Sped Access Key.
18
     *
19
     * @param int          $state         IBGE state code.
20
     * @param \DateTime    $generatedAt   Year and month when invoice was created.
21
     * @param Cnpj         $cnpj          Cnpj from issuer.
22
     * @param int          $sequence      Invoice sequence.
23
     * @param int          $invoiceNumber Invoice number.
24
     * @param EmissionType $emissionType  Emission Type
25
     * @param int          $controlNumber Control number.
26
     *
27
     * @return NFe
28
     */
29 1
    public static function generate(
30
        int $state,
31
        \DateTime $generatedAt,
32
        Cnpj $cnpj,
33
        int $sequence,
34
        int $invoiceNumber,
35
        EmissionType $emissionType,
36
        int $controlNumber
37
    ) : AbstractAccessKey {
38 1
        $accessKey = self::generateKey(
39
            $state,
40
            $generatedAt,
41
            $cnpj,
42 1
            Model::CTeOther(),
43
            $sequence,
44
            $invoiceNumber,
45
            $emissionType,
46
            $controlNumber
47
        );
48
49 1
        return new self("{$accessKey}");
0 ignored issues
show
Bug Best Practice introduced by
The expression return new self($accessKey) returns the type Brazanation\Documents\Sped\CTeOther which is incompatible with the documented return type Brazanation\Documents\Sped\NFe.
Loading history...
50
    }
51
}
52