Person   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 68
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A address() 0 4 1
A setAddress() 0 4 1
A name() 0 4 1
A setName() 0 4 1
A equals() 0 6 2
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Serializer\Tests\Fixtures;
13
14
use Cubiche\Core\Serializer\SerializableInterface;
15
16
/**
17
 * Person class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class Person implements SerializableInterface
22
{
23
    /**
24
     * @var string
25
     */
26
    protected $name;
27
28
    /**
29
     * @var Address
30
     */
31
    protected $address;
32
33
    /**
34
     * Person constructor.
35
     *
36
     * @param string  $name
37
     * @param Address $address
38
     */
39
    public function __construct($name, Address $address)
40
    {
41
        $this->setName($name);
42
        $this->setAddress($address);
43
    }
44
45
    /**
46
     * @return Address
47
     */
48
    public function address()
49
    {
50
        return $this->address;
51
    }
52
53
    /**
54
     * @param Address $address
55
     */
56
    public function setAddress($address)
57
    {
58
        $this->address = $address;
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function name()
65
    {
66
        return $this->name;
67
    }
68
69
    /**
70
     * @param string $name
71
     */
72
    public function setName($name)
73
    {
74
        $this->name = $name;
75
    }
76
77
    /**
78
     * @param Person $other
79
     *
80
     * @return bool
81
     */
82
    public function equals(Person $other)
83
    {
84
        return $this->address() == $other->address() &&
85
            $this->name() == $other->name()
86
        ;
87
    }
88
}
89