Completed
Branch EDTR/master (6a4cc7)
by
unknown
43:17 queued 35:24
created
core/domain/entities/routing/handlers/Route.php 2 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -23,133 +23,133 @@
 block discarded – undo
23 23
 abstract class Route implements RouteInterface
24 24
 {
25 25
 
26
-    // /** will most likely need this for routing so pencilled it in for now
27
-    //  * @type CommandBusInterface $command_bus
28
-    //  */
29
-    // protected $command_bus;
30
-
31
-    /**
32
-     * @var EE_Dependency_Map $dependency_map
33
-     */
34
-    protected $dependency_map;
35
-
36
-    /**
37
-     * @var LoaderInterface $loader
38
-     */
39
-    protected $loader;
40
-
41
-    /**
42
-     * @var RequestInterface $request
43
-     */
44
-    protected $request;
45
-
46
-    /**
47
-     * @var RouteMatchSpecificationInterface $specification
48
-     */
49
-    private $specification;
50
-
51
-    /**
52
-     * @var boolean $handled
53
-     */
54
-    private $handled = false;
55
-
56
-
57
-    /**
58
-     * Route constructor.
59
-     *
60
-     * @param EE_Dependency_Map                $dependency_map
61
-     * @param LoaderInterface                  $loader
62
-     * @param RequestInterface                 $request
63
-     * @param RouteMatchSpecificationInterface $specification
64
-     */
65
-    public function __construct(
66
-        EE_Dependency_Map $dependency_map,
67
-        LoaderInterface $loader,
68
-        RequestInterface $request,
69
-        RouteMatchSpecificationInterface $specification = null
70
-    ) {
71
-        $this->dependency_map = $dependency_map;
72
-        $this->loader = $loader;
73
-        $this->request = $request;
74
-        $this->specification = $specification;
75
-    }
76
-
77
-
78
-    /**
79
-     * @since $VID:$
80
-     */
81
-    abstract protected function registerDependencies();
82
-
83
-
84
-    /**
85
-     * implements logic required to run during request
86
-     *
87
-     * @return bool
88
-     * @since   $VID:$
89
-     */
90
-    abstract protected function requestHandler();
91
-
92
-
93
-    /**
94
-     * returns true if the current request matches this route
95
-     * child classes can override and use Request directly to match route with request
96
-     * or supply a RouteMatchSpecification class and just use the below
97
-     *
98
-     * @return bool
99
-     * @since   $VID:$
100
-     */
101
-    public function matchesCurrentRequest()
102
-    {
103
-        return $this->specification instanceof RouteMatchSpecificationInterface
104
-            ? $this->specification->isMatchingRoute()
105
-            : false;
106
-    }
107
-
108
-
109
-    /**
110
-     * @return bool
111
-     */
112
-    final public function isHandled()
113
-    {
114
-        return $this->handled;
115
-    }
116
-
117
-
118
-    /**
119
-     * @param bool $handled
120
-     */
121
-    private function setHandled($handled)
122
-    {
123
-        $this->handled = filter_var($handled, FILTER_VALIDATE_BOOLEAN);
124
-    }
125
-
126
-
127
-    /**
128
-     * runs route requestHandler() if
129
-     *      - route has not previously been handled
130
-     *      - route specification matches for current request
131
-     * sets route handled property based on results returned by requestHandler()
132
-     *
133
-     * @return bool
134
-     * @throws DomainException
135
-     * @since   $VID:$
136
-     */
137
-    final public function handleRequest()
138
-    {
139
-        if (! $this->isHandled() && $this->matchesCurrentRequest()) {
140
-            do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this);
141
-            $this->registerDependencies();
142
-            $handled = $this->requestHandler();
143
-            if (! is_bool($handled)) {
144
-                throw new DomainException(
145
-                    esc_html__(
146
-                        'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.',
147
-                        'event_espresso'
148
-                    )
149
-                );
150
-            }
151
-            $this->setHandled($handled);
152
-        }
153
-        return $this->handled;
154
-    }
26
+	// /** will most likely need this for routing so pencilled it in for now
27
+	//  * @type CommandBusInterface $command_bus
28
+	//  */
29
+	// protected $command_bus;
30
+
31
+	/**
32
+	 * @var EE_Dependency_Map $dependency_map
33
+	 */
34
+	protected $dependency_map;
35
+
36
+	/**
37
+	 * @var LoaderInterface $loader
38
+	 */
39
+	protected $loader;
40
+
41
+	/**
42
+	 * @var RequestInterface $request
43
+	 */
44
+	protected $request;
45
+
46
+	/**
47
+	 * @var RouteMatchSpecificationInterface $specification
48
+	 */
49
+	private $specification;
50
+
51
+	/**
52
+	 * @var boolean $handled
53
+	 */
54
+	private $handled = false;
55
+
56
+
57
+	/**
58
+	 * Route constructor.
59
+	 *
60
+	 * @param EE_Dependency_Map                $dependency_map
61
+	 * @param LoaderInterface                  $loader
62
+	 * @param RequestInterface                 $request
63
+	 * @param RouteMatchSpecificationInterface $specification
64
+	 */
65
+	public function __construct(
66
+		EE_Dependency_Map $dependency_map,
67
+		LoaderInterface $loader,
68
+		RequestInterface $request,
69
+		RouteMatchSpecificationInterface $specification = null
70
+	) {
71
+		$this->dependency_map = $dependency_map;
72
+		$this->loader = $loader;
73
+		$this->request = $request;
74
+		$this->specification = $specification;
75
+	}
76
+
77
+
78
+	/**
79
+	 * @since $VID:$
80
+	 */
81
+	abstract protected function registerDependencies();
82
+
83
+
84
+	/**
85
+	 * implements logic required to run during request
86
+	 *
87
+	 * @return bool
88
+	 * @since   $VID:$
89
+	 */
90
+	abstract protected function requestHandler();
91
+
92
+
93
+	/**
94
+	 * returns true if the current request matches this route
95
+	 * child classes can override and use Request directly to match route with request
96
+	 * or supply a RouteMatchSpecification class and just use the below
97
+	 *
98
+	 * @return bool
99
+	 * @since   $VID:$
100
+	 */
101
+	public function matchesCurrentRequest()
102
+	{
103
+		return $this->specification instanceof RouteMatchSpecificationInterface
104
+			? $this->specification->isMatchingRoute()
105
+			: false;
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return bool
111
+	 */
112
+	final public function isHandled()
113
+	{
114
+		return $this->handled;
115
+	}
116
+
117
+
118
+	/**
119
+	 * @param bool $handled
120
+	 */
121
+	private function setHandled($handled)
122
+	{
123
+		$this->handled = filter_var($handled, FILTER_VALIDATE_BOOLEAN);
124
+	}
125
+
126
+
127
+	/**
128
+	 * runs route requestHandler() if
129
+	 *      - route has not previously been handled
130
+	 *      - route specification matches for current request
131
+	 * sets route handled property based on results returned by requestHandler()
132
+	 *
133
+	 * @return bool
134
+	 * @throws DomainException
135
+	 * @since   $VID:$
136
+	 */
137
+	final public function handleRequest()
138
+	{
139
+		if (! $this->isHandled() && $this->matchesCurrentRequest()) {
140
+			do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this);
141
+			$this->registerDependencies();
142
+			$handled = $this->requestHandler();
143
+			if (! is_bool($handled)) {
144
+				throw new DomainException(
145
+					esc_html__(
146
+						'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.',
147
+						'event_espresso'
148
+					)
149
+				);
150
+			}
151
+			$this->setHandled($handled);
152
+		}
153
+		return $this->handled;
154
+	}
155 155
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,11 +136,11 @@
 block discarded – undo
136 136
      */
137 137
     final public function handleRequest()
138 138
     {
139
-        if (! $this->isHandled() && $this->matchesCurrentRequest()) {
139
+        if ( ! $this->isHandled() && $this->matchesCurrentRequest()) {
140 140
             do_action('AHEE__EventEspresso_core_domain_entities_routes_handlers_Route__handleRequest', $this);
141 141
             $this->registerDependencies();
142 142
             $handled = $this->requestHandler();
143
-            if (! is_bool($handled)) {
143
+            if ( ! is_bool($handled)) {
144 144
                 throw new DomainException(
145 145
                     esc_html__(
146 146
                         'Route::requestHandler() must return a boolean to indicate whether the request has been handled or not.',
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/RouteInterface.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@
 block discarded – undo
14 14
 interface RouteInterface
15 15
 {
16 16
 
17
-    /**
18
-     * final method called by RouteHandler on Route which in turn calls requestHandler()
19
-     *
20
-     * @return bool
21
-     * @since   $VID:$
22
-     */
23
-    public function handleRequest();
17
+	/**
18
+	 * final method called by RouteHandler on Route which in turn calls requestHandler()
19
+	 *
20
+	 * @return bool
21
+	 * @since   $VID:$
22
+	 */
23
+	public function handleRequest();
24 24
 
25
-    /**
26
-     * @return bool
27
-     */
28
-    public function isHandled();
25
+	/**
26
+	 * @return bool
27
+	 */
28
+	public function isHandled();
29 29
 
30
-    /**
31
-     * returns true if the current request matches this route
32
-     *
33
-     * @return bool
34
-     * @since   $VID:$
35
-     */
36
-    public function matchesCurrentRequest();
30
+	/**
31
+	 * returns true if the current request matches this route
32
+	 *
33
+	 * @return bool
34
+	 * @since   $VID:$
35
+	 */
36
+	public function matchesCurrentRequest();
37 37
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/frontend/FrontendRequests.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -19,71 +19,71 @@
 block discarded – undo
19 19
 class FrontendRequests extends Route
20 20
 {
21 21
 
22
-    /**
23
-     * @var EE_Maintenance_Mode $maintenance_mode
24
-     */
25
-    private $maintenance_mode;
22
+	/**
23
+	 * @var EE_Maintenance_Mode $maintenance_mode
24
+	 */
25
+	private $maintenance_mode;
26 26
 
27 27
 
28
-    /**
29
-     * returns true if the current request matches this route
30
-     * child classes can override and use Request directly to match route with request
31
-     * or supply a RouteMatchSpecification class and just use the below
32
-     *
33
-     * @return bool
34
-     * @since   $VID:$
35
-     */
36
-    public function matchesCurrentRequest()
37
-    {
38
-        return ($this->request->isFrontend() || $this->request->isFrontAjax()) && ! $this->maintenance_mode->level();
39
-    }
28
+	/**
29
+	 * returns true if the current request matches this route
30
+	 * child classes can override and use Request directly to match route with request
31
+	 * or supply a RouteMatchSpecification class and just use the below
32
+	 *
33
+	 * @return bool
34
+	 * @since   $VID:$
35
+	 */
36
+	public function matchesCurrentRequest()
37
+	{
38
+		return ($this->request->isFrontend() || $this->request->isFrontAjax()) && ! $this->maintenance_mode->level();
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * FrontendRequests constructor.
44
-     *
45
-     * @param EE_Dependency_Map   $dependency_map
46
-     * @param EE_Maintenance_Mode $maintenance_mode
47
-     * @param LoaderInterface     $loader
48
-     * @param RequestInterface    $request
49
-     */
50
-    public function __construct(
51
-        EE_Dependency_Map $dependency_map,
52
-        EE_Maintenance_Mode $maintenance_mode,
53
-        LoaderInterface $loader,
54
-        RequestInterface $request
55
-    ) {
56
-        $this->maintenance_mode = $maintenance_mode;
57
-        parent::__construct($dependency_map, $loader, $request);
58
-    }
42
+	/**
43
+	 * FrontendRequests constructor.
44
+	 *
45
+	 * @param EE_Dependency_Map   $dependency_map
46
+	 * @param EE_Maintenance_Mode $maintenance_mode
47
+	 * @param LoaderInterface     $loader
48
+	 * @param RequestInterface    $request
49
+	 */
50
+	public function __construct(
51
+		EE_Dependency_Map $dependency_map,
52
+		EE_Maintenance_Mode $maintenance_mode,
53
+		LoaderInterface $loader,
54
+		RequestInterface $request
55
+	) {
56
+		$this->maintenance_mode = $maintenance_mode;
57
+		parent::__construct($dependency_map, $loader, $request);
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @since $VID:$
63
-     */
64
-    protected function registerDependencies()
65
-    {
66
-        $this->dependency_map->registerDependencies(
67
-            'EE_Front_Controller',
68
-            [
69
-                'EE_Registry'              => EE_Dependency_Map::load_from_cache,
70
-                'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
71
-                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
72
-            ]
73
-        );
74
-    }
61
+	/**
62
+	 * @since $VID:$
63
+	 */
64
+	protected function registerDependencies()
65
+	{
66
+		$this->dependency_map->registerDependencies(
67
+			'EE_Front_Controller',
68
+			[
69
+				'EE_Registry'              => EE_Dependency_Map::load_from_cache,
70
+				'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
71
+				'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
72
+			]
73
+		);
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * implements logic required to run during request
79
-     *
80
-     * @return bool
81
-     * @since   $VID:$
82
-     */
83
-    protected function requestHandler()
84
-    {
85
-        do_action('AHEE__EE_System__load_controllers__load_front_controllers');
86
-        $this->loader->getShared('EE_Front_Controller');
87
-        return true;
88
-    }
77
+	/**
78
+	 * implements logic required to run during request
79
+	 *
80
+	 * @return bool
81
+	 * @since   $VID:$
82
+	 */
83
+	protected function requestHandler()
84
+	{
85
+		do_action('AHEE__EE_System__load_controllers__load_front_controllers');
86
+		$this->loader->getShared('EE_Front_Controller');
87
+		return true;
88
+	}
89 89
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/frontend/ShortcodeRequests.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -17,72 +17,72 @@
 block discarded – undo
17 17
 class ShortcodeRequests extends Route
18 18
 {
19 19
 
20
-    /**
21
-     * returns true if the current request matches this route
22
-     * child classes can override and use Request directly to match route with request
23
-     * or supply a RouteMatchSpecification class and just use the below
24
-     *
25
-     * @return bool
26
-     * @since   $VID:$
27
-     */
28
-    public function matchesCurrentRequest()
29
-    {
30
-        return $this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax();
31
-    }
20
+	/**
21
+	 * returns true if the current request matches this route
22
+	 * child classes can override and use Request directly to match route with request
23
+	 * or supply a RouteMatchSpecification class and just use the below
24
+	 *
25
+	 * @return bool
26
+	 * @since   $VID:$
27
+	 */
28
+	public function matchesCurrentRequest()
29
+	{
30
+		return $this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax();
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @since $VID:$
36
-     */
37
-    protected function registerDependencies()
38
-    {
39
-        $this->dependency_map->registerDependencies(
40
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled',
41
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
42
-        );
43
-        $this->dependency_map->registerDependencies(
44
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout',
45
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
46
-        );
47
-        $this->dependency_map->registerDependencies(
48
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees',
49
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
50
-        );
51
-        $this->dependency_map->registerDependencies(
52
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents',
53
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
54
-        );
55
-        $this->dependency_map->registerDependencies(
56
-            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou',
57
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
58
-        );
59
-        $this->dependency_map->registerDependencies(
60
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector',
61
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
62
-        );
63
-        $this->dependency_map->registerDependencies(
64
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage',
65
-            ['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
66
-        );
67
-    }
34
+	/**
35
+	 * @since $VID:$
36
+	 */
37
+	protected function registerDependencies()
38
+	{
39
+		$this->dependency_map->registerDependencies(
40
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled',
41
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
42
+		);
43
+		$this->dependency_map->registerDependencies(
44
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout',
45
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
46
+		);
47
+		$this->dependency_map->registerDependencies(
48
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees',
49
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
50
+		);
51
+		$this->dependency_map->registerDependencies(
52
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEvents',
53
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
54
+		);
55
+		$this->dependency_map->registerDependencies(
56
+			'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou',
57
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
58
+		);
59
+		$this->dependency_map->registerDependencies(
60
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector',
61
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
62
+		);
63
+		$this->dependency_map->registerDependencies(
64
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage',
65
+			['EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache]
66
+		);
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * implements logic required to run during request
72
-     *
73
-     * @return bool
74
-     * @since   $VID:$
75
-     */
76
-    protected function requestHandler()
77
-    {
78
-        // load, register, and add shortcodes the new way
79
-        $this->loader->getShared(
80
-            'EventEspresso\core\services\shortcodes\ShortcodesManager',
81
-            [
82
-                // and the old way, but we'll put it under control of the new system
83
-                EE_Config::getLegacyShortcodesManager(),
84
-            ]
85
-        );
86
-        return true;
87
-    }
70
+	/**
71
+	 * implements logic required to run during request
72
+	 *
73
+	 * @return bool
74
+	 * @since   $VID:$
75
+	 */
76
+	protected function requestHandler()
77
+	{
78
+		// load, register, and add shortcodes the new way
79
+		$this->loader->getShared(
80
+			'EventEspresso\core\services\shortcodes\ShortcodesManager',
81
+			[
82
+				// and the old way, but we'll put it under control of the new system
83
+				EE_Config::getLegacyShortcodesManager(),
84
+			]
85
+		);
86
+		return true;
87
+	}
88 88
 }
Please login to merge, or discard this patch.