Completed
Branch EDTR/master (f9130a)
by
unknown
46:59 queued 38:09
created
core/domain/services/graphql/mutators/DatetimeUpdate.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -20,80 +20,80 @@
 block discarded – undo
20 20
 class DatetimeUpdate
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Datetime $model
27
-     * @param Datetime     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
-    {
32
-        /**
33
-         * Updates an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
-            /**
48
-             * Stop now if a user isn't allowed to create a datetime.
49
-             */
50
-            if (! current_user_can('ee_edit_events')) {
51
-                // translators: the %1$s is the name of the object being mutated
52
-                throw new UserError(
53
-                    sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
-                );
55
-            }
56
-
57
-            $id = ! empty($input['id']) ? absint($input['id']) : 0;
58
-            $entity = null;
59
-
60
-            if ($id) {
61
-                $entity = $model->get_one_by_ID($id);
62
-            }
63
-
64
-            /**
65
-             * If there's no existing datetime, throw an exception
66
-             */
67
-            if (! $id || ! ($entity instanceof EE_Datetime)) {
68
-                // translators: the placeholder is the name of the type being updated
69
-                throw new UserError(
70
-                    sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
71
-                );
72
-            }
73
-
74
-            $tickets = [];
75
-
76
-            $args = DatetimeMutation::prepareFields($input);
77
-
78
-            if (isset($args['tickets'])) {
79
-                $tickets = $args['tickets'];
80
-                unset($args['tickets']);
81
-            }
82
-
83
-            // Update the entity
84
-            $result = $entity->save($args);
85
-
86
-            if (empty($result)) {
87
-                throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88
-            }
89
-
90
-            if (! empty($tickets)) {
91
-                DatetimeMutation::setRelatedTickets($entity, $tickets);
92
-            }
93
-
94
-            return [
95
-                'id' => $id,
96
-            ];
97
-        };
98
-    }
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Datetime $model
27
+	 * @param Datetime     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
+	{
32
+		/**
33
+		 * Updates an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
+			/**
48
+			 * Stop now if a user isn't allowed to create a datetime.
49
+			 */
50
+			if (! current_user_can('ee_edit_events')) {
51
+				// translators: the %1$s is the name of the object being mutated
52
+				throw new UserError(
53
+					sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
+				);
55
+			}
56
+
57
+			$id = ! empty($input['id']) ? absint($input['id']) : 0;
58
+			$entity = null;
59
+
60
+			if ($id) {
61
+				$entity = $model->get_one_by_ID($id);
62
+			}
63
+
64
+			/**
65
+			 * If there's no existing datetime, throw an exception
66
+			 */
67
+			if (! $id || ! ($entity instanceof EE_Datetime)) {
68
+				// translators: the placeholder is the name of the type being updated
69
+				throw new UserError(
70
+					sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
71
+				);
72
+			}
73
+
74
+			$tickets = [];
75
+
76
+			$args = DatetimeMutation::prepareFields($input);
77
+
78
+			if (isset($args['tickets'])) {
79
+				$tickets = $args['tickets'];
80
+				unset($args['tickets']);
81
+			}
82
+
83
+			// Update the entity
84
+			$result = $entity->save($args);
85
+
86
+			if (empty($result)) {
87
+				throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88
+			}
89
+
90
+			if (! empty($tickets)) {
91
+				DatetimeMutation::setRelatedTickets($entity, $tickets);
92
+			}
93
+
94
+			return [
95
+				'id' => $id,
96
+			];
97
+		};
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
          * @throws InvalidDataTypeException
44 44
          * @throws EE_Error
45 45
          */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
46
+        return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
             /**
48 48
              * Stop now if a user isn't allowed to create a datetime.
49 49
              */
50
-            if (! current_user_can('ee_edit_events')) {
50
+            if ( ! current_user_can('ee_edit_events')) {
51 51
                 // translators: the %1$s is the name of the object being mutated
52 52
                 throw new UserError(
53 53
                     sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             /**
65 65
              * If there's no existing datetime, throw an exception
66 66
              */
67
-            if (! $id || ! ($entity instanceof EE_Datetime)) {
67
+            if ( ! $id || ! ($entity instanceof EE_Datetime)) {
68 68
                 // translators: the placeholder is the name of the type being updated
69 69
                 throw new UserError(
70 70
                     sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88 88
             }
89 89
 
90
-            if (! empty($tickets)) {
90
+            if ( ! empty($tickets)) {
91 91
                 DatetimeMutation::setRelatedTickets($entity, $tickets);
92 92
             }
93 93
 
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeCreate.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -20,64 +20,64 @@
 block discarded – undo
20 20
 class DatetimeCreate
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Datetime $model
27
-     * @param Datetime     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
-    {
32
-        /**
33
-         * Creates an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Datetime $model
27
+	 * @param Datetime     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
+	{
32
+		/**
33
+		 * Creates an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
 
48
-            /**
49
-             * Stop now if a user isn't allowed to create a datetime.
50
-             */
51
-            if (! current_user_can('ee_edit_events')) {
52
-                // translators: the %1$s is the name of the object being mutated
53
-                throw new UserError(
54
-                    sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
55
-                );
56
-            }
48
+			/**
49
+			 * Stop now if a user isn't allowed to create a datetime.
50
+			 */
51
+			if (! current_user_can('ee_edit_events')) {
52
+				// translators: the %1$s is the name of the object being mutated
53
+				throw new UserError(
54
+					sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
55
+				);
56
+			}
57 57
 
58
-            $tickets = [];
58
+			$tickets = [];
59 59
 
60
-            $args = DatetimeMutation::prepareFields($input);
60
+			$args = DatetimeMutation::prepareFields($input);
61 61
 
62
-            if (isset($args['tickets'])) {
63
-                $tickets = $args['tickets'];
64
-                unset($args['tickets']);
65
-            }
62
+			if (isset($args['tickets'])) {
63
+				$tickets = $args['tickets'];
64
+				unset($args['tickets']);
65
+			}
66 66
 
67
-            $entity = EE_Datetime::new_instance($args);
68
-            $id = $entity->save();
67
+			$entity = EE_Datetime::new_instance($args);
68
+			$id = $entity->save();
69 69
 
70
-            if (empty($id)) {
71
-                throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72
-            }
70
+			if (empty($id)) {
71
+				throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72
+			}
73 73
 
74
-            if (! empty($tickets)) {
75
-                DatetimeMutation::setRelatedTickets($entity, $tickets);
76
-            }
74
+			if (! empty($tickets)) {
75
+				DatetimeMutation::setRelatedTickets($entity, $tickets);
76
+			}
77 77
 
78
-            return [
79
-                'id' => $id,
80
-            ];
81
-        };
82
-    }
78
+			return [
79
+				'id' => $id,
80
+			];
81
+		};
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
          * @throws InvalidDataTypeException
44 44
          * @throws EE_Error
45 45
          */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
46
+        return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
 
48 48
             /**
49 49
              * Stop now if a user isn't allowed to create a datetime.
50 50
              */
51
-            if (! current_user_can('ee_edit_events')) {
51
+            if ( ! current_user_can('ee_edit_events')) {
52 52
                 // translators: the %1$s is the name of the object being mutated
53 53
                 throw new UserError(
54 54
                     sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72 72
             }
73 73
 
74
-            if (! empty($tickets)) {
74
+            if ( ! empty($tickets)) {
75 75
                 DatetimeMutation::setRelatedTickets($entity, $tickets);
76 76
             }
77 77
 
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketUpdate.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -20,80 +20,80 @@
 block discarded – undo
20 20
 class TicketUpdate
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Ticket $model
27
-     * @param Ticket     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
-    {
32
-        /**
33
-         * Updates an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
-            /**
48
-             * Stop now if a user isn't allowed to create a datetime.
49
-             */
50
-            if (! current_user_can('ee_edit_events')) {
51
-                // translators: the %1$s is the name of the object being mutated
52
-                throw new UserError(
53
-                    sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
-                );
55
-            }
56
-
57
-            $id = ! empty($input['id']) ? absint($input['id']) : 0;
58
-            $entity = null;
59
-
60
-            if ($id) {
61
-                $entity = $model->get_one_by_ID($id);
62
-            }
63
-
64
-            /**
65
-             * If there's no existing datetime, throw an exception
66
-             */
67
-            if (! $id || ! ($entity instanceof EE_Ticket)) {
68
-                // translators: the placeholder is the name of the type being updated
69
-                throw new UserError(
70
-                    sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
71
-                );
72
-            }
73
-
74
-            $datetimes = [];
75
-
76
-            $args = TicketMutation::prepareFields($input);
77
-
78
-            if (isset($args['datetimes'])) {
79
-                $datetimes = $args['datetimes'];
80
-                unset($args['datetimes']);
81
-            }
82
-
83
-            // Update the entity
84
-            $result = $entity->save($args);
85
-
86
-            if (empty($result)) {
87
-                throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88
-            }
89
-
90
-            if (! empty($datetimes)) {
91
-                TicketMutation::setRelatedDatetimes($entity, $datetimes);
92
-            }
93
-
94
-            return [
95
-                'id' => $id,
96
-            ];
97
-        };
98
-    }
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Ticket $model
27
+	 * @param Ticket     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
+	{
32
+		/**
33
+		 * Updates an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
+			/**
48
+			 * Stop now if a user isn't allowed to create a datetime.
49
+			 */
50
+			if (! current_user_can('ee_edit_events')) {
51
+				// translators: the %1$s is the name of the object being mutated
52
+				throw new UserError(
53
+					sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
+				);
55
+			}
56
+
57
+			$id = ! empty($input['id']) ? absint($input['id']) : 0;
58
+			$entity = null;
59
+
60
+			if ($id) {
61
+				$entity = $model->get_one_by_ID($id);
62
+			}
63
+
64
+			/**
65
+			 * If there's no existing datetime, throw an exception
66
+			 */
67
+			if (! $id || ! ($entity instanceof EE_Ticket)) {
68
+				// translators: the placeholder is the name of the type being updated
69
+				throw new UserError(
70
+					sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
71
+				);
72
+			}
73
+
74
+			$datetimes = [];
75
+
76
+			$args = TicketMutation::prepareFields($input);
77
+
78
+			if (isset($args['datetimes'])) {
79
+				$datetimes = $args['datetimes'];
80
+				unset($args['datetimes']);
81
+			}
82
+
83
+			// Update the entity
84
+			$result = $entity->save($args);
85
+
86
+			if (empty($result)) {
87
+				throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88
+			}
89
+
90
+			if (! empty($datetimes)) {
91
+				TicketMutation::setRelatedDatetimes($entity, $datetimes);
92
+			}
93
+
94
+			return [
95
+				'id' => $id,
96
+			];
97
+		};
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
          * @throws InvalidDataTypeException
44 44
          * @throws EE_Error
45 45
          */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
46
+        return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
             /**
48 48
              * Stop now if a user isn't allowed to create a datetime.
49 49
              */
50
-            if (! current_user_can('ee_edit_events')) {
50
+            if ( ! current_user_can('ee_edit_events')) {
51 51
                 // translators: the %1$s is the name of the object being mutated
52 52
                 throw new UserError(
53 53
                     sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             /**
65 65
              * If there's no existing datetime, throw an exception
66 66
              */
67
-            if (! $id || ! ($entity instanceof EE_Ticket)) {
67
+            if ( ! $id || ! ($entity instanceof EE_Ticket)) {
68 68
                 // translators: the placeholder is the name of the type being updated
69 69
                 throw new UserError(
70 70
                     sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
88 88
             }
89 89
 
90
-            if (! empty($datetimes)) {
90
+            if ( ! empty($datetimes)) {
91 91
                 TicketMutation::setRelatedDatetimes($entity, $datetimes);
92 92
             }
93 93
 
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketCreate.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -20,64 +20,64 @@
 block discarded – undo
20 20
 class TicketCreate
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Ticket $model
27
-     * @param Ticket     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
-    {
32
-        /**
33
-         * Creates an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Ticket $model
27
+	 * @param Ticket     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
+	{
32
+		/**
33
+		 * Creates an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
 
48
-            /**
49
-             * Stop now if a user isn't allowed to create a datetime.
50
-             */
51
-            if (! current_user_can('ee_edit_events')) {
52
-                // translators: the %1$s is the name of the object being mutated
53
-                throw new UserError(
54
-                    sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
55
-                );
56
-            }
48
+			/**
49
+			 * Stop now if a user isn't allowed to create a datetime.
50
+			 */
51
+			if (! current_user_can('ee_edit_events')) {
52
+				// translators: the %1$s is the name of the object being mutated
53
+				throw new UserError(
54
+					sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
55
+				);
56
+			}
57 57
 
58
-            $datetimes = [];
58
+			$datetimes = [];
59 59
 
60
-            $args = TicketMutation::prepareFields($input);
60
+			$args = TicketMutation::prepareFields($input);
61 61
 
62
-            if (isset($args['datetimes'])) {
63
-                $datetimes = $args['datetimes'];
64
-                unset($args['datetimes']);
65
-            }
62
+			if (isset($args['datetimes'])) {
63
+				$datetimes = $args['datetimes'];
64
+				unset($args['datetimes']);
65
+			}
66 66
 
67
-            $entity = EE_Ticket::new_instance($args);
68
-            $id = $entity->save();
67
+			$entity = EE_Ticket::new_instance($args);
68
+			$id = $entity->save();
69 69
 
70
-            if (empty($id)) {
71
-                throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72
-            }
70
+			if (empty($id)) {
71
+				throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72
+			}
73 73
 
74
-            if (! empty($datetimes)) {
75
-                TicketMutation::setRelatedDatetimes($entity, $datetimes);
76
-            }
74
+			if (! empty($datetimes)) {
75
+				TicketMutation::setRelatedDatetimes($entity, $datetimes);
76
+			}
77 77
 
78
-            return [
79
-                'id' => $id,
80
-            ];
81
-        };
82
-    }
78
+			return [
79
+				'id' => $id,
80
+			];
81
+		};
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
          * @throws InvalidDataTypeException
44 44
          * @throws EE_Error
45 45
          */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
46
+        return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47 47
 
48 48
             /**
49 49
              * Stop now if a user isn't allowed to create a datetime.
50 50
              */
51
-            if (! current_user_can('ee_edit_events')) {
51
+            if ( ! current_user_can('ee_edit_events')) {
52 52
                 // translators: the %1$s is the name of the object being mutated
53 53
                 throw new UserError(
54 54
                     sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 throw new UserError(__('The object failed to create but no error was provided', 'event_espresso'));
72 72
             }
73 73
 
74
-            if (! empty($datetimes)) {
74
+            if ( ! empty($datetimes)) {
75 75
                 TicketMutation::setRelatedDatetimes($entity, $datetimes);
76 76
             }
77 77
 
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/DatetimeMutation.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -11,63 +11,63 @@
 block discarded – undo
11 11
 class DatetimeMutation
12 12
 {
13 13
 
14
-    /**
15
-     * Maps the GraphQL input to a format that the model functions can use
16
-     *
17
-     * @param array $input Data coming from the GraphQL mutation query input
18
-     * @return array
19
-     */
20
-    public static function prepareFields(array $input)
21
-    {
14
+	/**
15
+	 * Maps the GraphQL input to a format that the model functions can use
16
+	 *
17
+	 * @param array $input Data coming from the GraphQL mutation query input
18
+	 * @return array
19
+	 */
20
+	public static function prepareFields(array $input)
21
+	{
22 22
 
23
-        $args = [];
23
+		$args = [];
24 24
 
25
-        if (! empty($input['event'])) {
26
-            $args['EVT_ID'] = absint($input['event']);
27
-        }
25
+		if (! empty($input['event'])) {
26
+			$args['EVT_ID'] = absint($input['event']);
27
+		}
28 28
 
29
-        if (! empty($input['name'])) {
30
-            $args['DTT_name'] = sanitize_text_field($input['name']);
31
-        }
29
+		if (! empty($input['name'])) {
30
+			$args['DTT_name'] = sanitize_text_field($input['name']);
31
+		}
32 32
 
33
-        if (! empty($input['description'])) {
34
-            $args['DTT_description'] = sanitize_text_field($input['description']);
35
-        }
33
+		if (! empty($input['description'])) {
34
+			$args['DTT_description'] = sanitize_text_field($input['description']);
35
+		}
36 36
 
37
-        if (! empty($input['startDate'])) {
38
-            $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
39
-        }
37
+		if (! empty($input['startDate'])) {
38
+			$args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
39
+		}
40 40
 
41
-        if (! empty($input['endDate'])) {
42
-            $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
43
-        }
41
+		if (! empty($input['endDate'])) {
42
+			$args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
43
+		}
44 44
 
45
-        if (! empty($input['tickets'])) {
46
-            $args['tickets'] = array_filter(array_map('absint', (array) $input['tickets']));
47
-        }
45
+		if (! empty($input['tickets'])) {
46
+			$args['tickets'] = array_filter(array_map('absint', (array) $input['tickets']));
47
+		}
48 48
 
49
-        // Likewise the other fields...
49
+		// Likewise the other fields...
50 50
 
51
-        return $args;
52
-    }
51
+		return $args;
52
+	}
53 53
 
54
-    /**
55
-     * Sets the related tickets for the given datetime.
56
-     *
57
-     * @param EE_Datetime $entity  The datetime instance.
58
-     * @param array       $tickets Array of ticket IDs to relate.
59
-     */
60
-    public static function setRelatedTickets($entity, array $tickets)
61
-    {
62
-        $relationName = 'Ticket';
63
-        // Remove all the existing related tickets
64
-        $entity->_remove_relations($relationName);
54
+	/**
55
+	 * Sets the related tickets for the given datetime.
56
+	 *
57
+	 * @param EE_Datetime $entity  The datetime instance.
58
+	 * @param array       $tickets Array of ticket IDs to relate.
59
+	 */
60
+	public static function setRelatedTickets($entity, array $tickets)
61
+	{
62
+		$relationName = 'Ticket';
63
+		// Remove all the existing related tickets
64
+		$entity->_remove_relations($relationName);
65 65
 
66
-        foreach ($tickets as $ID) {
67
-            $entity->_add_relation_to(
68
-                $ID,
69
-                $relationName
70
-            );
71
-        }
72
-    }
66
+		foreach ($tickets as $ID) {
67
+			$entity->_add_relation_to(
68
+				$ID,
69
+				$relationName
70
+			);
71
+		}
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,27 +22,27 @@
 block discarded – undo
22 22
 
23 23
         $args = [];
24 24
 
25
-        if (! empty($input['event'])) {
25
+        if ( ! empty($input['event'])) {
26 26
             $args['EVT_ID'] = absint($input['event']);
27 27
         }
28 28
 
29
-        if (! empty($input['name'])) {
29
+        if ( ! empty($input['name'])) {
30 30
             $args['DTT_name'] = sanitize_text_field($input['name']);
31 31
         }
32 32
 
33
-        if (! empty($input['description'])) {
33
+        if ( ! empty($input['description'])) {
34 34
             $args['DTT_description'] = sanitize_text_field($input['description']);
35 35
         }
36 36
 
37
-        if (! empty($input['startDate'])) {
37
+        if ( ! empty($input['startDate'])) {
38 38
             $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
39 39
         }
40 40
 
41
-        if (! empty($input['endDate'])) {
41
+        if ( ! empty($input['endDate'])) {
42 42
             $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
43 43
         }
44 44
 
45
-        if (! empty($input['tickets'])) {
45
+        if ( ! empty($input['tickets'])) {
46 46
             $args['tickets'] = array_filter(array_map('absint', (array) $input['tickets']));
47 47
         }
48 48
 
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/TicketMutation.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -11,55 +11,55 @@
 block discarded – undo
11 11
 class TicketMutation
12 12
 {
13 13
 
14
-    /**
15
-     * Maps the GraphQL input to a format that the model functions can use
16
-     *
17
-     * @param array $input Data coming from the GraphQL mutation query input
18
-     * @return array
19
-     */
20
-    public static function prepareFields(array $input)
21
-    {
14
+	/**
15
+	 * Maps the GraphQL input to a format that the model functions can use
16
+	 *
17
+	 * @param array $input Data coming from the GraphQL mutation query input
18
+	 * @return array
19
+	 */
20
+	public static function prepareFields(array $input)
21
+	{
22 22
 
23
-        $args = [];
23
+		$args = [];
24 24
 
25
-        if (! empty($input['name'])) {
26
-            $args['TKT_name'] = sanitize_text_field($input['name']);
27
-        }
25
+		if (! empty($input['name'])) {
26
+			$args['TKT_name'] = sanitize_text_field($input['name']);
27
+		}
28 28
 
29
-        if (! empty($input['description'])) {
30
-            $args['TKT_description'] = sanitize_text_field($input['description']);
31
-        }
29
+		if (! empty($input['description'])) {
30
+			$args['TKT_description'] = sanitize_text_field($input['description']);
31
+		}
32 32
 
33
-        if (! empty($input['price'])) {
34
-            $args['TKT_price'] = floatval($input['price']);
35
-        }
33
+		if (! empty($input['price'])) {
34
+			$args['TKT_price'] = floatval($input['price']);
35
+		}
36 36
 
37
-        if (! empty($input['datetimes'])) {
38
-            $args['datetimes'] = array_filter(array_map('absint', (array) $input['datetimes']));
39
-        }
37
+		if (! empty($input['datetimes'])) {
38
+			$args['datetimes'] = array_filter(array_map('absint', (array) $input['datetimes']));
39
+		}
40 40
 
41
-        // Likewise the other fields...
41
+		// Likewise the other fields...
42 42
 
43
-        return $args;
44
-    }
43
+		return $args;
44
+	}
45 45
 
46
-    /**
47
-     * Sets the related tickets for the given datetime.
48
-     *
49
-     * @param EE_Ticket $entity    The Ticket instance.
50
-     * @param array     $datetimes Array of datetime IDs to relate.
51
-     */
52
-    public static function setRelatedDatetimes($entity, array $datetimes)
53
-    {
54
-        $relationName = 'Datetime';
55
-        // Remove all the existing related datetimes
56
-        $entity->_remove_relations($relationName);
46
+	/**
47
+	 * Sets the related tickets for the given datetime.
48
+	 *
49
+	 * @param EE_Ticket $entity    The Ticket instance.
50
+	 * @param array     $datetimes Array of datetime IDs to relate.
51
+	 */
52
+	public static function setRelatedDatetimes($entity, array $datetimes)
53
+	{
54
+		$relationName = 'Datetime';
55
+		// Remove all the existing related datetimes
56
+		$entity->_remove_relations($relationName);
57 57
 
58
-        foreach ($datetimes as $ID) {
59
-            $entity->_add_relation_to(
60
-                $ID,
61
-                $relationName
62
-            );
63
-        }
64
-    }
58
+		foreach ($datetimes as $ID) {
59
+			$entity->_add_relation_to(
60
+				$ID,
61
+				$relationName
62
+			);
63
+		}
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@
 block discarded – undo
22 22
 
23 23
         $args = [];
24 24
 
25
-        if (! empty($input['name'])) {
25
+        if ( ! empty($input['name'])) {
26 26
             $args['TKT_name'] = sanitize_text_field($input['name']);
27 27
         }
28 28
 
29
-        if (! empty($input['description'])) {
29
+        if ( ! empty($input['description'])) {
30 30
             $args['TKT_description'] = sanitize_text_field($input['description']);
31 31
         }
32 32
 
33
-        if (! empty($input['price'])) {
33
+        if ( ! empty($input['price'])) {
34 34
             $args['TKT_price'] = floatval($input['price']);
35 35
         }
36 36
 
37
-        if (! empty($input['datetimes'])) {
37
+        if ( ! empty($input['datetimes'])) {
38 38
             $args['datetimes'] = array_filter(array_map('absint', (array) $input['datetimes']));
39 39
         }
40 40
 
Please login to merge, or discard this patch.
core/domain/services/graphql/abstracts/AbstractRootQueryConnection.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -19,50 +19,50 @@
 block discarded – undo
19 19
 abstract class AbstractRootQueryConnection implements ConnectionInterface
20 20
 {
21 21
 
22
-    /**
23
-     * @var EEM_Base $model
24
-     */
25
-    protected $model;
22
+	/**
23
+	 * @var EEM_Base $model
24
+	 */
25
+	protected $model;
26 26
 
27 27
 
28
-    /**
29
-     * @param $entity
30
-     * @param $args
31
-     * @param $context
32
-     * @param $info
33
-     * @return AbstractConnectionResolver
34
-     * @throws Exception
35
-     * @since $VID:$
36
-     */
37
-    abstract public function getConnectionResolver($entity, $args, $context, $info);
28
+	/**
29
+	 * @param $entity
30
+	 * @param $args
31
+	 * @param $context
32
+	 * @param $info
33
+	 * @return AbstractConnectionResolver
34
+	 * @throws Exception
35
+	 * @since $VID:$
36
+	 */
37
+	abstract public function getConnectionResolver($entity, $args, $context, $info);
38 38
 
39 39
 
40
-    /**
41
-     * @param $entity
42
-     * @param $args
43
-     * @param $context
44
-     * @param $info
45
-     * @return array
46
-     * @throws Exception
47
-     * @since $VID:$
48
-     */
49
-    public function resolveConnection($entity, $args, $context, $info)
50
-    {
51
-        $resolver = $this->getConnectionResolver($entity, $args, $context, $info);
52
-        return $resolver->get_connection();
53
-    }
40
+	/**
41
+	 * @param $entity
42
+	 * @param $args
43
+	 * @param $context
44
+	 * @param $info
45
+	 * @return array
46
+	 * @throws Exception
47
+	 * @since $VID:$
48
+	 */
49
+	public function resolveConnection($entity, $args, $context, $info)
50
+	{
51
+		$resolver = $this->getConnectionResolver($entity, $args, $context, $info);
52
+		return $resolver->get_connection();
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * @param $id
58
-     * @param $args
59
-     * @param $context
60
-     * @param $info
61
-     * @return EE_Base_Class
62
-     * @since $VID:$
63
-     */
64
-    public function resolveNode($id, $args, $context, $info)
65
-    {
66
-        return $this->model->get_one_by_ID($id);
67
-    }
56
+	/**
57
+	 * @param $id
58
+	 * @param $args
59
+	 * @param $context
60
+	 * @param $info
61
+	 * @return EE_Base_Class
62
+	 * @since $VID:$
63
+	 */
64
+	public function resolveNode($id, $args, $context, $info)
65
+	{
66
+		return $this->model->get_one_by_ID($id);
67
+	}
68 68
 }
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/TicketConnectionResolver.php 2 patches
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -16,127 +16,127 @@
 block discarded – undo
16 16
 class TicketConnectionResolver extends AbstractConnectionResolver
17 17
 {
18 18
 
19
-    /**
20
-     * @return EEM_Ticket
21
-     * @throws EE_Error
22
-     * @throws InvalidArgumentException
23
-     * @throws InvalidDataTypeException
24
-     * @throws InvalidInterfaceException
25
-     */
26
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
27
-    public function get_query()
28
-    {
29
-        return EEM_Ticket::instance();
30
-    }
31
-
32
-
33
-    /**
34
-     * Return an array of items from the query
35
-     *
36
-     * @return array
37
-     */
38
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
39
-    public function get_items()
40
-    {
41
-        $results = $this->query->get_col($this->query_args);
42
-
43
-        return ! empty($results) ? $results : [];
44
-    }
45
-
46
-
47
-    /**
48
-     * Determine whether the Query should execute. If it's determined that the query should
49
-     * not be run based on context such as, but not limited to, who the user is, where in the
50
-     * ResolveTree the Query is, the relation to the node the Query is connected to, etc
51
-     * Return false to prevent the query from executing.
52
-     *
53
-     * @return bool
54
-     */
55
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
56
-    public function should_execute()
57
-    {
58
-        if (false === $this->should_execute) {
59
-            return false;
60
-        }
61
-
62
-        return $this->should_execute;
63
-    }
64
-
65
-
66
-    /**
67
-     * Here, we map the args from the input, then we make sure that we're only querying
68
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
69
-     * handle batch resolution of the posts.
70
-     *
71
-     * @return array
72
-     * @throws EE_Error
73
-     * @throws InvalidArgumentException
74
-     * @throws ReflectionException
75
-     * @throws InvalidDataTypeException
76
-     * @throws InvalidInterfaceException
77
-     */
78
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
79
-    public function get_query_args()
80
-    {
81
-        $where_params = [];
82
-        $query_args   = [];
83
-
84
-        $query_args['limit'] = $this->getLimit();
85
-
86
-        // Avoid multiple entries by join.
87
-        $query_args['group_by'] = 'TKT_ID';
88
-
89
-        /**
90
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
91
-         */
92
-        $input_fields = [];
93
-        if (! empty($this->args['where'])) {
94
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
95
-
96
-            // Use the proper operator.
97
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
98
-                $input_fields['Datetime.DTT_ID'] = ['in', $input_fields['Datetime.DTT_ID']];
99
-            }
100
-        }
101
-
102
-        /**
103
-         * Determine where we're at in the Graph and adjust the query context appropriately.
104
-         */
105
-        if ($this->source instanceof EE_Datetime) {
106
-            $where_params['Datetime.DTT_ID'] = $this->source->ID();
107
-        }
108
-
109
-        /**
110
-         * Merge the input_fields with the default query_args
111
-         */
112
-        if (! empty($input_fields)) {
113
-            $where_params = array_merge($where_params, $input_fields);
114
-        }
115
-
116
-        list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
117
-
118
-        $query_args[] = $where_params;
119
-
120
-        /**
121
-         * Return the $query_args
122
-         */
123
-        return $query_args;
124
-    }
125
-
126
-
127
-    /**
128
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
129
-     * friendly keys.
130
-     *
131
-     * @param array $where_args
132
-     * @return array
133
-     */
134
-    public function sanitizeInputFields(array $where_args)
135
-    {
136
-        $arg_mapping = [
137
-            'datetimeIn'  => 'Datetime.DTT_ID',
138
-            'datetimeId'  => 'Datetime.DTT_ID', // preferred.
139
-        ];
140
-        return $this->sanitizeWhereArgsForInputFields($where_args, $arg_mapping);
141
-    }
19
+	/**
20
+	 * @return EEM_Ticket
21
+	 * @throws EE_Error
22
+	 * @throws InvalidArgumentException
23
+	 * @throws InvalidDataTypeException
24
+	 * @throws InvalidInterfaceException
25
+	 */
26
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
27
+	public function get_query()
28
+	{
29
+		return EEM_Ticket::instance();
30
+	}
31
+
32
+
33
+	/**
34
+	 * Return an array of items from the query
35
+	 *
36
+	 * @return array
37
+	 */
38
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
39
+	public function get_items()
40
+	{
41
+		$results = $this->query->get_col($this->query_args);
42
+
43
+		return ! empty($results) ? $results : [];
44
+	}
45
+
46
+
47
+	/**
48
+	 * Determine whether the Query should execute. If it's determined that the query should
49
+	 * not be run based on context such as, but not limited to, who the user is, where in the
50
+	 * ResolveTree the Query is, the relation to the node the Query is connected to, etc
51
+	 * Return false to prevent the query from executing.
52
+	 *
53
+	 * @return bool
54
+	 */
55
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
56
+	public function should_execute()
57
+	{
58
+		if (false === $this->should_execute) {
59
+			return false;
60
+		}
61
+
62
+		return $this->should_execute;
63
+	}
64
+
65
+
66
+	/**
67
+	 * Here, we map the args from the input, then we make sure that we're only querying
68
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
69
+	 * handle batch resolution of the posts.
70
+	 *
71
+	 * @return array
72
+	 * @throws EE_Error
73
+	 * @throws InvalidArgumentException
74
+	 * @throws ReflectionException
75
+	 * @throws InvalidDataTypeException
76
+	 * @throws InvalidInterfaceException
77
+	 */
78
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
79
+	public function get_query_args()
80
+	{
81
+		$where_params = [];
82
+		$query_args   = [];
83
+
84
+		$query_args['limit'] = $this->getLimit();
85
+
86
+		// Avoid multiple entries by join.
87
+		$query_args['group_by'] = 'TKT_ID';
88
+
89
+		/**
90
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
91
+		 */
92
+		$input_fields = [];
93
+		if (! empty($this->args['where'])) {
94
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
95
+
96
+			// Use the proper operator.
97
+			if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
98
+				$input_fields['Datetime.DTT_ID'] = ['in', $input_fields['Datetime.DTT_ID']];
99
+			}
100
+		}
101
+
102
+		/**
103
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
104
+		 */
105
+		if ($this->source instanceof EE_Datetime) {
106
+			$where_params['Datetime.DTT_ID'] = $this->source->ID();
107
+		}
108
+
109
+		/**
110
+		 * Merge the input_fields with the default query_args
111
+		 */
112
+		if (! empty($input_fields)) {
113
+			$where_params = array_merge($where_params, $input_fields);
114
+		}
115
+
116
+		list($query_args, $where_params) = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
117
+
118
+		$query_args[] = $where_params;
119
+
120
+		/**
121
+		 * Return the $query_args
122
+		 */
123
+		return $query_args;
124
+	}
125
+
126
+
127
+	/**
128
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
129
+	 * friendly keys.
130
+	 *
131
+	 * @param array $where_args
132
+	 * @return array
133
+	 */
134
+	public function sanitizeInputFields(array $where_args)
135
+	{
136
+		$arg_mapping = [
137
+			'datetimeIn'  => 'Datetime.DTT_ID',
138
+			'datetimeId'  => 'Datetime.DTT_ID', // preferred.
139
+		];
140
+		return $this->sanitizeWhereArgsForInputFields($where_args, $arg_mapping);
141
+	}
142 142
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
91 91
          */
92 92
         $input_fields = [];
93
-        if (! empty($this->args['where'])) {
93
+        if ( ! empty($this->args['where'])) {
94 94
             $input_fields = $this->sanitizeInputFields($this->args['where']);
95 95
 
96 96
             // Use the proper operator.
97
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
97
+            if ( ! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
98 98
                 $input_fields['Datetime.DTT_ID'] = ['in', $input_fields['Datetime.DTT_ID']];
99 99
             }
100 100
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         /**
110 110
          * Merge the input_fields with the default query_args
111 111
          */
112
-        if (! empty($input_fields)) {
112
+        if ( ! empty($input_fields)) {
113 113
             $where_params = array_merge($where_params, $input_fields);
114 114
         }
115 115
 
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/AbstractConnectionResolver.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -15,90 +15,90 @@
 block discarded – undo
15 15
 abstract class AbstractConnectionResolver extends WPGraphQLConnectionResolver
16 16
 {
17 17
 
18
-    /**
19
-     * Set limit the highest value of first and last, with a (filterable) max of 100
20
-     *
21
-     * @return array
22
-     */
23
-    protected function getLimit()
24
-    {
25
-        $this->args['first'] = ! empty($this->args['first']) ? absint($this->args['first']) : 0;
26
-        $this->args['last'] = ! empty($this->args['last']) ? absint($this->args['last']) : 0;
18
+	/**
19
+	 * Set limit the highest value of first and last, with a (filterable) max of 100
20
+	 *
21
+	 * @return array
22
+	 */
23
+	protected function getLimit()
24
+	{
25
+		$this->args['first'] = ! empty($this->args['first']) ? absint($this->args['first']) : 0;
26
+		$this->args['last'] = ! empty($this->args['last']) ? absint($this->args['last']) : 0;
27 27
 
28
-        $limit = min(
29
-            max($this->args['first'], $this->args['last'], 10),
30
-            $this->query_amount
31
-        );
32
-        $limit++;
33
-        return $limit;
34
-    }
28
+		$limit = min(
29
+			max($this->args['first'], $this->args['last'], 10),
30
+			$this->query_amount
31
+		);
32
+		$limit++;
33
+		return $limit;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
39
-     * friendly keys.
40
-     *
41
-     * @param array  $query_args
42
-     * @param array  $where_params
43
-     * @param string $primary_key
44
-     * @return array
45
-     */
46
-    protected function mapOrderbyInputArgs(array $query_args, array $where_params, $primary_key)
47
-    {
48
-        // ID of the current offset
49
-        $offset = $this->get_offset();
50
-        /**
51
-         * Map the orderby inputArgs to the WP_Query
52
-         */
53
-        if (! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) {
54
-            $query_args['order_by'] = [];
55
-            foreach ($this->args['where']['orderby'] as $orderby_input) {
56
-                $query_args['order_by'][ $orderby_input['field'] ] = $orderby_input['order'];
57
-            }
58
-        } elseif ($offset) {
59
-            $compare = $this->args['last'] ? '<' : '>';
60
-            $where_params[ $primary_key ] = [$compare, $offset];
61
-        }
62
-        return [$query_args, $where_params];
63
-    }
37
+	/**
38
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
39
+	 * friendly keys.
40
+	 *
41
+	 * @param array  $query_args
42
+	 * @param array  $where_params
43
+	 * @param string $primary_key
44
+	 * @return array
45
+	 */
46
+	protected function mapOrderbyInputArgs(array $query_args, array $where_params, $primary_key)
47
+	{
48
+		// ID of the current offset
49
+		$offset = $this->get_offset();
50
+		/**
51
+		 * Map the orderby inputArgs to the WP_Query
52
+		 */
53
+		if (! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) {
54
+			$query_args['order_by'] = [];
55
+			foreach ($this->args['where']['orderby'] as $orderby_input) {
56
+				$query_args['order_by'][ $orderby_input['field'] ] = $orderby_input['order'];
57
+			}
58
+		} elseif ($offset) {
59
+			$compare = $this->args['last'] ? '<' : '>';
60
+			$where_params[ $primary_key ] = [$compare, $offset];
61
+		}
62
+		return [$query_args, $where_params];
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
68
-     * friendly keys.
69
-     *
70
-     * @param array $where_args
71
-     * @param array $arg_mapping
72
-     * @return array
73
-     */
74
-    protected function sanitizeWhereArgsForInputFields(array $where_args, array $arg_mapping)
75
-    {
76
-        $query_args = [];
66
+	/**
67
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
68
+	 * friendly keys.
69
+	 *
70
+	 * @param array $where_args
71
+	 * @param array $arg_mapping
72
+	 * @return array
73
+	 */
74
+	protected function sanitizeWhereArgsForInputFields(array $where_args, array $arg_mapping)
75
+	{
76
+		$query_args = [];
77 77
 
78
-        foreach ($where_args as $arg => $value) {
79
-            if (! array_key_exists($arg, $arg_mapping)) {
80
-                continue;
81
-            }
78
+		foreach ($where_args as $arg => $value) {
79
+			if (! array_key_exists($arg, $arg_mapping)) {
80
+				continue;
81
+			}
82 82
 
83
-            if (is_array($value) && ! empty($value)) {
84
-                $value = array_map(
85
-                    static function ($value) {
86
-                        if (is_string($value)) {
87
-                            $value = sanitize_text_field($value);
88
-                        }
89
-                        return $value;
90
-                    },
91
-                    $value
92
-                );
93
-            } elseif (is_string($value)) {
94
-                $value = sanitize_text_field($value);
95
-            }
96
-            $query_args[ $arg_mapping[ $arg ] ] = $value;
97
-        }
83
+			if (is_array($value) && ! empty($value)) {
84
+				$value = array_map(
85
+					static function ($value) {
86
+						if (is_string($value)) {
87
+							$value = sanitize_text_field($value);
88
+						}
89
+						return $value;
90
+					},
91
+					$value
92
+				);
93
+			} elseif (is_string($value)) {
94
+				$value = sanitize_text_field($value);
95
+			}
96
+			$query_args[ $arg_mapping[ $arg ] ] = $value;
97
+		}
98 98
 
99
-        /**
100
-         * Return the Query Args
101
-         */
102
-        return ! empty($query_args) && is_array($query_args) ? $query_args : [];
103
-    }
99
+		/**
100
+		 * Return the Query Args
101
+		 */
102
+		return ! empty($query_args) && is_array($query_args) ? $query_args : [];
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
         /**
51 51
          * Map the orderby inputArgs to the WP_Query
52 52
          */
53
-        if (! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) {
53
+        if ( ! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) {
54 54
             $query_args['order_by'] = [];
55 55
             foreach ($this->args['where']['orderby'] as $orderby_input) {
56
-                $query_args['order_by'][ $orderby_input['field'] ] = $orderby_input['order'];
56
+                $query_args['order_by'][$orderby_input['field']] = $orderby_input['order'];
57 57
             }
58 58
         } elseif ($offset) {
59 59
             $compare = $this->args['last'] ? '<' : '>';
60
-            $where_params[ $primary_key ] = [$compare, $offset];
60
+            $where_params[$primary_key] = [$compare, $offset];
61 61
         }
62 62
         return [$query_args, $where_params];
63 63
     }
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
         $query_args = [];
77 77
 
78 78
         foreach ($where_args as $arg => $value) {
79
-            if (! array_key_exists($arg, $arg_mapping)) {
79
+            if ( ! array_key_exists($arg, $arg_mapping)) {
80 80
                 continue;
81 81
             }
82 82
 
83 83
             if (is_array($value) && ! empty($value)) {
84 84
                 $value = array_map(
85
-                    static function ($value) {
85
+                    static function($value) {
86 86
                         if (is_string($value)) {
87 87
                             $value = sanitize_text_field($value);
88 88
                         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             } elseif (is_string($value)) {
94 94
                 $value = sanitize_text_field($value);
95 95
             }
96
-            $query_args[ $arg_mapping[ $arg ] ] = $value;
96
+            $query_args[$arg_mapping[$arg]] = $value;
97 97
         }
98 98
 
99 99
         /**
Please login to merge, or discard this patch.