Completed
Pull Request — master (#144)
by
unknown
12:31
created

CustomerResponse::setCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace AppBundle\Model;
4
5
use AppBundle\Entity\Customer;
6
use JMS\Serializer\Annotation\Accessor;
7
use JMS\Serializer\Annotation\ExclusionPolicy;
8
use JMS\Serializer\Annotation\Expose;
9
use JMS\Serializer\Annotation\Type;
10
11
/**
12
 * @ExclusionPolicy("all")
13
 */
14
class CustomerResponse
15
{
16
    /**
17
     * @var Customer
18
     *
19
     * @Type("AppBundle\Entity\Customer")
20
     * @Expose
21
     */
22
    protected $customer;
23
24
    /**
25
     * @var string
26
     *
27
     * @Type("string")
28
     * @Accessor(getter="getApiKey")
29
     * @Expose
30
     */
31
    protected $apiKey;
32
33
    /**
34
     * @param Customer $customer
35
     */
36
    public function __construct($customer)
37
    {
38
        $this->customer = $customer;
39
    }
40
41
    /**
42
     * @return Customer
43
     */
44
    public function getCustomer()
45
    {
46
        return $this->customer;
47
    }
48
49
    /**
50
     * @param  Customer $customer
51
     * @return $this
52
     */
53
    public function setCustomer($customer)
54
    {
55
        $this->customer = $customer;
56
57
        return $this;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getApiKey()
64
    {
65
        return $this->getCustomer()->getApiKey();
66
    }
67
}
68