@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Collect the input_fields and sanitize them to prepare them for sending to the Query |
74 | 74 | */ |
75 | 75 | $input_fields = []; |
76 | - if (! empty($this->args['where'])) { |
|
76 | + if ( ! empty($this->args['where'])) { |
|
77 | 77 | $input_fields = $this->sanitizeInputFields($this->args['where']); |
78 | 78 | } |
79 | 79 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Merge the input_fields with the default query_args |
100 | 100 | */ |
101 | - if (! empty($input_fields)) { |
|
101 | + if ( ! empty($input_fields)) { |
|
102 | 102 | $where_params = array_merge($where_params, $input_fields); |
103 | 103 | } |
104 | 104 |
@@ -16,130 +16,130 @@ |
||
16 | 16 | */ |
17 | 17 | class VenueConnectionResolver extends AbstractConnectionResolver |
18 | 18 | { |
19 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
20 | - public function get_loader_name(): string |
|
21 | - { |
|
22 | - return 'espresso_venue'; |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * @return EEM_Venue |
|
27 | - * @throws EE_Error |
|
28 | - * @throws InvalidArgumentException |
|
29 | - * @throws InvalidDataTypeException |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws ReflectionException |
|
32 | - */ |
|
33 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
34 | - public function get_query(): EEM_Venue |
|
35 | - { |
|
36 | - return EEM_Venue::instance(); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * Return an array of item IDs from the query |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
46 | - public function get_ids(): array |
|
47 | - { |
|
48 | - $results = $this->query->get_col($this->query_args); |
|
49 | - |
|
50 | - return ! empty($results) ? $results : []; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * Here, we map the args from the input, then we make sure that we're only querying |
|
56 | - * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
57 | - * handle batch resolution of the posts. |
|
58 | - * |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
62 | - public function get_query_args(): array |
|
63 | - { |
|
64 | - $where_params = []; |
|
65 | - $query_args = []; |
|
66 | - |
|
67 | - $query_args['limit'] = $this->getLimit(); |
|
68 | - |
|
69 | - // Avoid multiple entries by join. |
|
70 | - $query_args['group_by'] = 'VNU_ID'; |
|
71 | - |
|
72 | - $query_args['default_where_conditions'] = 'minimum'; |
|
73 | - |
|
74 | - /** |
|
75 | - * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
76 | - */ |
|
77 | - $input_fields = []; |
|
78 | - if (! empty($this->args['where'])) { |
|
79 | - $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * Determine where we're at in the Graph and adjust the query context appropriately. |
|
84 | - * For example, if we're querying for datetime as a field of event query, this will automatically |
|
85 | - * set the query to pull datetimes that belong to that event. |
|
86 | - * We can set more cases for other source types. |
|
87 | - */ |
|
88 | - if (is_object($this->source)) { |
|
89 | - switch (true) { |
|
90 | - // Assumed to be an event |
|
91 | - case $this->source instanceof Post: |
|
92 | - $where_params['Event.EVT_ID'] = $this->source->ID; |
|
93 | - break; |
|
94 | - case $this->source instanceof EE_Event: |
|
95 | - $where_params['Event.EVT_ID'] = $this->source->ID(); |
|
96 | - break; |
|
97 | - } |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Merge the input_fields with the default query_args |
|
102 | - */ |
|
103 | - if (! empty($input_fields)) { |
|
104 | - $where_params = array_merge($where_params, $input_fields); |
|
105 | - } |
|
106 | - |
|
107 | - [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'VNU_ID'); |
|
108 | - |
|
109 | - $where_params = apply_filters( |
|
110 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__venue_where_params', |
|
111 | - $where_params, |
|
112 | - $this->source, |
|
113 | - $this->args |
|
114 | - ); |
|
115 | - |
|
116 | - $query_args[] = $where_params; |
|
117 | - |
|
118 | - /** |
|
119 | - * Return the $query_args |
|
120 | - */ |
|
121 | - return apply_filters( |
|
122 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__venue_query_args', |
|
123 | - $query_args, |
|
124 | - $this->source, |
|
125 | - $this->args |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
132 | - * friendly keys. |
|
133 | - * |
|
134 | - * @param array $where_args |
|
135 | - * @return array |
|
136 | - */ |
|
137 | - public function sanitizeInputFields(array $where_args): array |
|
138 | - { |
|
139 | - return $this->sanitizeWhereArgsForInputFields( |
|
140 | - $where_args, |
|
141 | - [], |
|
142 | - [] |
|
143 | - ); |
|
144 | - } |
|
19 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
20 | + public function get_loader_name(): string |
|
21 | + { |
|
22 | + return 'espresso_venue'; |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * @return EEM_Venue |
|
27 | + * @throws EE_Error |
|
28 | + * @throws InvalidArgumentException |
|
29 | + * @throws InvalidDataTypeException |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws ReflectionException |
|
32 | + */ |
|
33 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
34 | + public function get_query(): EEM_Venue |
|
35 | + { |
|
36 | + return EEM_Venue::instance(); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * Return an array of item IDs from the query |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
46 | + public function get_ids(): array |
|
47 | + { |
|
48 | + $results = $this->query->get_col($this->query_args); |
|
49 | + |
|
50 | + return ! empty($results) ? $results : []; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * Here, we map the args from the input, then we make sure that we're only querying |
|
56 | + * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
57 | + * handle batch resolution of the posts. |
|
58 | + * |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
62 | + public function get_query_args(): array |
|
63 | + { |
|
64 | + $where_params = []; |
|
65 | + $query_args = []; |
|
66 | + |
|
67 | + $query_args['limit'] = $this->getLimit(); |
|
68 | + |
|
69 | + // Avoid multiple entries by join. |
|
70 | + $query_args['group_by'] = 'VNU_ID'; |
|
71 | + |
|
72 | + $query_args['default_where_conditions'] = 'minimum'; |
|
73 | + |
|
74 | + /** |
|
75 | + * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
76 | + */ |
|
77 | + $input_fields = []; |
|
78 | + if (! empty($this->args['where'])) { |
|
79 | + $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * Determine where we're at in the Graph and adjust the query context appropriately. |
|
84 | + * For example, if we're querying for datetime as a field of event query, this will automatically |
|
85 | + * set the query to pull datetimes that belong to that event. |
|
86 | + * We can set more cases for other source types. |
|
87 | + */ |
|
88 | + if (is_object($this->source)) { |
|
89 | + switch (true) { |
|
90 | + // Assumed to be an event |
|
91 | + case $this->source instanceof Post: |
|
92 | + $where_params['Event.EVT_ID'] = $this->source->ID; |
|
93 | + break; |
|
94 | + case $this->source instanceof EE_Event: |
|
95 | + $where_params['Event.EVT_ID'] = $this->source->ID(); |
|
96 | + break; |
|
97 | + } |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Merge the input_fields with the default query_args |
|
102 | + */ |
|
103 | + if (! empty($input_fields)) { |
|
104 | + $where_params = array_merge($where_params, $input_fields); |
|
105 | + } |
|
106 | + |
|
107 | + [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'VNU_ID'); |
|
108 | + |
|
109 | + $where_params = apply_filters( |
|
110 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__venue_where_params', |
|
111 | + $where_params, |
|
112 | + $this->source, |
|
113 | + $this->args |
|
114 | + ); |
|
115 | + |
|
116 | + $query_args[] = $where_params; |
|
117 | + |
|
118 | + /** |
|
119 | + * Return the $query_args |
|
120 | + */ |
|
121 | + return apply_filters( |
|
122 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__venue_query_args', |
|
123 | + $query_args, |
|
124 | + $this->source, |
|
125 | + $this->args |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
132 | + * friendly keys. |
|
133 | + * |
|
134 | + * @param array $where_args |
|
135 | + * @return array |
|
136 | + */ |
|
137 | + public function sanitizeInputFields(array $where_args): array |
|
138 | + { |
|
139 | + return $this->sanitizeWhereArgsForInputFields( |
|
140 | + $where_args, |
|
141 | + [], |
|
142 | + [] |
|
143 | + ); |
|
144 | + } |
|
145 | 145 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function initialize() |
37 | 37 | { |
38 | 38 | $current_user = wp_get_current_user(); |
39 | - if (! $current_user instanceof WP_User) { |
|
39 | + if ( ! $current_user instanceof WP_User) { |
|
40 | 40 | $current_user = new WP_User(); |
41 | 41 | } |
42 | 42 |
@@ -16,51 +16,51 @@ |
||
16 | 16 | */ |
17 | 17 | class CurrentUser extends JsonDataNode |
18 | 18 | { |
19 | - const NODE_NAME = 'currentUser'; |
|
19 | + const NODE_NAME = 'currentUser'; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var Capabilities $capabilities |
|
23 | - */ |
|
24 | - private $capabilities; |
|
21 | + /** |
|
22 | + * @var Capabilities $capabilities |
|
23 | + */ |
|
24 | + private $capabilities; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @param Capabilities $capabilities |
|
28 | - * @param JsonDataNodeValidator $validator |
|
29 | - */ |
|
30 | - public function __construct(Capabilities $capabilities, JsonDataNodeValidator $validator) |
|
31 | - { |
|
32 | - parent::__construct($validator); |
|
33 | - $this->capabilities = $capabilities; |
|
34 | - $this->setNodeName(CurrentUser::NODE_NAME); |
|
35 | - } |
|
26 | + /** |
|
27 | + * @param Capabilities $capabilities |
|
28 | + * @param JsonDataNodeValidator $validator |
|
29 | + */ |
|
30 | + public function __construct(Capabilities $capabilities, JsonDataNodeValidator $validator) |
|
31 | + { |
|
32 | + parent::__construct($validator); |
|
33 | + $this->capabilities = $capabilities; |
|
34 | + $this->setNodeName(CurrentUser::NODE_NAME); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @inheritDoc |
|
39 | - */ |
|
40 | - public function initialize() |
|
41 | - { |
|
42 | - $current_user = wp_get_current_user(); |
|
43 | - if (! $current_user instanceof WP_User) { |
|
44 | - $current_user = new WP_User(); |
|
45 | - } |
|
37 | + /** |
|
38 | + * @inheritDoc |
|
39 | + */ |
|
40 | + public function initialize() |
|
41 | + { |
|
42 | + $current_user = wp_get_current_user(); |
|
43 | + if (! $current_user instanceof WP_User) { |
|
44 | + $current_user = new WP_User(); |
|
45 | + } |
|
46 | 46 | |
47 | - if (class_exists(Relay::class)) { |
|
48 | - $this->addData('id', Relay::toGlobalId('user', $current_user->ID)); |
|
49 | - } |
|
50 | - $this->addData('databaseId', $current_user->ID); |
|
51 | - $this->addData('description', $current_user->description); |
|
52 | - $this->addData('email', $current_user->user_email); |
|
53 | - $this->addData('firstName', $current_user->first_name); |
|
54 | - $this->addData('isa', is_super_admin($current_user->ID)); |
|
55 | - $this->addData('lastName', $current_user->last_name); |
|
56 | - $this->addData('locale', get_user_locale($current_user->ID)); |
|
57 | - $this->addData('name', $current_user->display_name); |
|
58 | - $this->addData('nicename', $current_user->user_nicename); |
|
59 | - $this->addData('nickname', $current_user->nickname); |
|
60 | - $this->addData('username', $current_user->user_login); |
|
61 | - $this->addData('roles', $current_user->roles); |
|
62 | - $this->addData('__typename', 'User'); |
|
63 | - $this->addDataNode($this->capabilities); |
|
64 | - $this->setInitialized(true); |
|
65 | - } |
|
47 | + if (class_exists(Relay::class)) { |
|
48 | + $this->addData('id', Relay::toGlobalId('user', $current_user->ID)); |
|
49 | + } |
|
50 | + $this->addData('databaseId', $current_user->ID); |
|
51 | + $this->addData('description', $current_user->description); |
|
52 | + $this->addData('email', $current_user->user_email); |
|
53 | + $this->addData('firstName', $current_user->first_name); |
|
54 | + $this->addData('isa', is_super_admin($current_user->ID)); |
|
55 | + $this->addData('lastName', $current_user->last_name); |
|
56 | + $this->addData('locale', get_user_locale($current_user->ID)); |
|
57 | + $this->addData('name', $current_user->display_name); |
|
58 | + $this->addData('nicename', $current_user->user_nicename); |
|
59 | + $this->addData('nickname', $current_user->nickname); |
|
60 | + $this->addData('username', $current_user->user_login); |
|
61 | + $this->addData('roles', $current_user->roles); |
|
62 | + $this->addData('__typename', 'User'); |
|
63 | + $this->addDataNode($this->capabilities); |
|
64 | + $this->setInitialized(true); |
|
65 | + } |
|
66 | 66 | } |
@@ -44,27 +44,27 @@ |
||
44 | 44 | $args['PRC_name'] = sanitize_text_field($input['name']); |
45 | 45 | } |
46 | 46 | |
47 | - if (! empty($input['order'])) { |
|
47 | + if ( ! empty($input['order'])) { |
|
48 | 48 | $args['PRC_order'] = (int) $input['order']; |
49 | 49 | } |
50 | 50 | |
51 | - if (! empty($input['overrides'])) { |
|
51 | + if ( ! empty($input['overrides'])) { |
|
52 | 52 | $args['PRC_overrides'] = (int) $input['overrides']; |
53 | 53 | } |
54 | 54 | |
55 | - if (! empty($input['parent'])) { |
|
55 | + if ( ! empty($input['parent'])) { |
|
56 | 56 | $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
57 | 57 | $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
58 | 58 | } |
59 | 59 | |
60 | - if (! empty($input['priceType'])) { |
|
60 | + if ( ! empty($input['priceType'])) { |
|
61 | 61 | $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
62 | 62 | $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
63 | 63 | } |
64 | 64 | |
65 | - if (! empty($input['wpUser'])) { |
|
65 | + if ( ! empty($input['wpUser'])) { |
|
66 | 66 | $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
67 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | + $args['PRC_wp_user'] = ( ! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return apply_filters( |
@@ -12,64 +12,64 @@ |
||
12 | 12 | */ |
13 | 13 | class PriceMutation |
14 | 14 | { |
15 | - /** |
|
16 | - * Maps the GraphQL input to a format that the model functions can use |
|
17 | - * |
|
18 | - * @param array $input Data coming from the GraphQL mutation query input |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public static function prepareFields(array $input): array |
|
22 | - { |
|
23 | - $args = []; |
|
15 | + /** |
|
16 | + * Maps the GraphQL input to a format that the model functions can use |
|
17 | + * |
|
18 | + * @param array $input Data coming from the GraphQL mutation query input |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public static function prepareFields(array $input): array |
|
22 | + { |
|
23 | + $args = []; |
|
24 | 24 | |
25 | - // amount can be 0 |
|
26 | - if (array_key_exists('amount', $input)) { |
|
27 | - $args['PRC_amount'] = (float) $input['amount']; |
|
28 | - } |
|
25 | + // amount can be 0 |
|
26 | + if (array_key_exists('amount', $input)) { |
|
27 | + $args['PRC_amount'] = (float) $input['amount']; |
|
28 | + } |
|
29 | 29 | |
30 | - if (isset($input['description'])) { |
|
31 | - $args['PRC_desc'] = wp_kses_post($input['description']); |
|
32 | - } |
|
30 | + if (isset($input['description'])) { |
|
31 | + $args['PRC_desc'] = wp_kses_post($input['description']); |
|
32 | + } |
|
33 | 33 | |
34 | - if (array_key_exists('isDefault', $input)) { |
|
35 | - $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
36 | - } |
|
34 | + if (array_key_exists('isDefault', $input)) { |
|
35 | + $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
36 | + } |
|
37 | 37 | |
38 | - if (array_key_exists('isTrashed', $input)) { |
|
39 | - $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
40 | - } |
|
38 | + if (array_key_exists('isTrashed', $input)) { |
|
39 | + $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
40 | + } |
|
41 | 41 | |
42 | - if (isset($input['name'])) { |
|
43 | - $args['PRC_name'] = sanitize_text_field($input['name']); |
|
44 | - } |
|
42 | + if (isset($input['name'])) { |
|
43 | + $args['PRC_name'] = sanitize_text_field($input['name']); |
|
44 | + } |
|
45 | 45 | |
46 | - if (! empty($input['order'])) { |
|
47 | - $args['PRC_order'] = (int) $input['order']; |
|
48 | - } |
|
46 | + if (! empty($input['order'])) { |
|
47 | + $args['PRC_order'] = (int) $input['order']; |
|
48 | + } |
|
49 | 49 | |
50 | - if (! empty($input['overrides'])) { |
|
51 | - $args['PRC_overrides'] = (int) $input['overrides']; |
|
52 | - } |
|
50 | + if (! empty($input['overrides'])) { |
|
51 | + $args['PRC_overrides'] = (int) $input['overrides']; |
|
52 | + } |
|
53 | 53 | |
54 | - if (! empty($input['parent'])) { |
|
55 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
56 | - $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
57 | - } |
|
54 | + if (! empty($input['parent'])) { |
|
55 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
56 | + $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
57 | + } |
|
58 | 58 | |
59 | - if (! empty($input['priceType'])) { |
|
60 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
61 | - $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
62 | - } |
|
59 | + if (! empty($input['priceType'])) { |
|
60 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
61 | + $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
62 | + } |
|
63 | 63 | |
64 | - if (! empty($input['wpUser'])) { |
|
65 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
66 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | - } |
|
64 | + if (! empty($input['wpUser'])) { |
|
65 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
66 | + $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | + } |
|
68 | 68 | |
69 | - return apply_filters( |
|
70 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args', |
|
71 | - $args, |
|
72 | - $input |
|
73 | - ); |
|
74 | - } |
|
69 | + return apply_filters( |
|
70 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args', |
|
71 | + $args, |
|
72 | + $input |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | // $errors = []; |
42 | 42 | |
43 | 43 | try { |
44 | - if (empty($input['uniqueInputs']) || !is_array($input['uniqueInputs'])) { |
|
44 | + if (empty($input['uniqueInputs']) || ! is_array($input['uniqueInputs'])) { |
|
45 | 45 | throw new OutOfBoundsException( |
46 | 46 | esc_html__('A valid input was not provided.', 'event_espresso') |
47 | 47 | ); |
@@ -10,69 +10,69 @@ |
||
10 | 10 | class BulkEntityMutator extends EntityMutator |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * @var callable $entity_mutator . |
|
15 | - */ |
|
16 | - protected $entity_mutator; |
|
13 | + /** |
|
14 | + * @var callable $entity_mutator . |
|
15 | + */ |
|
16 | + protected $entity_mutator; |
|
17 | 17 | |
18 | - /** |
|
19 | - * BulkEntityMutator constructor. |
|
20 | - * |
|
21 | - * @param callable $entity_mutator The mutator for an entity. |
|
22 | - */ |
|
23 | - public function __construct(callable $entity_mutator) |
|
24 | - { |
|
25 | - $this->entity_mutator = $entity_mutator; |
|
26 | - } |
|
27 | - /** |
|
28 | - * Bulk updates entities. |
|
29 | - * |
|
30 | - * @param array $input The input for the mutation |
|
31 | - * @param AppContext $context The AppContext passed down to all resolvers |
|
32 | - * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function updateEntities(array $input, AppContext $context, ResolveInfo $info): array |
|
36 | - { |
|
18 | + /** |
|
19 | + * BulkEntityMutator constructor. |
|
20 | + * |
|
21 | + * @param callable $entity_mutator The mutator for an entity. |
|
22 | + */ |
|
23 | + public function __construct(callable $entity_mutator) |
|
24 | + { |
|
25 | + $this->entity_mutator = $entity_mutator; |
|
26 | + } |
|
27 | + /** |
|
28 | + * Bulk updates entities. |
|
29 | + * |
|
30 | + * @param array $input The input for the mutation |
|
31 | + * @param AppContext $context The AppContext passed down to all resolvers |
|
32 | + * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function updateEntities(array $input, AppContext $context, ResolveInfo $info): array |
|
36 | + { |
|
37 | 37 | |
38 | - $updated = []; |
|
39 | - $failed = []; |
|
40 | - // TODO Add meaningful error messages for every failure. |
|
41 | - // $errors = []; |
|
38 | + $updated = []; |
|
39 | + $failed = []; |
|
40 | + // TODO Add meaningful error messages for every failure. |
|
41 | + // $errors = []; |
|
42 | 42 | |
43 | - try { |
|
44 | - if (empty($input['uniqueInputs']) || !is_array($input['uniqueInputs'])) { |
|
45 | - throw new OutOfBoundsException( |
|
46 | - esc_html__('A valid input was not provided.', 'event_espresso') |
|
47 | - ); |
|
48 | - } |
|
43 | + try { |
|
44 | + if (empty($input['uniqueInputs']) || !is_array($input['uniqueInputs'])) { |
|
45 | + throw new OutOfBoundsException( |
|
46 | + esc_html__('A valid input was not provided.', 'event_espresso') |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - $sharedInput = ! empty($input['sharedInput']) ? $input['sharedInput'] : []; |
|
50 | + $sharedInput = ! empty($input['sharedInput']) ? $input['sharedInput'] : []; |
|
51 | 51 | |
52 | - foreach ($input['uniqueInputs'] as $uniqueInput) { |
|
53 | - try { |
|
54 | - // values in $uniqueInput will override those in $sharedInput |
|
55 | - $finalInput = array_merge($sharedInput, $uniqueInput); |
|
56 | - // mutate the individual entity. |
|
57 | - $mutator = $this->entity_mutator; |
|
58 | - $mutator($finalInput, $context, $info); |
|
59 | - // we are here it means the update was successful. |
|
60 | - $updated[] = $uniqueInput['id']; |
|
61 | - } catch (Exception $e) { |
|
62 | - // sorry mate, couldn't help you :( |
|
63 | - $failed[] = $uniqueInput['id']; |
|
64 | - } |
|
65 | - } |
|
66 | - } catch (Exception $exception) { |
|
67 | - EntityMutator::handleExceptions( |
|
68 | - $exception, |
|
69 | - esc_html__( |
|
70 | - 'Could not perform the update because of the following error(s)', |
|
71 | - 'event_espresso' |
|
72 | - ) |
|
73 | - ); |
|
74 | - } |
|
52 | + foreach ($input['uniqueInputs'] as $uniqueInput) { |
|
53 | + try { |
|
54 | + // values in $uniqueInput will override those in $sharedInput |
|
55 | + $finalInput = array_merge($sharedInput, $uniqueInput); |
|
56 | + // mutate the individual entity. |
|
57 | + $mutator = $this->entity_mutator; |
|
58 | + $mutator($finalInput, $context, $info); |
|
59 | + // we are here it means the update was successful. |
|
60 | + $updated[] = $uniqueInput['id']; |
|
61 | + } catch (Exception $e) { |
|
62 | + // sorry mate, couldn't help you :( |
|
63 | + $failed[] = $uniqueInput['id']; |
|
64 | + } |
|
65 | + } |
|
66 | + } catch (Exception $exception) { |
|
67 | + EntityMutator::handleExceptions( |
|
68 | + $exception, |
|
69 | + esc_html__( |
|
70 | + 'Could not perform the update because of the following error(s)', |
|
71 | + 'event_espresso' |
|
72 | + ) |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | - return compact('updated', 'failed'); |
|
77 | - } |
|
76 | + return compact('updated', 'failed'); |
|
77 | + } |
|
78 | 78 | } |
@@ -8,17 +8,17 @@ |
||
8 | 8 | class TicketBulkUpdate extends EntityMutator |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * Defines the mutation data modification closure. |
|
13 | - * |
|
14 | - * @param EEM_Ticket $model |
|
15 | - * @param Ticket $type |
|
16 | - * @return callable |
|
17 | - */ |
|
18 | - public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
19 | - { |
|
20 | - $entityMutator = TicketUpdate::mutateAndGetPayload($model, $type); |
|
21 | - $bulkMutator = new BulkEntityMutator($entityMutator); |
|
22 | - return array($bulkMutator, 'updateEntities'); |
|
23 | - } |
|
11 | + /** |
|
12 | + * Defines the mutation data modification closure. |
|
13 | + * |
|
14 | + * @param EEM_Ticket $model |
|
15 | + * @param Ticket $type |
|
16 | + * @return callable |
|
17 | + */ |
|
18 | + public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
|
19 | + { |
|
20 | + $entityMutator = TicketUpdate::mutateAndGetPayload($model, $type); |
|
21 | + $bulkMutator = new BulkEntityMutator($entityMutator); |
|
22 | + return array($bulkMutator, 'updateEntities'); |
|
23 | + } |
|
24 | 24 | } |
@@ -18,75 +18,75 @@ |
||
18 | 18 | */ |
19 | 19 | interface AssetManagerInterface |
20 | 20 | { |
21 | - /** |
|
22 | - * @since 4.9.71.p |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function assetNamespace(); |
|
21 | + /** |
|
22 | + * @since 4.9.71.p |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function assetNamespace(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * @since 4.9.62.p |
|
29 | - */ |
|
30 | - public function addAssets(); |
|
27 | + /** |
|
28 | + * @since 4.9.62.p |
|
29 | + */ |
|
30 | + public function addAssets(); |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @param string $handle |
|
35 | - * @param string $source |
|
36 | - * @param array $dependencies |
|
37 | - * @param bool $load_in_footer |
|
38 | - * @return JavascriptAsset |
|
39 | - * @throws DuplicateCollectionIdentifierException |
|
40 | - * @throws InvalidDataTypeException |
|
41 | - * @throws InvalidEntityException |
|
42 | - * @since 4.9.62.p |
|
43 | - */ |
|
44 | - public function addJavascript( |
|
45 | - $handle, |
|
46 | - $source, |
|
47 | - array $dependencies = array(), |
|
48 | - $load_in_footer = true |
|
49 | - ); |
|
33 | + /** |
|
34 | + * @param string $handle |
|
35 | + * @param string $source |
|
36 | + * @param array $dependencies |
|
37 | + * @param bool $load_in_footer |
|
38 | + * @return JavascriptAsset |
|
39 | + * @throws DuplicateCollectionIdentifierException |
|
40 | + * @throws InvalidDataTypeException |
|
41 | + * @throws InvalidEntityException |
|
42 | + * @since 4.9.62.p |
|
43 | + */ |
|
44 | + public function addJavascript( |
|
45 | + $handle, |
|
46 | + $source, |
|
47 | + array $dependencies = array(), |
|
48 | + $load_in_footer = true |
|
49 | + ); |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @since 4.9.71.p |
|
54 | - * @param string $handle |
|
55 | - * @param array $dependencies |
|
56 | - * @param bool $load_in_footer |
|
57 | - * @return JavascriptAsset |
|
58 | - */ |
|
59 | - public function addVendorJavascript( |
|
60 | - $handle, |
|
61 | - array $dependencies = array(), |
|
62 | - $load_in_footer = true |
|
63 | - ); |
|
52 | + /** |
|
53 | + * @since 4.9.71.p |
|
54 | + * @param string $handle |
|
55 | + * @param array $dependencies |
|
56 | + * @param bool $load_in_footer |
|
57 | + * @return JavascriptAsset |
|
58 | + */ |
|
59 | + public function addVendorJavascript( |
|
60 | + $handle, |
|
61 | + array $dependencies = array(), |
|
62 | + $load_in_footer = true |
|
63 | + ); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * @param string $handle |
|
69 | - * @param string $source |
|
70 | - * @param array $dependencies |
|
71 | - * @param string $media |
|
72 | - * @return StylesheetAsset |
|
73 | - * @throws DuplicateCollectionIdentifierException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidEntityException |
|
76 | - * @since 4.9.62.p |
|
77 | - */ |
|
78 | - public function addStylesheet( |
|
79 | - $handle, |
|
80 | - $source, |
|
81 | - array $dependencies = array(), |
|
82 | - $media = 'all' |
|
83 | - ); |
|
67 | + /** |
|
68 | + * @param string $handle |
|
69 | + * @param string $source |
|
70 | + * @param array $dependencies |
|
71 | + * @param string $media |
|
72 | + * @return StylesheetAsset |
|
73 | + * @throws DuplicateCollectionIdentifierException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidEntityException |
|
76 | + * @since 4.9.62.p |
|
77 | + */ |
|
78 | + public function addStylesheet( |
|
79 | + $handle, |
|
80 | + $source, |
|
81 | + array $dependencies = array(), |
|
82 | + $media = 'all' |
|
83 | + ); |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @param string $handle |
|
88 | - * @return bool |
|
89 | - * @since 4.9.62.p |
|
90 | - */ |
|
91 | - public function enqueueAsset($handle); |
|
86 | + /** |
|
87 | + * @param string $handle |
|
88 | + * @return bool |
|
89 | + * @since 4.9.62.p |
|
90 | + */ |
|
91 | + public function enqueueAsset($handle); |
|
92 | 92 | } |
@@ -16,32 +16,32 @@ |
||
16 | 16 | class ManifestFile extends Asset |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * Asset constructor. |
|
21 | - * |
|
22 | - * @param DomainInterface $domain |
|
23 | - * @throws InvalidDataTypeException |
|
24 | - */ |
|
25 | - public function __construct(DomainInterface $domain) |
|
26 | - { |
|
27 | - parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain); |
|
28 | - } |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * @return string |
|
33 | - */ |
|
34 | - public function urlBase() |
|
35 | - { |
|
36 | - return $this->domain->distributionAssetsUrl(); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function filepath() |
|
44 | - { |
|
45 | - return $this->domain->distributionAssetsPath(); |
|
46 | - } |
|
19 | + /** |
|
20 | + * Asset constructor. |
|
21 | + * |
|
22 | + * @param DomainInterface $domain |
|
23 | + * @throws InvalidDataTypeException |
|
24 | + */ |
|
25 | + public function __construct(DomainInterface $domain) |
|
26 | + { |
|
27 | + parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain); |
|
28 | + } |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * @return string |
|
33 | + */ |
|
34 | + public function urlBase() |
|
35 | + { |
|
36 | + return $this->domain->distributionAssetsUrl(); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function filepath() |
|
44 | + { |
|
45 | + return $this->domain->distributionAssetsPath(); |
|
46 | + } |
|
47 | 47 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | abstract class Factory implements FactoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** |
|
11 | - * @var LoaderInterface $loader |
|
12 | - */ |
|
13 | - protected $loader; |
|
10 | + /** |
|
11 | + * @var LoaderInterface $loader |
|
12 | + */ |
|
13 | + protected $loader; |
|
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * RouteFactory constructor. |
|
18 | - * |
|
19 | - * @param LoaderInterface $loader |
|
20 | - */ |
|
21 | - public function __construct(LoaderInterface $loader) |
|
22 | - { |
|
23 | - $this->loader = $loader; |
|
24 | - } |
|
16 | + /** |
|
17 | + * RouteFactory constructor. |
|
18 | + * |
|
19 | + * @param LoaderInterface $loader |
|
20 | + */ |
|
21 | + public function __construct(LoaderInterface $loader) |
|
22 | + { |
|
23 | + $this->loader = $loader; |
|
24 | + } |
|
25 | 25 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $fqcn = str_replace('\\', '_', $fqcn); |
72 | 72 | return $fqcn === $object_identifier |
73 | - || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0; |
|
73 | + || strpos($object_identifier, $fqcn.ObjectIdentifier::DELIMITER) === 0; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | ) |
91 | 91 | ? $this->getIdentifierForArguments($arguments) |
92 | 92 | : ''; |
93 | - if (! empty($identifier)) { |
|
94 | - $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier); |
|
93 | + if ( ! empty($identifier)) { |
|
94 | + $fqcn .= ObjectIdentifier::DELIMITER.md5($identifier); |
|
95 | 95 | } |
96 | 96 | $fqcn = str_replace('\\', '_', $fqcn); |
97 | 97 | return $fqcn; |
@@ -15,119 +15,119 @@ |
||
15 | 15 | */ |
16 | 16 | class ObjectIdentifier |
17 | 17 | { |
18 | - /** |
|
19 | - * used to separate the FQCN from the class's arguments identifier |
|
20 | - */ |
|
21 | - const DELIMITER = '____'; |
|
18 | + /** |
|
19 | + * used to separate the FQCN from the class's arguments identifier |
|
20 | + */ |
|
21 | + const DELIMITER = '____'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @var ClassInterfaceCache $class_cache |
|
25 | - */ |
|
26 | - private $class_cache; |
|
23 | + /** |
|
24 | + * @var ClassInterfaceCache $class_cache |
|
25 | + */ |
|
26 | + private $class_cache; |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * ObjectIdentifier constructor. |
|
31 | - * |
|
32 | - * @param ClassInterfaceCache $class_cache |
|
33 | - */ |
|
34 | - public function __construct(ClassInterfaceCache $class_cache) |
|
35 | - { |
|
36 | - $this->class_cache = $class_cache; |
|
37 | - } |
|
29 | + /** |
|
30 | + * ObjectIdentifier constructor. |
|
31 | + * |
|
32 | + * @param ClassInterfaceCache $class_cache |
|
33 | + */ |
|
34 | + public function __construct(ClassInterfaceCache $class_cache) |
|
35 | + { |
|
36 | + $this->class_cache = $class_cache; |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * Returns true if the supplied $object_identifier contains |
|
42 | - * the delimiter used to separate an fqcn from the arguments hash |
|
43 | - * |
|
44 | - * @param string $object_identifier |
|
45 | - * @return bool |
|
46 | - */ |
|
47 | - public function hasArguments($object_identifier) |
|
48 | - { |
|
49 | - // type casting to bool instead of using strpos() !== false |
|
50 | - // because an object identifier should never begin with the delimiter |
|
51 | - // therefore the delimiter should NOT be found at position 0 |
|
52 | - return (bool) strpos($object_identifier, ObjectIdentifier::DELIMITER); |
|
53 | - } |
|
40 | + /** |
|
41 | + * Returns true if the supplied $object_identifier contains |
|
42 | + * the delimiter used to separate an fqcn from the arguments hash |
|
43 | + * |
|
44 | + * @param string $object_identifier |
|
45 | + * @return bool |
|
46 | + */ |
|
47 | + public function hasArguments($object_identifier) |
|
48 | + { |
|
49 | + // type casting to bool instead of using strpos() !== false |
|
50 | + // because an object identifier should never begin with the delimiter |
|
51 | + // therefore the delimiter should NOT be found at position 0 |
|
52 | + return (bool) strpos($object_identifier, ObjectIdentifier::DELIMITER); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Returns true if the supplied FQCN equals the supplied $object_identifier |
|
58 | - * OR the supplied FQCN matches the FQCN portion of the supplied $object_identifier |
|
59 | - * AND that $object_identifier is for an object with arguments. |
|
60 | - * This allows a request for an object using a FQCN to match |
|
61 | - * a previously instantiated object with arguments |
|
62 | - * without having to know those arguments. |
|
63 | - * |
|
64 | - * @param string $fqcn |
|
65 | - * @param string $object_identifier |
|
66 | - * @return bool |
|
67 | - */ |
|
68 | - public function fqcnMatchesObjectIdentifier($fqcn, $object_identifier) |
|
69 | - { |
|
70 | - $fqcn = str_replace('\\', '_', $fqcn); |
|
71 | - return $fqcn === $object_identifier |
|
72 | - || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0; |
|
73 | - } |
|
56 | + /** |
|
57 | + * Returns true if the supplied FQCN equals the supplied $object_identifier |
|
58 | + * OR the supplied FQCN matches the FQCN portion of the supplied $object_identifier |
|
59 | + * AND that $object_identifier is for an object with arguments. |
|
60 | + * This allows a request for an object using a FQCN to match |
|
61 | + * a previously instantiated object with arguments |
|
62 | + * without having to know those arguments. |
|
63 | + * |
|
64 | + * @param string $fqcn |
|
65 | + * @param string $object_identifier |
|
66 | + * @return bool |
|
67 | + */ |
|
68 | + public function fqcnMatchesObjectIdentifier($fqcn, $object_identifier) |
|
69 | + { |
|
70 | + $fqcn = str_replace('\\', '_', $fqcn); |
|
71 | + return $fqcn === $object_identifier |
|
72 | + || strpos($object_identifier, $fqcn . ObjectIdentifier::DELIMITER) === 0; |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * build a string representation of an object's FQCN and arguments |
|
78 | - * |
|
79 | - * @param string $fqcn |
|
80 | - * @param array $arguments |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function getIdentifier($fqcn, array $arguments = array()) |
|
84 | - { |
|
85 | - // only build identifier from arguments if class is not ReservedInstanceInterface |
|
86 | - $identifier = ! $this->class_cache->hasInterface( |
|
87 | - $fqcn, |
|
88 | - 'EventEspresso\core\interfaces\ReservedInstanceInterface' |
|
89 | - ) |
|
90 | - ? $this->getIdentifierForArguments($arguments) |
|
91 | - : ''; |
|
92 | - if (! empty($identifier)) { |
|
93 | - $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier); |
|
94 | - } |
|
95 | - $fqcn = str_replace('\\', '_', $fqcn); |
|
96 | - return $fqcn; |
|
97 | - } |
|
76 | + /** |
|
77 | + * build a string representation of an object's FQCN and arguments |
|
78 | + * |
|
79 | + * @param string $fqcn |
|
80 | + * @param array $arguments |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function getIdentifier($fqcn, array $arguments = array()) |
|
84 | + { |
|
85 | + // only build identifier from arguments if class is not ReservedInstanceInterface |
|
86 | + $identifier = ! $this->class_cache->hasInterface( |
|
87 | + $fqcn, |
|
88 | + 'EventEspresso\core\interfaces\ReservedInstanceInterface' |
|
89 | + ) |
|
90 | + ? $this->getIdentifierForArguments($arguments) |
|
91 | + : ''; |
|
92 | + if (! empty($identifier)) { |
|
93 | + $fqcn .= ObjectIdentifier::DELIMITER . md5($identifier); |
|
94 | + } |
|
95 | + $fqcn = str_replace('\\', '_', $fqcn); |
|
96 | + return $fqcn; |
|
97 | + } |
|
98 | 98 | |
99 | 99 | |
100 | - /** |
|
101 | - * build a string representation of a object's arguments |
|
102 | - * (mostly because Closures can't be serialized) |
|
103 | - * |
|
104 | - * @param array $arguments |
|
105 | - * @return string |
|
106 | - */ |
|
107 | - protected function getIdentifierForArguments(array $arguments) |
|
108 | - { |
|
109 | - if (empty($arguments)) { |
|
110 | - return ''; |
|
111 | - } |
|
112 | - $identifier = ''; |
|
113 | - foreach ($arguments as $key => $argument) { |
|
114 | - // don't include arguments used to assist with loading legacy classes |
|
115 | - if (is_string($key) && strpos($key, 'EE_Registry::create') === 0) { |
|
116 | - continue; |
|
117 | - } |
|
118 | - switch (true) { |
|
119 | - case is_object($argument): |
|
120 | - case $argument instanceof Closure: |
|
121 | - $identifier .= spl_object_hash($argument); |
|
122 | - break; |
|
123 | - case is_array($argument): |
|
124 | - $identifier .= $this->getIdentifierForArguments($argument); |
|
125 | - break; |
|
126 | - default: |
|
127 | - $identifier .= $argument; |
|
128 | - break; |
|
129 | - } |
|
130 | - } |
|
131 | - return $identifier; |
|
132 | - } |
|
100 | + /** |
|
101 | + * build a string representation of a object's arguments |
|
102 | + * (mostly because Closures can't be serialized) |
|
103 | + * |
|
104 | + * @param array $arguments |
|
105 | + * @return string |
|
106 | + */ |
|
107 | + protected function getIdentifierForArguments(array $arguments) |
|
108 | + { |
|
109 | + if (empty($arguments)) { |
|
110 | + return ''; |
|
111 | + } |
|
112 | + $identifier = ''; |
|
113 | + foreach ($arguments as $key => $argument) { |
|
114 | + // don't include arguments used to assist with loading legacy classes |
|
115 | + if (is_string($key) && strpos($key, 'EE_Registry::create') === 0) { |
|
116 | + continue; |
|
117 | + } |
|
118 | + switch (true) { |
|
119 | + case is_object($argument): |
|
120 | + case $argument instanceof Closure: |
|
121 | + $identifier .= spl_object_hash($argument); |
|
122 | + break; |
|
123 | + case is_array($argument): |
|
124 | + $identifier .= $this->getIdentifierForArguments($argument); |
|
125 | + break; |
|
126 | + default: |
|
127 | + $identifier .= $argument; |
|
128 | + break; |
|
129 | + } |
|
130 | + } |
|
131 | + return $identifier; |
|
132 | + } |
|
133 | 133 | } |