@@ -19,221 +19,221 @@ |
||
19 | 19 | abstract class EspressoShortcode implements ShortcodeInterface |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * transient prefix |
|
24 | - * |
|
25 | - * @type string |
|
26 | - */ |
|
27 | - const CACHE_TRANSIENT_PREFIX = 'ee_sc_'; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var PostRelatedCacheManager $cache_manager |
|
31 | - */ |
|
32 | - private $cache_manager; |
|
33 | - |
|
34 | - /** |
|
35 | - * true if ShortcodeInterface::initializeShortcode() has been called |
|
36 | - * if false, then that will get called before processing |
|
37 | - * |
|
38 | - * @var boolean $initialized |
|
39 | - */ |
|
40 | - private $initialized = false; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * EspressoShortcode constructor |
|
45 | - * |
|
46 | - * @param PostRelatedCacheManager $cache_manager |
|
47 | - */ |
|
48 | - public function __construct(PostRelatedCacheManager $cache_manager) |
|
49 | - { |
|
50 | - $this->cache_manager = $cache_manager; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public function shortcodeHasBeenInitialized() |
|
58 | - { |
|
59 | - $this->initialized = true; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * enqueues scripts then processes the shortcode |
|
65 | - * |
|
66 | - * @param array $attributes |
|
67 | - * @return string |
|
68 | - * @throws EE_Error |
|
69 | - */ |
|
70 | - final public function processShortcodeCallback($attributes = array()) |
|
71 | - { |
|
72 | - if ($this instanceof EnqueueAssetsInterface) { |
|
73 | - if (is_admin()) { |
|
74 | - $this->enqueueAdminScripts(); |
|
75 | - } else { |
|
76 | - $this->enqueueScripts(); |
|
77 | - } |
|
78 | - } |
|
79 | - return $this->shortcodeContent( |
|
80 | - $this->sanitizeAttributes((array) $attributes) |
|
81 | - ); |
|
82 | - } |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * If shortcode caching is enabled for the shortcode, |
|
87 | - * and cached results exist, then that will be returned |
|
88 | - * else new content will be generated. |
|
89 | - * If caching is enabled, then the new content will be cached for later. |
|
90 | - * |
|
91 | - * @param array $attributes |
|
92 | - * @return mixed|string |
|
93 | - * @throws EE_Error |
|
94 | - */ |
|
95 | - private function shortcodeContent(array $attributes) |
|
96 | - { |
|
97 | - $shortcode = $this; |
|
98 | - $post_ID = $this->currentPostID(); |
|
99 | - // something like "SC_EVENTS-123" |
|
100 | - $cache_ID = $this->shortcodeCacheID($post_ID); |
|
101 | - $this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID); |
|
102 | - return $this->cache_manager->get( |
|
103 | - $cache_ID, |
|
104 | - // serialized attributes |
|
105 | - wp_json_encode($attributes), |
|
106 | - // Closure for generating content if cache is expired |
|
107 | - function () use ($shortcode, $attributes) { |
|
108 | - if ($shortcode->initialized() === false) { |
|
109 | - $shortcode->initializeShortcode(); |
|
110 | - } |
|
111 | - return $shortcode->processShortcode($attributes); |
|
112 | - }, |
|
113 | - // filterable cache expiration set by each shortcode |
|
114 | - apply_filters( |
|
115 | - 'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration', |
|
116 | - $this->cacheExpiration(), |
|
117 | - $this->getTag(), |
|
118 | - $this |
|
119 | - ) |
|
120 | - ); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * @return int |
|
126 | - * @throws EE_Error |
|
127 | - */ |
|
128 | - private function currentPostID() |
|
129 | - { |
|
130 | - // try to get EE_Event any way we can |
|
131 | - $event = EEH_Event_View::get_event(); |
|
132 | - // then get some kind of ID |
|
133 | - if ($event instanceof EE_Event) { |
|
134 | - return $event->ID(); |
|
135 | - } |
|
136 | - global $post; |
|
137 | - if ($post instanceof WP_Post) { |
|
138 | - return $post->ID; |
|
139 | - } |
|
140 | - return 0; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param int $post_ID |
|
146 | - * @return string |
|
147 | - * @throws EE_Error |
|
148 | - */ |
|
149 | - private function shortcodeCacheID($post_ID) |
|
150 | - { |
|
151 | - $tag = str_replace('ESPRESSO_', '', $this->getTag()); |
|
152 | - return "SC_{$tag}-{$post_ID}"; |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * array for defining custom attribute sanitization callbacks, |
|
158 | - * where keys match keys in your attributes array, |
|
159 | - * and values represent the sanitization function you wish to be applied to that attribute. |
|
160 | - * So for example, if you had an integer attribute named "event_id" |
|
161 | - * that you wanted to be sanitized using absint(), |
|
162 | - * then you would return the following: |
|
163 | - * array('event_id' => 'absint') |
|
164 | - * Entering 'skip_sanitization' for the callback value |
|
165 | - * means that no sanitization will be applied |
|
166 | - * on the assumption that the attribute |
|
167 | - * will be sanitized at some point... right? |
|
168 | - * You wouldn't pass around unsanitized attributes would you? |
|
169 | - * That would be very Tom Foolery of you!!! |
|
170 | - * |
|
171 | - * @return array |
|
172 | - */ |
|
173 | - protected function customAttributeSanitizationMap() |
|
174 | - { |
|
175 | - return array(); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * Performs basic sanitization on shortcode attributes |
|
181 | - * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
182 | - * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
183 | - * This can be overridden using the customAttributeSanitizationMap() method (see above), |
|
184 | - * all other attributes would be sanitized using the defaults in the switch statement below |
|
185 | - * |
|
186 | - * @param array $attributes |
|
187 | - * @return array |
|
188 | - */ |
|
189 | - private function sanitizeAttributes(array $attributes) |
|
190 | - { |
|
191 | - $custom_sanitization = $this->customAttributeSanitizationMap(); |
|
192 | - foreach ($attributes as $key => $value) { |
|
193 | - // is a custom sanitization callback specified ? |
|
194 | - if (isset($custom_sanitization[ $key ])) { |
|
195 | - $callback = $custom_sanitization[ $key ]; |
|
196 | - if ($callback === 'skip_sanitization') { |
|
197 | - $attributes[ $key ] = $value; |
|
198 | - continue; |
|
199 | - } |
|
200 | - if (function_exists($callback)) { |
|
201 | - $attributes[ $key ] = $callback($value); |
|
202 | - continue; |
|
203 | - } |
|
204 | - } |
|
205 | - switch (true) { |
|
206 | - case $value === null: |
|
207 | - case is_int($value): |
|
208 | - case is_float($value): |
|
209 | - // typical booleans |
|
210 | - case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
|
211 | - $attributes[ $key ] = $value; |
|
212 | - break; |
|
213 | - case is_string($value): |
|
214 | - $attributes[ $key ] = sanitize_text_field($value); |
|
215 | - break; |
|
216 | - case is_array($value): |
|
217 | - $attributes[ $key ] = $this->sanitizeAttributes($value); |
|
218 | - break; |
|
219 | - default: |
|
220 | - // only remaining data types are Object and Resource |
|
221 | - // which are not allowed as shortcode attributes |
|
222 | - $attributes[ $key ] = null; |
|
223 | - break; |
|
224 | - } |
|
225 | - } |
|
226 | - return $attributes; |
|
227 | - } |
|
228 | - |
|
229 | - |
|
230 | - /** |
|
231 | - * Returns whether or not this shortcode has been initialized |
|
232 | - * |
|
233 | - * @return boolean |
|
234 | - */ |
|
235 | - public function initialized() |
|
236 | - { |
|
237 | - return $this->initialized; |
|
238 | - } |
|
22 | + /** |
|
23 | + * transient prefix |
|
24 | + * |
|
25 | + * @type string |
|
26 | + */ |
|
27 | + const CACHE_TRANSIENT_PREFIX = 'ee_sc_'; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var PostRelatedCacheManager $cache_manager |
|
31 | + */ |
|
32 | + private $cache_manager; |
|
33 | + |
|
34 | + /** |
|
35 | + * true if ShortcodeInterface::initializeShortcode() has been called |
|
36 | + * if false, then that will get called before processing |
|
37 | + * |
|
38 | + * @var boolean $initialized |
|
39 | + */ |
|
40 | + private $initialized = false; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * EspressoShortcode constructor |
|
45 | + * |
|
46 | + * @param PostRelatedCacheManager $cache_manager |
|
47 | + */ |
|
48 | + public function __construct(PostRelatedCacheManager $cache_manager) |
|
49 | + { |
|
50 | + $this->cache_manager = $cache_manager; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public function shortcodeHasBeenInitialized() |
|
58 | + { |
|
59 | + $this->initialized = true; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * enqueues scripts then processes the shortcode |
|
65 | + * |
|
66 | + * @param array $attributes |
|
67 | + * @return string |
|
68 | + * @throws EE_Error |
|
69 | + */ |
|
70 | + final public function processShortcodeCallback($attributes = array()) |
|
71 | + { |
|
72 | + if ($this instanceof EnqueueAssetsInterface) { |
|
73 | + if (is_admin()) { |
|
74 | + $this->enqueueAdminScripts(); |
|
75 | + } else { |
|
76 | + $this->enqueueScripts(); |
|
77 | + } |
|
78 | + } |
|
79 | + return $this->shortcodeContent( |
|
80 | + $this->sanitizeAttributes((array) $attributes) |
|
81 | + ); |
|
82 | + } |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * If shortcode caching is enabled for the shortcode, |
|
87 | + * and cached results exist, then that will be returned |
|
88 | + * else new content will be generated. |
|
89 | + * If caching is enabled, then the new content will be cached for later. |
|
90 | + * |
|
91 | + * @param array $attributes |
|
92 | + * @return mixed|string |
|
93 | + * @throws EE_Error |
|
94 | + */ |
|
95 | + private function shortcodeContent(array $attributes) |
|
96 | + { |
|
97 | + $shortcode = $this; |
|
98 | + $post_ID = $this->currentPostID(); |
|
99 | + // something like "SC_EVENTS-123" |
|
100 | + $cache_ID = $this->shortcodeCacheID($post_ID); |
|
101 | + $this->cache_manager->clearPostRelatedCacheOnUpdate($post_ID, $cache_ID); |
|
102 | + return $this->cache_manager->get( |
|
103 | + $cache_ID, |
|
104 | + // serialized attributes |
|
105 | + wp_json_encode($attributes), |
|
106 | + // Closure for generating content if cache is expired |
|
107 | + function () use ($shortcode, $attributes) { |
|
108 | + if ($shortcode->initialized() === false) { |
|
109 | + $shortcode->initializeShortcode(); |
|
110 | + } |
|
111 | + return $shortcode->processShortcode($attributes); |
|
112 | + }, |
|
113 | + // filterable cache expiration set by each shortcode |
|
114 | + apply_filters( |
|
115 | + 'FHEE__EventEspresso_core_services_shortcodes_EspressoShortcode__shortcodeContent__cache_expiration', |
|
116 | + $this->cacheExpiration(), |
|
117 | + $this->getTag(), |
|
118 | + $this |
|
119 | + ) |
|
120 | + ); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * @return int |
|
126 | + * @throws EE_Error |
|
127 | + */ |
|
128 | + private function currentPostID() |
|
129 | + { |
|
130 | + // try to get EE_Event any way we can |
|
131 | + $event = EEH_Event_View::get_event(); |
|
132 | + // then get some kind of ID |
|
133 | + if ($event instanceof EE_Event) { |
|
134 | + return $event->ID(); |
|
135 | + } |
|
136 | + global $post; |
|
137 | + if ($post instanceof WP_Post) { |
|
138 | + return $post->ID; |
|
139 | + } |
|
140 | + return 0; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param int $post_ID |
|
146 | + * @return string |
|
147 | + * @throws EE_Error |
|
148 | + */ |
|
149 | + private function shortcodeCacheID($post_ID) |
|
150 | + { |
|
151 | + $tag = str_replace('ESPRESSO_', '', $this->getTag()); |
|
152 | + return "SC_{$tag}-{$post_ID}"; |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * array for defining custom attribute sanitization callbacks, |
|
158 | + * where keys match keys in your attributes array, |
|
159 | + * and values represent the sanitization function you wish to be applied to that attribute. |
|
160 | + * So for example, if you had an integer attribute named "event_id" |
|
161 | + * that you wanted to be sanitized using absint(), |
|
162 | + * then you would return the following: |
|
163 | + * array('event_id' => 'absint') |
|
164 | + * Entering 'skip_sanitization' for the callback value |
|
165 | + * means that no sanitization will be applied |
|
166 | + * on the assumption that the attribute |
|
167 | + * will be sanitized at some point... right? |
|
168 | + * You wouldn't pass around unsanitized attributes would you? |
|
169 | + * That would be very Tom Foolery of you!!! |
|
170 | + * |
|
171 | + * @return array |
|
172 | + */ |
|
173 | + protected function customAttributeSanitizationMap() |
|
174 | + { |
|
175 | + return array(); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * Performs basic sanitization on shortcode attributes |
|
181 | + * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
182 | + * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
183 | + * This can be overridden using the customAttributeSanitizationMap() method (see above), |
|
184 | + * all other attributes would be sanitized using the defaults in the switch statement below |
|
185 | + * |
|
186 | + * @param array $attributes |
|
187 | + * @return array |
|
188 | + */ |
|
189 | + private function sanitizeAttributes(array $attributes) |
|
190 | + { |
|
191 | + $custom_sanitization = $this->customAttributeSanitizationMap(); |
|
192 | + foreach ($attributes as $key => $value) { |
|
193 | + // is a custom sanitization callback specified ? |
|
194 | + if (isset($custom_sanitization[ $key ])) { |
|
195 | + $callback = $custom_sanitization[ $key ]; |
|
196 | + if ($callback === 'skip_sanitization') { |
|
197 | + $attributes[ $key ] = $value; |
|
198 | + continue; |
|
199 | + } |
|
200 | + if (function_exists($callback)) { |
|
201 | + $attributes[ $key ] = $callback($value); |
|
202 | + continue; |
|
203 | + } |
|
204 | + } |
|
205 | + switch (true) { |
|
206 | + case $value === null: |
|
207 | + case is_int($value): |
|
208 | + case is_float($value): |
|
209 | + // typical booleans |
|
210 | + case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
|
211 | + $attributes[ $key ] = $value; |
|
212 | + break; |
|
213 | + case is_string($value): |
|
214 | + $attributes[ $key ] = sanitize_text_field($value); |
|
215 | + break; |
|
216 | + case is_array($value): |
|
217 | + $attributes[ $key ] = $this->sanitizeAttributes($value); |
|
218 | + break; |
|
219 | + default: |
|
220 | + // only remaining data types are Object and Resource |
|
221 | + // which are not allowed as shortcode attributes |
|
222 | + $attributes[ $key ] = null; |
|
223 | + break; |
|
224 | + } |
|
225 | + } |
|
226 | + return $attributes; |
|
227 | + } |
|
228 | + |
|
229 | + |
|
230 | + /** |
|
231 | + * Returns whether or not this shortcode has been initialized |
|
232 | + * |
|
233 | + * @return boolean |
|
234 | + */ |
|
235 | + public function initialized() |
|
236 | + { |
|
237 | + return $this->initialized; |
|
238 | + } |
|
239 | 239 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // serialized attributes |
105 | 105 | wp_json_encode($attributes), |
106 | 106 | // Closure for generating content if cache is expired |
107 | - function () use ($shortcode, $attributes) { |
|
107 | + function() use ($shortcode, $attributes) { |
|
108 | 108 | if ($shortcode->initialized() === false) { |
109 | 109 | $shortcode->initializeShortcode(); |
110 | 110 | } |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | $custom_sanitization = $this->customAttributeSanitizationMap(); |
192 | 192 | foreach ($attributes as $key => $value) { |
193 | 193 | // is a custom sanitization callback specified ? |
194 | - if (isset($custom_sanitization[ $key ])) { |
|
195 | - $callback = $custom_sanitization[ $key ]; |
|
194 | + if (isset($custom_sanitization[$key])) { |
|
195 | + $callback = $custom_sanitization[$key]; |
|
196 | 196 | if ($callback === 'skip_sanitization') { |
197 | - $attributes[ $key ] = $value; |
|
197 | + $attributes[$key] = $value; |
|
198 | 198 | continue; |
199 | 199 | } |
200 | 200 | if (function_exists($callback)) { |
201 | - $attributes[ $key ] = $callback($value); |
|
201 | + $attributes[$key] = $callback($value); |
|
202 | 202 | continue; |
203 | 203 | } |
204 | 204 | } |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | case is_float($value): |
209 | 209 | // typical booleans |
210 | 210 | case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
211 | - $attributes[ $key ] = $value; |
|
211 | + $attributes[$key] = $value; |
|
212 | 212 | break; |
213 | 213 | case is_string($value): |
214 | - $attributes[ $key ] = sanitize_text_field($value); |
|
214 | + $attributes[$key] = sanitize_text_field($value); |
|
215 | 215 | break; |
216 | 216 | case is_array($value): |
217 | - $attributes[ $key ] = $this->sanitizeAttributes($value); |
|
217 | + $attributes[$key] = $this->sanitizeAttributes($value); |
|
218 | 218 | break; |
219 | 219 | default: |
220 | 220 | // only remaining data types are Object and Resource |
221 | 221 | // which are not allowed as shortcode attributes |
222 | - $attributes[ $key ] = null; |
|
222 | + $attributes[$key] = null; |
|
223 | 223 | break; |
224 | 224 | } |
225 | 225 | } |
@@ -13,31 +13,31 @@ |
||
13 | 13 | interface NoticeConverterInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return NoticesContainerInterface |
|
18 | - */ |
|
19 | - public function getNotices(); |
|
16 | + /** |
|
17 | + * @return NoticesContainerInterface |
|
18 | + */ |
|
19 | + public function getNotices(); |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param bool $throw_exceptions |
|
23 | - */ |
|
24 | - public function setThrowExceptions($throw_exceptions); |
|
21 | + /** |
|
22 | + * @param bool $throw_exceptions |
|
23 | + */ |
|
24 | + public function setThrowExceptions($throw_exceptions); |
|
25 | 25 | |
26 | - /** |
|
27 | - * @return bool |
|
28 | - */ |
|
29 | - public function getThrowExceptions(); |
|
26 | + /** |
|
27 | + * @return bool |
|
28 | + */ |
|
29 | + public function getThrowExceptions(); |
|
30 | 30 | |
31 | - /** |
|
32 | - * Converts NoticesContainerInterface objects into other format |
|
33 | - * |
|
34 | - * @param NoticesContainerInterface $notices |
|
35 | - * @return |
|
36 | - */ |
|
37 | - public function process(NoticesContainerInterface $notices); |
|
31 | + /** |
|
32 | + * Converts NoticesContainerInterface objects into other format |
|
33 | + * |
|
34 | + * @param NoticesContainerInterface $notices |
|
35 | + * @return |
|
36 | + */ |
|
37 | + public function process(NoticesContainerInterface $notices); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return void; |
|
41 | - */ |
|
42 | - public function clearNotices(); |
|
39 | + /** |
|
40 | + * @return void; |
|
41 | + */ |
|
42 | + public function clearNotices(); |
|
43 | 43 | } |
@@ -13,38 +13,38 @@ |
||
13 | 13 | interface NoticeInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function type(); |
|
16 | + /** |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function type(); |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function message(); |
|
22 | + /** |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function message(); |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return bool |
|
30 | - */ |
|
31 | - public function isDismissible(); |
|
28 | + /** |
|
29 | + * @return bool |
|
30 | + */ |
|
31 | + public function isDismissible(); |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function file(); |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function file(); |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function func(); |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function func(); |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - public function line(); |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + public function line(); |
|
50 | 50 | } |
@@ -9,13 +9,13 @@ |
||
9 | 9 | interface LocatorInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * given a string or an array of information for where to look, |
|
14 | - * will find all files in that location |
|
15 | - * |
|
16 | - * @access public |
|
17 | - * @param array|string $location |
|
18 | - * @return \FilesystemIterator |
|
19 | - */ |
|
20 | - public function locate($location); |
|
12 | + /** |
|
13 | + * given a string or an array of information for where to look, |
|
14 | + * will find all files in that location |
|
15 | + * |
|
16 | + * @access public |
|
17 | + * @param array|string $location |
|
18 | + * @return \FilesystemIterator |
|
19 | + */ |
|
20 | + public function locate($location); |
|
21 | 21 | } |
@@ -5,18 +5,18 @@ |
||
5 | 5 | interface LoaderDecoratorInterface |
6 | 6 | { |
7 | 7 | |
8 | - /** |
|
9 | - * @param string $fqcn |
|
10 | - * @param array $arguments |
|
11 | - * @param bool $shared |
|
12 | - * @return mixed |
|
13 | - */ |
|
14 | - public function load($fqcn, $arguments = array(), $shared = true); |
|
8 | + /** |
|
9 | + * @param string $fqcn |
|
10 | + * @param array $arguments |
|
11 | + * @param bool $shared |
|
12 | + * @return mixed |
|
13 | + */ |
|
14 | + public function load($fqcn, $arguments = array(), $shared = true); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * calls reset() on loader if method exists |
|
20 | - */ |
|
21 | - public function reset(); |
|
18 | + /** |
|
19 | + * calls reset() on loader if method exists |
|
20 | + */ |
|
21 | + public function reset(); |
|
22 | 22 | } |
@@ -12,63 +12,63 @@ |
||
12 | 12 | interface GatewayDataFormatterInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Gets the text to use for a gateway's line item name when this is a partial payment |
|
17 | - * |
|
18 | - * @param \EEI_Payment $payment |
|
19 | - * @return string |
|
20 | - */ |
|
21 | - public function formatPartialPaymentLineItemName(\EEI_Payment $payment); |
|
15 | + /** |
|
16 | + * Gets the text to use for a gateway's line item name when this is a partial payment |
|
17 | + * |
|
18 | + * @param \EEI_Payment $payment |
|
19 | + * @return string |
|
20 | + */ |
|
21 | + public function formatPartialPaymentLineItemName(\EEI_Payment $payment); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * Gets the text to use for a gateway's line item description when this is a partial payment |
|
27 | - * |
|
28 | - * @param \EEI_Payment $payment |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment); |
|
25 | + /** |
|
26 | + * Gets the text to use for a gateway's line item description when this is a partial payment |
|
27 | + * |
|
28 | + * @param \EEI_Payment $payment |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Gets the name to use for a line item when sending line items to the gateway |
|
37 | - * |
|
38 | - * @param \EEI_Line_Item $line_item |
|
39 | - * @param \EEI_Payment $payment |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment); |
|
35 | + /** |
|
36 | + * Gets the name to use for a line item when sending line items to the gateway |
|
37 | + * |
|
38 | + * @param \EEI_Line_Item $line_item |
|
39 | + * @param \EEI_Payment $payment |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment); |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Gets the description to use for a line item when sending line items to the gateway |
|
48 | - * |
|
49 | - * @param \EEI_Line_Item $line_item |
|
50 | - * @param \EEI_Payment $payment |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment); |
|
46 | + /** |
|
47 | + * Gets the description to use for a line item when sending line items to the gateway |
|
48 | + * |
|
49 | + * @param \EEI_Line_Item $line_item |
|
50 | + * @param \EEI_Payment $payment |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Gets the order description that should generally be sent to gateways |
|
59 | - * |
|
60 | - * @param \EEI_Payment $payment |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - public function formatOrderDescription(\EEI_Payment $payment); |
|
57 | + /** |
|
58 | + * Gets the order description that should generally be sent to gateways |
|
59 | + * |
|
60 | + * @param \EEI_Payment $payment |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + public function formatOrderDescription(\EEI_Payment $payment); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * Formats the amount so it can generally be sent to gateways |
|
69 | - * |
|
70 | - * @param float $amount |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function formatCurrency($amount); |
|
67 | + /** |
|
68 | + * Formats the amount so it can generally be sent to gateways |
|
69 | + * |
|
70 | + * @param float $amount |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function formatCurrency($amount); |
|
74 | 74 | } |
@@ -12,24 +12,24 @@ |
||
12 | 12 | interface ContainerInterface |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Finds an entry of the container by its identifier and returns it. |
|
17 | - * |
|
18 | - * @param string $id Identifier of the entry to look for. |
|
19 | - * @return mixed Entry. |
|
20 | - */ |
|
21 | - public function get($id); |
|
15 | + /** |
|
16 | + * Finds an entry of the container by its identifier and returns it. |
|
17 | + * |
|
18 | + * @param string $id Identifier of the entry to look for. |
|
19 | + * @return mixed Entry. |
|
20 | + */ |
|
21 | + public function get($id); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * Returns true if the container can return an entry for the given identifier. |
|
27 | - * Returns false otherwise. |
|
28 | - * `has($id)` returning true does not mean that `get($id)` will not throw an exception. |
|
29 | - * It does however mean that `get($id)` will not throw a `NotFoundException`. |
|
30 | - * |
|
31 | - * @param string $id Identifier of the entry to look for. |
|
32 | - * @return boolean |
|
33 | - */ |
|
34 | - public function has($id); |
|
25 | + /** |
|
26 | + * Returns true if the container can return an entry for the given identifier. |
|
27 | + * Returns false otherwise. |
|
28 | + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. |
|
29 | + * It does however mean that `get($id)` will not throw a `NotFoundException`. |
|
30 | + * |
|
31 | + * @param string $id Identifier of the entry to look for. |
|
32 | + * @return boolean |
|
33 | + */ |
|
34 | + public function has($id); |
|
35 | 35 | } |
@@ -11,82 +11,82 @@ |
||
11 | 11 | interface RecipeInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @return string |
|
16 | - */ |
|
17 | - public function identifier(); |
|
14 | + /** |
|
15 | + * @return string |
|
16 | + */ |
|
17 | + public function identifier(); |
|
18 | 18 | |
19 | - /** |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function fqcn(); |
|
19 | + /** |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function fqcn(); |
|
23 | 23 | |
24 | - /** |
|
25 | - * @return array |
|
26 | - */ |
|
27 | - public function ingredients(); |
|
24 | + /** |
|
25 | + * @return array |
|
26 | + */ |
|
27 | + public function ingredients(); |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function type(); |
|
29 | + /** |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function type(); |
|
33 | 33 | |
34 | - /** |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function filters(); |
|
34 | + /** |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function filters(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function paths(); |
|
39 | + /** |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function paths(); |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param string $identifier Identifier for the entity class that the Recipe applies to |
|
46 | - * Typically a Fully Qualified Class Name |
|
47 | - */ |
|
48 | - public function setIdentifier($identifier); |
|
44 | + /** |
|
45 | + * @param string $identifier Identifier for the entity class that the Recipe applies to |
|
46 | + * Typically a Fully Qualified Class Name |
|
47 | + */ |
|
48 | + public function setIdentifier($identifier); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Ensures incoming string is a valid Fully Qualified Class Name, |
|
52 | - * except if this is the default wildcard Recipe ( * ), |
|
53 | - * or it's NOT an actual FQCN because the Recipe is using filepaths |
|
54 | - * for classes that are not PSR-4 compatible |
|
55 | - * PLZ NOTE: |
|
56 | - * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
57 | - * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
58 | - * |
|
59 | - * @param string $fqcn |
|
60 | - */ |
|
61 | - public function setFqcn($fqcn); |
|
50 | + /** |
|
51 | + * Ensures incoming string is a valid Fully Qualified Class Name, |
|
52 | + * except if this is the default wildcard Recipe ( * ), |
|
53 | + * or it's NOT an actual FQCN because the Recipe is using filepaths |
|
54 | + * for classes that are not PSR-4 compatible |
|
55 | + * PLZ NOTE: |
|
56 | + * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
57 | + * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
58 | + * |
|
59 | + * @param string $fqcn |
|
60 | + */ |
|
61 | + public function setFqcn($fqcn); |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param array $ingredients an array of dependencies where keys are the aliases and values are the FQCNs |
|
65 | - * example: |
|
66 | - * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
67 | - */ |
|
68 | - public function setIngredients(array $ingredients); |
|
63 | + /** |
|
64 | + * @param array $ingredients an array of dependencies where keys are the aliases and values are the FQCNs |
|
65 | + * example: |
|
66 | + * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
67 | + */ |
|
68 | + public function setIngredients(array $ingredients); |
|
69 | 69 | |
70 | - /** |
|
71 | - * @param string $type one of the class constants returned from CoffeeMaker::getTypes() |
|
72 | - */ |
|
73 | - public function setType($type = CoffeeMaker::BREW_NEW); |
|
70 | + /** |
|
71 | + * @param string $type one of the class constants returned from CoffeeMaker::getTypes() |
|
72 | + */ |
|
73 | + public function setType($type = CoffeeMaker::BREW_NEW); |
|
74 | 74 | |
75 | - /** |
|
76 | - * @param array $filters an array of filters where keys are the aliases and values are the FQCNs |
|
77 | - * example: |
|
78 | - * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
79 | - */ |
|
80 | - public function setFilters(array $filters); |
|
75 | + /** |
|
76 | + * @param array $filters an array of filters where keys are the aliases and values are the FQCNs |
|
77 | + * example: |
|
78 | + * array( 'ClassInterface' => 'Fully\Qualified\ClassName' ) |
|
79 | + */ |
|
80 | + public function setFilters(array $filters); |
|
81 | 81 | |
82 | - /** |
|
83 | - * Ensures incoming paths is a valid filepath, or array of valid filepaths, |
|
84 | - * and merges them in with any existing filepaths |
|
85 | - * PLZ NOTE: |
|
86 | - * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
87 | - * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
88 | - * |
|
89 | - * @param string|array $paths |
|
90 | - */ |
|
91 | - public function setPaths($paths = array()); |
|
82 | + /** |
|
83 | + * Ensures incoming paths is a valid filepath, or array of valid filepaths, |
|
84 | + * and merges them in with any existing filepaths |
|
85 | + * PLZ NOTE: |
|
86 | + * Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not, |
|
87 | + * therefore you should always call Recipe::setPaths() before Recipe::setFqcn() |
|
88 | + * |
|
89 | + * @param string|array $paths |
|
90 | + */ |
|
91 | + public function setPaths($paths = array()); |
|
92 | 92 | } |
@@ -11,37 +11,37 @@ |
||
11 | 11 | interface InjectorInterface |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * getReflectionClass |
|
16 | - * checks if a ReflectionClass object has already been generated for a class |
|
17 | - * and returns that instead of creating a new one |
|
18 | - * |
|
19 | - * @access public |
|
20 | - * @param string $class_name |
|
21 | - * @return \ReflectionClass |
|
22 | - */ |
|
23 | - public function getReflectionClass($class_name); |
|
14 | + /** |
|
15 | + * getReflectionClass |
|
16 | + * checks if a ReflectionClass object has already been generated for a class |
|
17 | + * and returns that instead of creating a new one |
|
18 | + * |
|
19 | + * @access public |
|
20 | + * @param string $class_name |
|
21 | + * @return \ReflectionClass |
|
22 | + */ |
|
23 | + public function getReflectionClass($class_name); |
|
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * resolveDependencies |
|
29 | - * examines the constructor for the requested class to determine |
|
30 | - * if any dependencies exist, and if they can be injected. |
|
31 | - * If so, then those classes will be added to the array of arguments passed to the constructor |
|
32 | - * PLZ NOTE: this is achieved by type hinting the constructor params |
|
33 | - * For example: |
|
34 | - * if attempting to load a class "Foo" with the following constructor: |
|
35 | - * __construct( Bar $bar_class, Fighter $grohl_class ) |
|
36 | - * then $bar_class and $grohl_class will be added to the $arguments array, |
|
37 | - * but only IF they are NOT already present in the incoming arguments array, |
|
38 | - * and the correct classes can be loaded |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @param \EventEspresso\core\services\container\RecipeInterface $recipe |
|
42 | - * @param \ReflectionClass $reflector |
|
43 | - * @param array $arguments |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array()); |
|
27 | + /** |
|
28 | + * resolveDependencies |
|
29 | + * examines the constructor for the requested class to determine |
|
30 | + * if any dependencies exist, and if they can be injected. |
|
31 | + * If so, then those classes will be added to the array of arguments passed to the constructor |
|
32 | + * PLZ NOTE: this is achieved by type hinting the constructor params |
|
33 | + * For example: |
|
34 | + * if attempting to load a class "Foo" with the following constructor: |
|
35 | + * __construct( Bar $bar_class, Fighter $grohl_class ) |
|
36 | + * then $bar_class and $grohl_class will be added to the $arguments array, |
|
37 | + * but only IF they are NOT already present in the incoming arguments array, |
|
38 | + * and the correct classes can be loaded |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @param \EventEspresso\core\services\container\RecipeInterface $recipe |
|
42 | + * @param \ReflectionClass $reflector |
|
43 | + * @param array $arguments |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public function resolveDependencies(RecipeInterface $recipe, \ReflectionClass $reflector, $arguments = array()); |
|
47 | 47 | } |