ValueObject   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 54
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getProperties() 0 4 1
A getProperty() 0 4 2
A setProperty() 0 4 1
A getData() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Data;
11
12
/**
13
 * Generic object interface implementation.
14
 */
15
class ValueObject implements ObjectInterface
16
{
17
    /**
18
     * @var mixed Associated data
19
     */
20
    public $data;
21
22
    /**
23
     * @var array Property collection
24
     */
25
    protected $properties = array();
26
27
    /**
28
     * @param mixed $data       Associated data
29
     * @param array $properties Properties
30
     */
31 10
    public function __construct($data, array $properties = array())
32
    {
33 10
        $this->data = $data;
34 10
        $this->properties = $properties;
35 10
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function getProperties()
41
    {
42 1
        return $this->properties;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 2
    public function getProperty($key)
49
    {
50 2
        return isset($this->properties[$key]) ? $this->properties[$key] : null;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 2
    public function setProperty($key, $value)
57
    {
58 2
        $this->properties[$key] = $value;
59 2
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64 1
    public function getData()
65
    {
66 1
        return $this->data;
67
    }
68
}
69