Code Duplication    Length = 32-32 lines in 2 locations

src/Model/Customer/Customers.php 1 location

@@ 12-43 (lines=32) @@
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12
class Customers implements CreatableFromArray
13
{
14
    /**
15
     * @var Customer[]
16
     */
17
    private $customers;
18
19
    private function __construct(array $customers)
20
    {
21
        $this->customers = $customers;
22
    }
23
24
    public static function createFromArray(array $data)
25
    {
26
        $customers = [];
27
        if (isset($data['data'])) {
28
            foreach ($data['data'] as $item) {
29
                $customers[] = Customer::createFromArray(['data' => $item]);
30
            }
31
        }
32
33
        return new self($customers);
34
    }
35
36
    /**
37
     * @return Customer[]
38
     */
39
    public function getCustomer()
40
    {
41
        return $this->customers;
42
    }
43
}
44

src/Model/Invoice/Invoices.php 1 location

@@ 12-43 (lines=32) @@
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12
class Invoices implements CreatableFromArray
13
{
14
    /**
15
     * @var Invoice[]
16
     */
17
    private $invoices;
18
19
    private function __construct(array $invoices)
20
    {
21
        $this->invoices = $invoices;
22
    }
23
24
    public static function createFromArray(array $data)
25
    {
26
        $invoices = [];
27
        if (isset($data['data'])) {
28
            foreach ($data['data'] as $item) {
29
                $invoices[] = Invoice::createFromArray(['data' => $item]);
30
            }
31
        }
32
33
        return new self($invoices);
34
    }
35
36
    /**
37
     * @return Invoice[]
38
     */
39
    public function getCustomer()
40
    {
41
        return $this->invoices;
42
    }
43
}
44