Collectable::parent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TPG\Pcflib\Traits;
4
5
use TPG\Pcflib\OfferCollection;
6
7
/**
8
 * Trait Collectable
9
 * @package TPG\Pcflib\Traits
10
 */
11
trait Collectable
12
{
13
    /**
14
     * @var OfferCollection
15
     */
16
    protected $parent;
17
18
    /**
19
     * Set or get the parent collection
20
     *
21
     * @param OfferCollection|null $collection
22
     * @return OfferCollection|null
23
     */
24
    public function parent(OfferCollection $collection = null): ?OfferCollection
25
    {
26
        if ($collection) {
27
            $this->parent = $collection;
28
        }
29
30
        return $this->parent;
31
    }
32
}