@@ -13,33 +13,33 @@ |
||
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * persist |
|
18 | - * |
|
19 | - * used for persisting the current object ( ie: to the database, cache, session, etc ) |
|
20 | - * can be supplied with a "persistence callback" on a per method call basis, |
|
21 | - * or the $persist_method property can be set in the class constructor, |
|
22 | - * for providing how to persist an object such as session caching, etc... |
|
23 | - * an array of arguments can also be supplied that will be passed along to the object's persistence method |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
27 | - * @param array $persistence_arguments arrays of arguments that will be passed to the object's persistence method |
|
28 | - * @return bool | int |
|
29 | - * @throws \EE_Error |
|
30 | - */ |
|
31 | - public function persist($persistence_callback = '', $persistence_arguments = array()); |
|
16 | + /** |
|
17 | + * persist |
|
18 | + * |
|
19 | + * used for persisting the current object ( ie: to the database, cache, session, etc ) |
|
20 | + * can be supplied with a "persistence callback" on a per method call basis, |
|
21 | + * or the $persist_method property can be set in the class constructor, |
|
22 | + * for providing how to persist an object such as session caching, etc... |
|
23 | + * an array of arguments can also be supplied that will be passed along to the object's persistence method |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * @param string $persistence_callback name of method found on object that can be used for persisting the object |
|
27 | + * @param array $persistence_arguments arrays of arguments that will be passed to the object's persistence method |
|
28 | + * @return bool | int |
|
29 | + * @throws \EE_Error |
|
30 | + */ |
|
31 | + public function persist($persistence_callback = '', $persistence_arguments = array()); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * persist_all |
|
37 | - * |
|
38 | - * calls \EEI_Repository::persist() on all objects within the repository |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @param string $persistence_callback name of method found on object that can be used for persisting it |
|
42 | - * @return bool | int |
|
43 | - */ |
|
44 | - public function persist_all($persistence_callback = ''); |
|
35 | + /** |
|
36 | + * persist_all |
|
37 | + * |
|
38 | + * calls \EEI_Repository::persist() on all objects within the repository |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @param string $persistence_callback name of method found on object that can be used for persisting it |
|
42 | + * @return bool | int |
|
43 | + */ |
|
44 | + public function persist_all($persistence_callback = ''); |
|
45 | 45 | } |
@@ -6,97 +6,97 @@ |
||
6 | 6 | interface EEI_Base |
7 | 7 | { |
8 | 8 | |
9 | - /** |
|
10 | - * gets the unique ID of the model object. If it hasn't been saved yet |
|
11 | - * to the database, this should be 0 or NULL |
|
12 | - */ |
|
13 | - public function ID(); |
|
14 | - |
|
15 | - |
|
16 | - |
|
17 | - /** |
|
18 | - * Returns an array where keys are field names and values are their values |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function model_field_array(); |
|
23 | - |
|
24 | - |
|
25 | - |
|
26 | - /** |
|
27 | - * Saves the thing to the database and returns success (or an ID) |
|
28 | - * |
|
29 | - * @return boolean success on insert; or int on update (ID of newly inserted thing) |
|
30 | - */ |
|
31 | - public function save(); |
|
32 | - |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Similar to insert_post_meta, adds a record in the Extra_Meta model's table with the given key and value. |
|
37 | - * A $previous_value can be specified in case there are many meta rows with the same key |
|
38 | - * |
|
39 | - * @param string $meta_key |
|
40 | - * @param string $meta_value |
|
41 | - * @param string $previous_value |
|
42 | - * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
|
43 | - * NOTE: if the values haven't changed, returns 0 |
|
44 | - */ |
|
45 | - public function update_extra_meta($meta_key, $meta_value, $previous_value = null); |
|
46 | - |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check |
|
51 | - * no other extra meta for this model object have the same key. Returns TRUE if the |
|
52 | - * extra meta row was entered, false if not |
|
53 | - * |
|
54 | - * @param string $meta_key |
|
55 | - * @param string $meta_value |
|
56 | - * @param boolean $unique |
|
57 | - * @return boolean |
|
58 | - */ |
|
59 | - public function add_extra_meta($meta_key, $meta_value, $unique = false); |
|
60 | - |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Deletes all the extra meta rows for this record as specified by key. If $meta_value |
|
65 | - * is specified, only deletes extra meta records with that value. |
|
66 | - * |
|
67 | - * @param string $meta_key |
|
68 | - * @param string $meta_value |
|
69 | - * @return int number of extra meta rows deleted |
|
70 | - */ |
|
71 | - public function delete_extra_meta($meta_key, $meta_value = null); |
|
72 | - |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise |
|
77 | - * an array of everything found. Requires that this model actually have a relation of type EE_Has_Many_Any_Relation. |
|
78 | - * You can specify $default is case you haven't found the extra meta |
|
79 | - * |
|
80 | - * @param string $meta_key |
|
81 | - * @param boolean $single |
|
82 | - * @param mixed $default if we don't find anything, what should we return? |
|
83 | - * @return mixed single value if $single; array if ! $single |
|
84 | - */ |
|
85 | - public function get_extra_meta($meta_key, $single = false, $default = null); |
|
86 | - |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * Gets a pretty view of the field's value. $extra_cache_ref can specify different formats for this. |
|
91 | - * The $extra_cache_ref will be passed to the model field's prepare_for_pretty_echoing, so consult the field's class |
|
92 | - * to see what options are available. |
|
93 | - * |
|
94 | - * @param string $field_name |
|
95 | - * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property |
|
96 | - * (in cases where the same property may be used for different outputs |
|
97 | - * - i.e. datetime, money etc.) |
|
98 | - * @return mixed |
|
99 | - * @throws \EE_Error |
|
100 | - */ |
|
101 | - public function get_pretty($field_name, $extra_cache_ref); |
|
9 | + /** |
|
10 | + * gets the unique ID of the model object. If it hasn't been saved yet |
|
11 | + * to the database, this should be 0 or NULL |
|
12 | + */ |
|
13 | + public function ID(); |
|
14 | + |
|
15 | + |
|
16 | + |
|
17 | + /** |
|
18 | + * Returns an array where keys are field names and values are their values |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function model_field_array(); |
|
23 | + |
|
24 | + |
|
25 | + |
|
26 | + /** |
|
27 | + * Saves the thing to the database and returns success (or an ID) |
|
28 | + * |
|
29 | + * @return boolean success on insert; or int on update (ID of newly inserted thing) |
|
30 | + */ |
|
31 | + public function save(); |
|
32 | + |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Similar to insert_post_meta, adds a record in the Extra_Meta model's table with the given key and value. |
|
37 | + * A $previous_value can be specified in case there are many meta rows with the same key |
|
38 | + * |
|
39 | + * @param string $meta_key |
|
40 | + * @param string $meta_value |
|
41 | + * @param string $previous_value |
|
42 | + * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
|
43 | + * NOTE: if the values haven't changed, returns 0 |
|
44 | + */ |
|
45 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = null); |
|
46 | + |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check |
|
51 | + * no other extra meta for this model object have the same key. Returns TRUE if the |
|
52 | + * extra meta row was entered, false if not |
|
53 | + * |
|
54 | + * @param string $meta_key |
|
55 | + * @param string $meta_value |
|
56 | + * @param boolean $unique |
|
57 | + * @return boolean |
|
58 | + */ |
|
59 | + public function add_extra_meta($meta_key, $meta_value, $unique = false); |
|
60 | + |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Deletes all the extra meta rows for this record as specified by key. If $meta_value |
|
65 | + * is specified, only deletes extra meta records with that value. |
|
66 | + * |
|
67 | + * @param string $meta_key |
|
68 | + * @param string $meta_value |
|
69 | + * @return int number of extra meta rows deleted |
|
70 | + */ |
|
71 | + public function delete_extra_meta($meta_key, $meta_value = null); |
|
72 | + |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise |
|
77 | + * an array of everything found. Requires that this model actually have a relation of type EE_Has_Many_Any_Relation. |
|
78 | + * You can specify $default is case you haven't found the extra meta |
|
79 | + * |
|
80 | + * @param string $meta_key |
|
81 | + * @param boolean $single |
|
82 | + * @param mixed $default if we don't find anything, what should we return? |
|
83 | + * @return mixed single value if $single; array if ! $single |
|
84 | + */ |
|
85 | + public function get_extra_meta($meta_key, $single = false, $default = null); |
|
86 | + |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * Gets a pretty view of the field's value. $extra_cache_ref can specify different formats for this. |
|
91 | + * The $extra_cache_ref will be passed to the model field's prepare_for_pretty_echoing, so consult the field's class |
|
92 | + * to see what options are available. |
|
93 | + * |
|
94 | + * @param string $field_name |
|
95 | + * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property |
|
96 | + * (in cases where the same property may be used for different outputs |
|
97 | + * - i.e. datetime, money etc.) |
|
98 | + * @return mixed |
|
99 | + * @throws \EE_Error |
|
100 | + */ |
|
101 | + public function get_pretty($field_name, $extra_cache_ref); |
|
102 | 102 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | interface ProgressStepsConfigInterface |
11 | 11 | { |
12 | 12 | |
13 | - public function get(); |
|
13 | + public function get(); |
|
14 | 14 | |
15 | - public function update(); |
|
15 | + public function update(); |
|
16 | 16 | } |
@@ -11,33 +11,33 @@ |
||
11 | 11 | interface ProgressStepInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @return boolean |
|
16 | - */ |
|
17 | - public function isCurrent(); |
|
14 | + /** |
|
15 | + * @return boolean |
|
16 | + */ |
|
17 | + public function isCurrent(); |
|
18 | 18 | |
19 | - /** |
|
20 | - * @param boolean $is_current |
|
21 | - */ |
|
22 | - public function setIsCurrent($is_current = true); |
|
19 | + /** |
|
20 | + * @param boolean $is_current |
|
21 | + */ |
|
22 | + public function setIsCurrent($is_current = true); |
|
23 | 23 | |
24 | - /** |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function id(); |
|
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function id(); |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return int |
|
31 | - */ |
|
32 | - public function order(); |
|
29 | + /** |
|
30 | + * @return int |
|
31 | + */ |
|
32 | + public function order(); |
|
33 | 33 | |
34 | - /** |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function htmlClass(); |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function htmlClass(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function text(); |
|
39 | + /** |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function text(); |
|
43 | 43 | } |
@@ -11,23 +11,23 @@ |
||
11 | 11 | interface ProgressStepsDisplayInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * used for setting up css and js required for the display strategy |
|
16 | - * ** IMPORTANT ** |
|
17 | - * This needs to be called BEFORE the wp_enqueue_scripts hook point for the frontend |
|
18 | - * or the admin_enqueue_scripts in the admin. |
|
19 | - * If setting up steps for the admin, this can be done via the |
|
20 | - * 'FHEE__EE_Admin_Page___load_page_dependencies__after_load' ACTION |
|
21 | - * in \EE_Admin_Page::_load_page_dependencies() or the targeted hook that comes after it |
|
22 | - * |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function enqueueStylesAndScripts(); |
|
14 | + /** |
|
15 | + * used for setting up css and js required for the display strategy |
|
16 | + * ** IMPORTANT ** |
|
17 | + * This needs to be called BEFORE the wp_enqueue_scripts hook point for the frontend |
|
18 | + * or the admin_enqueue_scripts in the admin. |
|
19 | + * If setting up steps for the admin, this can be done via the |
|
20 | + * 'FHEE__EE_Admin_Page___load_page_dependencies__after_load' ACTION |
|
21 | + * in \EE_Admin_Page::_load_page_dependencies() or the targeted hook that comes after it |
|
22 | + * |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function enqueueStylesAndScripts(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * loads and returns a full server path to the template used for the display strategy |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function getTemplate(); |
|
27 | + /** |
|
28 | + * loads and returns a full server path to the template used for the display strategy |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function getTemplate(); |
|
33 | 33 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('No direct script access allowed'); |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * This is the template for the "Number Bubbles" Progress Steps |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -17,18 +17,18 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * Uses CollectionFilterCallbackIterator on a provided collection with provided Closure for filtering each object |
|
22 | - * in the collection. |
|
23 | - * The closure receives an instance of the object and should return false if it is not "valid" and true if it is. |
|
24 | - * |
|
25 | - * @param Collection $collection |
|
26 | - * @param Closure $acceptance_callback |
|
27 | - * @return array |
|
28 | - */ |
|
29 | - public static function getFilteredObjectsFromCollection(Collection $collection, Closure $acceptance_callback) |
|
30 | - { |
|
31 | - $collection_filter_iterator = new CollectionFilterCallbackIterator($collection, $acceptance_callback); |
|
32 | - return $collection_filter_iterator->getFiltered(); |
|
33 | - } |
|
20 | + /** |
|
21 | + * Uses CollectionFilterCallbackIterator on a provided collection with provided Closure for filtering each object |
|
22 | + * in the collection. |
|
23 | + * The closure receives an instance of the object and should return false if it is not "valid" and true if it is. |
|
24 | + * |
|
25 | + * @param Collection $collection |
|
26 | + * @param Closure $acceptance_callback |
|
27 | + * @return array |
|
28 | + */ |
|
29 | + public static function getFilteredObjectsFromCollection(Collection $collection, Closure $acceptance_callback) |
|
30 | + { |
|
31 | + $collection_filter_iterator = new CollectionFilterCallbackIterator($collection, $acceptance_callback); |
|
32 | + return $collection_filter_iterator->getFiltered(); |
|
33 | + } |
|
34 | 34 | } |
@@ -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 | } |
@@ -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 |
@@ -46,225 +46,225 @@ |
||
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 InvalidRequestStackMiddlewareException |
|
96 | - * @throws OutOfBoundsException |
|
97 | - * @throws ReflectionException |
|
98 | - */ |
|
99 | - public function initialize() |
|
100 | - { |
|
101 | - $this->bootstrapDependencyInjectionContainer(); |
|
102 | - $this->bootstrapDomain(); |
|
103 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
104 | - add_action( |
|
105 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
106 | - array($bootstrap_request, 'setupLegacyRequest') |
|
107 | - ); |
|
108 | - $this->runRequestStack(); |
|
109 | - } |
|
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 InvalidRequestStackMiddlewareException |
|
96 | + * @throws OutOfBoundsException |
|
97 | + * @throws ReflectionException |
|
98 | + */ |
|
99 | + public function initialize() |
|
100 | + { |
|
101 | + $this->bootstrapDependencyInjectionContainer(); |
|
102 | + $this->bootstrapDomain(); |
|
103 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
104 | + add_action( |
|
105 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
106 | + array($bootstrap_request, 'setupLegacyRequest') |
|
107 | + ); |
|
108 | + $this->runRequestStack(); |
|
109 | + } |
|
110 | 110 | |
111 | 111 | |
112 | - /** |
|
113 | - * @throws ReflectionException |
|
114 | - * @throws EE_Error |
|
115 | - * @throws InvalidArgumentException |
|
116 | - * @throws InvalidDataTypeException |
|
117 | - * @throws InvalidInterfaceException |
|
118 | - * @throws OutOfBoundsException |
|
119 | - */ |
|
120 | - private function bootstrapDependencyInjectionContainer() |
|
121 | - { |
|
122 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
123 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
124 | - $bootstrap_di->buildLoader(); |
|
125 | - $registry = $bootstrap_di->getRegistry(); |
|
126 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
127 | - $dependency_map->initialize(); |
|
128 | - $registry->initialize(); |
|
129 | - $this->loader = $bootstrap_di->getLoader(); |
|
130 | - } |
|
112 | + /** |
|
113 | + * @throws ReflectionException |
|
114 | + * @throws EE_Error |
|
115 | + * @throws InvalidArgumentException |
|
116 | + * @throws InvalidDataTypeException |
|
117 | + * @throws InvalidInterfaceException |
|
118 | + * @throws OutOfBoundsException |
|
119 | + */ |
|
120 | + private function bootstrapDependencyInjectionContainer() |
|
121 | + { |
|
122 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
123 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
124 | + $bootstrap_di->buildLoader(); |
|
125 | + $registry = $bootstrap_di->getRegistry(); |
|
126 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
127 | + $dependency_map->initialize(); |
|
128 | + $registry->initialize(); |
|
129 | + $this->loader = $bootstrap_di->getLoader(); |
|
130 | + } |
|
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * configures the Domain object for core |
|
135 | - * |
|
136 | - * @return void |
|
137 | - * @throws DomainException |
|
138 | - * @throws InvalidArgumentException |
|
139 | - * @throws InvalidDataTypeException |
|
140 | - * @throws InvalidClassException |
|
141 | - * @throws InvalidFilePathException |
|
142 | - * @throws InvalidInterfaceException |
|
143 | - */ |
|
144 | - private function bootstrapDomain() |
|
145 | - { |
|
146 | - DomainFactory::getEventEspressoCoreDomain(); |
|
147 | - } |
|
133 | + /** |
|
134 | + * configures the Domain object for core |
|
135 | + * |
|
136 | + * @return void |
|
137 | + * @throws DomainException |
|
138 | + * @throws InvalidArgumentException |
|
139 | + * @throws InvalidDataTypeException |
|
140 | + * @throws InvalidClassException |
|
141 | + * @throws InvalidFilePathException |
|
142 | + * @throws InvalidInterfaceException |
|
143 | + */ |
|
144 | + private function bootstrapDomain() |
|
145 | + { |
|
146 | + DomainFactory::getEventEspressoCoreDomain(); |
|
147 | + } |
|
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * sets up the request and response objects |
|
152 | - * |
|
153 | - * @return BootstrapRequestResponseObjects |
|
154 | - * @throws InvalidArgumentException |
|
155 | - */ |
|
156 | - private function bootstrapRequestResponseObjects() |
|
157 | - { |
|
158 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
159 | - $bootstrap_request = $this->loader->getShared( |
|
160 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
161 | - array($this->loader) |
|
162 | - ); |
|
163 | - $bootstrap_request->buildRequestResponse(); |
|
164 | - $bootstrap_request->shareRequestResponse(); |
|
165 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
166 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
167 | - return $bootstrap_request; |
|
168 | - } |
|
150 | + /** |
|
151 | + * sets up the request and response objects |
|
152 | + * |
|
153 | + * @return BootstrapRequestResponseObjects |
|
154 | + * @throws InvalidArgumentException |
|
155 | + */ |
|
156 | + private function bootstrapRequestResponseObjects() |
|
157 | + { |
|
158 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
159 | + $bootstrap_request = $this->loader->getShared( |
|
160 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
161 | + array($this->loader) |
|
162 | + ); |
|
163 | + $bootstrap_request->buildRequestResponse(); |
|
164 | + $bootstrap_request->shareRequestResponse(); |
|
165 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
166 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
167 | + return $bootstrap_request; |
|
168 | + } |
|
169 | 169 | |
170 | 170 | |
171 | - /** |
|
172 | - * run_request_stack |
|
173 | - * construct request stack and run middleware apps |
|
174 | - * |
|
175 | - * @throws EE_Error |
|
176 | - * @throws Exception |
|
177 | - */ |
|
178 | - public function runRequestStack() |
|
179 | - { |
|
180 | - $this->loadAutoloader(); |
|
181 | - $this->setAutoloadersForRequiredFiles(); |
|
182 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
183 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
184 | - new RequestStackCoreApp() |
|
185 | - ); |
|
186 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
187 | - $this->request_stack->handleResponse(); |
|
188 | - } |
|
171 | + /** |
|
172 | + * run_request_stack |
|
173 | + * construct request stack and run middleware apps |
|
174 | + * |
|
175 | + * @throws EE_Error |
|
176 | + * @throws Exception |
|
177 | + */ |
|
178 | + public function runRequestStack() |
|
179 | + { |
|
180 | + $this->loadAutoloader(); |
|
181 | + $this->setAutoloadersForRequiredFiles(); |
|
182 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
183 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
184 | + new RequestStackCoreApp() |
|
185 | + ); |
|
186 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
187 | + $this->request_stack->handleResponse(); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | - /** |
|
192 | - * load_autoloader |
|
193 | - * |
|
194 | - * @throws EE_Error |
|
195 | - */ |
|
196 | - protected function loadAutoloader() |
|
197 | - { |
|
198 | - // load interfaces |
|
199 | - espresso_load_required( |
|
200 | - 'EEH_Autoloader', |
|
201 | - EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
202 | - ); |
|
203 | - EEH_Autoloader::instance(); |
|
204 | - } |
|
191 | + /** |
|
192 | + * load_autoloader |
|
193 | + * |
|
194 | + * @throws EE_Error |
|
195 | + */ |
|
196 | + protected function loadAutoloader() |
|
197 | + { |
|
198 | + // load interfaces |
|
199 | + espresso_load_required( |
|
200 | + 'EEH_Autoloader', |
|
201 | + EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
202 | + ); |
|
203 | + EEH_Autoloader::instance(); |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | - /** |
|
208 | - * load_required_files |
|
209 | - * |
|
210 | - * @throws EE_Error |
|
211 | - */ |
|
212 | - protected function setAutoloadersForRequiredFiles() |
|
213 | - { |
|
214 | - // load interfaces |
|
215 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | - // load helpers |
|
217 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
218 | - // register legacy request stack classes just in case |
|
219 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
220 | - // register legacy middleware classes just in case |
|
221 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
222 | - } |
|
207 | + /** |
|
208 | + * load_required_files |
|
209 | + * |
|
210 | + * @throws EE_Error |
|
211 | + */ |
|
212 | + protected function setAutoloadersForRequiredFiles() |
|
213 | + { |
|
214 | + // load interfaces |
|
215 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
216 | + // load helpers |
|
217 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
218 | + // register legacy request stack classes just in case |
|
219 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
220 | + // register legacy middleware classes just in case |
|
221 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
222 | + } |
|
223 | 223 | |
224 | 224 | |
225 | - /** |
|
226 | - * build_request_stack |
|
227 | - * |
|
228 | - * @return RequestStackBuilder |
|
229 | - */ |
|
230 | - public function buildRequestStack() |
|
231 | - { |
|
232 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
233 | - /** |
|
234 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
235 | - * so items at the beginning of the final middleware stack will run last. |
|
236 | - * First parameter is the middleware classname, second is an array of arguments |
|
237 | - */ |
|
238 | - $stack_apps = apply_filters( |
|
239 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
240 | - array( |
|
241 | - // first in last out |
|
242 | - 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
243 | - 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
244 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
245 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
246 | - // last in first out |
|
247 | - 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
248 | - ) |
|
249 | - ); |
|
250 | - // legacy filter for backwards compatibility |
|
251 | - $stack_apps = apply_filters( |
|
252 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
253 | - $stack_apps |
|
254 | - ); |
|
255 | - // load middleware onto stack : FILO (First In Last Out) |
|
256 | - // items at the beginning of the $stack_apps array will run last |
|
257 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
258 | - $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
259 | - } |
|
260 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
261 | - // and we also need it to always run first because the rest of the system relies on it |
|
262 | - $request_stack_builder->push( |
|
263 | - array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
264 | - ); |
|
265 | - return apply_filters( |
|
266 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
267 | - $request_stack_builder |
|
268 | - ); |
|
269 | - } |
|
225 | + /** |
|
226 | + * build_request_stack |
|
227 | + * |
|
228 | + * @return RequestStackBuilder |
|
229 | + */ |
|
230 | + public function buildRequestStack() |
|
231 | + { |
|
232 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
233 | + /** |
|
234 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
235 | + * so items at the beginning of the final middleware stack will run last. |
|
236 | + * First parameter is the middleware classname, second is an array of arguments |
|
237 | + */ |
|
238 | + $stack_apps = apply_filters( |
|
239 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
240 | + array( |
|
241 | + // first in last out |
|
242 | + 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
243 | + 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
244 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
245 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
246 | + // last in first out |
|
247 | + 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
248 | + ) |
|
249 | + ); |
|
250 | + // legacy filter for backwards compatibility |
|
251 | + $stack_apps = apply_filters( |
|
252 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
253 | + $stack_apps |
|
254 | + ); |
|
255 | + // load middleware onto stack : FILO (First In Last Out) |
|
256 | + // items at the beginning of the $stack_apps array will run last |
|
257 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
258 | + $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
259 | + } |
|
260 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
261 | + // and we also need it to always run first because the rest of the system relies on it |
|
262 | + $request_stack_builder->push( |
|
263 | + array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
264 | + ); |
|
265 | + return apply_filters( |
|
266 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
267 | + $request_stack_builder |
|
268 | + ); |
|
269 | + } |
|
270 | 270 | } |