Passed
Push — v2 ( 36b0ac...56b613 )
by Daniel
04:35
created

Collection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 20
ccs 0
cts 7
cp 0
rs 10
c 3
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setCollection() 0 8 3
A getCollection() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\Entity\Component;
15
16
use Doctrine\ORM\Mapping as ORM;
17
use Silverback\ApiComponentBundle\Entity\Core\AbstractComponent;
18
use Traversable;
19
20
/**
21
 * @author Daniel West <[email protected]>
22
 * @ORM\Entity
23
 */
24
class Collection extends AbstractComponent
25
{
26
    /**
27
     * @var array|Traversable
28
     */
29
    private $collection;
30
31
    public function getCollection()
32
    {
33
        return $this->collection;
34
    }
35
36
    public function setCollection($collection): self
37
    {
38
        if (!$collection instanceof Traversable && !\is_array($collection)) {
39
            return $this;
40
        }
41
        $this->collection = $collection;
42
43
        return $this;
44
    }
45
}
46