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

PersonalDataRequests::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 9
rs 9.9666
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\frontend\PublicRoute;
7
8
/**
9
 * Class PersonalDataRequests
10
 * loads resources and dependencies required for user privacy related logic
11
 *
12
 * @package EventEspresso\core\domain\entities\routing\handlers\admin
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16
class PersonalDataRequests extends PublicRoute
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() || $this->request->isAjax()) && $this->maintenance_mode->models_can_query();
28
    }
29
30
31
    /**
32
     * @since $VID:$
33
     */
34
    protected function registerDependencies()
35
    {
36
        $this->dependency_map->registerDependencies(
37
            'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy',
38
            [
39
                'EEM_Payment_Method'                                       => EE_Dependency_Map::load_from_cache,
40
                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache
41
            ]
42
        );
43
        $this->dependency_map->registerDependencies(
44
            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee',
45
            ['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
46
        );
47
        $this->dependency_map->registerDependencies(
48
            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData',
49
            [
50
                'EEM_Attendee'       => EE_Dependency_Map::load_from_cache,
51
                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache
52
            ]
53
        );
54
        $this->dependency_map->registerDependencies(
55
            'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins',
56
            ['EEM_Checkin' => EE_Dependency_Map::load_from_cache]
57
        );
58
        $this->dependency_map->registerDependencies(
59
            'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration',
60
            ['EEM_Registration' => EE_Dependency_Map::load_from_cache]
61
        );
62
        $this->dependency_map->registerDependencies(
63
            'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction',
64
            ['EEM_Transaction' => EE_Dependency_Map::load_from_cache]
65
        );
66
        $this->dependency_map->registerDependencies(
67
            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData',
68
            ['EEM_Attendee' => EE_Dependency_Map::load_from_cache]
69
        );
70
        $this->dependency_map->registerDependencies(
71
            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers',
72
            [
73
                'EEM_Answer'   => EE_Dependency_Map::load_from_cache,
74
                'EEM_Question' => EE_Dependency_Map::load_from_cache,
75
            ]
76
        );
77
        $this->dependency_map->registerDependencies(
78
            'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler',
79
            [
80
                'EE_Registry' => EE_Dependency_Map::load_from_cache,
81
                'EE_Config'   => EE_Dependency_Map::load_from_cache
82
            ]
83
        );
84
    }
85
86
87
    /**
88
     * implements logic required to run during request
89
     *
90
     * @return bool
91
     * @since   $VID:$
92
     */
93
    protected function requestHandler()
94
    {
95
        $this->loader->getShared('EventEspresso\core\services\privacy\erasure\PersonalDataEraserManager');
96
        $this->loader->getShared('EventEspresso\core\services\privacy\export\PersonalDataExporterManager');
97
        return true;
98
    }
99
}
100