@@ -11,45 +11,45 @@ |
||
11 | 11 | interface CollectionDetailsInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @access public |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function getCollectionInterface(); |
|
19 | - |
|
20 | - /** |
|
21 | - * @access public |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function collectionName(); |
|
25 | - |
|
26 | - /** |
|
27 | - * @access public |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function identifierType(); |
|
31 | - |
|
32 | - /** |
|
33 | - * @access public |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function identifierCallback(); |
|
37 | - |
|
38 | - /** |
|
39 | - * @access public |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function getFileMask(); |
|
43 | - |
|
44 | - /** |
|
45 | - * @access public |
|
46 | - * @return array |
|
47 | - */ |
|
48 | - public function getCollectionFQCNs(); |
|
49 | - |
|
50 | - /** |
|
51 | - * @access public |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function getCollectionPaths(); |
|
14 | + /** |
|
15 | + * @access public |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function getCollectionInterface(); |
|
19 | + |
|
20 | + /** |
|
21 | + * @access public |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function collectionName(); |
|
25 | + |
|
26 | + /** |
|
27 | + * @access public |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function identifierType(); |
|
31 | + |
|
32 | + /** |
|
33 | + * @access public |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function identifierCallback(); |
|
37 | + |
|
38 | + /** |
|
39 | + * @access public |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function getFileMask(); |
|
43 | + |
|
44 | + /** |
|
45 | + * @access public |
|
46 | + * @return array |
|
47 | + */ |
|
48 | + public function getCollectionFQCNs(); |
|
49 | + |
|
50 | + /** |
|
51 | + * @access public |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function getCollectionPaths(); |
|
55 | 55 | } |
@@ -11,159 +11,159 @@ |
||
11 | 11 | interface CollectionInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * add |
|
16 | - * attaches an object to the Collection |
|
17 | - * and sets any supplied data associated with the current iterator entry |
|
18 | - * by calling EE_Object_Collection::set_identifier() |
|
19 | - * |
|
20 | - * @access public |
|
21 | - * @param $object |
|
22 | - * @param mixed $identifier |
|
23 | - * @return bool |
|
24 | - */ |
|
25 | - public function add($object, $identifier = null); |
|
26 | - |
|
27 | - /** |
|
28 | - * setIdentifier |
|
29 | - * Sets the data associated with an object in the Collection |
|
30 | - * if no $identifier is supplied, then the spl_object_hash() is used |
|
31 | - * |
|
32 | - * @access public |
|
33 | - * @param $object |
|
34 | - * @param mixed $identifier |
|
35 | - * @return bool |
|
36 | - */ |
|
37 | - public function setIdentifier($object, $identifier = null); |
|
38 | - |
|
39 | - /** |
|
40 | - * get |
|
41 | - * finds and returns an object in the Collection based on the identifier that was set using addObject() |
|
42 | - * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
43 | - * |
|
44 | - * @access public |
|
45 | - * @param mixed $identifier |
|
46 | - * @return mixed |
|
47 | - */ |
|
48 | - public function get($identifier); |
|
49 | - |
|
50 | - /** |
|
51 | - * has |
|
52 | - * returns TRUE or FALSE |
|
53 | - * depending on whether the object is within the Collection |
|
54 | - * based on the supplied $identifier |
|
55 | - * |
|
56 | - * @access public |
|
57 | - * @param mixed $identifier |
|
58 | - * @return bool |
|
59 | - */ |
|
60 | - public function has($identifier); |
|
61 | - |
|
62 | - /** |
|
63 | - * hasObject |
|
64 | - * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @param $object |
|
68 | - * @return bool |
|
69 | - */ |
|
70 | - public function hasObject($object); |
|
71 | - |
|
72 | - /** |
|
73 | - * remove |
|
74 | - * detaches an object from the Collection |
|
75 | - * |
|
76 | - * @access public |
|
77 | - * @param $object |
|
78 | - * @return bool |
|
79 | - */ |
|
80 | - public function remove($object); |
|
81 | - |
|
82 | - /** |
|
83 | - * setCurrent |
|
84 | - * advances pointer to the object whose identifier matches that which was provided |
|
85 | - * |
|
86 | - * @access public |
|
87 | - * @param mixed $identifier |
|
88 | - * @return boolean |
|
89 | - */ |
|
90 | - public function setCurrent($identifier); |
|
91 | - |
|
92 | - /** |
|
93 | - * setCurrentUsingObject |
|
94 | - * advances pointer to the provided object |
|
95 | - * |
|
96 | - * @access public |
|
97 | - * @param $object |
|
98 | - * @return boolean |
|
99 | - */ |
|
100 | - public function setCurrentUsingObject($object); |
|
101 | - |
|
102 | - /** |
|
103 | - * Returns the object occupying the index before the current object, |
|
104 | - * unless this is already the first object, in which case it just returns the first object |
|
105 | - * |
|
106 | - * @return mixed |
|
107 | - */ |
|
108 | - public function previous(); |
|
109 | - |
|
110 | - /** |
|
111 | - * Returns the index of a given object, or false if not found |
|
112 | - * |
|
113 | - * @see http://stackoverflow.com/a/8736013 |
|
114 | - * @param $object |
|
115 | - * @return boolean|int|string |
|
116 | - */ |
|
117 | - public function indexOf($object); |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * Returns the object at the given index |
|
122 | - * |
|
123 | - * @see http://stackoverflow.com/a/8736013 |
|
124 | - * @param $index |
|
125 | - * @return mixed |
|
126 | - */ |
|
127 | - public function objectAtIndex($index); |
|
128 | - |
|
129 | - /** |
|
130 | - * Returns the sequence of objects as specified by the offset and length |
|
131 | - * |
|
132 | - * @see http://stackoverflow.com/a/8736013 |
|
133 | - * @param int $offset |
|
134 | - * @param int $length |
|
135 | - * @return array |
|
136 | - */ |
|
137 | - public function slice($offset, $length); |
|
138 | - |
|
139 | - /** |
|
140 | - * Inserts an object (or an array of objects) at a certain point |
|
141 | - * |
|
142 | - * @see http://stackoverflow.com/a/8736013 |
|
143 | - * @param mixed $objects A single object or an array of objects |
|
144 | - * @param integer $index |
|
145 | - */ |
|
146 | - public function insertAt($objects, $index); |
|
147 | - |
|
148 | - /** |
|
149 | - * Removes the object at the given index |
|
150 | - * |
|
151 | - * @see http://stackoverflow.com/a/8736013 |
|
152 | - * @param integer $index |
|
153 | - */ |
|
154 | - public function removeAt($index); |
|
155 | - |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * detaches ALL objects from the Collection |
|
160 | - */ |
|
161 | - public function detachAll(); |
|
162 | - |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * unsets and detaches ALL objects from the Collection |
|
167 | - */ |
|
168 | - public function trashAndDetachAll(); |
|
14 | + /** |
|
15 | + * add |
|
16 | + * attaches an object to the Collection |
|
17 | + * and sets any supplied data associated with the current iterator entry |
|
18 | + * by calling EE_Object_Collection::set_identifier() |
|
19 | + * |
|
20 | + * @access public |
|
21 | + * @param $object |
|
22 | + * @param mixed $identifier |
|
23 | + * @return bool |
|
24 | + */ |
|
25 | + public function add($object, $identifier = null); |
|
26 | + |
|
27 | + /** |
|
28 | + * setIdentifier |
|
29 | + * Sets the data associated with an object in the Collection |
|
30 | + * if no $identifier is supplied, then the spl_object_hash() is used |
|
31 | + * |
|
32 | + * @access public |
|
33 | + * @param $object |
|
34 | + * @param mixed $identifier |
|
35 | + * @return bool |
|
36 | + */ |
|
37 | + public function setIdentifier($object, $identifier = null); |
|
38 | + |
|
39 | + /** |
|
40 | + * get |
|
41 | + * finds and returns an object in the Collection based on the identifier that was set using addObject() |
|
42 | + * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
43 | + * |
|
44 | + * @access public |
|
45 | + * @param mixed $identifier |
|
46 | + * @return mixed |
|
47 | + */ |
|
48 | + public function get($identifier); |
|
49 | + |
|
50 | + /** |
|
51 | + * has |
|
52 | + * returns TRUE or FALSE |
|
53 | + * depending on whether the object is within the Collection |
|
54 | + * based on the supplied $identifier |
|
55 | + * |
|
56 | + * @access public |
|
57 | + * @param mixed $identifier |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | + public function has($identifier); |
|
61 | + |
|
62 | + /** |
|
63 | + * hasObject |
|
64 | + * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @param $object |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | + public function hasObject($object); |
|
71 | + |
|
72 | + /** |
|
73 | + * remove |
|
74 | + * detaches an object from the Collection |
|
75 | + * |
|
76 | + * @access public |
|
77 | + * @param $object |
|
78 | + * @return bool |
|
79 | + */ |
|
80 | + public function remove($object); |
|
81 | + |
|
82 | + /** |
|
83 | + * setCurrent |
|
84 | + * advances pointer to the object whose identifier matches that which was provided |
|
85 | + * |
|
86 | + * @access public |
|
87 | + * @param mixed $identifier |
|
88 | + * @return boolean |
|
89 | + */ |
|
90 | + public function setCurrent($identifier); |
|
91 | + |
|
92 | + /** |
|
93 | + * setCurrentUsingObject |
|
94 | + * advances pointer to the provided object |
|
95 | + * |
|
96 | + * @access public |
|
97 | + * @param $object |
|
98 | + * @return boolean |
|
99 | + */ |
|
100 | + public function setCurrentUsingObject($object); |
|
101 | + |
|
102 | + /** |
|
103 | + * Returns the object occupying the index before the current object, |
|
104 | + * unless this is already the first object, in which case it just returns the first object |
|
105 | + * |
|
106 | + * @return mixed |
|
107 | + */ |
|
108 | + public function previous(); |
|
109 | + |
|
110 | + /** |
|
111 | + * Returns the index of a given object, or false if not found |
|
112 | + * |
|
113 | + * @see http://stackoverflow.com/a/8736013 |
|
114 | + * @param $object |
|
115 | + * @return boolean|int|string |
|
116 | + */ |
|
117 | + public function indexOf($object); |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * Returns the object at the given index |
|
122 | + * |
|
123 | + * @see http://stackoverflow.com/a/8736013 |
|
124 | + * @param $index |
|
125 | + * @return mixed |
|
126 | + */ |
|
127 | + public function objectAtIndex($index); |
|
128 | + |
|
129 | + /** |
|
130 | + * Returns the sequence of objects as specified by the offset and length |
|
131 | + * |
|
132 | + * @see http://stackoverflow.com/a/8736013 |
|
133 | + * @param int $offset |
|
134 | + * @param int $length |
|
135 | + * @return array |
|
136 | + */ |
|
137 | + public function slice($offset, $length); |
|
138 | + |
|
139 | + /** |
|
140 | + * Inserts an object (or an array of objects) at a certain point |
|
141 | + * |
|
142 | + * @see http://stackoverflow.com/a/8736013 |
|
143 | + * @param mixed $objects A single object or an array of objects |
|
144 | + * @param integer $index |
|
145 | + */ |
|
146 | + public function insertAt($objects, $index); |
|
147 | + |
|
148 | + /** |
|
149 | + * Removes the object at the given index |
|
150 | + * |
|
151 | + * @see http://stackoverflow.com/a/8736013 |
|
152 | + * @param integer $index |
|
153 | + */ |
|
154 | + public function removeAt($index); |
|
155 | + |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * detaches ALL objects from the Collection |
|
160 | + */ |
|
161 | + public function detachAll(); |
|
162 | + |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * unsets and detaches ALL objects from the Collection |
|
167 | + */ |
|
168 | + public function trashAndDetachAll(); |
|
169 | 169 | } |
@@ -46,224 +46,224 @@ |
||
46 | 46 | class BootstrapCore |
47 | 47 | { |
48 | 48 | |
49 | - /** |
|
50 | - * @type LoaderInterface $loader |
|
51 | - */ |
|
52 | - private $loader; |
|
49 | + /** |
|
50 | + * @type LoaderInterface $loader |
|
51 | + */ |
|
52 | + private $loader; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @var RequestInterface $request |
|
56 | - */ |
|
57 | - protected $request; |
|
54 | + /** |
|
55 | + * @var RequestInterface $request |
|
56 | + */ |
|
57 | + protected $request; |
|
58 | 58 | |
59 | - /** |
|
60 | - * @var ResponseInterface $response |
|
61 | - */ |
|
62 | - protected $response; |
|
59 | + /** |
|
60 | + * @var ResponseInterface $response |
|
61 | + */ |
|
62 | + protected $response; |
|
63 | 63 | |
64 | - /** |
|
65 | - * @var RequestStackBuilder $request_stack_builder |
|
66 | - */ |
|
67 | - protected $request_stack_builder; |
|
64 | + /** |
|
65 | + * @var RequestStackBuilder $request_stack_builder |
|
66 | + */ |
|
67 | + protected $request_stack_builder; |
|
68 | 68 | |
69 | - /** |
|
70 | - * @var RequestStack $request_stack |
|
71 | - */ |
|
72 | - protected $request_stack; |
|
69 | + /** |
|
70 | + * @var RequestStack $request_stack |
|
71 | + */ |
|
72 | + protected $request_stack; |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * BootstrapCore constructor. |
|
77 | - */ |
|
78 | - public function __construct() |
|
79 | - { |
|
80 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
81 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
82 | - add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
83 | - } |
|
75 | + /** |
|
76 | + * BootstrapCore constructor. |
|
77 | + */ |
|
78 | + public function __construct() |
|
79 | + { |
|
80 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
81 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
82 | + add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @throws DomainException |
|
88 | - * @throws EE_Error |
|
89 | - * @throws Exception |
|
90 | - * @throws InvalidArgumentException |
|
91 | - * @throws InvalidClassException |
|
92 | - * @throws InvalidDataTypeException |
|
93 | - * @throws InvalidFilePathException |
|
94 | - * @throws InvalidInterfaceException |
|
95 | - * @throws OutOfBoundsException |
|
96 | - * @throws ReflectionException |
|
97 | - */ |
|
98 | - public function initialize() |
|
99 | - { |
|
100 | - $this->bootstrapDependencyInjectionContainer(); |
|
101 | - $this->bootstrapDomain(); |
|
102 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
103 | - add_action( |
|
104 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
105 | - array($bootstrap_request, 'setupLegacyRequest') |
|
106 | - ); |
|
107 | - $this->runRequestStack(); |
|
108 | - } |
|
86 | + /** |
|
87 | + * @throws DomainException |
|
88 | + * @throws EE_Error |
|
89 | + * @throws Exception |
|
90 | + * @throws InvalidArgumentException |
|
91 | + * @throws InvalidClassException |
|
92 | + * @throws InvalidDataTypeException |
|
93 | + * @throws InvalidFilePathException |
|
94 | + * @throws InvalidInterfaceException |
|
95 | + * @throws OutOfBoundsException |
|
96 | + * @throws ReflectionException |
|
97 | + */ |
|
98 | + public function initialize() |
|
99 | + { |
|
100 | + $this->bootstrapDependencyInjectionContainer(); |
|
101 | + $this->bootstrapDomain(); |
|
102 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
103 | + add_action( |
|
104 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
105 | + array($bootstrap_request, 'setupLegacyRequest') |
|
106 | + ); |
|
107 | + $this->runRequestStack(); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | |
111 | - /** |
|
112 | - * @throws ReflectionException |
|
113 | - * @throws EE_Error |
|
114 | - * @throws InvalidArgumentException |
|
115 | - * @throws InvalidDataTypeException |
|
116 | - * @throws InvalidInterfaceException |
|
117 | - * @throws OutOfBoundsException |
|
118 | - */ |
|
119 | - private function bootstrapDependencyInjectionContainer() |
|
120 | - { |
|
121 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
122 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
123 | - $bootstrap_di->buildLoader(); |
|
124 | - $registry = $bootstrap_di->getRegistry(); |
|
125 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
126 | - $dependency_map->initialize(); |
|
127 | - $registry->initialize(); |
|
128 | - $this->loader = $bootstrap_di->getLoader(); |
|
129 | - } |
|
111 | + /** |
|
112 | + * @throws ReflectionException |
|
113 | + * @throws EE_Error |
|
114 | + * @throws InvalidArgumentException |
|
115 | + * @throws InvalidDataTypeException |
|
116 | + * @throws InvalidInterfaceException |
|
117 | + * @throws OutOfBoundsException |
|
118 | + */ |
|
119 | + private function bootstrapDependencyInjectionContainer() |
|
120 | + { |
|
121 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
122 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
123 | + $bootstrap_di->buildLoader(); |
|
124 | + $registry = $bootstrap_di->getRegistry(); |
|
125 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
126 | + $dependency_map->initialize(); |
|
127 | + $registry->initialize(); |
|
128 | + $this->loader = $bootstrap_di->getLoader(); |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | - /** |
|
133 | - * configures the Domain object for core |
|
134 | - * |
|
135 | - * @return void |
|
136 | - * @throws DomainException |
|
137 | - * @throws InvalidArgumentException |
|
138 | - * @throws InvalidDataTypeException |
|
139 | - * @throws InvalidClassException |
|
140 | - * @throws InvalidFilePathException |
|
141 | - * @throws InvalidInterfaceException |
|
142 | - */ |
|
143 | - private function bootstrapDomain() |
|
144 | - { |
|
145 | - DomainFactory::getEventEspressoCoreDomain(); |
|
146 | - } |
|
132 | + /** |
|
133 | + * configures the Domain object for core |
|
134 | + * |
|
135 | + * @return void |
|
136 | + * @throws DomainException |
|
137 | + * @throws InvalidArgumentException |
|
138 | + * @throws InvalidDataTypeException |
|
139 | + * @throws InvalidClassException |
|
140 | + * @throws InvalidFilePathException |
|
141 | + * @throws InvalidInterfaceException |
|
142 | + */ |
|
143 | + private function bootstrapDomain() |
|
144 | + { |
|
145 | + DomainFactory::getEventEspressoCoreDomain(); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | |
149 | - /** |
|
150 | - * sets up the request and response objects |
|
151 | - * |
|
152 | - * @return BootstrapRequestResponseObjects |
|
153 | - * @throws InvalidArgumentException |
|
154 | - */ |
|
155 | - private function bootstrapRequestResponseObjects() |
|
156 | - { |
|
157 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
158 | - $bootstrap_request = $this->loader->getShared( |
|
159 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
160 | - array($this->loader) |
|
161 | - ); |
|
162 | - $bootstrap_request->buildRequestResponse(); |
|
163 | - $bootstrap_request->shareRequestResponse(); |
|
164 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
165 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
166 | - return $bootstrap_request; |
|
167 | - } |
|
149 | + /** |
|
150 | + * sets up the request and response objects |
|
151 | + * |
|
152 | + * @return BootstrapRequestResponseObjects |
|
153 | + * @throws InvalidArgumentException |
|
154 | + */ |
|
155 | + private function bootstrapRequestResponseObjects() |
|
156 | + { |
|
157 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
158 | + $bootstrap_request = $this->loader->getShared( |
|
159 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
160 | + array($this->loader) |
|
161 | + ); |
|
162 | + $bootstrap_request->buildRequestResponse(); |
|
163 | + $bootstrap_request->shareRequestResponse(); |
|
164 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
165 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
166 | + return $bootstrap_request; |
|
167 | + } |
|
168 | 168 | |
169 | 169 | |
170 | - /** |
|
171 | - * run_request_stack |
|
172 | - * construct request stack and run middleware apps |
|
173 | - * |
|
174 | - * @throws EE_Error |
|
175 | - * @throws Exception |
|
176 | - */ |
|
177 | - public function runRequestStack() |
|
178 | - { |
|
179 | - $this->loadAutoloader(); |
|
180 | - $this->setAutoloadersForRequiredFiles(); |
|
181 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
182 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
183 | - new RequestStackCoreApp() |
|
184 | - ); |
|
185 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
186 | - $this->request_stack->handleResponse(); |
|
187 | - } |
|
170 | + /** |
|
171 | + * run_request_stack |
|
172 | + * construct request stack and run middleware apps |
|
173 | + * |
|
174 | + * @throws EE_Error |
|
175 | + * @throws Exception |
|
176 | + */ |
|
177 | + public function runRequestStack() |
|
178 | + { |
|
179 | + $this->loadAutoloader(); |
|
180 | + $this->setAutoloadersForRequiredFiles(); |
|
181 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
182 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
183 | + new RequestStackCoreApp() |
|
184 | + ); |
|
185 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
186 | + $this->request_stack->handleResponse(); |
|
187 | + } |
|
188 | 188 | |
189 | 189 | |
190 | - /** |
|
191 | - * load_autoloader |
|
192 | - * |
|
193 | - * @throws EE_Error |
|
194 | - */ |
|
195 | - protected function loadAutoloader() |
|
196 | - { |
|
197 | - // load interfaces |
|
198 | - espresso_load_required( |
|
199 | - 'EEH_Autoloader', |
|
200 | - EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
201 | - ); |
|
202 | - EEH_Autoloader::instance(); |
|
203 | - } |
|
190 | + /** |
|
191 | + * load_autoloader |
|
192 | + * |
|
193 | + * @throws EE_Error |
|
194 | + */ |
|
195 | + protected function loadAutoloader() |
|
196 | + { |
|
197 | + // load interfaces |
|
198 | + espresso_load_required( |
|
199 | + 'EEH_Autoloader', |
|
200 | + EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
201 | + ); |
|
202 | + EEH_Autoloader::instance(); |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | - /** |
|
207 | - * load_required_files |
|
208 | - * |
|
209 | - * @throws EE_Error |
|
210 | - */ |
|
211 | - protected function setAutoloadersForRequiredFiles() |
|
212 | - { |
|
213 | - // load interfaces |
|
214 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
215 | - // load helpers |
|
216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
217 | - // register legacy request stack classes just in case |
|
218 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
219 | - // register legacy middleware classes just in case |
|
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
221 | - } |
|
206 | + /** |
|
207 | + * load_required_files |
|
208 | + * |
|
209 | + * @throws EE_Error |
|
210 | + */ |
|
211 | + protected function setAutoloadersForRequiredFiles() |
|
212 | + { |
|
213 | + // load interfaces |
|
214 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
215 | + // load helpers |
|
216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
217 | + // register legacy request stack classes just in case |
|
218 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
219 | + // register legacy middleware classes just in case |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
221 | + } |
|
222 | 222 | |
223 | 223 | |
224 | - /** |
|
225 | - * build_request_stack |
|
226 | - * |
|
227 | - * @return RequestStackBuilder |
|
228 | - */ |
|
229 | - public function buildRequestStack() |
|
230 | - { |
|
231 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
232 | - /** |
|
233 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
234 | - * so items at the beginning of the final middleware stack will run last. |
|
235 | - * First parameter is the middleware classname, second is an array of arguments |
|
236 | - */ |
|
237 | - $stack_apps = apply_filters( |
|
238 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
239 | - array( |
|
240 | - // first in last out |
|
241 | - 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
242 | - 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
243 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
244 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
245 | - // last in first out |
|
246 | - 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
247 | - ) |
|
248 | - ); |
|
249 | - // legacy filter for backwards compatibility |
|
250 | - $stack_apps = apply_filters( |
|
251 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
252 | - $stack_apps |
|
253 | - ); |
|
254 | - // load middleware onto stack : FILO (First In Last Out) |
|
255 | - // items at the beginning of the $stack_apps array will run last |
|
256 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
257 | - $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
258 | - } |
|
259 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
260 | - // and we also need it to always run first because the rest of the system relies on it |
|
261 | - $request_stack_builder->push( |
|
262 | - array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
263 | - ); |
|
264 | - return apply_filters( |
|
265 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
266 | - $request_stack_builder |
|
267 | - ); |
|
268 | - } |
|
224 | + /** |
|
225 | + * build_request_stack |
|
226 | + * |
|
227 | + * @return RequestStackBuilder |
|
228 | + */ |
|
229 | + public function buildRequestStack() |
|
230 | + { |
|
231 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
232 | + /** |
|
233 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
234 | + * so items at the beginning of the final middleware stack will run last. |
|
235 | + * First parameter is the middleware classname, second is an array of arguments |
|
236 | + */ |
|
237 | + $stack_apps = apply_filters( |
|
238 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
239 | + array( |
|
240 | + // first in last out |
|
241 | + 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
242 | + 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
243 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
244 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
245 | + // last in first out |
|
246 | + 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
247 | + ) |
|
248 | + ); |
|
249 | + // legacy filter for backwards compatibility |
|
250 | + $stack_apps = apply_filters( |
|
251 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
252 | + $stack_apps |
|
253 | + ); |
|
254 | + // load middleware onto stack : FILO (First In Last Out) |
|
255 | + // items at the beginning of the $stack_apps array will run last |
|
256 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
257 | + $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
258 | + } |
|
259 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
260 | + // and we also need it to always run first because the rest of the system relies on it |
|
261 | + $request_stack_builder->push( |
|
262 | + array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
263 | + ); |
|
264 | + return apply_filters( |
|
265 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
266 | + $request_stack_builder |
|
267 | + ); |
|
268 | + } |
|
269 | 269 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | // load interfaces |
198 | 198 | espresso_load_required( |
199 | 199 | 'EEH_Autoloader', |
200 | - EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
200 | + EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php' |
|
201 | 201 | ); |
202 | 202 | EEH_Autoloader::instance(); |
203 | 203 | } |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | protected function setAutoloadersForRequiredFiles() |
212 | 212 | { |
213 | 213 | // load interfaces |
214 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
214 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces', true); |
|
215 | 215 | // load helpers |
216 | 216 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
217 | 217 | // register legacy request stack classes just in case |
218 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
218 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
219 | 219 | // register legacy middleware classes just in case |
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 |
@@ -12,11 +12,11 @@ |
||
12 | 12 | interface RequestStackCoreAppInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * gives the core app a chance to handle the response after the request stack has fully processed |
|
17 | - * |
|
18 | - * @param RequestInterface $request |
|
19 | - * @param ResponseInterface $response |
|
20 | - */ |
|
21 | - public function handleResponse(RequestInterface $request, ResponseInterface $response); |
|
15 | + /** |
|
16 | + * gives the core app a chance to handle the response after the request stack has fully processed |
|
17 | + * |
|
18 | + * @param RequestInterface $request |
|
19 | + * @param ResponseInterface $response |
|
20 | + */ |
|
21 | + public function handleResponse(RequestInterface $request, ResponseInterface $response); |
|
22 | 22 | } |
@@ -12,21 +12,21 @@ |
||
12 | 12 | interface RequestDecoratorInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * converts a Request to a Response |
|
17 | - * can perform their logic either before or after the core application has run like so: |
|
18 | - * public function handle_request( EE_Request $request, EE_Response $response ) { |
|
19 | - * $this->request = $request; |
|
20 | - * $this->response = $response; |
|
21 | - * // logic performed BEFORE core app has run |
|
22 | - * $this->process_request_stack( $this->request, $this->response ); |
|
23 | - * // logic performed AFTER core app has run |
|
24 | - * return $response; |
|
25 | - * } |
|
26 | - * |
|
27 | - * @param RequestInterface $request |
|
28 | - * @param ResponseInterface $response |
|
29 | - * @return ResponseInterface |
|
30 | - */ |
|
31 | - public function handleRequest(RequestInterface $request, ResponseInterface $response); |
|
15 | + /** |
|
16 | + * converts a Request to a Response |
|
17 | + * can perform their logic either before or after the core application has run like so: |
|
18 | + * public function handle_request( EE_Request $request, EE_Response $response ) { |
|
19 | + * $this->request = $request; |
|
20 | + * $this->response = $response; |
|
21 | + * // logic performed BEFORE core app has run |
|
22 | + * $this->process_request_stack( $this->request, $this->response ); |
|
23 | + * // logic performed AFTER core app has run |
|
24 | + * return $response; |
|
25 | + * } |
|
26 | + * |
|
27 | + * @param RequestInterface $request |
|
28 | + * @param ResponseInterface $response |
|
29 | + * @return ResponseInterface |
|
30 | + */ |
|
31 | + public function handleRequest(RequestInterface $request, ResponseInterface $response); |
|
32 | 32 | } |
@@ -12,67 +12,67 @@ |
||
12 | 12 | interface ResponseInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * set_notice |
|
17 | - * |
|
18 | - * @access public |
|
19 | - * @param $key |
|
20 | - * @param $value |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function setNotice($key, $value); |
|
15 | + /** |
|
16 | + * set_notice |
|
17 | + * |
|
18 | + * @access public |
|
19 | + * @param $key |
|
20 | + * @param $value |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function setNotice($key, $value); |
|
24 | 24 | |
25 | - /** |
|
26 | - * get_notice |
|
27 | - * |
|
28 | - * @access public |
|
29 | - * @param $key |
|
30 | - * @return mixed |
|
31 | - */ |
|
32 | - public function getNotice($key); |
|
25 | + /** |
|
26 | + * get_notice |
|
27 | + * |
|
28 | + * @access public |
|
29 | + * @param $key |
|
30 | + * @return mixed |
|
31 | + */ |
|
32 | + public function getNotice($key); |
|
33 | 33 | |
34 | - /** |
|
35 | - * get_notices |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @return array |
|
39 | - */ |
|
40 | - public function getNotices(); |
|
34 | + /** |
|
35 | + * get_notices |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @return array |
|
39 | + */ |
|
40 | + public function getNotices(); |
|
41 | 41 | |
42 | - /** |
|
43 | - * add_output |
|
44 | - * |
|
45 | - * @access public |
|
46 | - * @param $string |
|
47 | - * @param bool $append |
|
48 | - */ |
|
49 | - public function addOutput($string, $append = true); |
|
42 | + /** |
|
43 | + * add_output |
|
44 | + * |
|
45 | + * @access public |
|
46 | + * @param $string |
|
47 | + * @param bool $append |
|
48 | + */ |
|
49 | + public function addOutput($string, $append = true); |
|
50 | 50 | |
51 | - /** |
|
52 | - * get_output |
|
53 | - * |
|
54 | - * @access public |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function getOutput(); |
|
51 | + /** |
|
52 | + * get_output |
|
53 | + * |
|
54 | + * @access public |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function getOutput(); |
|
58 | 58 | |
59 | - /** |
|
60 | - * @return boolean |
|
61 | - */ |
|
62 | - public function requestTerminated(); |
|
59 | + /** |
|
60 | + * @return boolean |
|
61 | + */ |
|
62 | + public function requestTerminated(); |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param boolean $request_terminated |
|
66 | - */ |
|
67 | - public function terminateRequest($request_terminated = true); |
|
64 | + /** |
|
65 | + * @param boolean $request_terminated |
|
66 | + */ |
|
67 | + public function terminateRequest($request_terminated = true); |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return boolean |
|
71 | - */ |
|
72 | - public function pluginDeactivated(); |
|
69 | + /** |
|
70 | + * @return boolean |
|
71 | + */ |
|
72 | + public function pluginDeactivated(); |
|
73 | 73 | |
74 | - /** |
|
75 | - * sets $deactivate_plugin to true |
|
76 | - */ |
|
77 | - public function deactivatePlugin(); |
|
74 | + /** |
|
75 | + * sets $deactivate_plugin to true |
|
76 | + */ |
|
77 | + public function deactivatePlugin(); |
|
78 | 78 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | interface CommandRequiresCapCheckInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @return \EventEspresso\core\domain\services\capabilities\CapCheck |
|
16 | - */ |
|
17 | - public function getCapCheck(); |
|
14 | + /** |
|
15 | + * @return \EventEspresso\core\domain\services\capabilities\CapCheck |
|
16 | + */ |
|
17 | + public function getCapCheck(); |
|
18 | 18 | } |
@@ -9,13 +9,13 @@ |
||
9 | 9 | interface CommandFactoryInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param string $command_fqcn |
|
14 | - * @param array $arguments |
|
15 | - * @return mixed |
|
16 | - * @throws InvalidArgumentException |
|
17 | - * @throws InvalidDataTypeException |
|
18 | - * @throws InvalidInterfaceException |
|
19 | - */ |
|
20 | - public function getNew($command_fqcn, $arguments = array()); |
|
12 | + /** |
|
13 | + * @param string $command_fqcn |
|
14 | + * @param array $arguments |
|
15 | + * @return mixed |
|
16 | + * @throws InvalidArgumentException |
|
17 | + * @throws InvalidDataTypeException |
|
18 | + * @throws InvalidInterfaceException |
|
19 | + */ |
|
20 | + public function getNew($command_fqcn, $arguments = array()); |
|
21 | 21 | } |
@@ -9,9 +9,9 @@ |
||
9 | 9 | interface CommandHandlerInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
14 | - * @return mixed |
|
15 | - */ |
|
16 | - public function handle(CommandInterface $command); |
|
12 | + /** |
|
13 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
14 | + * @return mixed |
|
15 | + */ |
|
16 | + public function handle(CommandInterface $command); |
|
17 | 17 | } |