HasSpecifications   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A specifications() 0 8 2
1
<?php
2
3
namespace Pbmedia\Specifications;
4
5
use Pbmedia\Specifications\Interfaces\Specifications as SpecificationsInterface;
6
7
trait HasSpecifications
8
{
9
    /**
10
     * Instance of Specifications.
11
     *
12
     * @var \Pbmedia\Specifications\Interfaces\Specifications
13
     */
14
    protected $specifications;
15
16
    /**
17
     * Creates a new Specifications object if non exists
18
     * and returns it.
19
     *
20
     * @return \Pbmedia\Specifications\Specifications
21
     */
22
    public function specifications(): SpecificationsInterface
23
    {
24
        if (!$this->specifications) {
25
            $this->specifications = new Specifications;
26
        }
27
28
        return $this->specifications;
29
    }
30
}
31