Completed
Push — 3.x ( e32815...7c4255 )
by Ryota
09:26 queued 05:13
created

AbstractFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A collection() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Polidog\Chatwork\Entity\Factory;
6
7
use Polidog\Chatwork\Entity\Collection\EntityCollection;
8
9
abstract class AbstractFactory implements FactoryInterface
10
{
11
    protected $collectionName = EntityCollection::class;
12
13
    /**
14
     * @param array $listUp
15
     *
16
     * @return EntityCollection
17
     */
18
    public function collection($listUp = null)
19
    {
20
        $collection = new $this->collectionName();
21
        if (!is_array($listUp)) {
22
            return $collection;
23
        }
24
25
        foreach ($listUp as $value) {
26
            $collection->add($this->entity($value));
27
        }
28
29
        return $collection;
30
    }
31
}
32