Client   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 52%

Importance

Changes 5
Bugs 1 Features 3
Metric Value
wmc 9
c 5
b 1
f 3
lcom 1
cbo 2
dl 0
loc 118
ccs 13
cts 25
cp 0.52
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A setFirstName() 0 5 1
A getFirstName() 0 4 1
A setLastName() 0 5 1
A getLastName() 0 4 1
A addOrder() 0 6 1
A removeOrder() 0 5 1
A getOrders() 0 4 1
1
<?php
2
namespace Test\TestBundle\Document;
3
4
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
5
use Tpg\ExtjsBundle\Annotation as Extjs;
6
use JMS\Serializer\Annotation as JMS;
7
8
/**
9
 * @Extjs\Model(name="Test.document.Client")
10
 * @ODM\Document(collection="client")
11
 */
12
class Client {
13
    /**
14
     * @ODM\Id
15
     * @JMS\Type("string")
16
     */
17
    protected $id;
18
19
    /**
20
     * @ODM\Field(type="string")
21
     * @JMS\Type("string")
22
     */
23
    protected $firstName;
24
25
    /**
26
     * @ODM\String
27
     * @JMS\Type("string")
28
     */
29
    protected $lastName;
30
31
    /**
32
     * @ODM\ReferenceMany(targetDocument="Test\TestBundle\Document\Order", mappedBy="client")
33
     */
34
    protected $orders;
35
36 25
    public function __construct()
37
    {
38 25
        $this->orders = new \Doctrine\Common\Collections\ArrayCollection();
39 25
    }
40
    
41
    /**
42
     * Get id
43
     *
44
     * @return id $id
45
     */
46 4
    public function getId()
47
    {
48 4
        return $this->id;
49
    }
50
51
    /**
52
     * Set firstName
53
     *
54
     * @param string $firstName
55
     * @return self
56
     */
57 25
    public function setFirstName($firstName)
58
    {
59 25
        $this->firstName = $firstName;
60 25
        return $this;
61
    }
62
63
    /**
64
     * Get firstName
65
     *
66
     * @return string $firstName
67
     */
68 1
    public function getFirstName()
69
    {
70 1
        return $this->firstName;
71
    }
72
73
    /**
74
     * Set lastName
75
     *
76
     * @param string $lastName
77
     * @return self
78
     */
79 25
    public function setLastName($lastName)
80
    {
81 25
        $this->lastName = $lastName;
82 25
        return $this;
83
    }
84
85
    /**
86
     * Get lastName
87
     *
88
     * @return string $lastName
89
     */
90
    public function getLastName()
91
    {
92
        return $this->lastName;
93
    }
94
95
    /**
96
     * Add orders
97
     *
98
     * @param Test\TestBundle\Document\Order $orders
99
     *
100
     * @return $this
101
     */
102
    public function addOrder(\Test\TestBundle\Document\Order $orders)
103
    {
104
        $this->orders[] = $orders;
105
        $orders->setClient($this);
106
        return $this;
107
    }
108
109
    /**
110
     * Remove orders
111
     *
112
     * @param Test\TestBundle\Document\Order $orders
113
     */
114
    public function removeOrder(\Test\TestBundle\Document\Order $orders)
115
    {
116
        $this->orders->removeElement($orders);
117
        $orders->setClient(null);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<Test\TestBundle\Document\Client>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
118
    }
119
120
    /**
121
     * Get orders
122
     *
123
     * @return Doctrine\Common\Collections\Collection $orders
124
     */
125
    public function getOrders()
126
    {
127
        return $this->orders;
128
    }
129
}
130