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

WordPressHeartbeat   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesCurrentRequest() 0 4 1
A registerDependencies() 0 17 1
A requestHandler() 0 5 1
1
<?php
2
3
namespace EventEspresso\core\domain\entities\routing\handlers\shared;
4
5
use EE_Dependency_Map;
6
use EventEspresso\core\domain\entities\routing\handlers\Route;
7
8
/**
9
 * Class WordPressHeartbeat
10
 * registers dependencies and loads resources for handling WordPress Heartbeat requests
11
 *
12
 * @package \EventEspresso\core\domain\entities\routing\handlers\shared
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16
class WordPressHeartbeat 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->isWordPressHeartbeat();
28
    }
29
30
31
    /**
32
     * @since $VID:$
33
     */
34
    protected function registerDependencies()
35
    {
36
        $this->dependency_map->registerDependencies(
37
            'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat',
38
            [
39
                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
40
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
41
            ]
42
        );
43
        $this->dependency_map->registerDependencies(
44
            'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat',
45
            [
46
                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
47
                'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
48
            ]
49
        );
50
    }
51
52
53
    /**
54
     * implements logic required to run during request
55
     *
56
     * @return bool
57
     * @since   $VID:$
58
     */
59
    protected function requestHandler()
60
    {
61
        $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat');
62
        return true;
63
    }
64
}
65