Completed
Push — master ( c09ce2...1f44ff )
by Emily
02:06
created

AllReadableTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 4 1
A getPropertyAccessor() 0 9 2
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <emily@emilyshepherd>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Traits;
16
17
use Spaark\CompositeUtils\Service\RawPropertyAccessor;
18
19
trait AllReadableTrait
20
{
21
    /**
22
     * @var RawPropertyAccessor
23
     */
24
    protected $accessor;
25
26 28
    protected function getPropertyAccessor()
27
    {
28 28
        if (!$this->accessor)
29
        {
30 25
            $this->accessor = new RawPropertyAccessor($this);
31
        }
32
33 28
        return $this->accessor;
34
    }
35
36 28
    public function __get($property)
37
    {
38 28
        return $this->getPropertyAccessor()->getRawValue($property);
39
    }
40
}
41