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

ObtainCustomersResult   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A customers() 0 3 1
A __construct() 0 5 2
A message() 0 3 1
A pagesInformation() 0 4 1
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