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

ObtainCustomersResult::message()   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\Registration;
6
7
use PhpCfdi\Finkok\Services\AbstractResult;
8
use stdClass;
9
10
final class ObtainCustomersResult extends AbstractResult
11
{
12
    /** @var Customers */
13
    private $customers;
14
15 5
    public function __construct(stdClass $data)
16
    {
17 5
        parent::__construct($data, 'customersResult');
18 5
        $customers = $this->findInDescendent($data, 'customersResult', 'users', 'ResellerUser');
19 5
        $this->customers = new Customers(is_array($customers) ? $customers : []);
20
    }
21
22 4
    public function message(): string
23
    {
24 4
        return $this->get('message');
25
    }
26
27 3
    public function customers(): Customers
28
    {
29 3
        return $this->customers;
30
    }
31
32 3
    public function pagesInformation(): PageInformation
33
    {
34 3
        $message = $this->message();
35 3
        return PageInformation::fromMessage($message);
36
    }
37
}
38