Completed
Pull Request — master (#137)
by
unknown
14:03
created

CustomerRequest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 154
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 154
rs 10
wmc 8
lcom 0
cbo 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstName() 0 4 1
A getLastName() 0 4 1
A getEmail() 0 4 1
A getSocialNetwork() 0 4 1
A getSocialNetworks() 0 6 1
A getSocialToken() 0 4 1
A setApiKey() 0 6 1
A getApiKey() 0 4 1
1
<?php
2
3
namespace AppBundle\Model;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use JMS\Serializer\Annotation as Serializer;
7
use Symfony\Component\Validator\Constraints as Assert;
8
use JMS\Serializer\Annotation\Accessor;
9
use JMS\Serializer\Annotation\ExclusionPolicy;
10
use JMS\Serializer\Annotation\Expose;
11
use JMS\Serializer\Annotation\Type;
12
13
/**
14
 * @ExclusionPolicy("all")
15
 */
16
class CustomerRequest
17
{
18
    const SOCIAL_NETWORK_FACEBOOK = 'facebook';
19
20
    /**
21
     * @var string
22
     * @Type("string")
23
     * @Accessor(getter="getFirstName")
24
     * @Assert\Regex(pattern="/\d/", match=false, groups={"update"})
25
     * @Assert\Type("string", groups={"update"})
26
     * @Assert\Length(min=2, max=100, groups={"update"})
27
     * @Assert\NotBlank(
28
     *     message="not.blank", groups={"update"}
29
     * )
30
     * @Expose
31
     */
32
    protected $firstName;
33
34
    /**
35
     * @var string
36
     * @Type("string")
37
     * @Accessor(getter="getLastName")
38
     * @Assert\Regex(pattern="/\d/", match=false, groups={"update"})
39
     * @Assert\Type("string", groups={"update"})
40
     * @Assert\Length(min=2, max=100, groups={"update"})
41
     * @Assert\NotBlank(
42
     *     message="not.blank", groups={"update"}
43
     * )
44
     * @Expose
45
     */
46
    protected $lastName;
47
48
    /**
49
     * @var string
50
     * @Type("string")
51
     * @Accessor(getter="getEmail")
52
     * @Assert\Email(groups={"update"})
53
     * @Assert\Type("string", groups={"update"})
54
     * @Assert\Length(max=100, groups={"update"})
55
     * @Assert\NotBlank(
56
     *     message="not.blank", groups={"update"}
57
     * )
58
     * @Expose
59
     */
60
    protected $email;
61
62
    /**
63
     * @var string
64
     *
65
     * @Type("string")
66
     * @Accessor(getter="getApiKey")
67
     * @Expose
68
     */
69
    protected $apiKey;
70
71
    /**
72
     * @var string
73
     *
74
     * @Type("string")
75
     * @Accessor(getter="getSocialNetwork")
76
     * @Assert\NotBlank(groups={"socialNetwork"})
77
     * @Assert\Choice(callback="getSocialNetworks", groups={"socialNetwork"})
78
     * @Expose
79
     */
80
    protected $socialNetwork;
81
82
    /**
83
     * @var string
84
     *
85
     * @Type("string")
86
     * @Accessor(getter="getSocialToken")
87
     * @Assert\NotBlank(groups={"socialNetwork"})
88
     * @Expose
89
     */
90
    protected $socialToken;
91
92
    /**
93
     * Get firstName.
94
     *
95
     * @return string
96
     */
97
    public function getFirstName()
98
    {
99
        return $this->firstName;
100
    }
101
102
    /**
103
     * Get lastName.
104
     *
105
     * @return string
106
     */
107
    public function getLastName()
108
    {
109
        return $this->lastName;
110
    }
111
112
    /**
113
     * Get email.
114
     *
115
     * @return string
116
     */
117
    public function getEmail()
118
    {
119
        return $this->email;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function getSocialNetwork()
126
    {
127
        return $this->socialNetwork;
128
    }
129
130
    /**
131
     * @return array
132
     */
133
    public static function getSocialNetworks()
134
    {
135
        return [
136
            self::SOCIAL_NETWORK_FACEBOOK,
137
        ];
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getSocialToken()
144
    {
145
        return $this->socialToken;
146
    }
147
148
    /**
149
     * Set apiKey.
150
     *
151
     * @param string $apiKey
152
     *
153
     * @return mixed
154
     */
155
    public function setApiKey($apiKey)
156
    {
157
        $this->apiKey = $apiKey;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @return string
164
     */
165
    public function getApiKey()
166
    {
167
        return $this->apiKey;
168
    }
169
}
170