Completed
Branch EDTR/master (810f49)
by
unknown
28:59 queued 20:31
created

EspressoEventEditor::matchesCurrentRequest()   A

Complexity

Conditions 6
Paths 9

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
nc 9
nop 0
dl 0
loc 12
rs 9.2222
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\handlers\admin;
4
5
use EE_Dependency_Map;
6
use EventEspresso\core\domain\entities\routing\handlers\Route;
7
8
/**
9
 * Class EspressoEventEditor
10
 * detects and executes logic for the Event Espresso Event Editor
11
 *
12
 * @package EventEspresso\core\domain\entities\routing\admin
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16
class EspressoEventEditor extends Route
17
{
18
19
    /**
20
     * returns true if the current request matches this route
21
     *
22
     * @return bool
23
     * @since   $VID:$
24
     */
25
    public function matchesCurrentRequest()
26
    {
27
        global $pagenow;
28
        return $pagenow
29
               && $pagenow === 'admin.php'
30
               && $this->request->isAdmin()
31
               && $this->request->getRequestParam('page') === 'espresso_events'
32
               && (
33
                   $this->request->getRequestParam('action') === 'create_new'
34
                   || $this->request->getRequestParam('action') === 'edit'
35
               );
36
    }
37
38
39
    /**
40
     * @since $VID:$
41
     */
42
    protected function registerDependencies()
43
    {
44
        $this->dependency_map->registerDependencies(
45
            'EventEspresso\core\domain\services\assets\EspressoEditorAssetManager',
46
            [
47
                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
48
                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
49
                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
50
            ]
51
        );
52
        $this->dependency_map->registerDependencies(
53
            'EventEspresso\core\domain\services\admin\events\editor\EventEditor',
54
            [
55
                'EE_Admin_Config'                                                               => EE_Dependency_Map::load_from_cache,
56
                'EE_Event'                                                                      => EE_Dependency_Map::not_registered,
57
                'EventEspresso\core\domain\entities\admin\GraphQLData\CurrentUser'              =>
58
                    EE_Dependency_Map::not_registered,
59
                'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' =>
60
                    EE_Dependency_Map::load_from_cache,
61
                'EventEspresso\core\domain\entities\admin\GraphQLData\GeneralSettings'          =>
62
                    EE_Dependency_Map::load_from_cache,
63
                'EventEspresso\core\services\assets\JedLocaleData'                              => EE_Dependency_Map::load_from_cache,
64
            ]
65
        );
66
        $this->dependency_map->registerDependencies(
67
            'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection',
68
            ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache]
69
        );
70
        $this->dependency_map->registerDependencies(
71
            'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData',
72
            [
73
                'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes'                 => EE_Dependency_Map::load_from_cache,
74
                'EventEspresso\core\domain\entities\admin\GraphQLData\Prices'                    => EE_Dependency_Map::load_from_cache,
75
                'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes'                => EE_Dependency_Map::load_from_cache,
76
                'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets'                   => EE_Dependency_Map::load_from_cache,
77
                'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache,
78
                'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations'    => EE_Dependency_Map::load_from_cache,
79
            ]
80
        );
81
        $this->dependency_map->registerDependencies(
82
            'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations',
83
            [
84
                'EEM_Datetime'   => EE_Dependency_Map::load_from_cache,
85
                'EEM_Event'      => EE_Dependency_Map::load_from_cache,
86
                'EEM_Price'      => EE_Dependency_Map::load_from_cache,
87
                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
88
                'EEM_Ticket'     => EE_Dependency_Map::load_from_cache,
89
            ]
90
        );
91
        $this->dependency_map->registerDependencies(
92
            'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities',
93
            [
94
                'EEM_Datetime'                                                       => EE_Dependency_Map::load_from_cache,
95
                'EEM_Event'                                                          => EE_Dependency_Map::load_from_cache,
96
                'EEM_Price'                                                          => EE_Dependency_Map::load_from_cache,
97
                'EEM_Price_Type'                                                     => EE_Dependency_Map::load_from_cache,
98
                'EEM_Ticket'                                                         => EE_Dependency_Map::load_from_cache,
99
                'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache,
100
            ]
101
        );
102
        $this->dependency_map->registerDependencies(
103
            'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes',
104
            [
105
                'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache,
106
                'EEM_Datetime'                                                     => EE_Dependency_Map::load_from_cache,
107
            ]
108
        );
109
        $this->dependency_map->registerDependencies(
110
            'EventEspresso\core\domain\services\admin\entities\DefaultTickets',
111
            [
112
                'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache,
113
                'EEM_Ticket'                                                      => EE_Dependency_Map::load_from_cache,
114
            ]
115
        );
116
        $this->dependency_map->registerDependencies(
117
            'EventEspresso\core\domain\services\admin\entities\DefaultPrices',
118
            [
119
                'EEM_Price'      => EE_Dependency_Map::load_from_cache,
120
                'EEM_Price_Type' => EE_Dependency_Map::load_from_cache,
121
            ]
122
        );
123
    }
124
125
126
    /**
127
     * implements logic required to run during request
128
     *
129
     * @return bool
130
     * @since   $VID:$
131
     */
132
    protected function requestHandler()
133
    {
134
        return false;
135
    }
136
}
137