Passed
Branch 3.0.0 (3c68a7)
by Pieter
04:04
created

ApieAwareTrait::getApie()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
4
namespace W2w\Lib\Apie\PluginInterfaces;
5
6
use W2w\Lib\Apie\Apie;
7
use W2w\Lib\Apie\Exceptions\BadConfigurationException;
8
9
trait ApieAwareTrait
10
{
11
    private $apie;
12
13
    public function setApie(Apie $apie)
14
    {
15
        if ($this->apie) {
16
            throw new BadConfigurationException('setApie should only be called once');
17
        }
18
        $this->apie = $apie;
19
        return $this;
20
    }
21
22
    protected function getApie(): Apie
23
    {
24
        if (!$this->apie) {
25
            throw new BadConfigurationException('setApie is not being called');
26
        }
27
        return $this->apie;
28
    }
29
}
30