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

Collection::setCollection()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 5
cp 0
crap 12
rs 10
c 0
b 0
f 0
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