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

PueRequests   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 4
lcom 3
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesCurrentRequest() 0 4 2
A registerDependencies() 0 37 1
A requestHandler() 0 7 1
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 PueRequests
10
 * loads resources for PUE
11
 *
12
 * @package EventEspresso\core\domain\entities\routing\handlers\admin
13
 * @author  Brent Christensen
14
 * @since   \$VID:$
15
 */
16
class PueRequests 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
        return $this->request->isAdmin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true);
28
    }
29
30
31
    /**
32
     * @since $VID:$
33
     */
34
    protected function registerDependencies()
35
    {
36
        $this->dependency_map->registerDependencies(
37
            'EventEspresso\core\services\licensing\LicenseService',
38
            [
39
                'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
40
                'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
41
            ]
42
        );
43
        $this->dependency_map->registerDependencies(
44
            'EventEspresso\core\domain\services\pue\Stats',
45
            [
46
                'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
47
                'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
48
                'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
49
            ]
50
        );
51
        $this->dependency_map->registerDependencies(
52
            'EventEspresso\core\domain\services\pue\Config',
53
            [
54
                'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
55
                'EE_Config'         => EE_Dependency_Map::load_from_cache,
56
            ]
57
        );
58
        $this->dependency_map->registerDependencies(
59
            'EventEspresso\core\domain\services\pue\StatsGatherer',
60
            [
61
                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
62
                'EEM_Event'          => EE_Dependency_Map::load_from_cache,
63
                'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
64
                'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
65
                'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
66
                'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
67
                'EE_Config'          => EE_Dependency_Map::load_from_cache,
68
            ]
69
        );
70
    }
71
72
73
    /**
74
     * implements logic required to run during request
75
     *
76
     * @return bool
77
     * @since   $VID:$
78
     */
79
    protected function requestHandler()
80
    {
81
        // pew pew pew
82
        $this->loader->getShared('EventEspresso\core\services\licensing\LicenseService');
83
        do_action('AHEE__EE_System__brew_espresso__after_pue_init');
84
        return true;
85
    }
86
}
87