AbstractType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __set() 0 8 2
A setShould() 0 4 1
1
<?php
2
/**
3
 * ShouldPHP
4
 *
5
 * @author  Gabriel Jacinto <[email protected]>
6
 * @status  dev
7
 * @link    https://github.com/GabrielJMJ/ShouldPHP
8
 * @license MIT
9
 */
10
 
11
namespace Gabrieljmj\Should;
12
13
use Gabrieljmj\Should\ShouldInterface;
14
15
abstract class AbstractType
16
{
17
    /**
18
     * @var \Gabrieljmj\Should\ShouldInterface
19
     */
20
    protected $should;
21
22
    /**
23
     * @param string $property
24
     * @param mixed  $value
25
     */
26
    public function __set($property, $value)
27
    {
28
        if ($property === 'should') {
29
            throw new Exception(sprintf('You can not set the property Gabrieljmj\Should\%s::$should', get_class($this)));
30
        }
31
        
32
        $this->{$property} = $value;
33
    }
34
35
    /**
36
     * @param \Gabrieljmj\Should\ShouldInterface $should
37
     */
38
    protected function setShould(ShouldInterface $should)
39
    {
40
        $this->should = $should;
41
    }
42
}