ValueObject::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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