CountryMapping::setSource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Loevgaard\PakkelabelsBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
/**
10
 * This entity maps any (country) string to an ISO 3166 Alpha 2 country code.
11
 *
12
 * @ORM\Entity
13
 * @ORM\Table(name="pakkelabels_country_mapping")
14
 * @UniqueEntity("source")
15
 */
16
class CountryMapping
17
{
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Id
22
     * @ORM\GeneratedValue
23
     * @ORM\Column(type="integer")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     *
30
     * @Assert\NotBlank()
31
     *
32
     * @ORM\Column(type="string", unique=true)
33
     */
34
    protected $source;
35
36
    /**
37
     * ISO3166 country code.
38
     *
39
     * @var string
40
     *
41
     * @Assert\NotBlank()
42
     * @Assert\Country()
43
     *
44
     * @ORM\Column(type="string", length=2)
45
     */
46
    protected $countryCode;
47
48
    /**
49
     * @return int
50
     */
51
    public function getId(): ?int
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * @param int $id
58
     *
59
     * @return CountryMapping
60
     */
61
    public function setId(int $id): CountryMapping
62
    {
63
        $this->id = $id;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getSource(): ?string
72
    {
73
        return $this->source;
74
    }
75
76
    /**
77
     * @param string $source
78
     *
79
     * @return CountryMapping
80
     */
81
    public function setSource(string $source): CountryMapping
82
    {
83
        $this->source = $source;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return string
90
     */
91
    public function getCountryCode(): ?string
92
    {
93
        return $this->countryCode;
94
    }
95
96
    /**
97
     * @param string $countryCode
98
     *
99
     * @return CountryMapping
100
     */
101
    public function setCountryCode(string $countryCode): CountryMapping
102
    {
103
        $this->countryCode = $countryCode;
104
105
        return $this;
106
    }
107
}
108