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

FrontendRequests::requestHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\handlers\frontend;
4
5
use EE_Dependency_Map;
6
7
/**
8
 * Class FrontendRequests
9
 * registers dependencies and loads resources for all non-authorized standard HTTP requests
10
 *
11
 * @package EventEspresso\core\domain\entities\routing\handlers\frontend
12
 * @author  Brent Christensen
13
 * @since   $VID:$
14
 */
15
class FrontendRequests extends PublicRoute
16
{
17
18
19
    /**
20
     * returns true if the current request matches this route
21
     * child classes can override and use Request directly to match route with request
22
     * or supply a RouteMatchSpecification class and just use the below
23
     *
24
     * @return bool
25
     * @since   $VID:$
26
     */
27
    public function matchesCurrentRequest()
28
    {
29
        return ($this->request->isFrontend() || $this->request->isFrontAjax()) && ! $this->maintenance_mode->level();
30
    }
31
32
33
    /**
34
     * @since $VID:$
35
     */
36
    protected function registerDependencies()
37
    {
38
        $this->dependency_map->registerDependencies(
39
            'EE_Front_Controller',
40
            [
41
                'EE_Registry'              => EE_Dependency_Map::load_from_cache,
42
                'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
43
                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
44
            ]
45
        );
46
    }
47
48
49
    /**
50
     * implements logic required to run during request
51
     *
52
     * @return bool
53
     * @since   $VID:$
54
     */
55
    protected function requestHandler()
56
    {
57
        do_action('AHEE__EE_System__load_controllers__load_front_controllers');
58
        $this->loader->getShared('EE_Front_Controller');
59
        return true;
60
    }
61
}
62