Passed
Push — main ( b480f2...a8d709 )
by Carlos C
02:53 queued 12s
created

AcceptRejectUuidStatus::isSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Cancel;
6
7
use Eclipxe\MicroCatalog\MicroCatalog;
8
9
/**
10
 * @extends MicroCatalog<string>
11
 */
12
final class AcceptRejectUuidStatus extends MicroCatalog
13
{
14 13
    public static function getEntriesArray(): array
15
    {
16 13
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array('1000' => '...olicitudes permitidas') returns the type array<string,string> which is incompatible with the return type mandated by Eclipxe\MicroCatalog\Mic...alog::getEntriesArray() of Eclipxe\MicroCatalog\TEntry[].

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
17 13
            '1000' => 'Se recibió la respuesta de la petición de forma exitosa',
18 13
            '1001' => 'No existen peticiones de cancelación en espera de respuesta para el UUID',
19 13
            '1002' => 'Ya se recibió una respuesta para la petición de cancelación del UUID',
20 13
            '1003' => 'El sello no corresponde al RFC receptor',
21 13
            '1004' => 'Existen más de una petición de cancelación para el mismo UUID',
22 13
            '1005' => 'El UUID es nulo o no posee el formato correcto',
23 13
            '1006' => 'Se rebasó el número máximo de solicitudes permitidas',
24 13
        ];
25
    }
26
27 2
    public function getEntryValueOnUndefined(): string
28
    {
29 2
        return 'Respuesta del SAT desconocida';
0 ignored issues
show
Bug Best Practice introduced by
The expression return 'Respuesta del SAT desconocida' returns the type string which is incompatible with the return type mandated by Eclipxe\MicroCatalog\Mic...EntryValueOnUndefined() of Eclipxe\MicroCatalog\TEntry.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
30
    }
31
32 7
    public function getCode(): string
33
    {
34 7
        return $this->getEntryId();
35
    }
36
37 3
    public function getMessage(): string
38
    {
39 3
        return strval($this->getEntryValue());
40
    }
41
42 3
    public function isSuccess(): bool
43
    {
44 3
        return ('1000' === $this->getCode());
45
    }
46
}
47