LocatorAwareTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLocator() 0 7 2
A setLocator() 0 5 1
1
<?php
2
3
namespace WebinoDomLib\Dom;
4
5
/**
6
 * Class LocatorAwareTrait
7
 */
8
trait LocatorAwareTrait
9
{
10
    /**
11
     * @var Locator
12
     */
13
    private $locator;
14
15
    /**
16
     * @return Locator
17
     */
18
    protected function getLocator()
19
    {
20
        if (null === $this->locator) {
21
            $this->setLocator(new Locator);
22
        }
23
        return $this->locator;
24
    }
25
26
    /**
27
     * @param Locator $locator
28
     * @return $this
29
     */
30
    public function setLocator(Locator $locator)
31
    {
32
        $this->locator = $locator;
33
        return $this;
34
    }
35
}
36