Completed
Push — master ( c73ac3...acbb41 )
by Serhii
34:37 queued 19:37
created

CustomerResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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