1 <?php
2 /* --------------------------------------------------------------
3 CustomerB2BStatus.inc.php 2015-07-22 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('CustomerB2BStatusInterface');
13
14 /**
15 * Class CustomerB2BStatus
16 *
17 * @category System
18 * @package Customer
19 * @subpackage ValueObjects
20 */
21 class CustomerB2BStatus implements CustomerB2BStatusInterface
22 {
23 /**
24 * Customer's B2B status.
25 * @var bool
26 */
27 protected $status;
28
29
30 /**
31 * CustomerB2BStatus constructor.
32 *
33 * @param bool $p_status Customer's B2B status.
34 * @throws InvalidArgumentException On invalid argument type.
35 */
36 public function __construct($p_status)
37 {
38 if(!is_bool($p_status))
39 {
40 throw new InvalidArgumentException('$p_status (' . gettype($p_status) . ') is not a boolean');
41 }
42
43 $this->status = $p_status;
44 }
45
46
47 /**
48 * Returns the status.
49 * @return bool Customer B2B status.
50 */
51 public function getStatus()
52 {
53 return $this->status;
54 }
55
56
57 /**
58 * Returns the equivalent string value.
59 * @return string Equivalent string value.
60 */
61 public function __toString()
62 {
63 return (string)(int)$this->status;
64 }
65 }
66