PriceDto   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 105
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 11 2
A __set() 0 12 2
A __isset() 0 4 1
1
<?php namespace Packback\Prices;
2
3
class PriceDto
4
{
5
    /**
6
     * ISBN13 for this price
7
     *
8
     * @var string
9
     */
10
    public $isbn13;
11
12
    /**
13
     * Price amount
14
     *
15
     * @var string
16
     */
17
    public $price;
18
19
    /**
20
     * Shipping price amount
21
     *
22
     * @var string
23
     */
24
    public $shipping_price;
25
26
    /**
27
     * Url of store page to purchase book at this price
28
     *
29
     * @var string
30
     */
31
    public $url;
32
33
    /**
34
     * Retailer selling at this price
35
     *
36
     * @var string
37
     */
38
    public $retailer;
39
40
    /**
41
     * Term at which this price is available
42
     *
43
     * @var string
44
     */
45
    public $term;
46
47
    /**
48
     * Condition of the product
49
     *
50
     * @var string
51
     */
52
    public $condition;
53
54
    /**
55
     * Magic method to get protected property, if exists
56
     *
57
     * @param  string $name
58
     *
59
     * @return mixed
60
     * @throws OutOfRangeException
61
     */
62 4
    public function __get($name)
63
    {
64 4
        if (!property_exists($this, $name)) {
65 2
            throw new \OutOfRangeException(sprintf(
66 2
                '%s does not contain a property by the name of "%s"',
67 2
                __CLASS__,
68
                $name
69 2
            ));
70
        }
71 2
        return $this->{$name};
72
    }
73
74
    /**
75
     * Magic method to set protected property, if exists
76
     *
77
     * @param  string $name
78
     * @param  mixed $value
79
     *
80
     * @return $this
81
     * @throws OutOfRangeException
82
     */
83 4
    public function __set($name, $value)
84
    {
85 4
        if (!property_exists($this, $name)) {
86 2
            throw new \OutOfRangeException(sprintf(
87 2
                '%s does not contain a property by the name of "%s"',
88 2
                __CLASS__,
89
                $name
90 2
            ));
91
        }
92 2
        $this->{$name} = $value;
93 2
        return $this;
94
    }
95
96
    /**
97
     * Magic method to check if property is set
98
     *
99
     * @param  string $name
100
     *
101
     * @return boolean
102
     */
103 2
    public function __isset($name)
104
    {
105 2
        return (property_exists($this, $name));
106
    }
107
}
108