Completed
Branch dev (08e10f)
by
unknown
12:20 queued 10:12
created
core/services/graphql/resolvers/ResolverInterface.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@
 block discarded – undo
16 16
 interface ResolverInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @param             $source
21
-     * @param array       $args
22
-     * @param AppContext  $context
23
-     * @param ResolveInfo $info
24
-     * @return mixed
25
-     * @since $VID:$
26
-     */
27
-    public function resolve($source, array $args, AppContext $context, ResolveInfo $info);
19
+	/**
20
+	 * @param             $source
21
+	 * @param array       $args
22
+	 * @param AppContext  $context
23
+	 * @param ResolveInfo $info
24
+	 * @return mixed
25
+	 * @since $VID:$
26
+	 */
27
+	public function resolve($source, array $args, AppContext $context, ResolveInfo $info);
28 28
 }
Please login to merge, or discard this patch.
core/services/graphql/TypesManager.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
             $config = $field->toArray();
76 76
             if ($field->useForInput()) {
77 77
                 // Register input fields for existing mutations.
78
-                register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
79
-                register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
78
+                register_graphql_field('Update'.$typeName.'Input', $fieldName, $config);
79
+                register_graphql_field('Create'.$typeName.'Input', $fieldName, $config);
80 80
             }
81 81
             if ($field->useForOutput()) {
82 82
                 $config['resolve'] = [$type, 'resolveField'];
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
             $fieldName = $field->name();
103 103
             $config = $field->toArray();
104 104
             if ($field->useForInput()) {
105
-                $inputFields[ $fieldName ] = $config;
105
+                $inputFields[$fieldName] = $config;
106 106
             }
107 107
             if ($field->useForOutput()) {
108 108
                 $config['resolve'] = [$type, 'resolveField'];
109
-                $outputFields[ $fieldName ] = $config;
109
+                $outputFields[$fieldName] = $config;
110 110
             }
111 111
         }
112 112
         $typeName = $type->name();
113
-        if (! empty($outputFields)) {
113
+        if ( ! empty($outputFields)) {
114 114
             // Register the object type.
115 115
             register_graphql_object_type(
116 116
                 $typeName,
Please login to merge, or discard this patch.
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -18,110 +18,110 @@
 block discarded – undo
18 18
 class TypesManager implements GQLManagerInterface
19 19
 {
20 20
 
21
-    /**
22
-     * @var TypeCollection|TypeInterface[] $types
23
-     */
24
-    private $types;
21
+	/**
22
+	 * @var TypeCollection|TypeInterface[] $types
23
+	 */
24
+	private $types;
25 25
 
26 26
 
27
-    /**
28
-     * TypesManager constructor.
29
-     *
30
-     * @param TypeCollection|TypeInterface[] $types
31
-     */
32
-    public function __construct(TypeCollection $types)
33
-    {
34
-        $this->types = $types;
35
-    }
27
+	/**
28
+	 * TypesManager constructor.
29
+	 *
30
+	 * @param TypeCollection|TypeInterface[] $types
31
+	 */
32
+	public function __construct(TypeCollection $types)
33
+	{
34
+		$this->types = $types;
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @throws CollectionDetailsException
40
-     * @throws CollectionLoaderException
41
-     * @since $VID:$
42
-     */
43
-    public function init()
44
-    {
45
-        $this->types->loadTypes();
46
-        add_action('graphql_register_types', [$this, 'configureTypes'], 10);
47
-    }
38
+	/**
39
+	 * @throws CollectionDetailsException
40
+	 * @throws CollectionLoaderException
41
+	 * @since $VID:$
42
+	 */
43
+	public function init()
44
+	{
45
+		$this->types->loadTypes();
46
+		add_action('graphql_register_types', [$this, 'configureTypes'], 10);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @since $VID:$
52
-     */
53
-    public function configureTypes()
54
-    {
55
-        // loop through the collection of types and register their fields
56
-        foreach ($this->types as $type) {
57
-            if ($type->isCustomPostType()) {
58
-                $this->extendCustomPostType($type);
59
-            } else {
60
-                $this->registerType($type);
61
-            }
62
-        }
63
-    }
50
+	/**
51
+	 * @since $VID:$
52
+	 */
53
+	public function configureTypes()
54
+	{
55
+		// loop through the collection of types and register their fields
56
+		foreach ($this->types as $type) {
57
+			if ($type->isCustomPostType()) {
58
+				$this->extendCustomPostType($type);
59
+			} else {
60
+				$this->registerType($type);
61
+			}
62
+		}
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * @param TypeInterface $type
68
-     * @since $VID:$
69
-     */
70
-    public function extendCustomPostType(TypeInterface $type)
71
-    {
72
-        $typeName = $type->name();
73
-        foreach ($type->fields() as $field) {
74
-            $fieldName = $field->name();
75
-            $config = $field->toArray();
76
-            if ($field->useForInput()) {
77
-                // Register input fields for existing mutations.
78
-                register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
79
-                register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
80
-            }
81
-            if ($field->useForOutput()) {
82
-                $config['resolve'] = [$type, 'resolveField'];
83
-                // Register fields for queries.
84
-                register_graphql_field($typeName, $fieldName, $config);
85
-            }
86
-        }
87
-        if (is_callable([$type, 'extendMutations'])) {
88
-            $type->extendMutations();
89
-        }
90
-    }
66
+	/**
67
+	 * @param TypeInterface $type
68
+	 * @since $VID:$
69
+	 */
70
+	public function extendCustomPostType(TypeInterface $type)
71
+	{
72
+		$typeName = $type->name();
73
+		foreach ($type->fields() as $field) {
74
+			$fieldName = $field->name();
75
+			$config = $field->toArray();
76
+			if ($field->useForInput()) {
77
+				// Register input fields for existing mutations.
78
+				register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
79
+				register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
80
+			}
81
+			if ($field->useForOutput()) {
82
+				$config['resolve'] = [$type, 'resolveField'];
83
+				// Register fields for queries.
84
+				register_graphql_field($typeName, $fieldName, $config);
85
+			}
86
+		}
87
+		if (is_callable([$type, 'extendMutations'])) {
88
+			$type->extendMutations();
89
+		}
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * @param TypeInterface $type
95
-     * @since $VID:$
96
-     */
97
-    public function registerType(TypeInterface $type)
98
-    {
99
-        $outputFields = [];
100
-        $inputFields = [];
101
-        foreach ($type->fields() as $field) {
102
-            $fieldName = $field->name();
103
-            $config = $field->toArray();
104
-            if ($field->useForInput()) {
105
-                $inputFields[ $fieldName ] = $config;
106
-            }
107
-            if ($field->useForOutput()) {
108
-                $config['resolve'] = [$type, 'resolveField'];
109
-                $outputFields[ $fieldName ] = $config;
110
-            }
111
-        }
112
-        $typeName = $type->name();
113
-        if (! empty($outputFields)) {
114
-            // Register the object type.
115
-            register_graphql_object_type(
116
-                $typeName,
117
-                [
118
-                    'description' => $type->description(),
119
-                    'fields'      => $outputFields,
120
-                ]
121
-            );
122
-        }
123
-        if (is_callable([$type, 'registerMutations'])) {
124
-            $type->registerMutations($inputFields);
125
-        }
126
-    }
93
+	/**
94
+	 * @param TypeInterface $type
95
+	 * @since $VID:$
96
+	 */
97
+	public function registerType(TypeInterface $type)
98
+	{
99
+		$outputFields = [];
100
+		$inputFields = [];
101
+		foreach ($type->fields() as $field) {
102
+			$fieldName = $field->name();
103
+			$config = $field->toArray();
104
+			if ($field->useForInput()) {
105
+				$inputFields[ $fieldName ] = $config;
106
+			}
107
+			if ($field->useForOutput()) {
108
+				$config['resolve'] = [$type, 'resolveField'];
109
+				$outputFields[ $fieldName ] = $config;
110
+			}
111
+		}
112
+		$typeName = $type->name();
113
+		if (! empty($outputFields)) {
114
+			// Register the object type.
115
+			register_graphql_object_type(
116
+				$typeName,
117
+				[
118
+					'description' => $type->description(),
119
+					'fields'      => $outputFields,
120
+				]
121
+			);
122
+		}
123
+		if (is_callable([$type, 'registerMutations'])) {
124
+			$type->registerMutations($inputFields);
125
+		}
126
+	}
127 127
 }
Please login to merge, or discard this patch.
core/services/graphql/types/TypeBase.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
         $fields = [];
156 156
         foreach ($this->fields() as $field) {
157 157
             if ($field->useForOutput()) {
158
-                $fields[ $field->name() ] = $field;
158
+                $fields[$field->name()] = $field;
159 159
             }
160 160
         }
161 161
         return $fields;
Please login to merge, or discard this patch.
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -35,270 +35,270 @@
 block discarded – undo
35 35
 abstract class TypeBase implements TypeInterface
36 36
 {
37 37
 
38
-    /**
39
-     * @var string $namespace The graphql namespace/prefix.
40
-     */
41
-    protected $namespace = 'Espresso';
42
-
43
-    /**
44
-     * @var EEM_Base $model
45
-     */
46
-    protected $model;
47
-
48
-    /**
49
-     * @var string $name
50
-     */
51
-    protected $name = '';
52
-
53
-    /**
54
-     * @var string $description
55
-     */
56
-    protected $description = '';
57
-
58
-    /**
59
-     * @var GraphQLFieldInterface[] $fields
60
-     */
61
-    protected $fields = [];
62
-
63
-    /**
64
-     * @var array $graphql_to_model_map
65
-     */
66
-    protected $graphql_to_model_map = [];
67
-
68
-    /**
69
-     * @var FieldResolver $field_resolver
70
-     */
71
-    protected $field_resolver;
72
-
73
-    /**
74
-     * @var bool $is_custom_post_type
75
-     */
76
-    protected $is_custom_post_type = false;
77
-
78
-
79
-    /**
80
-     * TypeBase constructor.
81
-     *
82
-     * @param EEM_Base|null $model
83
-     */
84
-    public function __construct(EEM_Base $model = null)
85
-    {
86
-        $this->model = $model;
87
-        $this->setFields($this->getFields());
88
-        $this->field_resolver = new FieldResolver(
89
-            $this->model,
90
-            $this->getFieldsForResolver()
91
-        );
92
-    }
93
-
94
-
95
-    /**
96
-     * @return GraphQLFieldInterface[]
97
-     * @since $VID:$
98
-     */
99
-    abstract protected function getFields(): array;
100
-
101
-
102
-    /**
103
-     * @return string
104
-     */
105
-    public function name(): string
106
-    {
107
-        return $this->name;
108
-    }
109
-
110
-
111
-    /**
112
-     * @param string $name
113
-     */
114
-    protected function setName(string $name)
115
-    {
116
-        $this->name = $name;
117
-    }
118
-
119
-
120
-    /**
121
-     * @return string
122
-     */
123
-    public function description(): string
124
-    {
125
-        return $this->description;
126
-    }
127
-
128
-
129
-    /**
130
-     * @param string $description
131
-     */
132
-    protected function setDescription(string $description)
133
-    {
134
-        $this->description = $description;
135
-    }
136
-
137
-
138
-    /**
139
-     * @return GraphQLFieldInterface[]
140
-     * @since $VID:$
141
-     */
142
-    public function fields(): array
143
-    {
144
-        return (array) $this->fields;
145
-    }
146
-
147
-
148
-    /**
149
-     * @param GraphQLFieldInterface[] $fields
150
-     */
151
-    protected function setFields(array $fields)
152
-    {
153
-        foreach ($fields as $field) {
154
-            if ($field instanceof GraphQLField) {
155
-                $this->fields[] = $field;
156
-            }
157
-        }
158
-    }
159
-
160
-
161
-    /**
162
-     * Creates a key map for internal resolver.
163
-     *
164
-     * @return array
165
-     * @since $VID:$
166
-     */
167
-    public function getFieldsForResolver(): array
168
-    {
169
-        $fields = [];
170
-        foreach ($this->fields() as $field) {
171
-            if ($field->useForOutput()) {
172
-                $fields[ $field->name() ] = $field;
173
-            }
174
-        }
175
-        return $fields;
176
-    }
177
-
178
-
179
-    /**
180
-     * @return bool
181
-     */
182
-    public function isCustomPostType(): bool
183
-    {
184
-        return $this->is_custom_post_type;
185
-    }
186
-
187
-
188
-    /**
189
-     * @param bool $is_custom_post_type
190
-     */
191
-    protected function setIsCustomPostType(bool $is_custom_post_type)
192
-    {
193
-        $this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN);
194
-    }
195
-
196
-
197
-    /**
198
-     * @param int|float $value
199
-     * @return int
200
-     * @since $VID:$
201
-     */
202
-    public function parseInfiniteValue($value): int
203
-    {
204
-        $value = trim($value);
205
-        return $value === null
206
-               || $value === ''
207
-               || $value === '∞'
208
-               || $value === 'INF'
209
-               || $value === INF
210
-               || $value === EE_INF
211
-               || is_infinite((float) $value)
212
-            ? -1
213
-            : $value;
214
-    }
215
-
216
-
217
-    /**
218
-     * @param mixed $source
219
-     * @return EE_Base_Class|null
220
-     * @throws EE_Error
221
-     */
222
-    private function getModel($source): ?EE_Base_Class
223
-    {
224
-        // If it comes from a custom connection
225
-        // where the $source is already instantiated.
226
-        if ($source instanceof EE_Base_Class) {
227
-            return $source;
228
-        }
229
-        return $source instanceof Post ? $this->model->get_one_by_ID($source->ID) : null;
230
-    }
231
-
232
-
233
-    /**
234
-     * @param mixed       $source  The source that's passed down the GraphQL queries
235
-     * @param array       $args    The inputArgs on the field
236
-     * @param AppContext  $context The AppContext passed down the GraphQL tree
237
-     * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
238
-     * @return EE_Base_Class|Deferred|string|null
239
-     * @throws EE_Error
240
-     * @throws InvalidDataTypeException
241
-     * @throws InvalidInterfaceException
242
-     * @throws UnexpectedEntityException
243
-     * @throws UserError
244
-     * @throws InvalidArgumentException
245
-     * @throws ReflectionException
246
-     * @since $VID:$
247
-     */
248
-    public function resolveField($source, array $args, AppContext $context, ResolveInfo $info)
249
-    {
250
-        $source = $source instanceof RootQuery ? $source : $this->getModel($source);
251
-
252
-        return $this->field_resolver->resolve($source, $args, $context, $info);
253
-    }
254
-
255
-
256
-    /**
257
-     * @param mixed      $payload The payload returned after mutation
258
-     * @param array      $args    The inputArgs on the field
259
-     * @param AppContext $context The AppContext passed down the GraphQL tree
260
-     * @return EE_Base_Class|EE_Soft_Delete_Base_Class|null
261
-     * @throws EE_Error
262
-     */
263
-    public function resolveFromPayload($payload, array $args, AppContext $context)
264
-    {
265
-        if (empty($payload['id'])) {
266
-            return null;
267
-        }
268
-        return $this->model->get_one_by_ID($payload['id']);
269
-    }
270
-
271
-
272
-    /**
273
-     * Prepares a datetime value in ISO8601/RFC3339 format.
274
-     * It is assumed that the value of $datetime is in the format
275
-     * returned by EE_Base_Class::get_format().
276
-     *
277
-     * @param string        $datetime The datetime value.
278
-     * @param EE_Base_Class $source   The source object.
279
-     * @return string ISO8601/RFC3339 formatted datetime.
280
-     */
281
-    public function formatDatetime(string $datetime, EE_Base_Class $source): string
282
-    {
283
-        $format   = $source->get_format();
284
-        // create date object based on local timezone
285
-        $datetime = DateTime::createFromFormat($format, $datetime, new DateTimeZone($source->get_timezone()));
286
-        // change the timezone to UTC
287
-        $datetime->setTimezone(new DateTimeZone('UTC'));
288
-
289
-        return $datetime->format(DateTime::RFC3339);
290
-    }
291
-
292
-
293
-    /**
294
-     * Converts an object to JSON. The object must have a "toJson" method.
295
-     *
296
-     * @param string        $object   The object/value.
297
-     * @param EE_Base_Class $source   The source object.
298
-     * @return string JSON representation of the object.
299
-     */
300
-    public function toJson(JsonableInterface $object, EE_Base_Class $source): string
301
-    {
302
-        return $object->toJson();
303
-    }
38
+	/**
39
+	 * @var string $namespace The graphql namespace/prefix.
40
+	 */
41
+	protected $namespace = 'Espresso';
42
+
43
+	/**
44
+	 * @var EEM_Base $model
45
+	 */
46
+	protected $model;
47
+
48
+	/**
49
+	 * @var string $name
50
+	 */
51
+	protected $name = '';
52
+
53
+	/**
54
+	 * @var string $description
55
+	 */
56
+	protected $description = '';
57
+
58
+	/**
59
+	 * @var GraphQLFieldInterface[] $fields
60
+	 */
61
+	protected $fields = [];
62
+
63
+	/**
64
+	 * @var array $graphql_to_model_map
65
+	 */
66
+	protected $graphql_to_model_map = [];
67
+
68
+	/**
69
+	 * @var FieldResolver $field_resolver
70
+	 */
71
+	protected $field_resolver;
72
+
73
+	/**
74
+	 * @var bool $is_custom_post_type
75
+	 */
76
+	protected $is_custom_post_type = false;
77
+
78
+
79
+	/**
80
+	 * TypeBase constructor.
81
+	 *
82
+	 * @param EEM_Base|null $model
83
+	 */
84
+	public function __construct(EEM_Base $model = null)
85
+	{
86
+		$this->model = $model;
87
+		$this->setFields($this->getFields());
88
+		$this->field_resolver = new FieldResolver(
89
+			$this->model,
90
+			$this->getFieldsForResolver()
91
+		);
92
+	}
93
+
94
+
95
+	/**
96
+	 * @return GraphQLFieldInterface[]
97
+	 * @since $VID:$
98
+	 */
99
+	abstract protected function getFields(): array;
100
+
101
+
102
+	/**
103
+	 * @return string
104
+	 */
105
+	public function name(): string
106
+	{
107
+		return $this->name;
108
+	}
109
+
110
+
111
+	/**
112
+	 * @param string $name
113
+	 */
114
+	protected function setName(string $name)
115
+	{
116
+		$this->name = $name;
117
+	}
118
+
119
+
120
+	/**
121
+	 * @return string
122
+	 */
123
+	public function description(): string
124
+	{
125
+		return $this->description;
126
+	}
127
+
128
+
129
+	/**
130
+	 * @param string $description
131
+	 */
132
+	protected function setDescription(string $description)
133
+	{
134
+		$this->description = $description;
135
+	}
136
+
137
+
138
+	/**
139
+	 * @return GraphQLFieldInterface[]
140
+	 * @since $VID:$
141
+	 */
142
+	public function fields(): array
143
+	{
144
+		return (array) $this->fields;
145
+	}
146
+
147
+
148
+	/**
149
+	 * @param GraphQLFieldInterface[] $fields
150
+	 */
151
+	protected function setFields(array $fields)
152
+	{
153
+		foreach ($fields as $field) {
154
+			if ($field instanceof GraphQLField) {
155
+				$this->fields[] = $field;
156
+			}
157
+		}
158
+	}
159
+
160
+
161
+	/**
162
+	 * Creates a key map for internal resolver.
163
+	 *
164
+	 * @return array
165
+	 * @since $VID:$
166
+	 */
167
+	public function getFieldsForResolver(): array
168
+	{
169
+		$fields = [];
170
+		foreach ($this->fields() as $field) {
171
+			if ($field->useForOutput()) {
172
+				$fields[ $field->name() ] = $field;
173
+			}
174
+		}
175
+		return $fields;
176
+	}
177
+
178
+
179
+	/**
180
+	 * @return bool
181
+	 */
182
+	public function isCustomPostType(): bool
183
+	{
184
+		return $this->is_custom_post_type;
185
+	}
186
+
187
+
188
+	/**
189
+	 * @param bool $is_custom_post_type
190
+	 */
191
+	protected function setIsCustomPostType(bool $is_custom_post_type)
192
+	{
193
+		$this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN);
194
+	}
195
+
196
+
197
+	/**
198
+	 * @param int|float $value
199
+	 * @return int
200
+	 * @since $VID:$
201
+	 */
202
+	public function parseInfiniteValue($value): int
203
+	{
204
+		$value = trim($value);
205
+		return $value === null
206
+			   || $value === ''
207
+			   || $value === '∞'
208
+			   || $value === 'INF'
209
+			   || $value === INF
210
+			   || $value === EE_INF
211
+			   || is_infinite((float) $value)
212
+			? -1
213
+			: $value;
214
+	}
215
+
216
+
217
+	/**
218
+	 * @param mixed $source
219
+	 * @return EE_Base_Class|null
220
+	 * @throws EE_Error
221
+	 */
222
+	private function getModel($source): ?EE_Base_Class
223
+	{
224
+		// If it comes from a custom connection
225
+		// where the $source is already instantiated.
226
+		if ($source instanceof EE_Base_Class) {
227
+			return $source;
228
+		}
229
+		return $source instanceof Post ? $this->model->get_one_by_ID($source->ID) : null;
230
+	}
231
+
232
+
233
+	/**
234
+	 * @param mixed       $source  The source that's passed down the GraphQL queries
235
+	 * @param array       $args    The inputArgs on the field
236
+	 * @param AppContext  $context The AppContext passed down the GraphQL tree
237
+	 * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
238
+	 * @return EE_Base_Class|Deferred|string|null
239
+	 * @throws EE_Error
240
+	 * @throws InvalidDataTypeException
241
+	 * @throws InvalidInterfaceException
242
+	 * @throws UnexpectedEntityException
243
+	 * @throws UserError
244
+	 * @throws InvalidArgumentException
245
+	 * @throws ReflectionException
246
+	 * @since $VID:$
247
+	 */
248
+	public function resolveField($source, array $args, AppContext $context, ResolveInfo $info)
249
+	{
250
+		$source = $source instanceof RootQuery ? $source : $this->getModel($source);
251
+
252
+		return $this->field_resolver->resolve($source, $args, $context, $info);
253
+	}
254
+
255
+
256
+	/**
257
+	 * @param mixed      $payload The payload returned after mutation
258
+	 * @param array      $args    The inputArgs on the field
259
+	 * @param AppContext $context The AppContext passed down the GraphQL tree
260
+	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class|null
261
+	 * @throws EE_Error
262
+	 */
263
+	public function resolveFromPayload($payload, array $args, AppContext $context)
264
+	{
265
+		if (empty($payload['id'])) {
266
+			return null;
267
+		}
268
+		return $this->model->get_one_by_ID($payload['id']);
269
+	}
270
+
271
+
272
+	/**
273
+	 * Prepares a datetime value in ISO8601/RFC3339 format.
274
+	 * It is assumed that the value of $datetime is in the format
275
+	 * returned by EE_Base_Class::get_format().
276
+	 *
277
+	 * @param string        $datetime The datetime value.
278
+	 * @param EE_Base_Class $source   The source object.
279
+	 * @return string ISO8601/RFC3339 formatted datetime.
280
+	 */
281
+	public function formatDatetime(string $datetime, EE_Base_Class $source): string
282
+	{
283
+		$format   = $source->get_format();
284
+		// create date object based on local timezone
285
+		$datetime = DateTime::createFromFormat($format, $datetime, new DateTimeZone($source->get_timezone()));
286
+		// change the timezone to UTC
287
+		$datetime->setTimezone(new DateTimeZone('UTC'));
288
+
289
+		return $datetime->format(DateTime::RFC3339);
290
+	}
291
+
292
+
293
+	/**
294
+	 * Converts an object to JSON. The object must have a "toJson" method.
295
+	 *
296
+	 * @param string        $object   The object/value.
297
+	 * @param EE_Base_Class $source   The source object.
298
+	 * @return string JSON representation of the object.
299
+	 */
300
+	public function toJson(JsonableInterface $object, EE_Base_Class $source): string
301
+	{
302
+		return $object->toJson();
303
+	}
304 304
 }
Please login to merge, or discard this patch.
core/services/graphql/fields/GraphQLInputField.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,30 +11,30 @@
 block discarded – undo
11 11
 class GraphQLInputField extends GraphQLField
12 12
 {
13 13
 
14
-    /**
15
-     * @param string          $name
16
-     * @param string|string[] $type
17
-     * @param string|null     $key
18
-     * @param string          $description
19
-     * @param array           $caps
20
-     */
21
-    public function __construct(
22
-        $name,
23
-        $type,
24
-        $key = null,
25
-        $description = '',
26
-        array $caps = []
27
-    ) {
28
-        parent::__construct(
29
-            $name,
30
-            $type,
31
-            $key,
32
-            $description,
33
-            null,
34
-            null,
35
-            $caps
36
-        );
14
+	/**
15
+	 * @param string          $name
16
+	 * @param string|string[] $type
17
+	 * @param string|null     $key
18
+	 * @param string          $description
19
+	 * @param array           $caps
20
+	 */
21
+	public function __construct(
22
+		$name,
23
+		$type,
24
+		$key = null,
25
+		$description = '',
26
+		array $caps = []
27
+	) {
28
+		parent::__construct(
29
+			$name,
30
+			$type,
31
+			$key,
32
+			$description,
33
+			null,
34
+			null,
35
+			$caps
36
+		);
37 37
 
38
-        $this->setUseForOutput(false);
39
-    }
38
+		$this->setUseForOutput(false);
39
+	}
40 40
 }
Please login to merge, or discard this patch.
core/domain/services/converters/spoofers/RestApiSpoofer.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -28,58 +28,58 @@
 block discarded – undo
28 28
 class RestApiSpoofer
29 29
 {
30 30
 
31
-    /**
32
-     * @var Read
33
-     */
34
-    protected $rest_api;
31
+	/**
32
+	 * @var Read
33
+	 */
34
+	protected $rest_api;
35 35
 
36 36
 
37
-    /**
38
-     * RestApiSpoofer constructor.
39
-     *
40
-     * @param Read     $rest_api
41
-     * @param string   $api_version
42
-     */
43
-    public function __construct(Read $rest_api, $api_version = '4.8.36')
44
-    {
45
-        $this->rest_api = $rest_api;
46
-        $this->rest_api->setRequestedVersion($api_version);
47
-    }
37
+	/**
38
+	 * RestApiSpoofer constructor.
39
+	 *
40
+	 * @param Read     $rest_api
41
+	 * @param string   $api_version
42
+	 */
43
+	public function __construct(Read $rest_api, $api_version = '4.8.36')
44
+	{
45
+		$this->rest_api = $rest_api;
46
+		$this->rest_api->setRequestedVersion($api_version);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @param EEM_Base $model
52
-     * @param array    $query_params
53
-     * @param string   $include
54
-     * @return array
55
-     * @throws EE_Error
56
-     * @throws InvalidArgumentException
57
-     * @throws InvalidDataTypeException
58
-     * @throws InvalidInterfaceException
59
-     * @throws ModelConfigurationException
60
-     * @throws ReflectionException
61
-     * @throws RestException
62
-     * @throws RestPasswordIncorrectException
63
-     * @throws RestPasswordRequiredException
64
-     * @throws UnexpectedEntityException
65
-     * @throws DomainException
66
-     * @since $VID:$
67
-     */
68
-    public function getApiResults(EEM_Base $model, array $query_params, $include = '')
69
-    {
70
-        /** @type array $results */
71
-        $results = $model->get_all_wpdb_results($query_params);
72
-        $rest_request = new WP_REST_Request();
73
-        $rest_request->set_param('include', $include);
74
-        $rest_request->set_param('caps', 'edit');
75
-        $nice_results = array();
76
-        foreach ($results as $result) {
77
-            $nice_results[] = $this->rest_api->createEntityFromWpdbResult(
78
-                $model,
79
-                $result,
80
-                $rest_request
81
-            );
82
-        }
83
-        return $nice_results;
84
-    }
50
+	/**
51
+	 * @param EEM_Base $model
52
+	 * @param array    $query_params
53
+	 * @param string   $include
54
+	 * @return array
55
+	 * @throws EE_Error
56
+	 * @throws InvalidArgumentException
57
+	 * @throws InvalidDataTypeException
58
+	 * @throws InvalidInterfaceException
59
+	 * @throws ModelConfigurationException
60
+	 * @throws ReflectionException
61
+	 * @throws RestException
62
+	 * @throws RestPasswordIncorrectException
63
+	 * @throws RestPasswordRequiredException
64
+	 * @throws UnexpectedEntityException
65
+	 * @throws DomainException
66
+	 * @since $VID:$
67
+	 */
68
+	public function getApiResults(EEM_Base $model, array $query_params, $include = '')
69
+	{
70
+		/** @type array $results */
71
+		$results = $model->get_all_wpdb_results($query_params);
72
+		$rest_request = new WP_REST_Request();
73
+		$rest_request->set_param('include', $include);
74
+		$rest_request->set_param('caps', 'edit');
75
+		$nice_results = array();
76
+		foreach ($results as $result) {
77
+			$nice_results[] = $this->rest_api->createEntityFromWpdbResult(
78
+				$model,
79
+				$result,
80
+				$rest_request
81
+			);
82
+		}
83
+		return $nice_results;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
core/services/graphql/resolvers/ResolverCollection.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,86 +21,86 @@
 block discarded – undo
21 21
 class ResolverCollection extends Collection
22 22
 {
23 23
 
24
-    const COLLECTION_NAME = 'espresso_graphql_resolvers';
24
+	const COLLECTION_NAME = 'espresso_graphql_resolvers';
25 25
 
26
-    /**
27
-     * @var CollectionLoader $loader
28
-     */
29
-    protected $loader;
26
+	/**
27
+	 * @var CollectionLoader $loader
28
+	 */
29
+	protected $loader;
30 30
 
31
-    /**
32
-     * ResolverCollection constructor
33
-     *
34
-     * @throws InvalidInterfaceException
35
-     */
36
-    public function __construct()
37
-    {
38
-        parent::__construct(
39
-            'EventEspresso\core\services\graphql\ResolverInterface',
40
-            ResolverCollection::COLLECTION_NAME
41
-        );
42
-    }
31
+	/**
32
+	 * ResolverCollection constructor
33
+	 *
34
+	 * @throws InvalidInterfaceException
35
+	 */
36
+	public function __construct()
37
+	{
38
+		parent::__construct(
39
+			'EventEspresso\core\services\graphql\ResolverInterface',
40
+			ResolverCollection::COLLECTION_NAME
41
+		);
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * @throws CollectionDetailsException
47
-     * @throws CollectionLoaderException
48
-     * @since $VID:$
49
-     */
50
-    private function loadCollection()
51
-    {
52
-        if (! $this->loader instanceof CollectionLoader) {
53
-            $this->loader = new CollectionLoader(
54
-                new CollectionDetails(
55
-                    // collection name
56
-                    ResolverCollection::COLLECTION_NAME,
57
-                    // collection interface
58
-                    'EventEspresso\core\services\graphql\ResolverInterface',
59
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
60
-                    apply_filters(
61
-                        'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs',
62
-                        ['EventEspresso\core\domain\services\graphql\resolvers']
63
-                    ),
64
-                    // filepaths to classes to add
65
-                    array(),
66
-                    // file mask to use if parsing folder for files to add
67
-                    '',
68
-                    // what to use as identifier for collection entities
69
-                    // using CLASS NAME prevents duplicates (works like a singleton)
70
-                    CollectionDetails::ID_CLASS_NAME
71
-                ),
72
-                $this
73
-            );
74
-        }
75
-    }
45
+	/**
46
+	 * @throws CollectionDetailsException
47
+	 * @throws CollectionLoaderException
48
+	 * @since $VID:$
49
+	 */
50
+	private function loadCollection()
51
+	{
52
+		if (! $this->loader instanceof CollectionLoader) {
53
+			$this->loader = new CollectionLoader(
54
+				new CollectionDetails(
55
+					// collection name
56
+					ResolverCollection::COLLECTION_NAME,
57
+					// collection interface
58
+					'EventEspresso\core\services\graphql\ResolverInterface',
59
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
60
+					apply_filters(
61
+						'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs',
62
+						['EventEspresso\core\domain\services\graphql\resolvers']
63
+					),
64
+					// filepaths to classes to add
65
+					array(),
66
+					// file mask to use if parsing folder for files to add
67
+					'',
68
+					// what to use as identifier for collection entities
69
+					// using CLASS NAME prevents duplicates (works like a singleton)
70
+					CollectionDetails::ID_CLASS_NAME
71
+				),
72
+				$this
73
+			);
74
+		}
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * @return CollectionInterface
80
-     * @throws CollectionDetailsException
81
-     * @throws CollectionLoaderException
82
-     * @since $VID:$
83
-     */
84
-    public function loadResolvers()
85
-    {
86
-        $this->loadCollection();
87
-        return $this->loader->getCollection();
88
-    }
78
+	/**
79
+	 * @return CollectionInterface
80
+	 * @throws CollectionDetailsException
81
+	 * @throws CollectionLoaderException
82
+	 * @since $VID:$
83
+	 */
84
+	public function loadResolvers()
85
+	{
86
+		$this->loadCollection();
87
+		return $this->loader->getCollection();
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * getIdentifier
93
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
94
-     * If no $identifier is supplied, then the  fully qualified class name is used
95
-     *
96
-     * @param        $object
97
-     * @param mixed  $identifier
98
-     * @return bool
99
-     */
100
-    public function getIdentifier($object, $identifier = null)
101
-    {
102
-        return ! empty($identifier)
103
-            ? $identifier
104
-            : get_class($object);
105
-    }
91
+	/**
92
+	 * getIdentifier
93
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
94
+	 * If no $identifier is supplied, then the  fully qualified class name is used
95
+	 *
96
+	 * @param        $object
97
+	 * @param mixed  $identifier
98
+	 * @return bool
99
+	 */
100
+	public function getIdentifier($object, $identifier = null)
101
+	{
102
+		return ! empty($identifier)
103
+			? $identifier
104
+			: get_class($object);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
core/services/graphql/connections/ConnectionCollection.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,86 +21,86 @@
 block discarded – undo
21 21
 class ConnectionCollection extends Collection
22 22
 {
23 23
 
24
-    const COLLECTION_NAME = 'espresso_graphql_connections';
24
+	const COLLECTION_NAME = 'espresso_graphql_connections';
25 25
 
26
-    /**
27
-     * @var CollectionLoader $loader
28
-     */
29
-    protected $loader;
26
+	/**
27
+	 * @var CollectionLoader $loader
28
+	 */
29
+	protected $loader;
30 30
 
31
-    /**
32
-     * ConnectionCollection constructor
33
-     *
34
-     * @throws InvalidInterfaceException
35
-     */
36
-    public function __construct()
37
-    {
38
-        parent::__construct(
39
-            'EventEspresso\core\services\graphql\connections\ConnectionInterface',
40
-            ConnectionCollection::COLLECTION_NAME
41
-        );
42
-    }
31
+	/**
32
+	 * ConnectionCollection constructor
33
+	 *
34
+	 * @throws InvalidInterfaceException
35
+	 */
36
+	public function __construct()
37
+	{
38
+		parent::__construct(
39
+			'EventEspresso\core\services\graphql\connections\ConnectionInterface',
40
+			ConnectionCollection::COLLECTION_NAME
41
+		);
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * @throws CollectionDetailsException
47
-     * @throws CollectionLoaderException
48
-     * @since $VID:$
49
-     */
50
-    private function loadCollection()
51
-    {
52
-        if (! $this->loader instanceof CollectionLoader) {
53
-            $this->loader = new CollectionLoader(
54
-                new CollectionDetails(
55
-                    // collection name
56
-                    ConnectionCollection::COLLECTION_NAME,
57
-                    // collection interface
58
-                    'EventEspresso\core\services\graphql\connections\ConnectionInterface',
59
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
60
-                    apply_filters(
61
-                        'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs',
62
-                        ['EventEspresso\core\domain\services\graphql\connections']
63
-                    ),
64
-                    // filepaths to classes to add
65
-                    array(),
66
-                    // file mask to use if parsing folder for files to add
67
-                    '',
68
-                    // what to use as identifier for collection entities
69
-                    // using CLASS NAME prevents duplicates (works like a singleton)
70
-                    CollectionDetails::ID_CLASS_NAME
71
-                ),
72
-                $this
73
-            );
74
-        }
75
-    }
45
+	/**
46
+	 * @throws CollectionDetailsException
47
+	 * @throws CollectionLoaderException
48
+	 * @since $VID:$
49
+	 */
50
+	private function loadCollection()
51
+	{
52
+		if (! $this->loader instanceof CollectionLoader) {
53
+			$this->loader = new CollectionLoader(
54
+				new CollectionDetails(
55
+					// collection name
56
+					ConnectionCollection::COLLECTION_NAME,
57
+					// collection interface
58
+					'EventEspresso\core\services\graphql\connections\ConnectionInterface',
59
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
60
+					apply_filters(
61
+						'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs',
62
+						['EventEspresso\core\domain\services\graphql\connections']
63
+					),
64
+					// filepaths to classes to add
65
+					array(),
66
+					// file mask to use if parsing folder for files to add
67
+					'',
68
+					// what to use as identifier for collection entities
69
+					// using CLASS NAME prevents duplicates (works like a singleton)
70
+					CollectionDetails::ID_CLASS_NAME
71
+				),
72
+				$this
73
+			);
74
+		}
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * @return CollectionInterface
80
-     * @throws CollectionDetailsException
81
-     * @throws CollectionLoaderException
82
-     * @since $VID:$
83
-     */
84
-    public function loadConnections()
85
-    {
86
-        $this->loadCollection();
87
-        return $this->loader->getCollection();
88
-    }
78
+	/**
79
+	 * @return CollectionInterface
80
+	 * @throws CollectionDetailsException
81
+	 * @throws CollectionLoaderException
82
+	 * @since $VID:$
83
+	 */
84
+	public function loadConnections()
85
+	{
86
+		$this->loadCollection();
87
+		return $this->loader->getCollection();
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * getIdentifier
93
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
94
-     * If no $identifier is supplied, then the  fully qualified class name is used
95
-     *
96
-     * @param        $object
97
-     * @param mixed  $identifier
98
-     * @return bool
99
-     */
100
-    public function getIdentifier($object, $identifier = null)
101
-    {
102
-        return ! empty($identifier)
103
-            ? $identifier
104
-            : get_class($object);
105
-    }
91
+	/**
92
+	 * getIdentifier
93
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
94
+	 * If no $identifier is supplied, then the  fully qualified class name is used
95
+	 *
96
+	 * @param        $object
97
+	 * @param mixed  $identifier
98
+	 * @return bool
99
+	 */
100
+	public function getIdentifier($object, $identifier = null)
101
+	{
102
+		return ! empty($identifier)
103
+			? $identifier
104
+			: get_class($object);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
core/services/graphql/enums/EnumInterface.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@
 block discarded – undo
13 13
 interface EnumInterface
14 14
 {
15 15
 
16
-    /**
17
-     * @return string
18
-     */
19
-    public function name();
16
+	/**
17
+	 * @return string
18
+	 */
19
+	public function name();
20 20
 
21 21
 
22
-    /**
23
-     * @return string
24
-     */
25
-    public function description();
22
+	/**
23
+	 * @return string
24
+	 */
25
+	public function description();
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     * @since $VID:$
31
-     */
32
-    public function values();
28
+	/**
29
+	 * @return array
30
+	 * @since $VID:$
31
+	 */
32
+	public function values();
33 33
 }
Please login to merge, or discard this patch.
core/services/graphql/enums/EnumCollection.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class EnumCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_enums';
23
+	const COLLECTION_NAME = 'espresso_graphql_enums';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * EnumCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\enums\EnumInterface',
39
-            EnumCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * EnumCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\enums\EnumInterface',
39
+			EnumCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since $VID:$
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    EnumCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\enums\EnumInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\enums']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since $VID:$
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					EnumCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\enums\EnumInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\enums']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since $VID:$
82
-     */
83
-    public function loadEnums()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since $VID:$
82
+	 */
83
+	public function loadEnums()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.