@@ -34,221 +34,221 @@ discard block |
||
| 34 | 34 | class AdvancedEditorData |
| 35 | 35 | { |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string $namespace The graphql namespace/prefix. |
|
| 39 | - */ |
|
| 40 | - protected $namespace = 'Espresso'; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var EE_Event |
|
| 44 | - */ |
|
| 45 | - protected $event; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var EE_Admin_Config |
|
| 49 | - */ |
|
| 50 | - protected $admin_config; |
|
| 51 | - /** |
|
| 52 | - * @var EEM_Datetime $datetime_model |
|
| 53 | - */ |
|
| 54 | - protected $datetime_model; |
|
| 55 | - /** |
|
| 56 | - * @var EEM_Price $price_model |
|
| 57 | - */ |
|
| 58 | - protected $price_model; |
|
| 59 | - /** |
|
| 60 | - * @var EEM_Ticket $ticket_model |
|
| 61 | - */ |
|
| 62 | - protected $ticket_model; |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * AdvancedEditorAdminForm constructor. |
|
| 67 | - * |
|
| 68 | - * @param EE_Event $event |
|
| 69 | - * @param EE_Admin_Config $admin_config |
|
| 70 | - * @param EEM_Datetime $datetime_model |
|
| 71 | - * @param EEM_Price $price_model |
|
| 72 | - * @param EEM_Ticket $ticket_model |
|
| 73 | - */ |
|
| 74 | - public function __construct( |
|
| 75 | - EE_Event $event, |
|
| 76 | - EE_Admin_Config $admin_config, |
|
| 77 | - EEM_Datetime $datetime_model, |
|
| 78 | - EEM_Price $price_model, |
|
| 79 | - EEM_Ticket $ticket_model |
|
| 80 | - ) { |
|
| 81 | - $this->event = $event; |
|
| 82 | - $this->admin_config = $admin_config; |
|
| 83 | - $this->datetime_model = $datetime_model; |
|
| 84 | - $this->price_model = $price_model; |
|
| 85 | - $this->ticket_model = $ticket_model; |
|
| 86 | - add_action('admin_enqueue_scripts', [$this, 'loadScriptsStyles']); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @throws EE_Error |
|
| 92 | - * @throws InvalidArgumentException |
|
| 93 | - * @throws InvalidDataTypeException |
|
| 94 | - * @throws InvalidInterfaceException |
|
| 95 | - * @throws ModelConfigurationException |
|
| 96 | - * @throws ReflectionException |
|
| 97 | - * @throws UnexpectedEntityException |
|
| 98 | - * @throws DomainException |
|
| 99 | - * @since $VID:$ |
|
| 100 | - */ |
|
| 101 | - public function loadScriptsStyles() |
|
| 102 | - { |
|
| 103 | - if ($this->admin_config->useAdvancedEditor()) { |
|
| 104 | - $eventId = $this->event instanceof EE_Event ? $this->event->ID() : 0; |
|
| 105 | - if (! $eventId) { |
|
| 106 | - global $post; |
|
| 107 | - $eventId = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0; |
|
| 108 | - $eventId = $eventId === 0 && $post instanceof WP_Post && $post->post_type === 'espresso_events' |
|
| 109 | - ? $post->ID |
|
| 110 | - : $eventId; |
|
| 111 | - } |
|
| 112 | - if ($eventId) { |
|
| 113 | - $data = $this->getEditorData($eventId); |
|
| 114 | - $data = wp_json_encode($data); |
|
| 115 | - add_action( |
|
| 116 | - 'admin_footer', |
|
| 117 | - static function () use ($data) { |
|
| 118 | - wp_add_inline_script( |
|
| 119 | - EspressoEditorAssetManager::JS_HANDLE_EDITOR, |
|
| 120 | - " |
|
| 37 | + /** |
|
| 38 | + * @var string $namespace The graphql namespace/prefix. |
|
| 39 | + */ |
|
| 40 | + protected $namespace = 'Espresso'; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var EE_Event |
|
| 44 | + */ |
|
| 45 | + protected $event; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var EE_Admin_Config |
|
| 49 | + */ |
|
| 50 | + protected $admin_config; |
|
| 51 | + /** |
|
| 52 | + * @var EEM_Datetime $datetime_model |
|
| 53 | + */ |
|
| 54 | + protected $datetime_model; |
|
| 55 | + /** |
|
| 56 | + * @var EEM_Price $price_model |
|
| 57 | + */ |
|
| 58 | + protected $price_model; |
|
| 59 | + /** |
|
| 60 | + * @var EEM_Ticket $ticket_model |
|
| 61 | + */ |
|
| 62 | + protected $ticket_model; |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * AdvancedEditorAdminForm constructor. |
|
| 67 | + * |
|
| 68 | + * @param EE_Event $event |
|
| 69 | + * @param EE_Admin_Config $admin_config |
|
| 70 | + * @param EEM_Datetime $datetime_model |
|
| 71 | + * @param EEM_Price $price_model |
|
| 72 | + * @param EEM_Ticket $ticket_model |
|
| 73 | + */ |
|
| 74 | + public function __construct( |
|
| 75 | + EE_Event $event, |
|
| 76 | + EE_Admin_Config $admin_config, |
|
| 77 | + EEM_Datetime $datetime_model, |
|
| 78 | + EEM_Price $price_model, |
|
| 79 | + EEM_Ticket $ticket_model |
|
| 80 | + ) { |
|
| 81 | + $this->event = $event; |
|
| 82 | + $this->admin_config = $admin_config; |
|
| 83 | + $this->datetime_model = $datetime_model; |
|
| 84 | + $this->price_model = $price_model; |
|
| 85 | + $this->ticket_model = $ticket_model; |
|
| 86 | + add_action('admin_enqueue_scripts', [$this, 'loadScriptsStyles']); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @throws EE_Error |
|
| 92 | + * @throws InvalidArgumentException |
|
| 93 | + * @throws InvalidDataTypeException |
|
| 94 | + * @throws InvalidInterfaceException |
|
| 95 | + * @throws ModelConfigurationException |
|
| 96 | + * @throws ReflectionException |
|
| 97 | + * @throws UnexpectedEntityException |
|
| 98 | + * @throws DomainException |
|
| 99 | + * @since $VID:$ |
|
| 100 | + */ |
|
| 101 | + public function loadScriptsStyles() |
|
| 102 | + { |
|
| 103 | + if ($this->admin_config->useAdvancedEditor()) { |
|
| 104 | + $eventId = $this->event instanceof EE_Event ? $this->event->ID() : 0; |
|
| 105 | + if (! $eventId) { |
|
| 106 | + global $post; |
|
| 107 | + $eventId = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0; |
|
| 108 | + $eventId = $eventId === 0 && $post instanceof WP_Post && $post->post_type === 'espresso_events' |
|
| 109 | + ? $post->ID |
|
| 110 | + : $eventId; |
|
| 111 | + } |
|
| 112 | + if ($eventId) { |
|
| 113 | + $data = $this->getEditorData($eventId); |
|
| 114 | + $data = wp_json_encode($data); |
|
| 115 | + add_action( |
|
| 116 | + 'admin_footer', |
|
| 117 | + static function () use ($data) { |
|
| 118 | + wp_add_inline_script( |
|
| 119 | + EspressoEditorAssetManager::JS_HANDLE_EDITOR, |
|
| 120 | + " |
|
| 121 | 121 | var eeEditorData={$data}; |
| 122 | 122 | ", |
| 123 | - 'before' |
|
| 124 | - ); |
|
| 125 | - } |
|
| 126 | - ); |
|
| 127 | - add_action( |
|
| 128 | - 'admin_footer', |
|
| 129 | - static function () use ($data) { |
|
| 130 | - wp_add_inline_script( |
|
| 131 | - EspressoEditorAssetManager::JS_HANDLE_EDITOR_PROTOTYPE, |
|
| 132 | - " |
|
| 123 | + 'before' |
|
| 124 | + ); |
|
| 125 | + } |
|
| 126 | + ); |
|
| 127 | + add_action( |
|
| 128 | + 'admin_footer', |
|
| 129 | + static function () use ($data) { |
|
| 130 | + wp_add_inline_script( |
|
| 131 | + EspressoEditorAssetManager::JS_HANDLE_EDITOR_PROTOTYPE, |
|
| 132 | + " |
|
| 133 | 133 | var eeEditorData={$data}; |
| 134 | 134 | ", |
| 135 | - 'before' |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - ); |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * @param int $eventId |
|
| 146 | - * @return array |
|
| 147 | - * @throws EE_Error |
|
| 148 | - * @throws InvalidDataTypeException |
|
| 149 | - * @throws InvalidInterfaceException |
|
| 150 | - * @throws ModelConfigurationException |
|
| 151 | - * @throws UnexpectedEntityException |
|
| 152 | - * @throws InvalidArgumentException |
|
| 153 | - * @throws ReflectionException |
|
| 154 | - * @throws DomainException |
|
| 155 | - * @since $VID:$ |
|
| 156 | - */ |
|
| 157 | - protected function getEditorData($eventId) |
|
| 158 | - { |
|
| 159 | - $event = $this->getEventGraphQLData($eventId); |
|
| 160 | - $event['dbId'] = $eventId; |
|
| 161 | - |
|
| 162 | - $graphqlEndpoint = class_exists('WPGraphQL') ? trailingslashit(site_url()) . Router::$route : ''; |
|
| 163 | - $graphqlEndpoint = esc_url($graphqlEndpoint); |
|
| 164 | - |
|
| 165 | - $currentUser = $this->getGraphQLCurrentUser(); |
|
| 166 | - |
|
| 167 | - $generalSettings = $this->getGraphQLGeneralSettings(); |
|
| 168 | - |
|
| 169 | - return compact('event', 'graphqlEndpoint', 'currentUser', 'generalSettings'); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param int $eventId |
|
| 175 | - * @return array |
|
| 176 | - * @since $VID:$ |
|
| 177 | - */ |
|
| 178 | - protected function getEventGraphQLData($eventId) |
|
| 179 | - { |
|
| 180 | - $datetimes = $this->getGraphQLDatetimes($eventId); |
|
| 181 | - |
|
| 182 | - if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) { |
|
| 183 | - $this->addDefaultEntities($eventId); |
|
| 184 | - $datetimes = $this->getGraphQLDatetimes($eventId); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - if (! empty($datetimes['nodes'])) { |
|
| 188 | - $datetimeIn = wp_list_pluck($datetimes['nodes'], 'id'); |
|
| 189 | - |
|
| 190 | - if (! empty($datetimeIn)) { |
|
| 191 | - $tickets = $this->getGraphQLTickets($datetimeIn); |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if (! empty($tickets['nodes'])) { |
|
| 196 | - $ticketIn = wp_list_pluck($tickets['nodes'], 'id'); |
|
| 197 | - |
|
| 198 | - if (! empty($ticketIn)) { |
|
| 199 | - $prices = $this->getGraphQLPrices($ticketIn); |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - $priceTypes = $this->getGraphQLPriceTypes(); |
|
| 204 | - |
|
| 205 | - $relations = $this->getRelationalData($eventId); |
|
| 206 | - |
|
| 207 | - return compact('datetimes', 'tickets', 'prices', 'priceTypes', 'relations'); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * @param int $eventId |
|
| 212 | - * @throws DomainException |
|
| 213 | - * @throws EE_Error |
|
| 214 | - * @throws InvalidArgumentException |
|
| 215 | - * @throws InvalidDataTypeException |
|
| 216 | - * @throws InvalidInterfaceException |
|
| 217 | - * @throws ModelConfigurationException |
|
| 218 | - * @throws ReflectionException |
|
| 219 | - * @throws UnexpectedEntityException |
|
| 220 | - * @since $VID:$ |
|
| 221 | - */ |
|
| 222 | - protected function addDefaultEntities($eventId) |
|
| 223 | - { |
|
| 224 | - $default_dates = $this->datetime_model->create_new_blank_datetime(); |
|
| 225 | - if (is_array($default_dates) && isset($default_dates[0]) && $default_dates[0] instanceof EE_Datetime) { |
|
| 226 | - $default_date = $default_dates[0]; |
|
| 227 | - $default_date->save(); |
|
| 228 | - $default_date->_add_relation_to($eventId, 'Event'); |
|
| 229 | - $default_tickets = $this->ticket_model->get_all_default_tickets(); |
|
| 230 | - $default_prices = $this->price_model->get_all_default_prices(); |
|
| 231 | - foreach ($default_tickets as $default_ticket) { |
|
| 232 | - $default_ticket->save(); |
|
| 233 | - $default_ticket->_add_relation_to($default_date, 'Datetime'); |
|
| 234 | - foreach ($default_prices as $default_price) { |
|
| 235 | - $default_price->save(); |
|
| 236 | - $default_price->_add_relation_to($default_ticket, 'Ticket'); |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * @param int $eventId |
|
| 245 | - * @return array|null |
|
| 246 | - * @since $VID:$ |
|
| 247 | - */ |
|
| 248 | - protected function getGraphQLDatetimes($eventId) |
|
| 249 | - { |
|
| 250 | - $field_key = lcfirst($this->namespace) . 'Datetimes'; |
|
| 251 | - $query = <<<QUERY |
|
| 135 | + 'before' |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + ); |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * @param int $eventId |
|
| 146 | + * @return array |
|
| 147 | + * @throws EE_Error |
|
| 148 | + * @throws InvalidDataTypeException |
|
| 149 | + * @throws InvalidInterfaceException |
|
| 150 | + * @throws ModelConfigurationException |
|
| 151 | + * @throws UnexpectedEntityException |
|
| 152 | + * @throws InvalidArgumentException |
|
| 153 | + * @throws ReflectionException |
|
| 154 | + * @throws DomainException |
|
| 155 | + * @since $VID:$ |
|
| 156 | + */ |
|
| 157 | + protected function getEditorData($eventId) |
|
| 158 | + { |
|
| 159 | + $event = $this->getEventGraphQLData($eventId); |
|
| 160 | + $event['dbId'] = $eventId; |
|
| 161 | + |
|
| 162 | + $graphqlEndpoint = class_exists('WPGraphQL') ? trailingslashit(site_url()) . Router::$route : ''; |
|
| 163 | + $graphqlEndpoint = esc_url($graphqlEndpoint); |
|
| 164 | + |
|
| 165 | + $currentUser = $this->getGraphQLCurrentUser(); |
|
| 166 | + |
|
| 167 | + $generalSettings = $this->getGraphQLGeneralSettings(); |
|
| 168 | + |
|
| 169 | + return compact('event', 'graphqlEndpoint', 'currentUser', 'generalSettings'); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param int $eventId |
|
| 175 | + * @return array |
|
| 176 | + * @since $VID:$ |
|
| 177 | + */ |
|
| 178 | + protected function getEventGraphQLData($eventId) |
|
| 179 | + { |
|
| 180 | + $datetimes = $this->getGraphQLDatetimes($eventId); |
|
| 181 | + |
|
| 182 | + if (empty($datetimes['nodes']) || (isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new')) { |
|
| 183 | + $this->addDefaultEntities($eventId); |
|
| 184 | + $datetimes = $this->getGraphQLDatetimes($eventId); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + if (! empty($datetimes['nodes'])) { |
|
| 188 | + $datetimeIn = wp_list_pluck($datetimes['nodes'], 'id'); |
|
| 189 | + |
|
| 190 | + if (! empty($datetimeIn)) { |
|
| 191 | + $tickets = $this->getGraphQLTickets($datetimeIn); |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if (! empty($tickets['nodes'])) { |
|
| 196 | + $ticketIn = wp_list_pluck($tickets['nodes'], 'id'); |
|
| 197 | + |
|
| 198 | + if (! empty($ticketIn)) { |
|
| 199 | + $prices = $this->getGraphQLPrices($ticketIn); |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + $priceTypes = $this->getGraphQLPriceTypes(); |
|
| 204 | + |
|
| 205 | + $relations = $this->getRelationalData($eventId); |
|
| 206 | + |
|
| 207 | + return compact('datetimes', 'tickets', 'prices', 'priceTypes', 'relations'); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * @param int $eventId |
|
| 212 | + * @throws DomainException |
|
| 213 | + * @throws EE_Error |
|
| 214 | + * @throws InvalidArgumentException |
|
| 215 | + * @throws InvalidDataTypeException |
|
| 216 | + * @throws InvalidInterfaceException |
|
| 217 | + * @throws ModelConfigurationException |
|
| 218 | + * @throws ReflectionException |
|
| 219 | + * @throws UnexpectedEntityException |
|
| 220 | + * @since $VID:$ |
|
| 221 | + */ |
|
| 222 | + protected function addDefaultEntities($eventId) |
|
| 223 | + { |
|
| 224 | + $default_dates = $this->datetime_model->create_new_blank_datetime(); |
|
| 225 | + if (is_array($default_dates) && isset($default_dates[0]) && $default_dates[0] instanceof EE_Datetime) { |
|
| 226 | + $default_date = $default_dates[0]; |
|
| 227 | + $default_date->save(); |
|
| 228 | + $default_date->_add_relation_to($eventId, 'Event'); |
|
| 229 | + $default_tickets = $this->ticket_model->get_all_default_tickets(); |
|
| 230 | + $default_prices = $this->price_model->get_all_default_prices(); |
|
| 231 | + foreach ($default_tickets as $default_ticket) { |
|
| 232 | + $default_ticket->save(); |
|
| 233 | + $default_ticket->_add_relation_to($default_date, 'Datetime'); |
|
| 234 | + foreach ($default_prices as $default_price) { |
|
| 235 | + $default_price->save(); |
|
| 236 | + $default_price->_add_relation_to($default_ticket, 'Ticket'); |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * @param int $eventId |
|
| 245 | + * @return array|null |
|
| 246 | + * @since $VID:$ |
|
| 247 | + */ |
|
| 248 | + protected function getGraphQLDatetimes($eventId) |
|
| 249 | + { |
|
| 250 | + $field_key = lcfirst($this->namespace) . 'Datetimes'; |
|
| 251 | + $query = <<<QUERY |
|
| 252 | 252 | query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs) { |
| 253 | 253 | {$field_key}(where: \$where) { |
| 254 | 254 | nodes { |
@@ -274,31 +274,31 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | QUERY; |
| 277 | - $data = [ |
|
| 278 | - 'operation_name' => 'GET_DATETIMES', |
|
| 279 | - 'variables' => [ |
|
| 280 | - 'first' => 50, |
|
| 281 | - 'where' => [ |
|
| 282 | - 'eventId' => $eventId, |
|
| 283 | - ], |
|
| 284 | - ], |
|
| 285 | - 'query' => $query, |
|
| 286 | - ]; |
|
| 287 | - |
|
| 288 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 289 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * @param array $datetimeIn |
|
| 295 | - * @return array|null |
|
| 296 | - * @since $VID:$ |
|
| 297 | - */ |
|
| 298 | - protected function getGraphQLTickets(array $datetimeIn) |
|
| 299 | - { |
|
| 300 | - $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
| 301 | - $query = <<<QUERY |
|
| 277 | + $data = [ |
|
| 278 | + 'operation_name' => 'GET_DATETIMES', |
|
| 279 | + 'variables' => [ |
|
| 280 | + 'first' => 50, |
|
| 281 | + 'where' => [ |
|
| 282 | + 'eventId' => $eventId, |
|
| 283 | + ], |
|
| 284 | + ], |
|
| 285 | + 'query' => $query, |
|
| 286 | + ]; |
|
| 287 | + |
|
| 288 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 289 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * @param array $datetimeIn |
|
| 295 | + * @return array|null |
|
| 296 | + * @since $VID:$ |
|
| 297 | + */ |
|
| 298 | + protected function getGraphQLTickets(array $datetimeIn) |
|
| 299 | + { |
|
| 300 | + $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
| 301 | + $query = <<<QUERY |
|
| 302 | 302 | query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs) { |
| 303 | 303 | {$field_key}(where: \$where) { |
| 304 | 304 | nodes { |
@@ -327,30 +327,30 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | QUERY; |
| 330 | - $data = [ |
|
| 331 | - 'operation_name' => 'GET_TICKETS', |
|
| 332 | - 'variables' => [ |
|
| 333 | - 'where' => [ |
|
| 334 | - 'datetimeIn' => $datetimeIn, |
|
| 335 | - ], |
|
| 336 | - ], |
|
| 337 | - 'query' => $query, |
|
| 338 | - ]; |
|
| 339 | - |
|
| 340 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 341 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * @param array $ticketIn |
|
| 347 | - * @return array|null |
|
| 348 | - * @since $VID:$ |
|
| 349 | - */ |
|
| 350 | - protected function getGraphQLPrices(array $ticketIn) |
|
| 351 | - { |
|
| 352 | - $field_key = lcfirst($this->namespace) . 'Prices'; |
|
| 353 | - $query = <<<QUERY |
|
| 330 | + $data = [ |
|
| 331 | + 'operation_name' => 'GET_TICKETS', |
|
| 332 | + 'variables' => [ |
|
| 333 | + 'where' => [ |
|
| 334 | + 'datetimeIn' => $datetimeIn, |
|
| 335 | + ], |
|
| 336 | + ], |
|
| 337 | + 'query' => $query, |
|
| 338 | + ]; |
|
| 339 | + |
|
| 340 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 341 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * @param array $ticketIn |
|
| 347 | + * @return array|null |
|
| 348 | + * @since $VID:$ |
|
| 349 | + */ |
|
| 350 | + protected function getGraphQLPrices(array $ticketIn) |
|
| 351 | + { |
|
| 352 | + $field_key = lcfirst($this->namespace) . 'Prices'; |
|
| 353 | + $query = <<<QUERY |
|
| 354 | 354 | query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs) { |
| 355 | 355 | {$field_key}(where: \$where) { |
| 356 | 356 | nodes { |
@@ -374,29 +374,29 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | QUERY; |
| 377 | - $data = [ |
|
| 378 | - 'operation_name' => 'GET_PRICES', |
|
| 379 | - 'variables' => [ |
|
| 380 | - 'where' => [ |
|
| 381 | - 'ticketIn' => $ticketIn, |
|
| 382 | - ], |
|
| 383 | - ], |
|
| 384 | - 'query' => $query, |
|
| 385 | - ]; |
|
| 386 | - |
|
| 387 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 388 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - |
|
| 392 | - /** |
|
| 393 | - * @return array|null |
|
| 394 | - * @since $VID:$ |
|
| 395 | - */ |
|
| 396 | - protected function getGraphQLPriceTypes() |
|
| 397 | - { |
|
| 398 | - $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
| 399 | - $query = <<<QUERY |
|
| 377 | + $data = [ |
|
| 378 | + 'operation_name' => 'GET_PRICES', |
|
| 379 | + 'variables' => [ |
|
| 380 | + 'where' => [ |
|
| 381 | + 'ticketIn' => $ticketIn, |
|
| 382 | + ], |
|
| 383 | + ], |
|
| 384 | + 'query' => $query, |
|
| 385 | + ]; |
|
| 386 | + |
|
| 387 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 388 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + |
|
| 392 | + /** |
|
| 393 | + * @return array|null |
|
| 394 | + * @since $VID:$ |
|
| 395 | + */ |
|
| 396 | + protected function getGraphQLPriceTypes() |
|
| 397 | + { |
|
| 398 | + $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
| 399 | + $query = <<<QUERY |
|
| 400 | 400 | query GET_PRICES { |
| 401 | 401 | {$field_key} { |
| 402 | 402 | nodes { |
@@ -416,24 +416,24 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | QUERY; |
| 419 | - $data = [ |
|
| 420 | - 'operation_name' => 'GET_PRICES', |
|
| 421 | - 'query' => $query, |
|
| 422 | - ]; |
|
| 423 | - |
|
| 424 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 425 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * @return array|null |
|
| 431 | - * @since $VID:$ |
|
| 432 | - */ |
|
| 433 | - protected function getGraphQLCurrentUser() |
|
| 434 | - { |
|
| 435 | - $field_key = 'viewer'; |
|
| 436 | - $query = <<<QUERY |
|
| 419 | + $data = [ |
|
| 420 | + 'operation_name' => 'GET_PRICES', |
|
| 421 | + 'query' => $query, |
|
| 422 | + ]; |
|
| 423 | + |
|
| 424 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 425 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * @return array|null |
|
| 431 | + * @since $VID:$ |
|
| 432 | + */ |
|
| 433 | + protected function getGraphQLCurrentUser() |
|
| 434 | + { |
|
| 435 | + $field_key = 'viewer'; |
|
| 436 | + $query = <<<QUERY |
|
| 437 | 437 | query GET_CURRENT_USER { |
| 438 | 438 | {$field_key} { |
| 439 | 439 | description |
@@ -451,24 +451,24 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | QUERY; |
| 454 | - $data = [ |
|
| 455 | - 'operation_name' => 'GET_CURRENT_USER', |
|
| 456 | - 'query' => $query, |
|
| 457 | - ]; |
|
| 458 | - |
|
| 459 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 460 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - |
|
| 464 | - /** |
|
| 465 | - * @return array|null |
|
| 466 | - * @since $VID:$ |
|
| 467 | - */ |
|
| 468 | - protected function getGraphQLGeneralSettings() |
|
| 469 | - { |
|
| 470 | - $field_key = 'generalSettings'; |
|
| 471 | - $query = <<<QUERY |
|
| 454 | + $data = [ |
|
| 455 | + 'operation_name' => 'GET_CURRENT_USER', |
|
| 456 | + 'query' => $query, |
|
| 457 | + ]; |
|
| 458 | + |
|
| 459 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 460 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + |
|
| 464 | + /** |
|
| 465 | + * @return array|null |
|
| 466 | + * @since $VID:$ |
|
| 467 | + */ |
|
| 468 | + protected function getGraphQLGeneralSettings() |
|
| 469 | + { |
|
| 470 | + $field_key = 'generalSettings'; |
|
| 471 | + $query = <<<QUERY |
|
| 472 | 472 | query GET_GENERAL_SETTINGS { |
| 473 | 473 | {$field_key} { |
| 474 | 474 | dateFormat |
@@ -478,138 +478,138 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | QUERY; |
| 481 | - $data = [ |
|
| 482 | - 'operation_name' => 'GET_CURRENT_USER', |
|
| 483 | - 'query' => $query, |
|
| 484 | - ]; |
|
| 485 | - |
|
| 486 | - $responseData = $this->makeGraphQLRequest($data); |
|
| 487 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - |
|
| 491 | - /** |
|
| 492 | - * @param array $data |
|
| 493 | - * @return array |
|
| 494 | - * @since $VID:$ |
|
| 495 | - */ |
|
| 496 | - protected function makeGraphQLRequest($data) |
|
| 497 | - { |
|
| 498 | - try { |
|
| 499 | - $response = graphql($data); |
|
| 500 | - if (!empty($response['data'])) { |
|
| 501 | - return $response['data']; |
|
| 502 | - } |
|
| 503 | - return null; |
|
| 504 | - } catch (\Exception $e) { |
|
| 505 | - // do something with the errors thrown |
|
| 506 | - return null; |
|
| 507 | - } |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - |
|
| 511 | - /** |
|
| 512 | - * @param mixed $source The source that's passed down the GraphQL queries |
|
| 513 | - * @param array $args The inputArgs on the field |
|
| 514 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 515 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 516 | - * @return string |
|
| 517 | - * @throws EE_Error |
|
| 518 | - * @throws Exception |
|
| 519 | - * @throws InvalidArgumentException |
|
| 520 | - * @throws InvalidDataTypeException |
|
| 521 | - * @throws InvalidInterfaceException |
|
| 522 | - * @throws ReflectionException |
|
| 523 | - * @throws UserError |
|
| 524 | - * @throws UnexpectedEntityException |
|
| 525 | - * @since $VID:$ |
|
| 526 | - */ |
|
| 527 | - public static function getRelationalData($eventId) |
|
| 528 | - { |
|
| 529 | - |
|
| 530 | - $data = [ |
|
| 531 | - 'datetimes' => [], |
|
| 532 | - 'tickets' => [], |
|
| 533 | - 'prices' => [], |
|
| 534 | - ]; |
|
| 535 | - |
|
| 536 | - $eem_datetime = EEM_Datetime::instance(); |
|
| 537 | - $eem_ticket = EEM_Ticket::instance(); |
|
| 538 | - $eem_price = EEM_Price::instance(); |
|
| 539 | - $eem_price_type = EEM_Price_Type::instance(); |
|
| 540 | - |
|
| 541 | - // PROCESS DATETIMES |
|
| 542 | - $related_models = [ |
|
| 543 | - 'tickets' => $eem_ticket, |
|
| 544 | - ]; |
|
| 545 | - // Get the IDs of event datetimes. |
|
| 546 | - $datetimeIds = $eem_datetime->get_col([['EVT_ID' => $eventId]]); |
|
| 547 | - foreach ($datetimeIds as $datetimeId) { |
|
| 548 | - $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId); |
|
| 549 | - foreach ($related_models as $key => $model) { |
|
| 550 | - // Get the IDs of related entities for the datetime ID. |
|
| 551 | - $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]); |
|
| 552 | - if (! empty($Ids)) { |
|
| 553 | - $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 554 | - } |
|
| 555 | - } |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - // PROCESS TICKETS |
|
| 559 | - $related_models = [ |
|
| 560 | - 'datetimes' => $eem_datetime, |
|
| 561 | - 'prices' => $eem_price, |
|
| 562 | - ]; |
|
| 563 | - // Get the IDs of all datetime tickets. |
|
| 564 | - $ticketIds = $eem_ticket->get_col([['Datetime.DTT_ID' => ['in', $datetimeIds]]]); |
|
| 565 | - foreach ($ticketIds as $ticketId) { |
|
| 566 | - $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId); |
|
| 567 | - |
|
| 568 | - foreach ($related_models as $key => $model) { |
|
| 569 | - // Get the IDs of related entities for the ticket ID. |
|
| 570 | - $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]); |
|
| 571 | - if (! empty($Ids)) { |
|
| 572 | - $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 573 | - } |
|
| 574 | - } |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - // PROCESS PRICES |
|
| 578 | - $related_models = [ |
|
| 579 | - 'tickets' => $eem_ticket, |
|
| 580 | - 'priceTypes' => $eem_price_type, |
|
| 581 | - ]; |
|
| 582 | - // Get the IDs of all ticket prices. |
|
| 583 | - $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['in', $ticketIds]]]); |
|
| 584 | - foreach ($priceIds as $priceId) { |
|
| 585 | - $GID = self::convertToGlobalId($eem_price->item_name(), $priceId); |
|
| 586 | - |
|
| 587 | - foreach ($related_models as $key => $model) { |
|
| 588 | - // Get the IDs of related entities for the price ID. |
|
| 589 | - $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]); |
|
| 590 | - if (! empty($Ids)) { |
|
| 591 | - $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 592 | - } |
|
| 593 | - } |
|
| 594 | - } |
|
| 595 | - |
|
| 596 | - return $data; |
|
| 597 | - } |
|
| 598 | - |
|
| 599 | - /** |
|
| 600 | - * Convert the DB ID into GID |
|
| 601 | - * |
|
| 602 | - * @param string $type |
|
| 603 | - * @param int|int[] $ID |
|
| 604 | - * @return mixed |
|
| 605 | - */ |
|
| 606 | - public static function convertToGlobalId($type, $ID) |
|
| 607 | - { |
|
| 608 | - if (is_array($ID)) { |
|
| 609 | - return array_map(function ($id) use ($type) { |
|
| 610 | - return self::convertToGlobalId($type, $id); |
|
| 611 | - }, $ID); |
|
| 612 | - } |
|
| 613 | - return Relay::toGlobalId($type, $ID); |
|
| 614 | - } |
|
| 481 | + $data = [ |
|
| 482 | + 'operation_name' => 'GET_CURRENT_USER', |
|
| 483 | + 'query' => $query, |
|
| 484 | + ]; |
|
| 485 | + |
|
| 486 | + $responseData = $this->makeGraphQLRequest($data); |
|
| 487 | + return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + |
|
| 491 | + /** |
|
| 492 | + * @param array $data |
|
| 493 | + * @return array |
|
| 494 | + * @since $VID:$ |
|
| 495 | + */ |
|
| 496 | + protected function makeGraphQLRequest($data) |
|
| 497 | + { |
|
| 498 | + try { |
|
| 499 | + $response = graphql($data); |
|
| 500 | + if (!empty($response['data'])) { |
|
| 501 | + return $response['data']; |
|
| 502 | + } |
|
| 503 | + return null; |
|
| 504 | + } catch (\Exception $e) { |
|
| 505 | + // do something with the errors thrown |
|
| 506 | + return null; |
|
| 507 | + } |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + |
|
| 511 | + /** |
|
| 512 | + * @param mixed $source The source that's passed down the GraphQL queries |
|
| 513 | + * @param array $args The inputArgs on the field |
|
| 514 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
| 515 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
| 516 | + * @return string |
|
| 517 | + * @throws EE_Error |
|
| 518 | + * @throws Exception |
|
| 519 | + * @throws InvalidArgumentException |
|
| 520 | + * @throws InvalidDataTypeException |
|
| 521 | + * @throws InvalidInterfaceException |
|
| 522 | + * @throws ReflectionException |
|
| 523 | + * @throws UserError |
|
| 524 | + * @throws UnexpectedEntityException |
|
| 525 | + * @since $VID:$ |
|
| 526 | + */ |
|
| 527 | + public static function getRelationalData($eventId) |
|
| 528 | + { |
|
| 529 | + |
|
| 530 | + $data = [ |
|
| 531 | + 'datetimes' => [], |
|
| 532 | + 'tickets' => [], |
|
| 533 | + 'prices' => [], |
|
| 534 | + ]; |
|
| 535 | + |
|
| 536 | + $eem_datetime = EEM_Datetime::instance(); |
|
| 537 | + $eem_ticket = EEM_Ticket::instance(); |
|
| 538 | + $eem_price = EEM_Price::instance(); |
|
| 539 | + $eem_price_type = EEM_Price_Type::instance(); |
|
| 540 | + |
|
| 541 | + // PROCESS DATETIMES |
|
| 542 | + $related_models = [ |
|
| 543 | + 'tickets' => $eem_ticket, |
|
| 544 | + ]; |
|
| 545 | + // Get the IDs of event datetimes. |
|
| 546 | + $datetimeIds = $eem_datetime->get_col([['EVT_ID' => $eventId]]); |
|
| 547 | + foreach ($datetimeIds as $datetimeId) { |
|
| 548 | + $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId); |
|
| 549 | + foreach ($related_models as $key => $model) { |
|
| 550 | + // Get the IDs of related entities for the datetime ID. |
|
| 551 | + $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]); |
|
| 552 | + if (! empty($Ids)) { |
|
| 553 | + $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 554 | + } |
|
| 555 | + } |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + // PROCESS TICKETS |
|
| 559 | + $related_models = [ |
|
| 560 | + 'datetimes' => $eem_datetime, |
|
| 561 | + 'prices' => $eem_price, |
|
| 562 | + ]; |
|
| 563 | + // Get the IDs of all datetime tickets. |
|
| 564 | + $ticketIds = $eem_ticket->get_col([['Datetime.DTT_ID' => ['in', $datetimeIds]]]); |
|
| 565 | + foreach ($ticketIds as $ticketId) { |
|
| 566 | + $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId); |
|
| 567 | + |
|
| 568 | + foreach ($related_models as $key => $model) { |
|
| 569 | + // Get the IDs of related entities for the ticket ID. |
|
| 570 | + $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]); |
|
| 571 | + if (! empty($Ids)) { |
|
| 572 | + $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 573 | + } |
|
| 574 | + } |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + // PROCESS PRICES |
|
| 578 | + $related_models = [ |
|
| 579 | + 'tickets' => $eem_ticket, |
|
| 580 | + 'priceTypes' => $eem_price_type, |
|
| 581 | + ]; |
|
| 582 | + // Get the IDs of all ticket prices. |
|
| 583 | + $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['in', $ticketIds]]]); |
|
| 584 | + foreach ($priceIds as $priceId) { |
|
| 585 | + $GID = self::convertToGlobalId($eem_price->item_name(), $priceId); |
|
| 586 | + |
|
| 587 | + foreach ($related_models as $key => $model) { |
|
| 588 | + // Get the IDs of related entities for the price ID. |
|
| 589 | + $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]); |
|
| 590 | + if (! empty($Ids)) { |
|
| 591 | + $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 592 | + } |
|
| 593 | + } |
|
| 594 | + } |
|
| 595 | + |
|
| 596 | + return $data; |
|
| 597 | + } |
|
| 598 | + |
|
| 599 | + /** |
|
| 600 | + * Convert the DB ID into GID |
|
| 601 | + * |
|
| 602 | + * @param string $type |
|
| 603 | + * @param int|int[] $ID |
|
| 604 | + * @return mixed |
|
| 605 | + */ |
|
| 606 | + public static function convertToGlobalId($type, $ID) |
|
| 607 | + { |
|
| 608 | + if (is_array($ID)) { |
|
| 609 | + return array_map(function ($id) use ($type) { |
|
| 610 | + return self::convertToGlobalId($type, $id); |
|
| 611 | + }, $ID); |
|
| 612 | + } |
|
| 613 | + return Relay::toGlobalId($type, $ID); |
|
| 614 | + } |
|
| 615 | 615 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | if ($this->admin_config->useAdvancedEditor()) { |
| 104 | 104 | $eventId = $this->event instanceof EE_Event ? $this->event->ID() : 0; |
| 105 | - if (! $eventId) { |
|
| 105 | + if ( ! $eventId) { |
|
| 106 | 106 | global $post; |
| 107 | 107 | $eventId = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0; |
| 108 | 108 | $eventId = $eventId === 0 && $post instanceof WP_Post && $post->post_type === 'espresso_events' |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $data = wp_json_encode($data); |
| 115 | 115 | add_action( |
| 116 | 116 | 'admin_footer', |
| 117 | - static function () use ($data) { |
|
| 117 | + static function() use ($data) { |
|
| 118 | 118 | wp_add_inline_script( |
| 119 | 119 | EspressoEditorAssetManager::JS_HANDLE_EDITOR, |
| 120 | 120 | " |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ); |
| 127 | 127 | add_action( |
| 128 | 128 | 'admin_footer', |
| 129 | - static function () use ($data) { |
|
| 129 | + static function() use ($data) { |
|
| 130 | 130 | wp_add_inline_script( |
| 131 | 131 | EspressoEditorAssetManager::JS_HANDLE_EDITOR_PROTOTYPE, |
| 132 | 132 | " |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $event = $this->getEventGraphQLData($eventId); |
| 160 | 160 | $event['dbId'] = $eventId; |
| 161 | 161 | |
| 162 | - $graphqlEndpoint = class_exists('WPGraphQL') ? trailingslashit(site_url()) . Router::$route : ''; |
|
| 162 | + $graphqlEndpoint = class_exists('WPGraphQL') ? trailingslashit(site_url()).Router::$route : ''; |
|
| 163 | 163 | $graphqlEndpoint = esc_url($graphqlEndpoint); |
| 164 | 164 | |
| 165 | 165 | $currentUser = $this->getGraphQLCurrentUser(); |
@@ -184,18 +184,18 @@ discard block |
||
| 184 | 184 | $datetimes = $this->getGraphQLDatetimes($eventId); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if (! empty($datetimes['nodes'])) { |
|
| 187 | + if ( ! empty($datetimes['nodes'])) { |
|
| 188 | 188 | $datetimeIn = wp_list_pluck($datetimes['nodes'], 'id'); |
| 189 | 189 | |
| 190 | - if (! empty($datetimeIn)) { |
|
| 190 | + if ( ! empty($datetimeIn)) { |
|
| 191 | 191 | $tickets = $this->getGraphQLTickets($datetimeIn); |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (! empty($tickets['nodes'])) { |
|
| 195 | + if ( ! empty($tickets['nodes'])) { |
|
| 196 | 196 | $ticketIn = wp_list_pluck($tickets['nodes'], 'id'); |
| 197 | 197 | |
| 198 | - if (! empty($ticketIn)) { |
|
| 198 | + if ( ! empty($ticketIn)) { |
|
| 199 | 199 | $prices = $this->getGraphQLPrices($ticketIn); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getGraphQLDatetimes($eventId) |
| 249 | 249 | { |
| 250 | - $field_key = lcfirst($this->namespace) . 'Datetimes'; |
|
| 250 | + $field_key = lcfirst($this->namespace).'Datetimes'; |
|
| 251 | 251 | $query = <<<QUERY |
| 252 | 252 | query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs) { |
| 253 | 253 | {$field_key}(where: \$where) { |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | ]; |
| 287 | 287 | |
| 288 | 288 | $responseData = $this->makeGraphQLRequest($data); |
| 289 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 289 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function getGraphQLTickets(array $datetimeIn) |
| 299 | 299 | { |
| 300 | - $field_key = lcfirst($this->namespace) . 'Tickets'; |
|
| 300 | + $field_key = lcfirst($this->namespace).'Tickets'; |
|
| 301 | 301 | $query = <<<QUERY |
| 302 | 302 | query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs) { |
| 303 | 303 | {$field_key}(where: \$where) { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | ]; |
| 339 | 339 | |
| 340 | 340 | $responseData = $this->makeGraphQLRequest($data); |
| 341 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 341 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | protected function getGraphQLPrices(array $ticketIn) |
| 351 | 351 | { |
| 352 | - $field_key = lcfirst($this->namespace) . 'Prices'; |
|
| 352 | + $field_key = lcfirst($this->namespace).'Prices'; |
|
| 353 | 353 | $query = <<<QUERY |
| 354 | 354 | query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs) { |
| 355 | 355 | {$field_key}(where: \$where) { |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | ]; |
| 386 | 386 | |
| 387 | 387 | $responseData = $this->makeGraphQLRequest($data); |
| 388 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 388 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | protected function getGraphQLPriceTypes() |
| 397 | 397 | { |
| 398 | - $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
| 398 | + $field_key = lcfirst($this->namespace).'PriceTypes'; |
|
| 399 | 399 | $query = <<<QUERY |
| 400 | 400 | query GET_PRICES { |
| 401 | 401 | {$field_key} { |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | ]; |
| 423 | 423 | |
| 424 | 424 | $responseData = $this->makeGraphQLRequest($data); |
| 425 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 425 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | ]; |
| 458 | 458 | |
| 459 | 459 | $responseData = $this->makeGraphQLRequest($data); |
| 460 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 460 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | ]; |
| 485 | 485 | |
| 486 | 486 | $responseData = $this->makeGraphQLRequest($data); |
| 487 | - return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
| 487 | + return ! empty($responseData[$field_key]) ? $responseData[$field_key] : null; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | { |
| 498 | 498 | try { |
| 499 | 499 | $response = graphql($data); |
| 500 | - if (!empty($response['data'])) { |
|
| 500 | + if ( ! empty($response['data'])) { |
|
| 501 | 501 | return $response['data']; |
| 502 | 502 | } |
| 503 | 503 | return null; |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | foreach ($related_models as $key => $model) { |
| 550 | 550 | // Get the IDs of related entities for the datetime ID. |
| 551 | 551 | $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]); |
| 552 | - if (! empty($Ids)) { |
|
| 553 | - $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 552 | + if ( ! empty($Ids)) { |
|
| 553 | + $data['datetimes'][$GID][$key] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | } |
@@ -568,8 +568,8 @@ discard block |
||
| 568 | 568 | foreach ($related_models as $key => $model) { |
| 569 | 569 | // Get the IDs of related entities for the ticket ID. |
| 570 | 570 | $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]); |
| 571 | - if (! empty($Ids)) { |
|
| 572 | - $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 571 | + if ( ! empty($Ids)) { |
|
| 572 | + $data['tickets'][$GID][$key] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | } |
@@ -587,8 +587,8 @@ discard block |
||
| 587 | 587 | foreach ($related_models as $key => $model) { |
| 588 | 588 | // Get the IDs of related entities for the price ID. |
| 589 | 589 | $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]); |
| 590 | - if (! empty($Ids)) { |
|
| 591 | - $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 590 | + if ( ! empty($Ids)) { |
|
| 591 | + $data['prices'][$GID][$key] = self::convertToGlobalId($model->item_name(), $Ids); |
|
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | 594 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | public static function convertToGlobalId($type, $ID) |
| 607 | 607 | { |
| 608 | 608 | if (is_array($ID)) { |
| 609 | - return array_map(function ($id) use ($type) { |
|
| 609 | + return array_map(function($id) use ($type) { |
|
| 610 | 610 | return self::convertToGlobalId($type, $id); |
| 611 | 611 | }, $ID); |
| 612 | 612 | } |
@@ -21,1224 +21,1224 @@ |
||
| 21 | 21 | class EE_Dependency_Map |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * This means that the requested class dependency is not present in the dependency map |
|
| 26 | - */ |
|
| 27 | - const not_registered = 0; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 31 | - */ |
|
| 32 | - const load_new_object = 1; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 36 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 37 | - */ |
|
| 38 | - const load_from_cache = 2; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * When registering a dependency, |
|
| 42 | - * this indicates to keep any existing dependencies that already exist, |
|
| 43 | - * and simply discard any new dependencies declared in the incoming data |
|
| 44 | - */ |
|
| 45 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * When registering a dependency, |
|
| 49 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 50 | - */ |
|
| 51 | - const OVERWRITE_DEPENDENCIES = 1; |
|
| 52 | - |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @type EE_Dependency_Map $_instance |
|
| 56 | - */ |
|
| 57 | - protected static $_instance; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @var ClassInterfaceCache $class_cache |
|
| 61 | - */ |
|
| 62 | - private $class_cache; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @type RequestInterface $request |
|
| 66 | - */ |
|
| 67 | - protected $request; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @type LegacyRequestInterface $legacy_request |
|
| 71 | - */ |
|
| 72 | - protected $legacy_request; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @type ResponseInterface $response |
|
| 76 | - */ |
|
| 77 | - protected $response; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @type LoaderInterface $loader |
|
| 81 | - */ |
|
| 82 | - protected $loader; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @type array $_dependency_map |
|
| 86 | - */ |
|
| 87 | - protected $_dependency_map = array(); |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @type array $_class_loaders |
|
| 91 | - */ |
|
| 92 | - protected $_class_loaders = array(); |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * EE_Dependency_Map constructor. |
|
| 97 | - * |
|
| 98 | - * @param ClassInterfaceCache $class_cache |
|
| 99 | - */ |
|
| 100 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
| 101 | - { |
|
| 102 | - $this->class_cache = $class_cache; |
|
| 103 | - do_action('EE_Dependency_Map____construct', $this); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @return void |
|
| 109 | - * @throws EE_Error |
|
| 110 | - * @throws InvalidAliasException |
|
| 111 | - */ |
|
| 112 | - public function initialize() |
|
| 113 | - { |
|
| 114 | - $this->_register_core_dependencies(); |
|
| 115 | - $this->_register_core_class_loaders(); |
|
| 116 | - $this->_register_core_aliases(); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @singleton method used to instantiate class object |
|
| 122 | - * @param ClassInterfaceCache|null $class_cache |
|
| 123 | - * @return EE_Dependency_Map |
|
| 124 | - */ |
|
| 125 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 126 | - { |
|
| 127 | - // check if class object is instantiated, and instantiated properly |
|
| 128 | - if (! self::$_instance instanceof EE_Dependency_Map |
|
| 129 | - && $class_cache instanceof ClassInterfaceCache |
|
| 130 | - ) { |
|
| 131 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 132 | - } |
|
| 133 | - return self::$_instance; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @param RequestInterface $request |
|
| 139 | - */ |
|
| 140 | - public function setRequest(RequestInterface $request) |
|
| 141 | - { |
|
| 142 | - $this->request = $request; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * @param LegacyRequestInterface $legacy_request |
|
| 148 | - */ |
|
| 149 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 150 | - { |
|
| 151 | - $this->legacy_request = $legacy_request; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * @param ResponseInterface $response |
|
| 157 | - */ |
|
| 158 | - public function setResponse(ResponseInterface $response) |
|
| 159 | - { |
|
| 160 | - $this->response = $response; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * @param LoaderInterface $loader |
|
| 166 | - */ |
|
| 167 | - public function setLoader(LoaderInterface $loader) |
|
| 168 | - { |
|
| 169 | - $this->loader = $loader; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param string $class |
|
| 175 | - * @param array $dependencies |
|
| 176 | - * @param int $overwrite |
|
| 177 | - * @return bool |
|
| 178 | - */ |
|
| 179 | - public static function register_dependencies( |
|
| 180 | - $class, |
|
| 181 | - array $dependencies, |
|
| 182 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 183 | - ) { |
|
| 184 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 190 | - * to the class specified by the first parameter. |
|
| 191 | - * IMPORTANT !!! |
|
| 192 | - * The order of elements in the incoming $dependencies array MUST match |
|
| 193 | - * the order of the constructor parameters for the class in question. |
|
| 194 | - * This is especially important when overriding any existing dependencies that are registered. |
|
| 195 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 196 | - * |
|
| 197 | - * @param string $class |
|
| 198 | - * @param array $dependencies |
|
| 199 | - * @param int $overwrite |
|
| 200 | - * @return bool |
|
| 201 | - */ |
|
| 202 | - public function registerDependencies( |
|
| 203 | - $class, |
|
| 204 | - array $dependencies, |
|
| 205 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 206 | - ) { |
|
| 207 | - $class = trim($class, '\\'); |
|
| 208 | - $registered = false; |
|
| 209 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 210 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
| 211 | - } |
|
| 212 | - // we need to make sure that any aliases used when registering a dependency |
|
| 213 | - // get resolved to the correct class name |
|
| 214 | - foreach ($dependencies as $dependency => $load_source) { |
|
| 215 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 216 | - if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 217 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 218 | - ) { |
|
| 219 | - unset($dependencies[ $dependency ]); |
|
| 220 | - $dependencies[ $alias ] = $load_source; |
|
| 221 | - $registered = true; |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - // now add our two lists of dependencies together. |
|
| 225 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
| 226 | - // so $dependencies is NOT overwritten because it is listed first |
|
| 227 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 228 | - // Union is way faster than array_merge() but should be used with caution... |
|
| 229 | - // especially with numerically indexed arrays |
|
| 230 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 231 | - // now we need to ensure that the resulting dependencies |
|
| 232 | - // array only has the entries that are required for the class |
|
| 233 | - // so first count how many dependencies were originally registered for the class |
|
| 234 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 235 | - // if that count is non-zero (meaning dependencies were already registered) |
|
| 236 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 237 | - // then truncate the final array to match that count |
|
| 238 | - ? array_slice($dependencies, 0, $dependency_count) |
|
| 239 | - // otherwise just take the incoming array because nothing previously existed |
|
| 240 | - : $dependencies; |
|
| 241 | - return $registered; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * @param string $class_name |
|
| 247 | - * @param string $loader |
|
| 248 | - * @return bool |
|
| 249 | - * @throws DomainException |
|
| 250 | - */ |
|
| 251 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 252 | - { |
|
| 253 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 254 | - throw new DomainException( |
|
| 255 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 256 | - ); |
|
| 257 | - } |
|
| 258 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 259 | - if (! is_callable($loader) |
|
| 260 | - && ( |
|
| 261 | - strpos($loader, 'load_') !== 0 |
|
| 262 | - || ! method_exists('EE_Registry', $loader) |
|
| 263 | - ) |
|
| 264 | - ) { |
|
| 265 | - throw new DomainException( |
|
| 266 | - sprintf( |
|
| 267 | - esc_html__( |
|
| 268 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 269 | - 'event_espresso' |
|
| 270 | - ), |
|
| 271 | - $loader |
|
| 272 | - ) |
|
| 273 | - ); |
|
| 274 | - } |
|
| 275 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 276 | - if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 277 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 278 | - return true; |
|
| 279 | - } |
|
| 280 | - return false; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * @return array |
|
| 286 | - */ |
|
| 287 | - public function dependency_map() |
|
| 288 | - { |
|
| 289 | - return $this->_dependency_map; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
| 295 | - * |
|
| 296 | - * @param string $class_name |
|
| 297 | - * @return boolean |
|
| 298 | - */ |
|
| 299 | - public function has($class_name = '') |
|
| 300 | - { |
|
| 301 | - // all legacy models have the same dependencies |
|
| 302 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 303 | - $class_name = 'LEGACY_MODELS'; |
|
| 304 | - } |
|
| 305 | - return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - |
|
| 309 | - /** |
|
| 310 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 311 | - * |
|
| 312 | - * @param string $class_name |
|
| 313 | - * @param string $dependency |
|
| 314 | - * @return bool |
|
| 315 | - */ |
|
| 316 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 317 | - { |
|
| 318 | - // all legacy models have the same dependencies |
|
| 319 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 320 | - $class_name = 'LEGACY_MODELS'; |
|
| 321 | - } |
|
| 322 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 323 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 324 | - ? true |
|
| 325 | - : false; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 331 | - * |
|
| 332 | - * @param string $class_name |
|
| 333 | - * @param string $dependency |
|
| 334 | - * @return int |
|
| 335 | - */ |
|
| 336 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 337 | - { |
|
| 338 | - // all legacy models have the same dependencies |
|
| 339 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 340 | - $class_name = 'LEGACY_MODELS'; |
|
| 341 | - } |
|
| 342 | - $dependency = $this->getFqnForAlias($dependency); |
|
| 343 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
| 344 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 345 | - : EE_Dependency_Map::not_registered; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - |
|
| 349 | - /** |
|
| 350 | - * @param string $class_name |
|
| 351 | - * @return string | Closure |
|
| 352 | - */ |
|
| 353 | - public function class_loader($class_name) |
|
| 354 | - { |
|
| 355 | - // all legacy models use load_model() |
|
| 356 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 357 | - return 'load_model'; |
|
| 358 | - } |
|
| 359 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 360 | - // perform strpos() first to avoid loading regex every time we load a class |
|
| 361 | - if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 362 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 363 | - ) { |
|
| 364 | - return 'load_core'; |
|
| 365 | - } |
|
| 366 | - $class_name = $this->getFqnForAlias($class_name); |
|
| 367 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * @return array |
|
| 373 | - */ |
|
| 374 | - public function class_loaders() |
|
| 375 | - { |
|
| 376 | - return $this->_class_loaders; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * adds an alias for a classname |
|
| 382 | - * |
|
| 383 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 384 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 385 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 386 | - * @throws InvalidAliasException |
|
| 387 | - */ |
|
| 388 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
| 389 | - { |
|
| 390 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
| 396 | - * WHY? |
|
| 397 | - * Because if a class is type hinting for a concretion, |
|
| 398 | - * then why would we need to find another class to supply it? |
|
| 399 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 400 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 401 | - * Don't go looking for some substitute. |
|
| 402 | - * Whereas if a class is type hinting for an interface... |
|
| 403 | - * then we need to find an actual class to use. |
|
| 404 | - * So the interface IS the alias for some other FQN, |
|
| 405 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 406 | - * represents some other class. |
|
| 407 | - * |
|
| 408 | - * @param string $fqn |
|
| 409 | - * @param string $for_class |
|
| 410 | - * @return bool |
|
| 411 | - */ |
|
| 412 | - public function isAlias($fqn = '', $for_class = '') |
|
| 413 | - { |
|
| 414 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - |
|
| 418 | - /** |
|
| 419 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 420 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 421 | - * for example: |
|
| 422 | - * if the following two entries were added to the _aliases array: |
|
| 423 | - * array( |
|
| 424 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 425 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 426 | - * ) |
|
| 427 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 428 | - * to load an instance of 'some\namespace\classname' |
|
| 429 | - * |
|
| 430 | - * @param string $alias |
|
| 431 | - * @param string $for_class |
|
| 432 | - * @return string |
|
| 433 | - */ |
|
| 434 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
| 435 | - { |
|
| 436 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 442 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 443 | - * This is done by using the following class constants: |
|
| 444 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 445 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 446 | - */ |
|
| 447 | - protected function _register_core_dependencies() |
|
| 448 | - { |
|
| 449 | - $this->_dependency_map = array( |
|
| 450 | - 'EE_Request_Handler' => array( |
|
| 451 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 452 | - ), |
|
| 453 | - 'EE_System' => array( |
|
| 454 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 455 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 456 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 457 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 458 | - ), |
|
| 459 | - 'EE_Session' => array( |
|
| 460 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 461 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 462 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 463 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 464 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 465 | - ), |
|
| 466 | - 'EE_Cart' => array( |
|
| 467 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 468 | - ), |
|
| 469 | - 'EE_Front_Controller' => array( |
|
| 470 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 471 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 472 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 473 | - ), |
|
| 474 | - 'EE_Messenger_Collection_Loader' => array( |
|
| 475 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 476 | - ), |
|
| 477 | - 'EE_Message_Type_Collection_Loader' => array( |
|
| 478 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 479 | - ), |
|
| 480 | - 'EE_Message_Resource_Manager' => array( |
|
| 481 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 482 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 483 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 484 | - ), |
|
| 485 | - 'EE_Message_Factory' => array( |
|
| 486 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 487 | - ), |
|
| 488 | - 'EE_messages' => array( |
|
| 489 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 490 | - ), |
|
| 491 | - 'EE_Messages_Generator' => array( |
|
| 492 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 493 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 494 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 495 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 496 | - ), |
|
| 497 | - 'EE_Messages_Processor' => array( |
|
| 498 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 499 | - ), |
|
| 500 | - 'EE_Messages_Queue' => array( |
|
| 501 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 502 | - ), |
|
| 503 | - 'EE_Messages_Template_Defaults' => array( |
|
| 504 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 505 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 506 | - ), |
|
| 507 | - 'EE_Message_To_Generate_From_Request' => array( |
|
| 508 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 510 | - ), |
|
| 511 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 512 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 513 | - ), |
|
| 514 | - 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 515 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 516 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 517 | - ), |
|
| 518 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 519 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 520 | - ), |
|
| 521 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 522 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 523 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 524 | - ), |
|
| 525 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 526 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 527 | - ), |
|
| 528 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 529 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 530 | - ), |
|
| 531 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 532 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 533 | - ), |
|
| 534 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 535 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 536 | - ), |
|
| 537 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 538 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 539 | - ), |
|
| 540 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 541 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 542 | - ), |
|
| 543 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 544 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 545 | - ), |
|
| 546 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 547 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 548 | - ), |
|
| 549 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 550 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 551 | - ), |
|
| 552 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 553 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 554 | - ), |
|
| 555 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 556 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 557 | - ), |
|
| 558 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 559 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 560 | - ), |
|
| 561 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 562 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 563 | - ), |
|
| 564 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
| 565 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 566 | - ), |
|
| 567 | - 'EE_Data_Migration_Class_Base' => array( |
|
| 568 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | - ), |
|
| 571 | - 'EE_DMS_Core_4_1_0' => array( |
|
| 572 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | - ), |
|
| 575 | - 'EE_DMS_Core_4_2_0' => array( |
|
| 576 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | - ), |
|
| 579 | - 'EE_DMS_Core_4_3_0' => array( |
|
| 580 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | - ), |
|
| 583 | - 'EE_DMS_Core_4_4_0' => array( |
|
| 584 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | - ), |
|
| 587 | - 'EE_DMS_Core_4_5_0' => array( |
|
| 588 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | - ), |
|
| 591 | - 'EE_DMS_Core_4_6_0' => array( |
|
| 592 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | - ), |
|
| 595 | - 'EE_DMS_Core_4_7_0' => array( |
|
| 596 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | - ), |
|
| 599 | - 'EE_DMS_Core_4_8_0' => array( |
|
| 600 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | - ), |
|
| 603 | - 'EE_DMS_Core_4_9_0' => array( |
|
| 604 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | - ), |
|
| 607 | - 'EE_DMS_Core_4_10_0' => array( |
|
| 608 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 609 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 610 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 611 | - ), |
|
| 612 | - 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 613 | - array(), |
|
| 614 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 615 | - ), |
|
| 616 | - 'EventEspresso\core\services\assets\Registry' => array( |
|
| 617 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 618 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 619 | - ), |
|
| 620 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 621 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 622 | - ), |
|
| 623 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 624 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 625 | - ), |
|
| 626 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 627 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 628 | - ), |
|
| 629 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 630 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 631 | - ), |
|
| 632 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 633 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 634 | - ), |
|
| 635 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 636 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 637 | - ), |
|
| 638 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 639 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 640 | - ), |
|
| 641 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 642 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 643 | - ), |
|
| 644 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 645 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 646 | - ), |
|
| 647 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 648 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 649 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 650 | - ), |
|
| 651 | - 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 652 | - null, |
|
| 653 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 654 | - ), |
|
| 655 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 656 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 657 | - ), |
|
| 658 | - 'LEGACY_MODELS' => array( |
|
| 659 | - null, |
|
| 660 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 661 | - ), |
|
| 662 | - 'EE_Module_Request_Router' => array( |
|
| 663 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 664 | - ), |
|
| 665 | - 'EE_Registration_Processor' => array( |
|
| 666 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 667 | - ), |
|
| 668 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 669 | - null, |
|
| 670 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 671 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 672 | - ), |
|
| 673 | - 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 674 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 675 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 676 | - ), |
|
| 677 | - 'EE_Admin_Transactions_List_Table' => array( |
|
| 678 | - null, |
|
| 679 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 680 | - ), |
|
| 681 | - 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 682 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 683 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 684 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 685 | - ), |
|
| 686 | - 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 687 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 688 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 689 | - ), |
|
| 690 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 691 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 692 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 693 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 694 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 695 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 696 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 697 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 698 | - ), |
|
| 699 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 700 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 701 | - ), |
|
| 702 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 703 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 704 | - ), |
|
| 705 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 706 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 708 | - ), |
|
| 709 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 710 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 711 | - ), |
|
| 712 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 713 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 714 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 715 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 716 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 717 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 718 | - ), |
|
| 719 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 720 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 721 | - ), |
|
| 722 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 723 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 724 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 725 | - ), |
|
| 726 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 727 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 728 | - ), |
|
| 729 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 730 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | - ), |
|
| 732 | - 'EE_CPT_Strategy' => array( |
|
| 733 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 734 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 735 | - ), |
|
| 736 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 737 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 738 | - ), |
|
| 739 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 740 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 741 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 742 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 743 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 744 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 745 | - ), |
|
| 746 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 747 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 748 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 749 | - ), |
|
| 750 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 751 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 752 | - ), |
|
| 753 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 754 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 755 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 756 | - ), |
|
| 757 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 758 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 759 | - ), |
|
| 760 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 761 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 762 | - ), |
|
| 763 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 764 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 765 | - ), |
|
| 766 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 767 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 768 | - ), |
|
| 769 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 770 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 771 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 772 | - ), |
|
| 773 | - 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 774 | - null, |
|
| 775 | - null, |
|
| 776 | - null, |
|
| 777 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 778 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 779 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 780 | - ), |
|
| 781 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 782 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 783 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 784 | - ), |
|
| 785 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 786 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 787 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 788 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 789 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 790 | - ), |
|
| 791 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 792 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 793 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 794 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 795 | - ), |
|
| 796 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 797 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 798 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 799 | - ), |
|
| 800 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 801 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 802 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 803 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 804 | - ), |
|
| 805 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 806 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 807 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 808 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 809 | - ), |
|
| 810 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 811 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 812 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 813 | - ), |
|
| 814 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 815 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 816 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 817 | - ), |
|
| 818 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 819 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 820 | - ), |
|
| 821 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 822 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 823 | - ), |
|
| 824 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 825 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 826 | - ), |
|
| 827 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 828 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 829 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | - ), |
|
| 831 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 832 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 833 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 834 | - ), |
|
| 835 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 836 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 837 | - ), |
|
| 838 | - 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 839 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 840 | - ), |
|
| 841 | - 'EE_URL_Validation_Strategy' => array( |
|
| 842 | - null, |
|
| 843 | - null, |
|
| 844 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 845 | - ), |
|
| 846 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 847 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 848 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 849 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 850 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 851 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 852 | - ), |
|
| 853 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 854 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 855 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 856 | - ), |
|
| 857 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 858 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 859 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 860 | - ), |
|
| 861 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 862 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 863 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 864 | - ), |
|
| 865 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 866 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 867 | - ), |
|
| 868 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 869 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 870 | - ], |
|
| 871 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 872 | - null, |
|
| 873 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 875 | - ], |
|
| 876 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 877 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 879 | - ], |
|
| 880 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 881 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 883 | - ], |
|
| 884 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 885 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 887 | - ], |
|
| 888 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 889 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 890 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 891 | - ], |
|
| 892 | - 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
| 893 | - 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
| 894 | - 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
| 895 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
| 896 | - null |
|
| 897 | - ], |
|
| 898 | - 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' => [ |
|
| 899 | - 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache |
|
| 900 | - ], |
|
| 901 | - 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorData' => [ |
|
| 902 | - 'EE_Event' => EE_Dependency_Map::not_registered, |
|
| 903 | - 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 904 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 905 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 906 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 907 | - ], |
|
| 908 | - 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 909 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 910 | - 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 911 | - 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 912 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 913 | - ], |
|
| 914 | - 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 915 | - 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 916 | - ], |
|
| 917 | - 'EventEspresso\core\services\graphql\InputsManager' => [ |
|
| 918 | - 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 919 | - ], |
|
| 920 | - 'EventEspresso\core\services\graphql\EnumsManager' => [ |
|
| 921 | - 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 922 | - ], |
|
| 923 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 924 | - 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 925 | - ], |
|
| 926 | - 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 927 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 928 | - ], |
|
| 929 | - 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 930 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 931 | - ], |
|
| 932 | - 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 933 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 934 | - ], |
|
| 935 | - 'EventEspresso\core\domain\services\graphql\types\Price' => [ |
|
| 936 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 937 | - ], |
|
| 938 | - 'EventEspresso\core\domain\services\graphql\types\PriceType' => [ |
|
| 939 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 940 | - ], |
|
| 941 | - 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 942 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 943 | - ], |
|
| 944 | - 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 945 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 946 | - ], |
|
| 947 | - 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 948 | - 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 949 | - ], |
|
| 950 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 951 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 952 | - ], |
|
| 953 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection' => [ |
|
| 954 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 955 | - ], |
|
| 956 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 957 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 958 | - ], |
|
| 959 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection' => [ |
|
| 960 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 961 | - ], |
|
| 962 | - 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection' => [ |
|
| 963 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 964 | - ], |
|
| 965 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection' => [ |
|
| 966 | - 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 967 | - ], |
|
| 968 | - 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection' => [ |
|
| 969 | - 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 970 | - ], |
|
| 971 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 972 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 973 | - ], |
|
| 974 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 975 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 976 | - ], |
|
| 977 | - ); |
|
| 978 | - } |
|
| 979 | - |
|
| 980 | - |
|
| 981 | - /** |
|
| 982 | - * Registers how core classes are loaded. |
|
| 983 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 984 | - * 'EE_Request_Handler' => 'load_core' |
|
| 985 | - * 'EE_Messages_Queue' => 'load_lib' |
|
| 986 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
| 987 | - * or, if greater control is required, by providing a custom closure. For example: |
|
| 988 | - * 'Some_Class' => function () { |
|
| 989 | - * return new Some_Class(); |
|
| 990 | - * }, |
|
| 991 | - * This is required for instantiating dependencies |
|
| 992 | - * where an interface has been type hinted in a class constructor. For example: |
|
| 993 | - * 'Required_Interface' => function () { |
|
| 994 | - * return new A_Class_That_Implements_Required_Interface(); |
|
| 995 | - * }, |
|
| 996 | - */ |
|
| 997 | - protected function _register_core_class_loaders() |
|
| 998 | - { |
|
| 999 | - $this->_class_loaders = array( |
|
| 1000 | - // load_core |
|
| 1001 | - 'EE_Dependency_Map' => function () { |
|
| 1002 | - return $this; |
|
| 1003 | - }, |
|
| 1004 | - 'EE_Capabilities' => 'load_core', |
|
| 1005 | - 'EE_Encryption' => 'load_core', |
|
| 1006 | - 'EE_Front_Controller' => 'load_core', |
|
| 1007 | - 'EE_Module_Request_Router' => 'load_core', |
|
| 1008 | - 'EE_Registry' => 'load_core', |
|
| 1009 | - 'EE_Request' => function () { |
|
| 1010 | - return $this->legacy_request; |
|
| 1011 | - }, |
|
| 1012 | - 'EventEspresso\core\services\request\Request' => function () { |
|
| 1013 | - return $this->request; |
|
| 1014 | - }, |
|
| 1015 | - 'EventEspresso\core\services\request\Response' => function () { |
|
| 1016 | - return $this->response; |
|
| 1017 | - }, |
|
| 1018 | - 'EE_Base' => 'load_core', |
|
| 1019 | - 'EE_Request_Handler' => 'load_core', |
|
| 1020 | - 'EE_Session' => 'load_core', |
|
| 1021 | - 'EE_Cron_Tasks' => 'load_core', |
|
| 1022 | - 'EE_System' => 'load_core', |
|
| 1023 | - 'EE_Maintenance_Mode' => 'load_core', |
|
| 1024 | - 'EE_Register_CPTs' => 'load_core', |
|
| 1025 | - 'EE_Admin' => 'load_core', |
|
| 1026 | - 'EE_CPT_Strategy' => 'load_core', |
|
| 1027 | - // load_class |
|
| 1028 | - 'EE_Registration_Processor' => 'load_class', |
|
| 1029 | - // load_lib |
|
| 1030 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 1031 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
| 1032 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 1033 | - 'EE_Messenger_Collection' => 'load_lib', |
|
| 1034 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 1035 | - 'EE_Messages_Processor' => 'load_lib', |
|
| 1036 | - 'EE_Message_Repository' => 'load_lib', |
|
| 1037 | - 'EE_Messages_Queue' => 'load_lib', |
|
| 1038 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 1039 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 1040 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 1041 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 1042 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 1043 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 1044 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 1045 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 1046 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 1047 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 1048 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1049 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1050 | - 'EE_Messages_Generator' => static function () { |
|
| 1051 | - return EE_Registry::instance()->load_lib( |
|
| 1052 | - 'Messages_Generator', |
|
| 1053 | - array(), |
|
| 1054 | - false, |
|
| 1055 | - false |
|
| 1056 | - ); |
|
| 1057 | - }, |
|
| 1058 | - 'EE_Messages_Template_Defaults' => static function ($arguments = array()) { |
|
| 1059 | - return EE_Registry::instance()->load_lib( |
|
| 1060 | - 'Messages_Template_Defaults', |
|
| 1061 | - $arguments, |
|
| 1062 | - false, |
|
| 1063 | - false |
|
| 1064 | - ); |
|
| 1065 | - }, |
|
| 1066 | - // load_helper |
|
| 1067 | - 'EEH_Parse_Shortcodes' => static function () { |
|
| 1068 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1069 | - return new EEH_Parse_Shortcodes(); |
|
| 1070 | - } |
|
| 1071 | - return null; |
|
| 1072 | - }, |
|
| 1073 | - 'EE_Template_Config' => static function () { |
|
| 1074 | - return EE_Config::instance()->template_settings; |
|
| 1075 | - }, |
|
| 1076 | - 'EE_Currency_Config' => static function () { |
|
| 1077 | - return EE_Config::instance()->currency; |
|
| 1078 | - }, |
|
| 1079 | - 'EE_Registration_Config' => static function () { |
|
| 1080 | - return EE_Config::instance()->registration; |
|
| 1081 | - }, |
|
| 1082 | - 'EE_Core_Config' => static function () { |
|
| 1083 | - return EE_Config::instance()->core; |
|
| 1084 | - }, |
|
| 1085 | - 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
| 1086 | - return LoaderFactory::getLoader(); |
|
| 1087 | - }, |
|
| 1088 | - 'EE_Network_Config' => static function () { |
|
| 1089 | - return EE_Network_Config::instance(); |
|
| 1090 | - }, |
|
| 1091 | - 'EE_Config' => static function () { |
|
| 1092 | - return EE_Config::instance(); |
|
| 1093 | - }, |
|
| 1094 | - 'EventEspresso\core\domain\Domain' => static function () { |
|
| 1095 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1096 | - }, |
|
| 1097 | - 'EE_Admin_Config' => static function () { |
|
| 1098 | - return EE_Config::instance()->admin; |
|
| 1099 | - }, |
|
| 1100 | - 'EE_Organization_Config' => static function () { |
|
| 1101 | - return EE_Config::instance()->organization; |
|
| 1102 | - }, |
|
| 1103 | - 'EE_Network_Core_Config' => static function () { |
|
| 1104 | - return EE_Network_Config::instance()->core; |
|
| 1105 | - }, |
|
| 1106 | - 'EE_Environment_Config' => static function () { |
|
| 1107 | - return EE_Config::instance()->environment; |
|
| 1108 | - }, |
|
| 1109 | - 'EED_Core_Rest_Api' => static function () { |
|
| 1110 | - return EED_Core_Rest_Api::instance(); |
|
| 1111 | - }, |
|
| 1112 | - 'WP_REST_Server' => static function () { |
|
| 1113 | - return rest_get_server(); |
|
| 1114 | - }, |
|
| 1115 | - ); |
|
| 1116 | - } |
|
| 1117 | - |
|
| 1118 | - |
|
| 1119 | - /** |
|
| 1120 | - * can be used for supplying alternate names for classes, |
|
| 1121 | - * or for connecting interface names to instantiable classes |
|
| 1122 | - * |
|
| 1123 | - * @throws InvalidAliasException |
|
| 1124 | - */ |
|
| 1125 | - protected function _register_core_aliases() |
|
| 1126 | - { |
|
| 1127 | - $aliases = array( |
|
| 1128 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1129 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1130 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1131 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1132 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1133 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1134 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1135 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1136 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1137 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1138 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1139 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1140 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1141 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1142 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1143 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1144 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1145 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1146 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1147 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1148 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1149 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1150 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1151 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1152 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1153 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1154 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1155 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1156 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1157 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1158 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1159 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1160 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1161 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1162 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1163 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1164 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1165 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1166 | - ); |
|
| 1167 | - foreach ($aliases as $alias => $fqn) { |
|
| 1168 | - if (is_array($fqn)) { |
|
| 1169 | - foreach ($fqn as $class => $for_class) { |
|
| 1170 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1171 | - } |
|
| 1172 | - continue; |
|
| 1173 | - } |
|
| 1174 | - $this->class_cache->addAlias($fqn, $alias); |
|
| 1175 | - } |
|
| 1176 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1177 | - $this->class_cache->addAlias( |
|
| 1178 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1179 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1180 | - ); |
|
| 1181 | - } |
|
| 1182 | - } |
|
| 1183 | - |
|
| 1184 | - |
|
| 1185 | - /** |
|
| 1186 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1187 | - * request Primarily used by unit tests. |
|
| 1188 | - */ |
|
| 1189 | - public function reset() |
|
| 1190 | - { |
|
| 1191 | - $this->_register_core_class_loaders(); |
|
| 1192 | - $this->_register_core_dependencies(); |
|
| 1193 | - } |
|
| 1194 | - |
|
| 1195 | - |
|
| 1196 | - /** |
|
| 1197 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1198 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1199 | - * WHY? |
|
| 1200 | - * Because if a class is type hinting for a concretion, |
|
| 1201 | - * then why would we need to find another class to supply it? |
|
| 1202 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1203 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1204 | - * Don't go looking for some substitute. |
|
| 1205 | - * Whereas if a class is type hinting for an interface... |
|
| 1206 | - * then we need to find an actual class to use. |
|
| 1207 | - * So the interface IS the alias for some other FQN, |
|
| 1208 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1209 | - * represents some other class. |
|
| 1210 | - * |
|
| 1211 | - * @deprecated 4.9.62.p |
|
| 1212 | - * @param string $fqn |
|
| 1213 | - * @param string $for_class |
|
| 1214 | - * @return bool |
|
| 1215 | - */ |
|
| 1216 | - public function has_alias($fqn = '', $for_class = '') |
|
| 1217 | - { |
|
| 1218 | - return $this->isAlias($fqn, $for_class); |
|
| 1219 | - } |
|
| 1220 | - |
|
| 1221 | - |
|
| 1222 | - /** |
|
| 1223 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1224 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1225 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1226 | - * for example: |
|
| 1227 | - * if the following two entries were added to the _aliases array: |
|
| 1228 | - * array( |
|
| 1229 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 1230 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1231 | - * ) |
|
| 1232 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1233 | - * to load an instance of 'some\namespace\classname' |
|
| 1234 | - * |
|
| 1235 | - * @deprecated 4.9.62.p |
|
| 1236 | - * @param string $alias |
|
| 1237 | - * @param string $for_class |
|
| 1238 | - * @return string |
|
| 1239 | - */ |
|
| 1240 | - public function get_alias($alias = '', $for_class = '') |
|
| 1241 | - { |
|
| 1242 | - return $this->getFqnForAlias($alias, $for_class); |
|
| 1243 | - } |
|
| 24 | + /** |
|
| 25 | + * This means that the requested class dependency is not present in the dependency map |
|
| 26 | + */ |
|
| 27 | + const not_registered = 0; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 31 | + */ |
|
| 32 | + const load_new_object = 1; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 36 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 37 | + */ |
|
| 38 | + const load_from_cache = 2; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * When registering a dependency, |
|
| 42 | + * this indicates to keep any existing dependencies that already exist, |
|
| 43 | + * and simply discard any new dependencies declared in the incoming data |
|
| 44 | + */ |
|
| 45 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * When registering a dependency, |
|
| 49 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 50 | + */ |
|
| 51 | + const OVERWRITE_DEPENDENCIES = 1; |
|
| 52 | + |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @type EE_Dependency_Map $_instance |
|
| 56 | + */ |
|
| 57 | + protected static $_instance; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @var ClassInterfaceCache $class_cache |
|
| 61 | + */ |
|
| 62 | + private $class_cache; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @type RequestInterface $request |
|
| 66 | + */ |
|
| 67 | + protected $request; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @type LegacyRequestInterface $legacy_request |
|
| 71 | + */ |
|
| 72 | + protected $legacy_request; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @type ResponseInterface $response |
|
| 76 | + */ |
|
| 77 | + protected $response; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @type LoaderInterface $loader |
|
| 81 | + */ |
|
| 82 | + protected $loader; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @type array $_dependency_map |
|
| 86 | + */ |
|
| 87 | + protected $_dependency_map = array(); |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @type array $_class_loaders |
|
| 91 | + */ |
|
| 92 | + protected $_class_loaders = array(); |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * EE_Dependency_Map constructor. |
|
| 97 | + * |
|
| 98 | + * @param ClassInterfaceCache $class_cache |
|
| 99 | + */ |
|
| 100 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
| 101 | + { |
|
| 102 | + $this->class_cache = $class_cache; |
|
| 103 | + do_action('EE_Dependency_Map____construct', $this); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @return void |
|
| 109 | + * @throws EE_Error |
|
| 110 | + * @throws InvalidAliasException |
|
| 111 | + */ |
|
| 112 | + public function initialize() |
|
| 113 | + { |
|
| 114 | + $this->_register_core_dependencies(); |
|
| 115 | + $this->_register_core_class_loaders(); |
|
| 116 | + $this->_register_core_aliases(); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @singleton method used to instantiate class object |
|
| 122 | + * @param ClassInterfaceCache|null $class_cache |
|
| 123 | + * @return EE_Dependency_Map |
|
| 124 | + */ |
|
| 125 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 126 | + { |
|
| 127 | + // check if class object is instantiated, and instantiated properly |
|
| 128 | + if (! self::$_instance instanceof EE_Dependency_Map |
|
| 129 | + && $class_cache instanceof ClassInterfaceCache |
|
| 130 | + ) { |
|
| 131 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 132 | + } |
|
| 133 | + return self::$_instance; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @param RequestInterface $request |
|
| 139 | + */ |
|
| 140 | + public function setRequest(RequestInterface $request) |
|
| 141 | + { |
|
| 142 | + $this->request = $request; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * @param LegacyRequestInterface $legacy_request |
|
| 148 | + */ |
|
| 149 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 150 | + { |
|
| 151 | + $this->legacy_request = $legacy_request; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * @param ResponseInterface $response |
|
| 157 | + */ |
|
| 158 | + public function setResponse(ResponseInterface $response) |
|
| 159 | + { |
|
| 160 | + $this->response = $response; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * @param LoaderInterface $loader |
|
| 166 | + */ |
|
| 167 | + public function setLoader(LoaderInterface $loader) |
|
| 168 | + { |
|
| 169 | + $this->loader = $loader; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param string $class |
|
| 175 | + * @param array $dependencies |
|
| 176 | + * @param int $overwrite |
|
| 177 | + * @return bool |
|
| 178 | + */ |
|
| 179 | + public static function register_dependencies( |
|
| 180 | + $class, |
|
| 181 | + array $dependencies, |
|
| 182 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 183 | + ) { |
|
| 184 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 190 | + * to the class specified by the first parameter. |
|
| 191 | + * IMPORTANT !!! |
|
| 192 | + * The order of elements in the incoming $dependencies array MUST match |
|
| 193 | + * the order of the constructor parameters for the class in question. |
|
| 194 | + * This is especially important when overriding any existing dependencies that are registered. |
|
| 195 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 196 | + * |
|
| 197 | + * @param string $class |
|
| 198 | + * @param array $dependencies |
|
| 199 | + * @param int $overwrite |
|
| 200 | + * @return bool |
|
| 201 | + */ |
|
| 202 | + public function registerDependencies( |
|
| 203 | + $class, |
|
| 204 | + array $dependencies, |
|
| 205 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 206 | + ) { |
|
| 207 | + $class = trim($class, '\\'); |
|
| 208 | + $registered = false; |
|
| 209 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 210 | + self::$_instance->_dependency_map[ $class ] = array(); |
|
| 211 | + } |
|
| 212 | + // we need to make sure that any aliases used when registering a dependency |
|
| 213 | + // get resolved to the correct class name |
|
| 214 | + foreach ($dependencies as $dependency => $load_source) { |
|
| 215 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 216 | + if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 217 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 218 | + ) { |
|
| 219 | + unset($dependencies[ $dependency ]); |
|
| 220 | + $dependencies[ $alias ] = $load_source; |
|
| 221 | + $registered = true; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + // now add our two lists of dependencies together. |
|
| 225 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
| 226 | + // so $dependencies is NOT overwritten because it is listed first |
|
| 227 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 228 | + // Union is way faster than array_merge() but should be used with caution... |
|
| 229 | + // especially with numerically indexed arrays |
|
| 230 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 231 | + // now we need to ensure that the resulting dependencies |
|
| 232 | + // array only has the entries that are required for the class |
|
| 233 | + // so first count how many dependencies were originally registered for the class |
|
| 234 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 235 | + // if that count is non-zero (meaning dependencies were already registered) |
|
| 236 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 237 | + // then truncate the final array to match that count |
|
| 238 | + ? array_slice($dependencies, 0, $dependency_count) |
|
| 239 | + // otherwise just take the incoming array because nothing previously existed |
|
| 240 | + : $dependencies; |
|
| 241 | + return $registered; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * @param string $class_name |
|
| 247 | + * @param string $loader |
|
| 248 | + * @return bool |
|
| 249 | + * @throws DomainException |
|
| 250 | + */ |
|
| 251 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 252 | + { |
|
| 253 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 254 | + throw new DomainException( |
|
| 255 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 256 | + ); |
|
| 257 | + } |
|
| 258 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 259 | + if (! is_callable($loader) |
|
| 260 | + && ( |
|
| 261 | + strpos($loader, 'load_') !== 0 |
|
| 262 | + || ! method_exists('EE_Registry', $loader) |
|
| 263 | + ) |
|
| 264 | + ) { |
|
| 265 | + throw new DomainException( |
|
| 266 | + sprintf( |
|
| 267 | + esc_html__( |
|
| 268 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 269 | + 'event_espresso' |
|
| 270 | + ), |
|
| 271 | + $loader |
|
| 272 | + ) |
|
| 273 | + ); |
|
| 274 | + } |
|
| 275 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 276 | + if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 277 | + self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 278 | + return true; |
|
| 279 | + } |
|
| 280 | + return false; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * @return array |
|
| 286 | + */ |
|
| 287 | + public function dependency_map() |
|
| 288 | + { |
|
| 289 | + return $this->_dependency_map; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
| 295 | + * |
|
| 296 | + * @param string $class_name |
|
| 297 | + * @return boolean |
|
| 298 | + */ |
|
| 299 | + public function has($class_name = '') |
|
| 300 | + { |
|
| 301 | + // all legacy models have the same dependencies |
|
| 302 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 303 | + $class_name = 'LEGACY_MODELS'; |
|
| 304 | + } |
|
| 305 | + return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + |
|
| 309 | + /** |
|
| 310 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 311 | + * |
|
| 312 | + * @param string $class_name |
|
| 313 | + * @param string $dependency |
|
| 314 | + * @return bool |
|
| 315 | + */ |
|
| 316 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 317 | + { |
|
| 318 | + // all legacy models have the same dependencies |
|
| 319 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 320 | + $class_name = 'LEGACY_MODELS'; |
|
| 321 | + } |
|
| 322 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 323 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 324 | + ? true |
|
| 325 | + : false; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 331 | + * |
|
| 332 | + * @param string $class_name |
|
| 333 | + * @param string $dependency |
|
| 334 | + * @return int |
|
| 335 | + */ |
|
| 336 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 337 | + { |
|
| 338 | + // all legacy models have the same dependencies |
|
| 339 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 340 | + $class_name = 'LEGACY_MODELS'; |
|
| 341 | + } |
|
| 342 | + $dependency = $this->getFqnForAlias($dependency); |
|
| 343 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
| 344 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 345 | + : EE_Dependency_Map::not_registered; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + |
|
| 349 | + /** |
|
| 350 | + * @param string $class_name |
|
| 351 | + * @return string | Closure |
|
| 352 | + */ |
|
| 353 | + public function class_loader($class_name) |
|
| 354 | + { |
|
| 355 | + // all legacy models use load_model() |
|
| 356 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 357 | + return 'load_model'; |
|
| 358 | + } |
|
| 359 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 360 | + // perform strpos() first to avoid loading regex every time we load a class |
|
| 361 | + if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 362 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 363 | + ) { |
|
| 364 | + return 'load_core'; |
|
| 365 | + } |
|
| 366 | + $class_name = $this->getFqnForAlias($class_name); |
|
| 367 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * @return array |
|
| 373 | + */ |
|
| 374 | + public function class_loaders() |
|
| 375 | + { |
|
| 376 | + return $this->_class_loaders; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * adds an alias for a classname |
|
| 382 | + * |
|
| 383 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 384 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 385 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 386 | + * @throws InvalidAliasException |
|
| 387 | + */ |
|
| 388 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
| 389 | + { |
|
| 390 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
| 396 | + * WHY? |
|
| 397 | + * Because if a class is type hinting for a concretion, |
|
| 398 | + * then why would we need to find another class to supply it? |
|
| 399 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 400 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 401 | + * Don't go looking for some substitute. |
|
| 402 | + * Whereas if a class is type hinting for an interface... |
|
| 403 | + * then we need to find an actual class to use. |
|
| 404 | + * So the interface IS the alias for some other FQN, |
|
| 405 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 406 | + * represents some other class. |
|
| 407 | + * |
|
| 408 | + * @param string $fqn |
|
| 409 | + * @param string $for_class |
|
| 410 | + * @return bool |
|
| 411 | + */ |
|
| 412 | + public function isAlias($fqn = '', $for_class = '') |
|
| 413 | + { |
|
| 414 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + |
|
| 418 | + /** |
|
| 419 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 420 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 421 | + * for example: |
|
| 422 | + * if the following two entries were added to the _aliases array: |
|
| 423 | + * array( |
|
| 424 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 425 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 426 | + * ) |
|
| 427 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 428 | + * to load an instance of 'some\namespace\classname' |
|
| 429 | + * |
|
| 430 | + * @param string $alias |
|
| 431 | + * @param string $for_class |
|
| 432 | + * @return string |
|
| 433 | + */ |
|
| 434 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
| 435 | + { |
|
| 436 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 442 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 443 | + * This is done by using the following class constants: |
|
| 444 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 445 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 446 | + */ |
|
| 447 | + protected function _register_core_dependencies() |
|
| 448 | + { |
|
| 449 | + $this->_dependency_map = array( |
|
| 450 | + 'EE_Request_Handler' => array( |
|
| 451 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 452 | + ), |
|
| 453 | + 'EE_System' => array( |
|
| 454 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 455 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 456 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 457 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 458 | + ), |
|
| 459 | + 'EE_Session' => array( |
|
| 460 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 461 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 462 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 463 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 464 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 465 | + ), |
|
| 466 | + 'EE_Cart' => array( |
|
| 467 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 468 | + ), |
|
| 469 | + 'EE_Front_Controller' => array( |
|
| 470 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 471 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 472 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 473 | + ), |
|
| 474 | + 'EE_Messenger_Collection_Loader' => array( |
|
| 475 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 476 | + ), |
|
| 477 | + 'EE_Message_Type_Collection_Loader' => array( |
|
| 478 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 479 | + ), |
|
| 480 | + 'EE_Message_Resource_Manager' => array( |
|
| 481 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 482 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 483 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 484 | + ), |
|
| 485 | + 'EE_Message_Factory' => array( |
|
| 486 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 487 | + ), |
|
| 488 | + 'EE_messages' => array( |
|
| 489 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 490 | + ), |
|
| 491 | + 'EE_Messages_Generator' => array( |
|
| 492 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 493 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 494 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 495 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 496 | + ), |
|
| 497 | + 'EE_Messages_Processor' => array( |
|
| 498 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 499 | + ), |
|
| 500 | + 'EE_Messages_Queue' => array( |
|
| 501 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 502 | + ), |
|
| 503 | + 'EE_Messages_Template_Defaults' => array( |
|
| 504 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 505 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 506 | + ), |
|
| 507 | + 'EE_Message_To_Generate_From_Request' => array( |
|
| 508 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 510 | + ), |
|
| 511 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 512 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 513 | + ), |
|
| 514 | + 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 515 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 516 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 517 | + ), |
|
| 518 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 519 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 520 | + ), |
|
| 521 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 522 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 523 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 524 | + ), |
|
| 525 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 526 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 527 | + ), |
|
| 528 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 529 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 530 | + ), |
|
| 531 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 532 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 533 | + ), |
|
| 534 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 535 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 536 | + ), |
|
| 537 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 538 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 539 | + ), |
|
| 540 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 541 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 542 | + ), |
|
| 543 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 544 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 545 | + ), |
|
| 546 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 547 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 548 | + ), |
|
| 549 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 550 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 551 | + ), |
|
| 552 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 553 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 554 | + ), |
|
| 555 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 556 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 557 | + ), |
|
| 558 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 559 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 560 | + ), |
|
| 561 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 562 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 563 | + ), |
|
| 564 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
| 565 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 566 | + ), |
|
| 567 | + 'EE_Data_Migration_Class_Base' => array( |
|
| 568 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | + ), |
|
| 571 | + 'EE_DMS_Core_4_1_0' => array( |
|
| 572 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | + ), |
|
| 575 | + 'EE_DMS_Core_4_2_0' => array( |
|
| 576 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | + ), |
|
| 579 | + 'EE_DMS_Core_4_3_0' => array( |
|
| 580 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | + ), |
|
| 583 | + 'EE_DMS_Core_4_4_0' => array( |
|
| 584 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | + ), |
|
| 587 | + 'EE_DMS_Core_4_5_0' => array( |
|
| 588 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | + ), |
|
| 591 | + 'EE_DMS_Core_4_6_0' => array( |
|
| 592 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | + ), |
|
| 595 | + 'EE_DMS_Core_4_7_0' => array( |
|
| 596 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | + ), |
|
| 599 | + 'EE_DMS_Core_4_8_0' => array( |
|
| 600 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | + ), |
|
| 603 | + 'EE_DMS_Core_4_9_0' => array( |
|
| 604 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | + ), |
|
| 607 | + 'EE_DMS_Core_4_10_0' => array( |
|
| 608 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 609 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 610 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 611 | + ), |
|
| 612 | + 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 613 | + array(), |
|
| 614 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 615 | + ), |
|
| 616 | + 'EventEspresso\core\services\assets\Registry' => array( |
|
| 617 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 618 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 619 | + ), |
|
| 620 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 621 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 622 | + ), |
|
| 623 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 624 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 625 | + ), |
|
| 626 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 627 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 628 | + ), |
|
| 629 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 630 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 631 | + ), |
|
| 632 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 633 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 634 | + ), |
|
| 635 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 636 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 637 | + ), |
|
| 638 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 639 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 640 | + ), |
|
| 641 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 642 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 643 | + ), |
|
| 644 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 645 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 646 | + ), |
|
| 647 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 648 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 649 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 650 | + ), |
|
| 651 | + 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 652 | + null, |
|
| 653 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 654 | + ), |
|
| 655 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 656 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 657 | + ), |
|
| 658 | + 'LEGACY_MODELS' => array( |
|
| 659 | + null, |
|
| 660 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 661 | + ), |
|
| 662 | + 'EE_Module_Request_Router' => array( |
|
| 663 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 664 | + ), |
|
| 665 | + 'EE_Registration_Processor' => array( |
|
| 666 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 667 | + ), |
|
| 668 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 669 | + null, |
|
| 670 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 671 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 672 | + ), |
|
| 673 | + 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 674 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 675 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 676 | + ), |
|
| 677 | + 'EE_Admin_Transactions_List_Table' => array( |
|
| 678 | + null, |
|
| 679 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 680 | + ), |
|
| 681 | + 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 682 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 683 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 684 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 685 | + ), |
|
| 686 | + 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 687 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 688 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 689 | + ), |
|
| 690 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 691 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 692 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 693 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 694 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 695 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 696 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 697 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 698 | + ), |
|
| 699 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 700 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 701 | + ), |
|
| 702 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 703 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 704 | + ), |
|
| 705 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 706 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 708 | + ), |
|
| 709 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 710 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 711 | + ), |
|
| 712 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 713 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 714 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 715 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 716 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 717 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 718 | + ), |
|
| 719 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 720 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 721 | + ), |
|
| 722 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 723 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 724 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 725 | + ), |
|
| 726 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 727 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 728 | + ), |
|
| 729 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 730 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | + ), |
|
| 732 | + 'EE_CPT_Strategy' => array( |
|
| 733 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 734 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 735 | + ), |
|
| 736 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 737 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 738 | + ), |
|
| 739 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 740 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 741 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 742 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 743 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 744 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 745 | + ), |
|
| 746 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 747 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 748 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 749 | + ), |
|
| 750 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 751 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 752 | + ), |
|
| 753 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 754 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 755 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 756 | + ), |
|
| 757 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 758 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 759 | + ), |
|
| 760 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 761 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 762 | + ), |
|
| 763 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 764 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 765 | + ), |
|
| 766 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 767 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 768 | + ), |
|
| 769 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 770 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 771 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 772 | + ), |
|
| 773 | + 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 774 | + null, |
|
| 775 | + null, |
|
| 776 | + null, |
|
| 777 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 778 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 779 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 780 | + ), |
|
| 781 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 782 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 783 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 784 | + ), |
|
| 785 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 786 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 787 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 788 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 789 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 790 | + ), |
|
| 791 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 792 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 793 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 794 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 795 | + ), |
|
| 796 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 797 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 798 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 799 | + ), |
|
| 800 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 801 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 802 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 803 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 804 | + ), |
|
| 805 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 806 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 807 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 808 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 809 | + ), |
|
| 810 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 811 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 812 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 813 | + ), |
|
| 814 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 815 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 816 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 817 | + ), |
|
| 818 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 819 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 820 | + ), |
|
| 821 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 822 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 823 | + ), |
|
| 824 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 825 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 826 | + ), |
|
| 827 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 828 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 829 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | + ), |
|
| 831 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 832 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 833 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 834 | + ), |
|
| 835 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 836 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 837 | + ), |
|
| 838 | + 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 839 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 840 | + ), |
|
| 841 | + 'EE_URL_Validation_Strategy' => array( |
|
| 842 | + null, |
|
| 843 | + null, |
|
| 844 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 845 | + ), |
|
| 846 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 847 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 848 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 849 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 850 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 851 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 852 | + ), |
|
| 853 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 854 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 855 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 856 | + ), |
|
| 857 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 858 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 859 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 860 | + ), |
|
| 861 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 862 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 863 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 864 | + ), |
|
| 865 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 866 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 867 | + ), |
|
| 868 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 869 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 870 | + ], |
|
| 871 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 872 | + null, |
|
| 873 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 875 | + ], |
|
| 876 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 877 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 879 | + ], |
|
| 880 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 881 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 883 | + ], |
|
| 884 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 885 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 887 | + ], |
|
| 888 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 889 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 890 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 891 | + ], |
|
| 892 | + 'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [ |
|
| 893 | + 'WP_REST_Server' => EE_Dependency_Map::load_from_cache, |
|
| 894 | + 'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache, |
|
| 895 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache, |
|
| 896 | + null |
|
| 897 | + ], |
|
| 898 | + 'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection' => [ |
|
| 899 | + 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache |
|
| 900 | + ], |
|
| 901 | + 'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorData' => [ |
|
| 902 | + 'EE_Event' => EE_Dependency_Map::not_registered, |
|
| 903 | + 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 904 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 905 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 906 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 907 | + ], |
|
| 908 | + 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 909 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 910 | + 'EventEspresso\core\services\graphql\InputsManager' => EE_Dependency_Map::load_from_cache, |
|
| 911 | + 'EventEspresso\core\services\graphql\EnumsManager' => EE_Dependency_Map::load_from_cache, |
|
| 912 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 913 | + ], |
|
| 914 | + 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 915 | + 'EventEspresso\core\services\graphql\types\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 916 | + ], |
|
| 917 | + 'EventEspresso\core\services\graphql\InputsManager' => [ |
|
| 918 | + 'EventEspresso\core\services\graphql\inputs\InputCollection' => EE_Dependency_Map::load_from_cache, |
|
| 919 | + ], |
|
| 920 | + 'EventEspresso\core\services\graphql\EnumsManager' => [ |
|
| 921 | + 'EventEspresso\core\services\graphql\enums\EnumCollection' => EE_Dependency_Map::load_from_cache, |
|
| 922 | + ], |
|
| 923 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 924 | + 'EventEspresso\core\services\graphql\connections\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 925 | + ], |
|
| 926 | + 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 927 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 928 | + ], |
|
| 929 | + 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 930 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 931 | + ], |
|
| 932 | + 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 933 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 934 | + ], |
|
| 935 | + 'EventEspresso\core\domain\services\graphql\types\Price' => [ |
|
| 936 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 937 | + ], |
|
| 938 | + 'EventEspresso\core\domain\services\graphql\types\PriceType' => [ |
|
| 939 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 940 | + ], |
|
| 941 | + 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 942 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 943 | + ], |
|
| 944 | + 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 945 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 946 | + ], |
|
| 947 | + 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 948 | + 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 949 | + ], |
|
| 950 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 951 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 952 | + ], |
|
| 953 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryDatetimesConnection' => [ |
|
| 954 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 955 | + ], |
|
| 956 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 957 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 958 | + ], |
|
| 959 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryTicketsConnection' => [ |
|
| 960 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 961 | + ], |
|
| 962 | + 'EventEspresso\core\domain\services\graphql\connections\TicketPricesConnection' => [ |
|
| 963 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 964 | + ], |
|
| 965 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPricesConnection' => [ |
|
| 966 | + 'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
| 967 | + ], |
|
| 968 | + 'EventEspresso\core\domain\services\graphql\connections\RootQueryPriceTypesConnection' => [ |
|
| 969 | + 'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
| 970 | + ], |
|
| 971 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 972 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 973 | + ], |
|
| 974 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 975 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 976 | + ], |
|
| 977 | + ); |
|
| 978 | + } |
|
| 979 | + |
|
| 980 | + |
|
| 981 | + /** |
|
| 982 | + * Registers how core classes are loaded. |
|
| 983 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 984 | + * 'EE_Request_Handler' => 'load_core' |
|
| 985 | + * 'EE_Messages_Queue' => 'load_lib' |
|
| 986 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
| 987 | + * or, if greater control is required, by providing a custom closure. For example: |
|
| 988 | + * 'Some_Class' => function () { |
|
| 989 | + * return new Some_Class(); |
|
| 990 | + * }, |
|
| 991 | + * This is required for instantiating dependencies |
|
| 992 | + * where an interface has been type hinted in a class constructor. For example: |
|
| 993 | + * 'Required_Interface' => function () { |
|
| 994 | + * return new A_Class_That_Implements_Required_Interface(); |
|
| 995 | + * }, |
|
| 996 | + */ |
|
| 997 | + protected function _register_core_class_loaders() |
|
| 998 | + { |
|
| 999 | + $this->_class_loaders = array( |
|
| 1000 | + // load_core |
|
| 1001 | + 'EE_Dependency_Map' => function () { |
|
| 1002 | + return $this; |
|
| 1003 | + }, |
|
| 1004 | + 'EE_Capabilities' => 'load_core', |
|
| 1005 | + 'EE_Encryption' => 'load_core', |
|
| 1006 | + 'EE_Front_Controller' => 'load_core', |
|
| 1007 | + 'EE_Module_Request_Router' => 'load_core', |
|
| 1008 | + 'EE_Registry' => 'load_core', |
|
| 1009 | + 'EE_Request' => function () { |
|
| 1010 | + return $this->legacy_request; |
|
| 1011 | + }, |
|
| 1012 | + 'EventEspresso\core\services\request\Request' => function () { |
|
| 1013 | + return $this->request; |
|
| 1014 | + }, |
|
| 1015 | + 'EventEspresso\core\services\request\Response' => function () { |
|
| 1016 | + return $this->response; |
|
| 1017 | + }, |
|
| 1018 | + 'EE_Base' => 'load_core', |
|
| 1019 | + 'EE_Request_Handler' => 'load_core', |
|
| 1020 | + 'EE_Session' => 'load_core', |
|
| 1021 | + 'EE_Cron_Tasks' => 'load_core', |
|
| 1022 | + 'EE_System' => 'load_core', |
|
| 1023 | + 'EE_Maintenance_Mode' => 'load_core', |
|
| 1024 | + 'EE_Register_CPTs' => 'load_core', |
|
| 1025 | + 'EE_Admin' => 'load_core', |
|
| 1026 | + 'EE_CPT_Strategy' => 'load_core', |
|
| 1027 | + // load_class |
|
| 1028 | + 'EE_Registration_Processor' => 'load_class', |
|
| 1029 | + // load_lib |
|
| 1030 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 1031 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
| 1032 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 1033 | + 'EE_Messenger_Collection' => 'load_lib', |
|
| 1034 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 1035 | + 'EE_Messages_Processor' => 'load_lib', |
|
| 1036 | + 'EE_Message_Repository' => 'load_lib', |
|
| 1037 | + 'EE_Messages_Queue' => 'load_lib', |
|
| 1038 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 1039 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 1040 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 1041 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 1042 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 1043 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 1044 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 1045 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 1046 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 1047 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 1048 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1049 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1050 | + 'EE_Messages_Generator' => static function () { |
|
| 1051 | + return EE_Registry::instance()->load_lib( |
|
| 1052 | + 'Messages_Generator', |
|
| 1053 | + array(), |
|
| 1054 | + false, |
|
| 1055 | + false |
|
| 1056 | + ); |
|
| 1057 | + }, |
|
| 1058 | + 'EE_Messages_Template_Defaults' => static function ($arguments = array()) { |
|
| 1059 | + return EE_Registry::instance()->load_lib( |
|
| 1060 | + 'Messages_Template_Defaults', |
|
| 1061 | + $arguments, |
|
| 1062 | + false, |
|
| 1063 | + false |
|
| 1064 | + ); |
|
| 1065 | + }, |
|
| 1066 | + // load_helper |
|
| 1067 | + 'EEH_Parse_Shortcodes' => static function () { |
|
| 1068 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1069 | + return new EEH_Parse_Shortcodes(); |
|
| 1070 | + } |
|
| 1071 | + return null; |
|
| 1072 | + }, |
|
| 1073 | + 'EE_Template_Config' => static function () { |
|
| 1074 | + return EE_Config::instance()->template_settings; |
|
| 1075 | + }, |
|
| 1076 | + 'EE_Currency_Config' => static function () { |
|
| 1077 | + return EE_Config::instance()->currency; |
|
| 1078 | + }, |
|
| 1079 | + 'EE_Registration_Config' => static function () { |
|
| 1080 | + return EE_Config::instance()->registration; |
|
| 1081 | + }, |
|
| 1082 | + 'EE_Core_Config' => static function () { |
|
| 1083 | + return EE_Config::instance()->core; |
|
| 1084 | + }, |
|
| 1085 | + 'EventEspresso\core\services\loaders\Loader' => static function () { |
|
| 1086 | + return LoaderFactory::getLoader(); |
|
| 1087 | + }, |
|
| 1088 | + 'EE_Network_Config' => static function () { |
|
| 1089 | + return EE_Network_Config::instance(); |
|
| 1090 | + }, |
|
| 1091 | + 'EE_Config' => static function () { |
|
| 1092 | + return EE_Config::instance(); |
|
| 1093 | + }, |
|
| 1094 | + 'EventEspresso\core\domain\Domain' => static function () { |
|
| 1095 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1096 | + }, |
|
| 1097 | + 'EE_Admin_Config' => static function () { |
|
| 1098 | + return EE_Config::instance()->admin; |
|
| 1099 | + }, |
|
| 1100 | + 'EE_Organization_Config' => static function () { |
|
| 1101 | + return EE_Config::instance()->organization; |
|
| 1102 | + }, |
|
| 1103 | + 'EE_Network_Core_Config' => static function () { |
|
| 1104 | + return EE_Network_Config::instance()->core; |
|
| 1105 | + }, |
|
| 1106 | + 'EE_Environment_Config' => static function () { |
|
| 1107 | + return EE_Config::instance()->environment; |
|
| 1108 | + }, |
|
| 1109 | + 'EED_Core_Rest_Api' => static function () { |
|
| 1110 | + return EED_Core_Rest_Api::instance(); |
|
| 1111 | + }, |
|
| 1112 | + 'WP_REST_Server' => static function () { |
|
| 1113 | + return rest_get_server(); |
|
| 1114 | + }, |
|
| 1115 | + ); |
|
| 1116 | + } |
|
| 1117 | + |
|
| 1118 | + |
|
| 1119 | + /** |
|
| 1120 | + * can be used for supplying alternate names for classes, |
|
| 1121 | + * or for connecting interface names to instantiable classes |
|
| 1122 | + * |
|
| 1123 | + * @throws InvalidAliasException |
|
| 1124 | + */ |
|
| 1125 | + protected function _register_core_aliases() |
|
| 1126 | + { |
|
| 1127 | + $aliases = array( |
|
| 1128 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1129 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1130 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1131 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1132 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1133 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1134 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1135 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1136 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1137 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1138 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1139 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1140 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1141 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1142 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1143 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1144 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1145 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1146 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1147 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1148 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1149 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1150 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1151 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1152 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1153 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1154 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1155 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1156 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1157 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1158 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1159 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1160 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1161 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1162 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1163 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1164 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1165 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1166 | + ); |
|
| 1167 | + foreach ($aliases as $alias => $fqn) { |
|
| 1168 | + if (is_array($fqn)) { |
|
| 1169 | + foreach ($fqn as $class => $for_class) { |
|
| 1170 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1171 | + } |
|
| 1172 | + continue; |
|
| 1173 | + } |
|
| 1174 | + $this->class_cache->addAlias($fqn, $alias); |
|
| 1175 | + } |
|
| 1176 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1177 | + $this->class_cache->addAlias( |
|
| 1178 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1179 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1180 | + ); |
|
| 1181 | + } |
|
| 1182 | + } |
|
| 1183 | + |
|
| 1184 | + |
|
| 1185 | + /** |
|
| 1186 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1187 | + * request Primarily used by unit tests. |
|
| 1188 | + */ |
|
| 1189 | + public function reset() |
|
| 1190 | + { |
|
| 1191 | + $this->_register_core_class_loaders(); |
|
| 1192 | + $this->_register_core_dependencies(); |
|
| 1193 | + } |
|
| 1194 | + |
|
| 1195 | + |
|
| 1196 | + /** |
|
| 1197 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1198 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1199 | + * WHY? |
|
| 1200 | + * Because if a class is type hinting for a concretion, |
|
| 1201 | + * then why would we need to find another class to supply it? |
|
| 1202 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1203 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1204 | + * Don't go looking for some substitute. |
|
| 1205 | + * Whereas if a class is type hinting for an interface... |
|
| 1206 | + * then we need to find an actual class to use. |
|
| 1207 | + * So the interface IS the alias for some other FQN, |
|
| 1208 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1209 | + * represents some other class. |
|
| 1210 | + * |
|
| 1211 | + * @deprecated 4.9.62.p |
|
| 1212 | + * @param string $fqn |
|
| 1213 | + * @param string $for_class |
|
| 1214 | + * @return bool |
|
| 1215 | + */ |
|
| 1216 | + public function has_alias($fqn = '', $for_class = '') |
|
| 1217 | + { |
|
| 1218 | + return $this->isAlias($fqn, $for_class); |
|
| 1219 | + } |
|
| 1220 | + |
|
| 1221 | + |
|
| 1222 | + /** |
|
| 1223 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1224 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1225 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1226 | + * for example: |
|
| 1227 | + * if the following two entries were added to the _aliases array: |
|
| 1228 | + * array( |
|
| 1229 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 1230 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1231 | + * ) |
|
| 1232 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1233 | + * to load an instance of 'some\namespace\classname' |
|
| 1234 | + * |
|
| 1235 | + * @deprecated 4.9.62.p |
|
| 1236 | + * @param string $alias |
|
| 1237 | + * @param string $for_class |
|
| 1238 | + * @return string |
|
| 1239 | + */ |
|
| 1240 | + public function get_alias($alias = '', $for_class = '') |
|
| 1241 | + { |
|
| 1242 | + return $this->getFqnForAlias($alias, $for_class); |
|
| 1243 | + } |
|
| 1244 | 1244 | } |