Completed
Branch FET/reg-form-builder/main (69a760)
by
unknown
04:39 queued 02:08
created
core/domain/services/graphql/mutators/PriceDelete.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -17,70 +17,70 @@
 block discarded – undo
17 17
 class PriceDelete extends EntityMutator
18 18
 {
19 19
 
20
-    /**
21
-     * Defines the mutation data modification closure.
22
-     *
23
-     * @param EEM_Price $model
24
-     * @param Price     $type
25
-     * @return callable
26
-     */
27
-    public static function mutateAndGetPayload(EEM_Price $model, Price $type)
28
-    {
29
-        /**
30
-         * Deletes an entity.
31
-         *
32
-         * @param array       $input   The input for the mutation
33
-         * @param AppContext  $context The AppContext passed down to all resolvers
34
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35
-         * @return array
36
-         */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
-            try {
39
-                /** @var EE_Price $entity */
40
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
20
+	/**
21
+	 * Defines the mutation data modification closure.
22
+	 *
23
+	 * @param EEM_Price $model
24
+	 * @param Price     $type
25
+	 * @return callable
26
+	 */
27
+	public static function mutateAndGetPayload(EEM_Price $model, Price $type)
28
+	{
29
+		/**
30
+		 * Deletes an entity.
31
+		 *
32
+		 * @param array       $input   The input for the mutation
33
+		 * @param AppContext  $context The AppContext passed down to all resolvers
34
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35
+		 * @return array
36
+		 */
37
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
+			try {
39
+				/** @var EE_Price $entity */
40
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
41 41
 
42
-                // Delete the entity
43
-                if (! empty($input['deletePermanently'])) {
44
-                    $result = PriceDelete::deletePriceAndRelations($entity);
45
-                } else {
46
-                    // trash the price
47
-                    $result = $entity->delete();
48
-                }
49
-                EntityMutator::validateResults($result);
42
+				// Delete the entity
43
+				if (! empty($input['deletePermanently'])) {
44
+					$result = PriceDelete::deletePriceAndRelations($entity);
45
+				} else {
46
+					// trash the price
47
+					$result = $entity->delete();
48
+				}
49
+				EntityMutator::validateResults($result);
50 50
 
51
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_delete', $entity, $input);
52
-            } catch (Exception $exception) {
53
-                EntityMutator::handleExceptions(
54
-                    $exception,
55
-                    esc_html__(
56
-                        'The price could not be deleted because of the following error(s)',
57
-                        'event_espresso'
58
-                    )
59
-                );
60
-            }
51
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_delete', $entity, $input);
52
+			} catch (Exception $exception) {
53
+				EntityMutator::handleExceptions(
54
+					$exception,
55
+					esc_html__(
56
+						'The price could not be deleted because of the following error(s)',
57
+						'event_espresso'
58
+					)
59
+				);
60
+			}
61 61
 
62
-            return [
63
-                'deleted' => $entity,
64
-            ];
65
-        };
66
-    }
62
+			return [
63
+				'deleted' => $entity,
64
+			];
65
+		};
66
+	}
67 67
 
68
-    /**
69
-     * Deletes a price permanently along with its relations.
70
-     *
71
-     * @param EE_Price $entity
72
-     * @return bool | int
73
-     * @throws ReflectionException
74
-     * @throws InvalidArgumentException
75
-     * @throws InvalidInterfaceException
76
-     * @throws InvalidDataTypeException
77
-     * @throws EE_Error
78
-     */
79
-    public static function deletePriceAndRelations(EE_Price $entity)
80
-    {
81
-        // Remove relation with ticket
82
-        $entity->_remove_relations('Ticket');
83
-        // Now delete the price permanently
84
-        return $entity->delete_permanently();
85
-    }
68
+	/**
69
+	 * Deletes a price permanently along with its relations.
70
+	 *
71
+	 * @param EE_Price $entity
72
+	 * @return bool | int
73
+	 * @throws ReflectionException
74
+	 * @throws InvalidArgumentException
75
+	 * @throws InvalidInterfaceException
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws EE_Error
78
+	 */
79
+	public static function deletePriceAndRelations(EE_Price $entity)
80
+	{
81
+		// Remove relation with ticket
82
+		$entity->_remove_relations('Ticket');
83
+		// Now delete the price permanently
84
+		return $entity->delete_permanently();
85
+	}
86 86
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35 35
          * @return array
36 36
          */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
37
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38 38
             try {
39 39
                 /** @var EE_Price $entity */
40 40
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
41 41
 
42 42
                 // Delete the entity
43
-                if (! empty($input['deletePermanently'])) {
43
+                if ( ! empty($input['deletePermanently'])) {
44 44
                     $result = PriceDelete::deletePriceAndRelations($entity);
45 45
                 } else {
46 46
                     // trash the price
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/VenueUpdate.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
          * @param ResolveInfo   $info               The ResolveInfo passed down to all resolvers
35 35
          * @return void
36 36
          */
37
-        return static function (
37
+        return static function(
38 38
             int $id,
39 39
             array $input,
40 40
             WP_Post_Type $post_type_object,
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,63 +14,63 @@
 block discarded – undo
14 14
 class VenueUpdate extends EntityMutator
15 15
 {
16 16
 
17
-    /**
18
-     * Defines the mutation data modification closure.
19
-     *
20
-     * @param EEM_Venue $model
21
-     * @param Venue     $type
22
-     * @return callable
23
-     */
24
-    public static function mutateFields(EEM_Venue $model, Venue $type)
25
-    {
26
-        /**
27
-         * Update additional data related to the entity.
28
-         *
29
-         * @param int           $id                 The ID of the postObject being mutated
30
-         * @param array         $input              The input for the mutation
31
-         * @param WP_Post_Type  $post_type_object   The Post Type Object for the type of post being mutated
32
-         * @param string        $mutation_name      The name of the mutation (ex: create, update, delete)
33
-         * @param AppContext    $context            The AppContext passed down to all resolvers
34
-         * @param ResolveInfo   $info               The ResolveInfo passed down to all resolvers
35
-         * @return void
36
-         */
37
-        return static function (
38
-            int $id,
39
-            array $input,
40
-            WP_Post_Type $post_type_object,
41
-            string $mutation_name,
42
-            AppContext $context,
43
-            ResolveInfo $info
44
-        ) use (
45
-            $model,
46
-            $type
47
-        ) {
48
-            try {
49
-                // Make sure we are dealing with the right entity.
50
-                if (
51
-                    ! property_exists($post_type_object, 'graphql_single_name')
52
-                    || $post_type_object->graphql_single_name !== $type->name()
53
-                ) {
54
-                    return;
55
-                }
17
+	/**
18
+	 * Defines the mutation data modification closure.
19
+	 *
20
+	 * @param EEM_Venue $model
21
+	 * @param Venue     $type
22
+	 * @return callable
23
+	 */
24
+	public static function mutateFields(EEM_Venue $model, Venue $type)
25
+	{
26
+		/**
27
+		 * Update additional data related to the entity.
28
+		 *
29
+		 * @param int           $id                 The ID of the postObject being mutated
30
+		 * @param array         $input              The input for the mutation
31
+		 * @param WP_Post_Type  $post_type_object   The Post Type Object for the type of post being mutated
32
+		 * @param string        $mutation_name      The name of the mutation (ex: create, update, delete)
33
+		 * @param AppContext    $context            The AppContext passed down to all resolvers
34
+		 * @param ResolveInfo   $info               The ResolveInfo passed down to all resolvers
35
+		 * @return void
36
+		 */
37
+		return static function (
38
+			int $id,
39
+			array $input,
40
+			WP_Post_Type $post_type_object,
41
+			string $mutation_name,
42
+			AppContext $context,
43
+			ResolveInfo $info
44
+		) use (
45
+			$model,
46
+			$type
47
+		) {
48
+			try {
49
+				// Make sure we are dealing with the right entity.
50
+				if (
51
+					! property_exists($post_type_object, 'graphql_single_name')
52
+					|| $post_type_object->graphql_single_name !== $type->name()
53
+				) {
54
+					return;
55
+				}
56 56
 
57
-                /** @var EE_Venue $entity */
58
-                $entity = EntityMutator::getEntityFromID($model, $id);
59
-                $args = VenueMutation::prepareFields($input);
57
+				/** @var EE_Venue $entity */
58
+				$entity = EntityMutator::getEntityFromID($model, $id);
59
+				$args = VenueMutation::prepareFields($input);
60 60
 
61
-                // Update the entity
62
-                $entity->save($args);
61
+				// Update the entity
62
+				$entity->save($args);
63 63
 
64
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input);
65
-            } catch (Exception $exception) {
66
-                EntityMutator::handleExceptions(
67
-                    $exception,
68
-                    esc_html__(
69
-                        'The venue could not be updated because of the following error(s)',
70
-                        'event_espresso'
71
-                    )
72
-                );
73
-            }
74
-        };
75
-    }
64
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_venue_update', $entity, $input);
65
+			} catch (Exception $exception) {
66
+				EntityMutator::handleExceptions(
67
+					$exception,
68
+					esc_html__(
69
+						'The venue could not be updated because of the following error(s)',
70
+						'event_espresso'
71
+					)
72
+				);
73
+			}
74
+		};
75
+	}
76 76
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/PriceUpdate.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -15,49 +15,49 @@
 block discarded – undo
15 15
 class PriceUpdate extends EntityMutator
16 16
 {
17 17
 
18
-    /**
19
-     * Defines the mutation data modification closure.
20
-     *
21
-     * @param EEM_Price $model
22
-     * @param Price     $type
23
-     * @return callable
24
-     */
25
-    public static function mutateAndGetPayload(EEM_Price $model, Price $type)
26
-    {
27
-        /**
28
-         * Updates an entity.
29
-         *
30
-         * @param array       $input   The input for the mutation
31
-         * @param AppContext  $context The AppContext passed down to all resolvers
32
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
33
-         * @return array
34
-         * @throws EE_Error
35
-         * @throws ReflectionException
36
-         */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
-            try {
39
-                /** @var EE_Price $entity */
40
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
41
-
42
-                $args = PriceMutation::prepareFields($input);
43
-
44
-                // Update the entity
45
-                $entity->save($args);
46
-
47
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_update', $entity, $input);
48
-            } catch (Exception $exception) {
49
-                EntityMutator::handleExceptions(
50
-                    $exception,
51
-                    esc_html__(
52
-                        'The price could not be updated because of the following error(s)',
53
-                        'event_espresso'
54
-                    )
55
-                );
56
-            }
57
-
58
-            return [
59
-                'id' => $entity->ID(),
60
-            ];
61
-        };
62
-    }
18
+	/**
19
+	 * Defines the mutation data modification closure.
20
+	 *
21
+	 * @param EEM_Price $model
22
+	 * @param Price     $type
23
+	 * @return callable
24
+	 */
25
+	public static function mutateAndGetPayload(EEM_Price $model, Price $type)
26
+	{
27
+		/**
28
+		 * Updates an entity.
29
+		 *
30
+		 * @param array       $input   The input for the mutation
31
+		 * @param AppContext  $context The AppContext passed down to all resolvers
32
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
33
+		 * @return array
34
+		 * @throws EE_Error
35
+		 * @throws ReflectionException
36
+		 */
37
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
+			try {
39
+				/** @var EE_Price $entity */
40
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
41
+
42
+				$args = PriceMutation::prepareFields($input);
43
+
44
+				// Update the entity
45
+				$entity->save($args);
46
+
47
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_update', $entity, $input);
48
+			} catch (Exception $exception) {
49
+				EntityMutator::handleExceptions(
50
+					$exception,
51
+					esc_html__(
52
+						'The price could not be updated because of the following error(s)',
53
+						'event_espresso'
54
+					)
55
+				);
56
+			}
57
+
58
+			return [
59
+				'id' => $entity->ID(),
60
+			];
61
+		};
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
          * @throws EE_Error
35 35
          * @throws ReflectionException
36 36
          */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
37
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38 38
             try {
39 39
                 /** @var EE_Price $entity */
40 40
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/FormSectionUpdate.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,52 +14,52 @@
 block discarded – undo
14 14
 class FormSectionUpdate extends EntityMutator
15 15
 {
16 16
 
17
-    /**
18
-     * Defines the mutation data modification closure.
19
-     *
20
-     * @param EEM_Form_Section $model
21
-     * @return callable
22
-     */
23
-    public static function mutateAndGetPayload(EEM_Form_Section $model)
24
-    {
25
-        /**
26
-         * Updates an entity.
27
-         *
28
-         * @param array       $input   The input for the mutation
29
-         * @param AppContext  $context The AppContext passed down to all resolvers
30
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
31
-         * @return array
32
-         * @throws EE_Error
33
-         * @throws ReflectionException
34
-         */
35
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
36
-            try {
37
-                /** @var EE_Form_Section $entity */
38
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
17
+	/**
18
+	 * Defines the mutation data modification closure.
19
+	 *
20
+	 * @param EEM_Form_Section $model
21
+	 * @return callable
22
+	 */
23
+	public static function mutateAndGetPayload(EEM_Form_Section $model)
24
+	{
25
+		/**
26
+		 * Updates an entity.
27
+		 *
28
+		 * @param array       $input   The input for the mutation
29
+		 * @param AppContext  $context The AppContext passed down to all resolvers
30
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
31
+		 * @return array
32
+		 * @throws EE_Error
33
+		 * @throws ReflectionException
34
+		 */
35
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
36
+			try {
37
+				/** @var EE_Form_Section $entity */
38
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
39 39
 
40
-                $args = FormSectionMutation::prepareFields($input);
40
+				$args = FormSectionMutation::prepareFields($input);
41 41
 
42
-                // Update the entity
43
-                $entity->save($args);
42
+				// Update the entity
43
+				$entity->save($args);
44 44
 
45
-                do_action(
46
-                    'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_update',
47
-                    $entity,
48
-                    $input
49
-                );
50
-            } catch (Exception $exception) {
51
-                EntityMutator::handleExceptions(
52
-                    $exception,
53
-                    esc_html__(
54
-                        'The form section could not be updated because of the following error(s)',
55
-                        'event_espresso'
56
-                    )
57
-                );
58
-            }
45
+				do_action(
46
+					'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_update',
47
+					$entity,
48
+					$input
49
+				);
50
+			} catch (Exception $exception) {
51
+				EntityMutator::handleExceptions(
52
+					$exception,
53
+					esc_html__(
54
+						'The form section could not be updated because of the following error(s)',
55
+						'event_espresso'
56
+					)
57
+				);
58
+			}
59 59
 
60
-            return [
61
-                'id' => $entity->UUID(),
62
-            ];
63
-        };
64
-    }
60
+			return [
61
+				'id' => $entity->UUID(),
62
+			];
63
+		};
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
          * @throws EE_Error
33 33
          * @throws ReflectionException
34 34
          */
35
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
35
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model): array {
36 36
             try {
37 37
                 /** @var EE_Form_Section $entity */
38 38
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketDelete.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -17,91 +17,91 @@
 block discarded – undo
17 17
 class TicketDelete extends EntityMutator
18 18
 {
19 19
 
20
-    /**
21
-     * Defines the mutation data modification closure.
22
-     *
23
-     * @param EEM_Ticket $model
24
-     * @param Ticket     $type
25
-     * @return callable
26
-     */
27
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
28
-    {
29
-        /**
30
-         * Deletes an entity.
31
-         *
32
-         * @param array       $input   The input for the mutation
33
-         * @param AppContext  $context The AppContext passed down to all resolvers
34
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35
-         * @return array
36
-         */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
-            try {
39
-                /** @var EE_Ticket $entity */
40
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
20
+	/**
21
+	 * Defines the mutation data modification closure.
22
+	 *
23
+	 * @param EEM_Ticket $model
24
+	 * @param Ticket     $type
25
+	 * @return callable
26
+	 */
27
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
28
+	{
29
+		/**
30
+		 * Deletes an entity.
31
+		 *
32
+		 * @param array       $input   The input for the mutation
33
+		 * @param AppContext  $context The AppContext passed down to all resolvers
34
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35
+		 * @return array
36
+		 */
37
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38
+			try {
39
+				/** @var EE_Ticket $entity */
40
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
41 41
 
42
-                // Delete the entity
43
-                if (! empty($input['deletePermanently'])) {
44
-                    $result = TicketDelete::deleteTicketAndRelations($entity);
45
-                } else {
46
-                    // trash the ticket
47
-                    $result = TicketDelete::trashTicket($entity);
48
-                }
49
-                EntityMutator::validateResults($result);
42
+				// Delete the entity
43
+				if (! empty($input['deletePermanently'])) {
44
+					$result = TicketDelete::deleteTicketAndRelations($entity);
45
+				} else {
46
+					// trash the ticket
47
+					$result = TicketDelete::trashTicket($entity);
48
+				}
49
+				EntityMutator::validateResults($result);
50 50
 
51
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_delete', $entity, $input);
52
-            } catch (Exception $exception) {
53
-                EntityMutator::handleExceptions(
54
-                    $exception,
55
-                    esc_html__(
56
-                        'The ticket could not be deleted because of the following error(s)',
57
-                        'event_espresso'
58
-                    )
59
-                );
60
-            }
51
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_delete', $entity, $input);
52
+			} catch (Exception $exception) {
53
+				EntityMutator::handleExceptions(
54
+					$exception,
55
+					esc_html__(
56
+						'The ticket could not be deleted because of the following error(s)',
57
+						'event_espresso'
58
+					)
59
+				);
60
+			}
61 61
 
62
-            return [
63
-                'deleted' => $entity,
64
-            ];
65
-        };
66
-    }
62
+			return [
63
+				'deleted' => $entity,
64
+			];
65
+		};
66
+	}
67 67
 
68
-    /**
69
-     * Deletes a ticket permanently along with its relations.
70
-     *
71
-     * @param EE_Ticket $entity
72
-     * @return bool | int
73
-     * @throws ReflectionException
74
-     * @throws InvalidArgumentException
75
-     * @throws InvalidInterfaceException
76
-     * @throws InvalidDataTypeException
77
-     * @throws EE_Error
78
-     */
79
-    public static function deleteTicketAndRelations(EE_Ticket $entity)
80
-    {
81
-        // Remove related non-default prices for the ticket
82
-        $entity->delete_related_permanently('Price', [['PRC_is_default' => false]]);
83
-        // The ticket still might have relations with default taxes, lets divorce them
84
-        $entity->_remove_relations('Price');
85
-        // Remove relation with datetimes
86
-        $entity->_remove_relations('Datetime');
87
-        // Now delete the ticket permanently
88
-        return $entity->delete_permanently();
89
-    }
68
+	/**
69
+	 * Deletes a ticket permanently along with its relations.
70
+	 *
71
+	 * @param EE_Ticket $entity
72
+	 * @return bool | int
73
+	 * @throws ReflectionException
74
+	 * @throws InvalidArgumentException
75
+	 * @throws InvalidInterfaceException
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws EE_Error
78
+	 */
79
+	public static function deleteTicketAndRelations(EE_Ticket $entity)
80
+	{
81
+		// Remove related non-default prices for the ticket
82
+		$entity->delete_related_permanently('Price', [['PRC_is_default' => false]]);
83
+		// The ticket still might have relations with default taxes, lets divorce them
84
+		$entity->_remove_relations('Price');
85
+		// Remove relation with datetimes
86
+		$entity->_remove_relations('Datetime');
87
+		// Now delete the ticket permanently
88
+		return $entity->delete_permanently();
89
+	}
90 90
 
91
-    /**
92
-     * Trashes a ticket.
93
-     *
94
-     * @param EE_Ticket $entity
95
-     * @return bool | int
96
-     * @throws ReflectionException
97
-     * @throws InvalidArgumentException
98
-     * @throws InvalidInterfaceException
99
-     * @throws InvalidDataTypeException
100
-     * @throws EE_Error
101
-     */
102
-    public static function trashTicket(EE_Ticket $entity)
103
-    {
104
-        // trash the ticket
105
-        return $entity->delete();
106
-    }
91
+	/**
92
+	 * Trashes a ticket.
93
+	 *
94
+	 * @param EE_Ticket $entity
95
+	 * @return bool | int
96
+	 * @throws ReflectionException
97
+	 * @throws InvalidArgumentException
98
+	 * @throws InvalidInterfaceException
99
+	 * @throws InvalidDataTypeException
100
+	 * @throws EE_Error
101
+	 */
102
+	public static function trashTicket(EE_Ticket $entity)
103
+	{
104
+		// trash the ticket
105
+		return $entity->delete();
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
35 35
          * @return array
36 36
          */
37
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
37
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
38 38
             try {
39 39
                 /** @var EE_Ticket $entity */
40 40
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
41 41
 
42 42
                 // Delete the entity
43
-                if (! empty($input['deletePermanently'])) {
43
+                if ( ! empty($input['deletePermanently'])) {
44 44
                     $result = TicketDelete::deleteTicketAndRelations($entity);
45 45
                 } else {
46 46
                     // trash the ticket
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/FormSectionCreate.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -13,51 +13,51 @@
 block discarded – undo
13 13
 class FormSectionCreate extends EntityMutator
14 14
 {
15 15
 
16
-    /**
17
-     * Defines the mutation data modification closure.
18
-     *
19
-     * @param EEM_Form_Section $model
20
-     * @return callable
21
-     */
22
-    public static function mutateAndGetPayload(EEM_Form_Section $model)
23
-    {
24
-        /**
25
-         * Creates an entity.
26
-         *
27
-         * @param array       $input   The input for the mutation
28
-         * @param AppContext  $context The AppContext passed down to all resolvers
29
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
30
-         * @return array
31
-         */
32
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
33
-            $id = null;
34
-            try {
35
-                EntityMutator::checkPermissions($model);
36
-
37
-                $args = FormSectionMutation::prepareFields($input);
38
-
39
-                $entity = EE_Form_Section::new_instance($args);
40
-                $id = $entity->save();
41
-                EntityMutator::validateResults($id);
42
-
43
-                do_action(
44
-                    'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_create',
45
-                    $entity,
46
-                    $input
47
-                );
48
-            } catch (Exception $exception) {
49
-                EntityMutator::handleExceptions(
50
-                    $exception,
51
-                    esc_html__(
52
-                        'The form section could not be created because of the following error(s)',
53
-                        'event_espresso'
54
-                    )
55
-                );
56
-            }
57
-
58
-            return [
59
-                'id' => $id,
60
-            ];
61
-        };
62
-    }
16
+	/**
17
+	 * Defines the mutation data modification closure.
18
+	 *
19
+	 * @param EEM_Form_Section $model
20
+	 * @return callable
21
+	 */
22
+	public static function mutateAndGetPayload(EEM_Form_Section $model)
23
+	{
24
+		/**
25
+		 * Creates an entity.
26
+		 *
27
+		 * @param array       $input   The input for the mutation
28
+		 * @param AppContext  $context The AppContext passed down to all resolvers
29
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
30
+		 * @return array
31
+		 */
32
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
33
+			$id = null;
34
+			try {
35
+				EntityMutator::checkPermissions($model);
36
+
37
+				$args = FormSectionMutation::prepareFields($input);
38
+
39
+				$entity = EE_Form_Section::new_instance($args);
40
+				$id = $entity->save();
41
+				EntityMutator::validateResults($id);
42
+
43
+				do_action(
44
+					'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_section_create',
45
+					$entity,
46
+					$input
47
+				);
48
+			} catch (Exception $exception) {
49
+				EntityMutator::handleExceptions(
50
+					$exception,
51
+					esc_html__(
52
+						'The form section could not be created because of the following error(s)',
53
+						'event_espresso'
54
+					)
55
+				);
56
+			}
57
+
58
+			return [
59
+				'id' => $id,
60
+			];
61
+		};
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
30 30
          * @return array
31 31
          */
32
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
32
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model): array {
33 33
             $id = null;
34 34
             try {
35 35
                 EntityMutator::checkPermissions($model);
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeCreate.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
31 31
          * @return array
32 32
          */
33
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
33
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
34 34
             $id = null;
35 35
             try {
36 36
                 EntityMutator::checkPermissions($model);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
                 $id = $entity->save();
48 48
                 EntityMutator::validateResults($id);
49 49
 
50
-                if (! empty($tickets)) {
50
+                if ( ! empty($tickets)) {
51 51
                     DatetimeMutation::setRelatedTickets($entity, $tickets);
52 52
                 }
53 53
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 );
63 63
             }
64 64
 
65
-            return $id ? [ 'id' => $id ] : [];
65
+            return $id ? ['id' => $id] : [];
66 66
         };
67 67
     }
68 68
 }
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -13,67 +13,67 @@
 block discarded – undo
13 13
 class DatetimeCreate extends EntityMutator
14 14
 {
15 15
 
16
-    /**
17
-     * Defines the mutation data modification closure.
18
-     *
19
-     * @param EEM_Datetime $model
20
-     * @param Datetime     $type
21
-     * @return callable
22
-     */
23
-    public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
24
-    {
25
-        /**
26
-         * Creates an entity.
27
-         *
28
-         * @param array       $input   The input for the mutation
29
-         * @param AppContext  $context The AppContext passed down to all resolvers
30
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
31
-         * @return array
32
-         */
33
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
34
-            $id = null;
35
-            try {
36
-                EntityMutator::checkPermissions($model);
16
+	/**
17
+	 * Defines the mutation data modification closure.
18
+	 *
19
+	 * @param EEM_Datetime $model
20
+	 * @param Datetime     $type
21
+	 * @return callable
22
+	 */
23
+	public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
24
+	{
25
+		/**
26
+		 * Creates an entity.
27
+		 *
28
+		 * @param array       $input   The input for the mutation
29
+		 * @param AppContext  $context The AppContext passed down to all resolvers
30
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
31
+		 * @return array
32
+		 */
33
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
34
+			$id = null;
35
+			try {
36
+				EntityMutator::checkPermissions($model);
37 37
 
38
-                $tickets = [];
39
-                $args = DatetimeMutation::prepareFields($input);
38
+				$tickets = [];
39
+				$args = DatetimeMutation::prepareFields($input);
40 40
 
41
-                if (isset($args['tickets'])) {
42
-                    $tickets = $args['tickets'];
43
-                    unset($args['tickets']);
44
-                }
41
+				if (isset($args['tickets'])) {
42
+					$tickets = $args['tickets'];
43
+					unset($args['tickets']);
44
+				}
45 45
 
46 46
 
47
-                $venue = 'NO_VENUE_SET';
48
-                if (array_key_exists('venue', $args)) {
49
-                    $venue = $args['venue'];
50
-                    unset($args['venue']);
51
-                }
47
+				$venue = 'NO_VENUE_SET';
48
+				if (array_key_exists('venue', $args)) {
49
+					$venue = $args['venue'];
50
+					unset($args['venue']);
51
+				}
52 52
 
53
-                $entity = EE_Datetime::new_instance($args);
54
-                $id = $entity->save();
55
-                EntityMutator::validateResults($id);
53
+				$entity = EE_Datetime::new_instance($args);
54
+				$id = $entity->save();
55
+				EntityMutator::validateResults($id);
56 56
 
57
-                if (! empty($tickets)) {
58
-                    DatetimeMutation::setRelatedTickets($entity, $tickets);
59
-                }
57
+				if (! empty($tickets)) {
58
+					DatetimeMutation::setRelatedTickets($entity, $tickets);
59
+				}
60 60
 
61
-                if ($venue !== 'NO_VENUE_SET') {
62
-                    DatetimeMutation::setVenue($entity, $venue);
63
-                }
61
+				if ($venue !== 'NO_VENUE_SET') {
62
+					DatetimeMutation::setVenue($entity, $venue);
63
+				}
64 64
 
65
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_create', $entity, $input);
66
-            } catch (Exception $exception) {
67
-                EntityMutator::handleExceptions(
68
-                    $exception,
69
-                    esc_html__(
70
-                        'The datetime could not be created because of the following error(s)',
71
-                        'event_espresso'
72
-                    )
73
-                );
74
-            }
65
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_datetime_create', $entity, $input);
66
+			} catch (Exception $exception) {
67
+				EntityMutator::handleExceptions(
68
+					$exception,
69
+					esc_html__(
70
+						'The datetime could not be created because of the following error(s)',
71
+						'event_espresso'
72
+					)
73
+				);
74
+			}
75 75
 
76
-            return $id ? [ 'id' => $id ] : [];
77
-        };
78
-    }
76
+			return $id ? [ 'id' => $id ] : [];
77
+		};
78
+	}
79 79
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/EntityReorder.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -20,153 +20,153 @@
 block discarded – undo
20 20
 
21 21
 class EntityReorder
22 22
 {
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @return callable
27
-     */
28
-    public static function mutateAndGetPayload()
29
-    {
30
-        /**
31
-         * Updates an entity.
32
-         *
33
-         * @param array       $input   The input for the mutation
34
-         * @param AppContext  $context The AppContext passed down to all resolvers
35
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
36
-         * @return array
37
-         * @throws UserError
38
-         * @throws InvalidArgumentException
39
-         * @throws InvalidInterfaceException
40
-         * @throws InvalidDataTypeException
41
-         * @throws Exception
42
-         */
43
-        return static function (array $input, AppContext $context, ResolveInfo $info): array {
44
-            /**
45
-             * Stop now if a user isn't allowed to reorder.
46
-             */
47
-            if (! current_user_can('ee_edit_events')) {
48
-                throw new UserError(
49
-                    esc_html__('Sorry, you do not have the required permissions to reorder entities', 'event_espresso')
50
-                );
51
-            }
52
-
53
-            $details = EntityReorder::prepareEntityDetailsFromInput($input);
54
-
55
-            $orderKey  = $details['keyPrefix'] . '_order'; // e.g. "TKT_order"
56
-
57
-            $ok = false;
58
-
59
-            // We do not want to continue reorder if one fails.
60
-            // Thus wrap whole loop in try-catch
61
-            try {
62
-                foreach ($details['entityDbids'] as $order => $entityDbid) {
63
-                    $args = [
64
-                        $orderKey => $order + 1,
65
-                    ];
66
-                    $details['entities'][ $entityDbid ]->save($args);
67
-                }
68
-                $ok = true;
69
-            } catch (Exception $exception) {
70
-                new ExceptionStackTraceDisplay(
71
-                    new RuntimeException(
72
-                        sprintf(
73
-                            esc_html__(
74
-                                'Failed to update order because of the following error(s): %1$s',
75
-                                'event_espresso'
76
-                            ),
77
-                            $exception->getMessage()
78
-                        )
79
-                    )
80
-                );
81
-            }
82
-
83
-            return compact('ok');
84
-        };
85
-    }
86
-
87
-
88
-    /**
89
-     * Prepares entity details to use for mutations
90
-     *
91
-     * @param array $input The input for the mutation
92
-     * @return array
93
-     * @throws EE_Error
94
-     * @throws ReflectionException
95
-     */
96
-    public static function prepareEntityDetailsFromInput(array $input): array
97
-    {
98
-        $entityGuids = ! empty($input['entityIds']) ? array_map('sanitize_text_field', (array) $input['entityIds']) : [];
99
-        $entityType  = ! empty($input['entityType']) ? sanitize_text_field($input['entityType']) : null;
100
-
101
-        /**
102
-         * Make sure we have the IDs and entity type
103
-         */
104
-        if (empty($entityGuids) || empty($entityType)) {
105
-            throw new UserError(
106
-                // translators: the placeholders are the names of the fields
107
-                sprintf(esc_html__('%1$s and %2$s are required.', 'event_espresso'), 'entityIds', 'entityType')
108
-            );
109
-        }
110
-
111
-        $model = EE_Registry::instance()->load_model($entityType);
112
-
113
-        if (!($model instanceof EEM_Base)) {
114
-            throw new UserError(
115
-                esc_html__(
116
-                    'A valid data model could not be obtained. Did you supply a valid entity type?',
117
-                    'event_espresso'
118
-                )
119
-            );
120
-        }
121
-
122
-        // convert GUIDs to DB IDs
123
-        $entity_db_ids = array_map(
124
-            function ($entityGuid) {
125
-                $id_parts = Relay::fromGlobalId($entityGuid);
126
-                return ! empty($id_parts['id']) ? absint($id_parts['id']) : 0;
127
-            },
128
-            $entityGuids
129
-        );
130
-        // remove 0 values
131
-        $entity_db_ids = array_filter($entity_db_ids);
132
-
133
-        /**
134
-         * If we could not get DB IDs for some GUIDs
135
-         */
136
-        if (count($entity_db_ids) !== count($entityGuids)) {
137
-            throw new UserError(
138
-                esc_html__('Sorry, operation cancelled due to missing or invalid entity IDs.', 'event_espresso')
139
-            );
140
-        }
141
-
142
-        // e.g. DTT_ID, TKT_ID
143
-        $primaryKey = $model->get_primary_key_field()->get_name();
144
-        // e.g. "DTT_ID" will give us "DTT"
145
-        $keyPrefix = explode('_', $primaryKey)[0];
146
-        $deletedKey  = $keyPrefix . '_deleted'; // e.g. "TKT_deleted"
147
-
148
-        $entities = $model::instance()->get_all([
149
-            [
150
-                $primaryKey => ['IN', $entity_db_ids],
151
-                $deletedKey => ['IN', [true, false]],
152
-            ],
153
-        ]);
154
-
155
-        /**
156
-         * If we could not get exactly same number of entities for the given DB IDs
157
-         */
158
-        if (count($entity_db_ids) !== count($entities)) {
159
-            throw new UserError(esc_html__('Sorry, operation cancelled due to missing entities.', 'event_espresso'));
160
-        }
161
-
162
-        // Make sure we have an instance for every ID.
163
-        foreach ($entity_db_ids as $entity_db_id) {
164
-            if (isset($entities[ $entity_db_id ]) && $entities[ $entity_db_id ] instanceof EE_Base_Class) {
165
-                continue;
166
-            }
167
-            throw new UserError(esc_html__('Sorry, operation cancelled due to invalid entities.', 'event_espresso'));
168
-        }
169
-
170
-        return compact('entities', 'entityGuids', 'entity_db_ids', 'entityType', 'keyPrefix');
171
-    }
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @return callable
27
+	 */
28
+	public static function mutateAndGetPayload()
29
+	{
30
+		/**
31
+		 * Updates an entity.
32
+		 *
33
+		 * @param array       $input   The input for the mutation
34
+		 * @param AppContext  $context The AppContext passed down to all resolvers
35
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
36
+		 * @return array
37
+		 * @throws UserError
38
+		 * @throws InvalidArgumentException
39
+		 * @throws InvalidInterfaceException
40
+		 * @throws InvalidDataTypeException
41
+		 * @throws Exception
42
+		 */
43
+		return static function (array $input, AppContext $context, ResolveInfo $info): array {
44
+			/**
45
+			 * Stop now if a user isn't allowed to reorder.
46
+			 */
47
+			if (! current_user_can('ee_edit_events')) {
48
+				throw new UserError(
49
+					esc_html__('Sorry, you do not have the required permissions to reorder entities', 'event_espresso')
50
+				);
51
+			}
52
+
53
+			$details = EntityReorder::prepareEntityDetailsFromInput($input);
54
+
55
+			$orderKey  = $details['keyPrefix'] . '_order'; // e.g. "TKT_order"
56
+
57
+			$ok = false;
58
+
59
+			// We do not want to continue reorder if one fails.
60
+			// Thus wrap whole loop in try-catch
61
+			try {
62
+				foreach ($details['entityDbids'] as $order => $entityDbid) {
63
+					$args = [
64
+						$orderKey => $order + 1,
65
+					];
66
+					$details['entities'][ $entityDbid ]->save($args);
67
+				}
68
+				$ok = true;
69
+			} catch (Exception $exception) {
70
+				new ExceptionStackTraceDisplay(
71
+					new RuntimeException(
72
+						sprintf(
73
+							esc_html__(
74
+								'Failed to update order because of the following error(s): %1$s',
75
+								'event_espresso'
76
+							),
77
+							$exception->getMessage()
78
+						)
79
+					)
80
+				);
81
+			}
82
+
83
+			return compact('ok');
84
+		};
85
+	}
86
+
87
+
88
+	/**
89
+	 * Prepares entity details to use for mutations
90
+	 *
91
+	 * @param array $input The input for the mutation
92
+	 * @return array
93
+	 * @throws EE_Error
94
+	 * @throws ReflectionException
95
+	 */
96
+	public static function prepareEntityDetailsFromInput(array $input): array
97
+	{
98
+		$entityGuids = ! empty($input['entityIds']) ? array_map('sanitize_text_field', (array) $input['entityIds']) : [];
99
+		$entityType  = ! empty($input['entityType']) ? sanitize_text_field($input['entityType']) : null;
100
+
101
+		/**
102
+		 * Make sure we have the IDs and entity type
103
+		 */
104
+		if (empty($entityGuids) || empty($entityType)) {
105
+			throw new UserError(
106
+				// translators: the placeholders are the names of the fields
107
+				sprintf(esc_html__('%1$s and %2$s are required.', 'event_espresso'), 'entityIds', 'entityType')
108
+			);
109
+		}
110
+
111
+		$model = EE_Registry::instance()->load_model($entityType);
112
+
113
+		if (!($model instanceof EEM_Base)) {
114
+			throw new UserError(
115
+				esc_html__(
116
+					'A valid data model could not be obtained. Did you supply a valid entity type?',
117
+					'event_espresso'
118
+				)
119
+			);
120
+		}
121
+
122
+		// convert GUIDs to DB IDs
123
+		$entity_db_ids = array_map(
124
+			function ($entityGuid) {
125
+				$id_parts = Relay::fromGlobalId($entityGuid);
126
+				return ! empty($id_parts['id']) ? absint($id_parts['id']) : 0;
127
+			},
128
+			$entityGuids
129
+		);
130
+		// remove 0 values
131
+		$entity_db_ids = array_filter($entity_db_ids);
132
+
133
+		/**
134
+		 * If we could not get DB IDs for some GUIDs
135
+		 */
136
+		if (count($entity_db_ids) !== count($entityGuids)) {
137
+			throw new UserError(
138
+				esc_html__('Sorry, operation cancelled due to missing or invalid entity IDs.', 'event_espresso')
139
+			);
140
+		}
141
+
142
+		// e.g. DTT_ID, TKT_ID
143
+		$primaryKey = $model->get_primary_key_field()->get_name();
144
+		// e.g. "DTT_ID" will give us "DTT"
145
+		$keyPrefix = explode('_', $primaryKey)[0];
146
+		$deletedKey  = $keyPrefix . '_deleted'; // e.g. "TKT_deleted"
147
+
148
+		$entities = $model::instance()->get_all([
149
+			[
150
+				$primaryKey => ['IN', $entity_db_ids],
151
+				$deletedKey => ['IN', [true, false]],
152
+			],
153
+		]);
154
+
155
+		/**
156
+		 * If we could not get exactly same number of entities for the given DB IDs
157
+		 */
158
+		if (count($entity_db_ids) !== count($entities)) {
159
+			throw new UserError(esc_html__('Sorry, operation cancelled due to missing entities.', 'event_espresso'));
160
+		}
161
+
162
+		// Make sure we have an instance for every ID.
163
+		foreach ($entity_db_ids as $entity_db_id) {
164
+			if (isset($entities[ $entity_db_id ]) && $entities[ $entity_db_id ] instanceof EE_Base_Class) {
165
+				continue;
166
+			}
167
+			throw new UserError(esc_html__('Sorry, operation cancelled due to invalid entities.', 'event_espresso'));
168
+		}
169
+
170
+		return compact('entities', 'entityGuids', 'entity_db_ids', 'entityType', 'keyPrefix');
171
+	}
172 172
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
          * @throws InvalidDataTypeException
41 41
          * @throws Exception
42 42
          */
43
-        return static function (array $input, AppContext $context, ResolveInfo $info): array {
43
+        return static function(array $input, AppContext $context, ResolveInfo $info): array {
44 44
             /**
45 45
              * Stop now if a user isn't allowed to reorder.
46 46
              */
47
-            if (! current_user_can('ee_edit_events')) {
47
+            if ( ! current_user_can('ee_edit_events')) {
48 48
                 throw new UserError(
49 49
                     esc_html__('Sorry, you do not have the required permissions to reorder entities', 'event_espresso')
50 50
                 );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
             $details = EntityReorder::prepareEntityDetailsFromInput($input);
54 54
 
55
-            $orderKey  = $details['keyPrefix'] . '_order'; // e.g. "TKT_order"
55
+            $orderKey = $details['keyPrefix'].'_order'; // e.g. "TKT_order"
56 56
 
57 57
             $ok = false;
58 58
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                     $args = [
64 64
                         $orderKey => $order + 1,
65 65
                     ];
66
-                    $details['entities'][ $entityDbid ]->save($args);
66
+                    $details['entities'][$entityDbid]->save($args);
67 67
                 }
68 68
                 $ok = true;
69 69
             } catch (Exception $exception) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         $model = EE_Registry::instance()->load_model($entityType);
112 112
 
113
-        if (!($model instanceof EEM_Base)) {
113
+        if ( ! ($model instanceof EEM_Base)) {
114 114
             throw new UserError(
115 115
                 esc_html__(
116 116
                     'A valid data model could not be obtained. Did you supply a valid entity type?',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
         // convert GUIDs to DB IDs
123 123
         $entity_db_ids = array_map(
124
-            function ($entityGuid) {
124
+            function($entityGuid) {
125 125
                 $id_parts = Relay::fromGlobalId($entityGuid);
126 126
                 return ! empty($id_parts['id']) ? absint($id_parts['id']) : 0;
127 127
             },
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         $primaryKey = $model->get_primary_key_field()->get_name();
144 144
         // e.g. "DTT_ID" will give us "DTT"
145 145
         $keyPrefix = explode('_', $primaryKey)[0];
146
-        $deletedKey  = $keyPrefix . '_deleted'; // e.g. "TKT_deleted"
146
+        $deletedKey = $keyPrefix.'_deleted'; // e.g. "TKT_deleted"
147 147
 
148 148
         $entities = $model::instance()->get_all([
149 149
             [
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         // Make sure we have an instance for every ID.
163 163
         foreach ($entity_db_ids as $entity_db_id) {
164
-            if (isset($entities[ $entity_db_id ]) && $entities[ $entity_db_id ] instanceof EE_Base_Class) {
164
+            if (isset($entities[$entity_db_id]) && $entities[$entity_db_id] instanceof EE_Base_Class) {
165 165
                 continue;
166 166
             }
167 167
             throw new UserError(esc_html__('Sorry, operation cancelled due to invalid entities.', 'event_espresso'));
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/PriceCreate.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -14,55 +14,55 @@
 block discarded – undo
14 14
 class PriceCreate extends EntityMutator
15 15
 {
16 16
 
17
-    /**
18
-     * Defines the mutation data modification closure.
19
-     *
20
-     * @param EEM_Price $model
21
-     * @param Price     $type
22
-     * @return callable
23
-     */
24
-    public static function mutateAndGetPayload(EEM_Price $model, Price $type)
25
-    {
26
-        /**
27
-         * Creates an entity.
28
-         *
29
-         * @param array       $input   The input for the mutation
30
-         * @param AppContext  $context The AppContext passed down to all resolvers
31
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
32
-         * @return array
33
-         */
34
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
35
-            $id = null;
36
-            try {
37
-                EntityMutator::checkPermissions($model);
17
+	/**
18
+	 * Defines the mutation data modification closure.
19
+	 *
20
+	 * @param EEM_Price $model
21
+	 * @param Price     $type
22
+	 * @return callable
23
+	 */
24
+	public static function mutateAndGetPayload(EEM_Price $model, Price $type)
25
+	{
26
+		/**
27
+		 * Creates an entity.
28
+		 *
29
+		 * @param array       $input   The input for the mutation
30
+		 * @param AppContext  $context The AppContext passed down to all resolvers
31
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
32
+		 * @return array
33
+		 */
34
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
35
+			$id = null;
36
+			try {
37
+				EntityMutator::checkPermissions($model);
38 38
 
39
-                $args = PriceMutation::prepareFields($input);
39
+				$args = PriceMutation::prepareFields($input);
40 40
 
41
-                if (empty($args['PRT_ID'])) {
42
-                    // translators: the placeholder is the name of the field.
43
-                    throw new UserError(
44
-                        sprintf(esc_html__('A valid %1$s must be passed.', 'event_espresso'), 'priceType')
45
-                    );
46
-                }
41
+				if (empty($args['PRT_ID'])) {
42
+					// translators: the placeholder is the name of the field.
43
+					throw new UserError(
44
+						sprintf(esc_html__('A valid %1$s must be passed.', 'event_espresso'), 'priceType')
45
+					);
46
+				}
47 47
 
48
-                $entity = EE_Price::new_instance($args);
49
-                $id = $entity->save();
50
-                EntityMutator::validateResults($id);
48
+				$entity = EE_Price::new_instance($args);
49
+				$id = $entity->save();
50
+				EntityMutator::validateResults($id);
51 51
 
52
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_create', $entity, $input);
53
-            } catch (Exception $exception) {
54
-                EntityMutator::handleExceptions(
55
-                    $exception,
56
-                    esc_html__(
57
-                        'The price could not be created because of the following error(s)',
58
-                        'event_espresso'
59
-                    )
60
-                );
61
-            }
52
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_price_create', $entity, $input);
53
+			} catch (Exception $exception) {
54
+				EntityMutator::handleExceptions(
55
+					$exception,
56
+					esc_html__(
57
+						'The price could not be created because of the following error(s)',
58
+						'event_espresso'
59
+					)
60
+				);
61
+			}
62 62
 
63
-            return [
64
-                'id' => $id,
65
-            ];
66
-        };
67
-    }
63
+			return [
64
+				'id' => $id,
65
+			];
66
+		};
67
+	}
68 68
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
32 32
          * @return array
33 33
          */
34
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
34
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
35 35
             $id = null;
36 36
             try {
37 37
                 EntityMutator::checkPermissions($model);
Please login to merge, or discard this patch.