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

Config::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\data_nodes\core;
4
5
use DomainException;
6
use EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser;
7
use EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain;
8
use EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings;
9
use EventEspresso\core\domain\entities\routing\data_nodes\core\Locale;
10
use EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency;
11
use EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls;
12
use EventEspresso\core\services\json\JsonDataNode;
13
use EventEspresso\core\services\json\JsonDataNodeValidator;
14
15
/**
16
 * Class Config
17
 * Description
18
 *
19
 * @package EventEspresso\core\domain\entities\routing\data_nodes
20
 * @author  Brent Christensen
21
 * @since   $VID:$
22
 */
23
class Config extends JsonDataNode
24
{
25
26
    const NODE_NAME = 'config';
27
28
    /**
29
     * @var CurrentUser $current_user
30
     */
31
    private $current_user;
32
33
    /**
34
     * @var EspressoCoreDomain $core_domain
35
     */
36
    private $core_domain;
37
38
    /**
39
     * @var GeneralSettings $general_settings
40
     */
41
    private $general_settings;
42
43
    /**
44
     * @var Locale $locale
45
     */
46
    private $locale;
47
48
    /**
49
     * @var SiteCurrency $site_currency
50
     */
51
    private $site_currency;
52
53
    /**
54
     * @var SiteUrls $site_urls
55
     */
56
    private $site_urls;
57
58
59
    /**
60
     * JsonDataNode constructor.
61
     *
62
     * @param CurrentUser        $current_user
63
     * @param EspressoCoreDomain $core_domain
64
     * @param GeneralSettings    $general_settings
65
     * @param Locale $locale
66
     * @param SiteCurrency $site_currency
67
     * @param SiteUrls $site_urls
68
     * @param JsonDataNodeValidator $validator
69
     */
70
    public function __construct(
71
        CurrentUser $current_user,
72
        EspressoCoreDomain $core_domain,
73
        GeneralSettings $general_settings,
74
        Locale $locale,
75
        SiteCurrency $site_currency,
76
        SiteUrls $site_urls,
77
        JsonDataNodeValidator $validator
78
    ) {
79
        parent::__construct($validator);
80
        $this->current_user = $current_user;
81
        $this->core_domain = $core_domain;
82
        $this->general_settings = $general_settings;
83
        $this->locale = $locale;
84
        $this->site_currency = $site_currency;
85
        $this->site_urls = $site_urls;
86
        $this->setNodeName(Config::NODE_NAME);
87
    }
88
89
90
    /**
91
     * @throws DomainException
92
     * @since $VID:$
93
     */
94
    public function initialize()
95
    {
96
        $this->addDataNode($this->core_domain);
97
        $this->addDataNode($this->site_currency);
98
        $this->addDataNode($this->current_user);
99
        $this->addDataNode($this->general_settings);
100
        $this->addDataNode($this->locale);
101
        $this->addDataNode($this->site_urls);
102
        $this->setInitialized(true);
103
    }
104
}
105