1 <?php
2 /* --------------------------------------------------------------
3 CustomerCountry.inc.php 2015-02-18 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 MainFactory::load_class('CustomerCountryInterface');
13
14 /**
15 * Class CustomerCountry
16 *
17 * This class is used for getting customer country data
18 *
19 * @category System
20 * @package Customer
21 * @subpackage Country
22 * @implements CustomerCountryInterface
23 */
24 class CustomerCountry implements CustomerCountryInterface
25 {
26 /**
27 * @var int
28 */
29 protected $id;
30 /**
31 * @var CustomerCountryNameInterface
32 */
33 protected $name;
34 /**
35 * @var CustomerCountryIso2Interface
36 */
37 protected $iso2;
38 /**
39 * @var CustomerCountryIso3Interface
40 */
41 protected $iso3;
42 /**
43 * @var IdType
44 */
45 protected $addressFormatId;
46 /**
47 * @var bool
48 */
49 protected $status;
50
51 /**
52 * Constructor of the class CustomerCountry
53 *
54 * @param IdType $id
55 * @param CustomerCountryNameInterface $name
56 * @param CustomerCountryIso2Interface $iso2
57 * @param CustomerCountryIso3Interface $iso3
58 * @param IdType $addressFormatId
59 * @param bool $p_status
60 *
61 * @throws InvalidArgumentException if argument does not match the expected type
62 */
63 public function __construct(IdType $id,
64 CustomerCountryNameInterface $name,
65 CustomerCountryIso2Interface $iso2,
66 CustomerCountryIso3Interface $iso3,
67 IdType $addressFormatId,
68 $p_status)
69 {
70 if(!is_bool($p_status))
71 {
72 throw new InvalidArgumentException('$p_status is not a boolean');
73 }
74
75 $this->id = (int)(string)$id;
76 $this->name = $name;
77 $this->iso2 = $iso2;
78 $this->iso3 = $iso3;
79 $this->addressFormatId = $addressFormatId;
80 $this->status = (bool)$p_status;
81 }
82
83
84 /**
85 * Getter method for the country ID
86 *
87 * @return int countryId
88 */
89 public function getId()
90 {
91 return (int)$this->id;
92 }
93
94
95 /**
96 * Getter method for the country name
97 *
98 * @return CustomerCountryNameInterface country name
99 */
100 public function getName()
101 {
102 return $this->name;
103 }
104
105
106 /**
107 * Getter Method for the ISO2 code of the country
108 *
109 * @return CustomerCountryIso2Interface ISO2 code
110 */
111 public function getIso2()
112 {
113 return $this->iso2;
114 }
115
116
117 /**
118 * Getter Method for the ISO3 code of the country
119 *
120 * @return CustomerCountryIso3Interface ISO3 code
121 */
122 public function getIso3()
123 {
124 return $this->iso3;
125 }
126
127
128 /**
129 * Getter method for the address format of the country
130 *
131 * @return IdType address format id
132 */
133 public function getAddressFormatId()
134 {
135 return $this->addressFormatId;
136 }
137
138
139 /**
140 * Getter method for the Status of the country
141 *
142 * @return bool country active status
143 */
144 public function getStatus()
145 {
146 return $this->status;
147 }
148 }