Completed
Branch EDTR/master (83b47e)
by
unknown
25:37 queued 16:41
created

SiteCurrency   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A initialize() 0 12 1
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