1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\entities\routing\data_nodes\core; |
4
|
|
|
|
5
|
|
|
use EE_Currency_Config; |
6
|
|
|
use EventEspresso\core\services\json\JsonDataNode; |
7
|
|
|
use EventEspresso\core\services\json\JsonDataNodeValidator; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class SiteCurrency |
11
|
|
|
* Description |
12
|
|
|
* |
13
|
|
|
* @package EventEspresso\core\domain\entities\routing\data_nodes |
14
|
|
|
* @author Brent Christensen |
15
|
|
|
* @since $VID:$ |
16
|
|
|
*/ |
17
|
|
|
class SiteCurrency extends JsonDataNode |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
const NODE_NAME = 'siteCurrency'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var EE_Currency_Config $currency_config |
24
|
|
|
*/ |
25
|
|
|
protected $currency_config; |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* SiteCurrency constructor. |
30
|
|
|
* |
31
|
|
|
* @param EE_Currency_Config $currency_config |
32
|
|
|
* @param JsonDataNodeValidator $validator |
33
|
|
|
*/ |
34
|
|
|
public function __construct(EE_Currency_Config $currency_config, JsonDataNodeValidator $validator) |
35
|
|
|
{ |
36
|
|
|
parent::__construct($validator); |
37
|
|
|
$this->currency_config = $currency_config; |
38
|
|
|
$this->setNodeName(SiteCurrency::NODE_NAME); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @inheritDoc |
44
|
|
|
*/ |
45
|
|
|
public function initialize() |
46
|
|
|
{ |
47
|
|
|
$this->addData('code', $this->currency_config->code); |
48
|
|
|
$this->addData('singularLabel', $this->currency_config->name); |
49
|
|
|
$this->addData('pluralLabel', $this->currency_config->plural); |
50
|
|
|
$this->addData('sign', $this->currency_config->sign); |
51
|
|
|
$this->addData('signB4', $this->currency_config->sign_b4); |
52
|
|
|
$this->addData('decimalPlaces', $this->currency_config->dec_plc); |
53
|
|
|
$this->addData('decimalMark', $this->currency_config->dec_mrk); |
54
|
|
|
$this->addData('thousandsSeparator', $this->currency_config->thsnds); |
55
|
|
|
$this->setInitialized(true); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|