Contact   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 135
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 1
dl 0
loc 135
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setMean() 0 6 1
A getMean() 0 4 1
B getDisplayName() 0 15 5
A setClient() 0 6 1
A getClient() 0 4 1
A setType() 0 6 1
A getType() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace ClientBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * Class Contact
9
 * @ORM\Entity(repositoryClass="ClientBundle\Repository\ContactRepository")
10
 * @ORM\Table(name="contact")
11
 */
12
class Contact
13
{
14
    /**
15
     * @ORM\Column(type="integer")
16
     * @ORM\Id
17
     * @ORM\GeneratedValue(strategy="AUTO")
18
     */
19
    private $id;
20
21
    /**
22
     * @ORM\ManyToOne(targetEntity="ContactType")
23
     */
24
    private $type;
25
26
    /**
27
     * @ORM\Column(type="string", length=100, nullable=true)
28
     */
29
    private $mean;
30
    /**
31
     * @ORM\ManyToOne(targetEntity="Client", inversedBy="contacts")
32
     * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
33
     */
34
    private $client;
35
36
    /**
37
     * Get id
38
     *
39
     * @return integer
40
     */
41
    public function getId()
42
    {
43
        return $this->id;
44
    }
45
46
    /**
47
     * Set mean
48
     *
49
     * @param string $mean
50
     *
51
     * @return Contact
52
     */
53
    public function setMean($mean)
54
    {
55
        $this->mean = $mean;
56
57
        return $this;
58
    }
59
60
    /**
61
     * Get mean
62
     *
63
     * @return string
64
     */
65
    public function getMean()
66
    {
67
        return $this->mean;
68
    }
69
70
    /**
71
     * Get displaName
72
     *
73
     * @return string
74
     */
75
    public function getDisplayName()
76
    {
77
        $displayName = '';
78
        if (!empty($this->getType()) && !empty($this->getType()->getName())) {
79
            $displayName = $this->getType()->getName();
80
        }
81
        if (!empty($this->getMean())) {
82
            if (!empty($displayName)) {
83
                $displayName .= ': ';
84
            }
85
            $displayName .= $this->getMean();
86
        }
87
88
        return $displayName;
89
    }
90
91
    /**
92
     * Set client
93
     *
94
     * @param \ClientBundle\Entity\Client $client
95
     *
96
     * @return Contact
97
     */
98
    public function setClient(\ClientBundle\Entity\Client $client = null)
99
    {
100
        $this->client = $client;
101
102
        return $this;
103
    }
104
105
    /**
106
     * Get client
107
     *
108
     * @return \ClientBundle\Entity\Client
109
     */
110
    public function getClient()
111
    {
112
        return $this->client;
113
    }
114
115
    /**
116
     * Set type
117
     *
118
     * @param \ClientBundle\Entity\ContactType $type
119
     *
120
     * @return Contact
121
     */
122
    public function setType(\ClientBundle\Entity\ContactType $type = null)
123
    {
124
        $this->type = $type;
125
126
        return $this;
127
    }
128
129
    /**
130
     * Get type
131
     *
132
     * @return \ClientBundle\Entity\ContactType
133
     */
134
    public function getType()
135
    {
136
        return $this->type;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function __toString()
143
    {
144
        return (string) $this->getDisplayName();
145
    }
146
}
147