Completed
Branch dependabot/composer/wp-graphql... (64393b)
by
unknown
04:29
created
core/domain/services/graphql/mutators/FormElementDelete.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
 class FormElementDelete extends EntityMutator
12 12
 {
13 13
 
14
-    /**
15
-     * Defines the mutation data modification closure.
16
-     *
17
-     * @param EEM_Form_Element $model
18
-     * @return callable
19
-     */
20
-    public static function mutateAndGetPayload(EEM_Form_Element $model)
21
-    {
22
-        /**
23
-         * Deletes an entity.
24
-         *
25
-         * @param array       $input   The input for the mutation
26
-         * @param AppContext  $context The AppContext passed down to all resolvers
27
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
28
-         * @return array
29
-         */
30
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
31
-            try {
32
-                /** @var EE_Form_Element $entity */
33
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
14
+	/**
15
+	 * Defines the mutation data modification closure.
16
+	 *
17
+	 * @param EEM_Form_Element $model
18
+	 * @return callable
19
+	 */
20
+	public static function mutateAndGetPayload(EEM_Form_Element $model)
21
+	{
22
+		/**
23
+		 * Deletes an entity.
24
+		 *
25
+		 * @param array       $input   The input for the mutation
26
+		 * @param AppContext  $context The AppContext passed down to all resolvers
27
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
28
+		 * @return array
29
+		 */
30
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
31
+			try {
32
+				/** @var EE_Form_Element $entity */
33
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
34 34
 
35
-                $result = $entity->delete();
36
-                EntityMutator::validateResults($result);
35
+				$result = $entity->delete();
36
+				EntityMutator::validateResults($result);
37 37
 
38
-                do_action(
39
-                    'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_element_delete',
40
-                    $entity,
41
-                    $input
42
-                );
43
-            } catch (Exception $exception) {
44
-                EntityMutator::handleExceptions(
45
-                    $exception,
46
-                    esc_html__(
47
-                        'The form element could not be deleted because of the following error(s)',
48
-                        'event_espresso'
49
-                    )
50
-                );
51
-            }
38
+				do_action(
39
+					'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_element_delete',
40
+					$entity,
41
+					$input
42
+				);
43
+			} catch (Exception $exception) {
44
+				EntityMutator::handleExceptions(
45
+					$exception,
46
+					esc_html__(
47
+						'The form element could not be deleted because of the following error(s)',
48
+						'event_espresso'
49
+					)
50
+				);
51
+			}
52 52
 
53
-            return [
54
-                'deleted' => $entity,
55
-            ];
56
-        };
57
-    }
53
+			return [
54
+				'deleted' => $entity,
55
+			];
56
+		};
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
          * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
28 28
          * @return array
29 29
          */
30
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
30
+        return static function(array $input, AppContext $context, ResolveInfo $info) use ($model): array {
31 31
             try {
32 32
                 /** @var EE_Form_Element $entity */
33 33
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/FormElementCreate.php 2 patches
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.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -11,51 +11,51 @@
 block discarded – undo
11 11
 
12 12
 class FormElementCreate extends EntityMutator
13 13
 {
14
-    /**
15
-     * Defines the mutation data modification closure.
16
-     *
17
-     * @param EEM_Form_Element $model
18
-     * @return callable
19
-     */
20
-    public static function mutateAndGetPayload(EEM_Form_Element $model)
21
-    {
22
-        /**
23
-         * Creates an entity.
24
-         *
25
-         * @param array       $input   The input for the mutation
26
-         * @param AppContext  $context The AppContext passed down to all resolvers
27
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
28
-         * @return array
29
-         */
30
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
31
-            $id = null;
32
-            try {
33
-                EntityMutator::checkPermissions($model);
14
+	/**
15
+	 * Defines the mutation data modification closure.
16
+	 *
17
+	 * @param EEM_Form_Element $model
18
+	 * @return callable
19
+	 */
20
+	public static function mutateAndGetPayload(EEM_Form_Element $model)
21
+	{
22
+		/**
23
+		 * Creates an entity.
24
+		 *
25
+		 * @param array       $input   The input for the mutation
26
+		 * @param AppContext  $context The AppContext passed down to all resolvers
27
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
28
+		 * @return array
29
+		 */
30
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model): array {
31
+			$id = null;
32
+			try {
33
+				EntityMutator::checkPermissions($model);
34 34
 
35
-                $args = FormElementMutation::prepareFields($input);
35
+				$args = FormElementMutation::prepareFields($input);
36 36
 
37
-                $entity = EE_Form_Element::new_instance($args);
38
-                $id = $entity->save();
39
-                EntityMutator::validateResults($id);
37
+				$entity = EE_Form_Element::new_instance($args);
38
+				$id = $entity->save();
39
+				EntityMutator::validateResults($id);
40 40
 
41
-                do_action(
42
-                    'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_element_create',
43
-                    $entity,
44
-                    $input
45
-                );
46
-            } catch (Exception $exception) {
47
-                EntityMutator::handleExceptions(
48
-                    $exception,
49
-                    esc_html__(
50
-                        'The form element could not be created because of the following error(s)',
51
-                        'event_espresso'
52
-                    )
53
-                );
54
-            }
41
+				do_action(
42
+					'AHEE__EventEspresso_core_domain_services_graphql_mutators_form_element_create',
43
+					$entity,
44
+					$input
45
+				);
46
+			} catch (Exception $exception) {
47
+				EntityMutator::handleExceptions(
48
+					$exception,
49
+					esc_html__(
50
+						'The form element could not be created because of the following error(s)',
51
+						'event_espresso'
52
+					)
53
+				);
54
+			}
55 55
 
56
-            return [
57
-                'id' => $id,
58
-            ];
59
-        };
60
-    }
56
+			return [
57
+				'id' => $id,
58
+			];
59
+		};
60
+	}
61 61
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/FormElementUpdate.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 FormElementUpdate extends EntityMutator
15 15
 {
16 16
 
17
-    /**
18
-     * Defines the mutation data modification closure.
19
-     *
20
-     * @param EEM_Form_Element $model
21
-     * @return callable
22
-     */
23
-    public static function mutateAndGetPayload(EEM_Form_Element $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_Element $entity */
38
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
17
+	/**
18
+	 * Defines the mutation data modification closure.
19
+	 *
20
+	 * @param EEM_Form_Element $model
21
+	 * @return callable
22
+	 */
23
+	public static function mutateAndGetPayload(EEM_Form_Element $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_Element $entity */
38
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
39 39
 
40
-                $args = FormElementMutation::prepareFields($input);
40
+				$args = FormElementMutation::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_element_update',
47
-                    $entity,
48
-                    $input
49
-                );
50
-            } catch (Exception $exception) {
51
-                EntityMutator::handleExceptions(
52
-                    $exception,
53
-                    esc_html__(
54
-                        'The form element 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_element_update',
47
+					$entity,
48
+					$input
49
+				);
50
+			} catch (Exception $exception) {
51
+				EntityMutator::handleExceptions(
52
+					$exception,
53
+					esc_html__(
54
+						'The form element 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_Element $entity */
38 38
                 $entity = EntityMutator::getEntityFromInputData($model, $input);
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/FormSectionMutation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $args['FSC_status'] = sanitize_text_field($input['status']);
50 50
         }
51 51
 
52
-        if (! empty($input['wpUser'])) {
52
+        if ( ! empty($input['wpUser'])) {
53 53
             $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
54 54
             $args['FSC_wpUser'] = ! empty($parts['id']) ? $parts['id'] : null;
55 55
         }
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,54 +14,54 @@
 block discarded – undo
14 14
  */
15 15
 class FormSectionMutation
16 16
 {
17
-    /**
18
-     * Maps the GraphQL input to a format that the model functions can use
19
-     *
20
-     * @param array $input Data coming from the GraphQL mutation query input
21
-     * @return array
22
-     */
23
-    public static function prepareFields(array $input): array
24
-    {
25
-        $args = [];
17
+	/**
18
+	 * Maps the GraphQL input to a format that the model functions can use
19
+	 *
20
+	 * @param array $input Data coming from the GraphQL mutation query input
21
+	 * @return array
22
+	 */
23
+	public static function prepareFields(array $input): array
24
+	{
25
+		$args = [];
26 26
 
27
-        if (isset($input['id'])) {
28
-            $args['FSC_UUID'] = sanitize_text_field($input['id']);
29
-        }
27
+		if (isset($input['id'])) {
28
+			$args['FSC_UUID'] = sanitize_text_field($input['id']);
29
+		}
30 30
 
31
-        if (isset($input['appliesTo'])) {
32
-            $args['FSC_appliesTo'] = sanitize_text_field($input['appliesTo']);
33
-        }
31
+		if (isset($input['appliesTo'])) {
32
+			$args['FSC_appliesTo'] = sanitize_text_field($input['appliesTo']);
33
+		}
34 34
 
35
-        if (isset($input['attributes'])) {
36
-            $args['FSC_attributes'] = Attributes::fromJson(sanitize_text_field($input['attributes']))->toJson();
37
-        }
35
+		if (isset($input['attributes'])) {
36
+			$args['FSC_attributes'] = Attributes::fromJson(sanitize_text_field($input['attributes']))->toJson();
37
+		}
38 38
 
39
-        if (isset($input['belongsTo'])) {
40
-            $args['FSC_belongsTo'] = sanitize_text_field($input['belongsTo']);
41
-        }
39
+		if (isset($input['belongsTo'])) {
40
+			$args['FSC_belongsTo'] = sanitize_text_field($input['belongsTo']);
41
+		}
42 42
 
43
-        if (isset($input['label'])) {
44
-            $args['FSC_label'] = FormLabel::fromJson(sanitize_text_field($input['label']))->toJson();
45
-        }
43
+		if (isset($input['label'])) {
44
+			$args['FSC_label'] = FormLabel::fromJson(sanitize_text_field($input['label']))->toJson();
45
+		}
46 46
 
47
-        // order can be 0
48
-        if (array_key_exists('order', $input)) {
49
-            $args['FSC_order'] = absint($input['order']);
50
-        }
47
+		// order can be 0
48
+		if (array_key_exists('order', $input)) {
49
+			$args['FSC_order'] = absint($input['order']);
50
+		}
51 51
 
52
-        if (isset($input['status'])) {
53
-            $args['FSC_status'] = sanitize_text_field($input['status']);
54
-        }
52
+		if (isset($input['status'])) {
53
+			$args['FSC_status'] = sanitize_text_field($input['status']);
54
+		}
55 55
 
56
-        if (! empty($input['wpUser'])) {
57
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
58
-            $args['FSC_wpUser'] = ! empty($parts['id']) ? $parts['id'] : null;
59
-        }
56
+		if (! empty($input['wpUser'])) {
57
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
58
+			$args['FSC_wpUser'] = ! empty($parts['id']) ? $parts['id'] : null;
59
+		}
60 60
 
61
-        return apply_filters(
62
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__form_section_args',
63
-            $args,
64
-            $input
65
-        );
66
-    }
61
+		return apply_filters(
62
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__form_section_args',
63
+			$args,
64
+			$input
65
+		);
66
+	}
67 67
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/loaders/FormElementLoader.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@
 block discarded – undo
15 15
  */
16 16
 class FormElementLoader extends AbstractLoader
17 17
 {
18
-    /**
19
-     * @return EEM_Base
20
-     * @throws EE_Error
21
-     * @throws InvalidArgumentException
22
-     * @throws InvalidDataTypeException
23
-     * @throws InvalidInterfaceException
24
-     * @throws ReflectionException
25
-     */
26
-    protected function getQuery(): EEM_Base
27
-    {
28
-        return EEM_Form_Element::instance();
29
-    }
18
+	/**
19
+	 * @return EEM_Base
20
+	 * @throws EE_Error
21
+	 * @throws InvalidArgumentException
22
+	 * @throws InvalidDataTypeException
23
+	 * @throws InvalidInterfaceException
24
+	 * @throws ReflectionException
25
+	 */
26
+	protected function getQuery(): EEM_Base
27
+	{
28
+		return EEM_Form_Element::instance();
29
+	}
30 30
 
31
-    /**
32
-     * @param array $keys
33
-     * @return array
34
-     */
35
-    protected function getWhereParams(array $keys): array
36
-    {
37
-        return [
38
-            'FIN_UUID' => ['IN', $keys],
39
-        ];
40
-    }
31
+	/**
32
+	 * @param array $keys
33
+	 * @return array
34
+	 */
35
+	protected function getWhereParams(array $keys): array
36
+	{
37
+		return [
38
+			'FIN_UUID' => ['IN', $keys],
39
+		];
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/services/form/meta/JsonableInterface.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
  */
12 12
 interface JsonableInterface
13 13
 {
14
-    /**
15
-     * @param string $json
16
-     * @return mixed
17
-     */
18
-    public static function fromJson(string $json);
14
+	/**
15
+	 * @param string $json
16
+	 * @return mixed
17
+	 */
18
+	public static function fromJson(string $json);
19 19
 
20 20
 
21
-    /**
22
-     * @return string
23
-     */
24
-    public function toJson(): string;
21
+	/**
22
+	 * @return string
23
+	 */
24
+	public function toJson(): string;
25 25
 }
Please login to merge, or discard this patch.
core/services/form/meta/FormStatus.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     {
70 70
         $values = [];
71 71
         foreach ($this->valid_status_options as $value => $description) {
72
-            $values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
72
+            $values[GQLUtils::formatEnumKey($value)] = compact('value', 'description');
73 73
         }
74 74
         return $values;
75 75
     }
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -14,74 +14,74 @@
 block discarded – undo
14 14
  */
15 15
 class FormStatus
16 16
 {
17
-    /**
18
-     * indicates that element is not archived or trashed
19
-     */
20
-    public const ACTIVE = 'active';
17
+	/**
18
+	 * indicates that element is not archived or trashed
19
+	 */
20
+	public const ACTIVE = 'active';
21 21
 
22
-    /**
23
-     * indicates that element is archived and should no longer be displayed on public forms
24
-     * but may still be required due to existing answers when form was completed prior to input being archived
25
-     */
26
-    public const ARCHIVED = 'archived';
22
+	/**
23
+	 * indicates that element is archived and should no longer be displayed on public forms
24
+	 * but may still be required due to existing answers when form was completed prior to input being archived
25
+	 */
26
+	public const ARCHIVED = 'archived';
27 27
 
28
-    /**
29
-     * indicates that element should be automatically added to newly created forms
30
-     */
31
-    public const DEFAULT = 'default';
28
+	/**
29
+	 * indicates that element should be automatically added to newly created forms
30
+	 */
31
+	public const DEFAULT = 'default';
32 32
 
33
-    /**
34
-     * indicates that a copy of the form section will be saved for use in other events but not loaded by default
35
-     */
36
-    public const SHARED = 'shared';
33
+	/**
34
+	 * indicates that a copy of the form section will be saved for use in other events but not loaded by default
35
+	 */
36
+	public const SHARED = 'shared';
37 37
 
38
-    /**
39
-     * indicates that element is no longer needed, has no existing answers, and can be moved to the trash
40
-     */
41
-    public const TRASHED = 'trashed';
38
+	/**
39
+	 * indicates that element is no longer needed, has no existing answers, and can be moved to the trash
40
+	 */
41
+	public const TRASHED = 'trashed';
42 42
 
43
-    /**
44
-     * @var array
45
-     */
46
-    private $valid_status_options;
43
+	/**
44
+	 * @var array
45
+	 */
46
+	private $valid_status_options;
47 47
 
48 48
 
49
-    public function __construct()
50
-    {
51
-        $this->valid_status_options = apply_filters(
52
-            'FHEE__EventEspresso_core_services_form_meta_FormStatus__valid_status_options',
53
-            [
54
-                FormStatus::ACTIVE   => esc_html__('Active', 'event_espresso'),
55
-                FormStatus::ARCHIVED => esc_html__('Archived', 'event_espresso'),
56
-                FormStatus::DEFAULT  => esc_html__('Default', 'event_espresso'),
57
-                FormStatus::SHARED   => esc_html__('Shared', 'event_espresso'),
58
-                FormStatus::TRASHED  => esc_html__('Trashed', 'event_espresso'),
59
-            ]
60
-        );
61
-    }
49
+	public function __construct()
50
+	{
51
+		$this->valid_status_options = apply_filters(
52
+			'FHEE__EventEspresso_core_services_form_meta_FormStatus__valid_status_options',
53
+			[
54
+				FormStatus::ACTIVE   => esc_html__('Active', 'event_espresso'),
55
+				FormStatus::ARCHIVED => esc_html__('Archived', 'event_espresso'),
56
+				FormStatus::DEFAULT  => esc_html__('Default', 'event_espresso'),
57
+				FormStatus::SHARED   => esc_html__('Shared', 'event_espresso'),
58
+				FormStatus::TRASHED  => esc_html__('Trashed', 'event_espresso'),
59
+			]
60
+		);
61
+	}
62 62
 
63 63
 
64
-    /**
65
-     * @return array
66
-     */
67
-    public function getFormStatusValues(): array
68
-    {
69
-        $values = [];
70
-        foreach ($this->valid_status_options as $value => $description) {
71
-            $values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
72
-        }
73
-        return $values;
74
-    }
64
+	/**
65
+	 * @return array
66
+	 */
67
+	public function getFormStatusValues(): array
68
+	{
69
+		$values = [];
70
+		foreach ($this->valid_status_options as $value => $description) {
71
+			$values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
72
+		}
73
+		return $values;
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @param bool $constants_only
79
-     * @return array
80
-     */
81
-    public function validStatusOptions(bool $constants_only = false): array
82
-    {
83
-        return $constants_only
84
-            ? array_keys($this->valid_status_options)
85
-            : $this->valid_status_options;
86
-    }
77
+	/**
78
+	 * @param bool $constants_only
79
+	 * @return array
80
+	 */
81
+	public function validStatusOptions(bool $constants_only = false): array
82
+	{
83
+		return $constants_only
84
+			? array_keys($this->valid_status_options)
85
+			: $this->valid_status_options;
86
+	}
87 87
 }
Please login to merge, or discard this patch.
core/services/form/meta/InputTypes.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
     {
117 117
         $values = [];
118 118
         foreach ($this->valid_type_options as $value => $description) {
119
-            $values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
119
+            $values[GQLUtils::formatEnumKey($value)] = compact('value', 'description');
120 120
         }
121 121
         return $values;
122 122
     }
Please login to merge, or discard this patch.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -22,124 +22,124 @@
 block discarded – undo
22 22
  */
23 23
 class InputTypes
24 24
 {
25
-    /**
26
-     * @var Block
27
-     */
28
-    private $block;
29
-
30
-    /**
31
-     * @var Button
32
-     */
33
-    private $button;
34
-
35
-    /**
36
-     * @var DateTime
37
-     */
38
-    private $datetime;
39
-
40
-    /**
41
-     * @var Input
42
-     */
43
-    private $input;
44
-
45
-    /**
46
-     * @var Number
47
-     */
48
-    private $number;
49
-
50
-    /**
51
-     * @var Phone
52
-     */
53
-    private $phone;
54
-
55
-    /**
56
-     * @var Select
57
-     */
58
-    private $select;
59
-
60
-    /**
61
-     * @var Text
62
-     */
63
-    private $text;
64
-
65
-    /**
66
-     * @var array
67
-     */
68
-    private $valid_type_options;
69
-
70
-
71
-    /**
72
-     * InputTypes constructor.
73
-     *
74
-     * @param Block   $block
75
-     * @param Button   $button
76
-     * @param DateTime $datetime
77
-     * @param Input    $input
78
-     * @param Number   $number
79
-     * @param Phone    $phone
80
-     * @param Select   $select
81
-     * @param Text     $text
82
-     */
83
-    public function __construct(
84
-        Block $block,
85
-        Button $button,
86
-        DateTime $datetime,
87
-        Input $input,
88
-        Number $number,
89
-        Phone $phone,
90
-        Select $select,
91
-        Text $text
92
-    ) {
93
-        $this->block    = $block;
94
-        $this->button   = $button;
95
-        $this->datetime = $datetime;
96
-        $this->input    = $input;
97
-        $this->number   = $number;
98
-        $this->phone    = $phone;
99
-        $this->select   = $select;
100
-        $this->text     = $text;
101
-        $this->assembleValidTypeOptions();
102
-    }
103
-
104
-
105
-    private function assembleValidTypeOptions()
106
-    {
107
-        $block    = $this->block->validTypeOptions();
108
-        $button   = $this->button->validTypeOptions();
109
-        $datetime = $this->datetime->validTypeOptions();
110
-        $input    = $this->input->validTypeOptions();
111
-        $number   = $this->number->validTypeOptions();
112
-        $phone    = $this->phone->validTypeOptions();
113
-        $select   = $this->select->validTypeOptions();
114
-        $text     = $this->text->validTypeOptions();
115
-        $this->valid_type_options = apply_filters(
116
-            'FHEE__EventEspresso_core_services_form_meta_InputTypes__valid_type_options',
117
-            array_merge($block, $button, $datetime, $input, $number, $phone, $select, $text)
118
-        );
119
-    }
120
-
121
-
122
-    /**
123
-     * @return array
124
-     */
125
-    public function getInputTypesValues(): array
126
-    {
127
-        $values = [];
128
-        foreach ($this->valid_type_options as $value => $description) {
129
-            $values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
130
-        }
131
-        return $values;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param bool $constants_only
137
-     * @return array
138
-     */
139
-    public function validTypeOptions(bool $constants_only = false): array
140
-    {
141
-        return $constants_only
142
-            ? array_keys($this->valid_type_options)
143
-            : $this->valid_type_options;
144
-    }
25
+	/**
26
+	 * @var Block
27
+	 */
28
+	private $block;
29
+
30
+	/**
31
+	 * @var Button
32
+	 */
33
+	private $button;
34
+
35
+	/**
36
+	 * @var DateTime
37
+	 */
38
+	private $datetime;
39
+
40
+	/**
41
+	 * @var Input
42
+	 */
43
+	private $input;
44
+
45
+	/**
46
+	 * @var Number
47
+	 */
48
+	private $number;
49
+
50
+	/**
51
+	 * @var Phone
52
+	 */
53
+	private $phone;
54
+
55
+	/**
56
+	 * @var Select
57
+	 */
58
+	private $select;
59
+
60
+	/**
61
+	 * @var Text
62
+	 */
63
+	private $text;
64
+
65
+	/**
66
+	 * @var array
67
+	 */
68
+	private $valid_type_options;
69
+
70
+
71
+	/**
72
+	 * InputTypes constructor.
73
+	 *
74
+	 * @param Block   $block
75
+	 * @param Button   $button
76
+	 * @param DateTime $datetime
77
+	 * @param Input    $input
78
+	 * @param Number   $number
79
+	 * @param Phone    $phone
80
+	 * @param Select   $select
81
+	 * @param Text     $text
82
+	 */
83
+	public function __construct(
84
+		Block $block,
85
+		Button $button,
86
+		DateTime $datetime,
87
+		Input $input,
88
+		Number $number,
89
+		Phone $phone,
90
+		Select $select,
91
+		Text $text
92
+	) {
93
+		$this->block    = $block;
94
+		$this->button   = $button;
95
+		$this->datetime = $datetime;
96
+		$this->input    = $input;
97
+		$this->number   = $number;
98
+		$this->phone    = $phone;
99
+		$this->select   = $select;
100
+		$this->text     = $text;
101
+		$this->assembleValidTypeOptions();
102
+	}
103
+
104
+
105
+	private function assembleValidTypeOptions()
106
+	{
107
+		$block    = $this->block->validTypeOptions();
108
+		$button   = $this->button->validTypeOptions();
109
+		$datetime = $this->datetime->validTypeOptions();
110
+		$input    = $this->input->validTypeOptions();
111
+		$number   = $this->number->validTypeOptions();
112
+		$phone    = $this->phone->validTypeOptions();
113
+		$select   = $this->select->validTypeOptions();
114
+		$text     = $this->text->validTypeOptions();
115
+		$this->valid_type_options = apply_filters(
116
+			'FHEE__EventEspresso_core_services_form_meta_InputTypes__valid_type_options',
117
+			array_merge($block, $button, $datetime, $input, $number, $phone, $select, $text)
118
+		);
119
+	}
120
+
121
+
122
+	/**
123
+	 * @return array
124
+	 */
125
+	public function getInputTypesValues(): array
126
+	{
127
+		$values = [];
128
+		foreach ($this->valid_type_options as $value => $description) {
129
+			$values[ GQLUtils::formatEnumKey($value) ] = compact('value', 'description');
130
+		}
131
+		return $values;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param bool $constants_only
137
+	 * @return array
138
+	 */
139
+	public function validTypeOptions(bool $constants_only = false): array
140
+	{
141
+		return $constants_only
142
+			? array_keys($this->valid_type_options)
143
+			: $this->valid_type_options;
144
+	}
145 145
 }
Please login to merge, or discard this patch.
core/domain/values/Url.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function __construct($url)
53 53
     {
54
-        if (! filter_var($url, FILTER_VALIDATE_URL)) {
54
+        if ( ! filter_var($url, FILTER_VALIDATE_URL)) {
55 55
             throw new InvalidArgumentException(
56 56
                 esc_html__(
57 57
                     'Invalid URL. Both the "Scheme" and "Host" are required.',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     private function setScheme($url)
87 87
     {
88
-        $this->scheme = $url['scheme'] . '://';
88
+        $this->scheme = $url['scheme'].'://';
89 89
     }
90 90
 
91 91
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function queryString()
141 141
     {
142
-        return $this->query !== '' ? '?' . $this->query : '';
142
+        return $this->query !== '' ? '?'.$this->query : '';
143 143
     }
144 144
 
145 145
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function fragment()
174 174
     {
175
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
175
+        return $this->fragment !== '' ? '#'.$this->fragment : '';
176 176
     }
177 177
 
178 178
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function getFullUrl()
195 195
     {
196
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
196
+        return $this->scheme().$this->host().$this->path().$this->queryString().$this->fragment();
197 197
     }
198 198
 
199 199
 
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -16,194 +16,194 @@
 block discarded – undo
16 16
  */
17 17
 class Url
18 18
 {
19
-    /**
20
-     * @var string $scheme
21
-     */
22
-    private $scheme;
23
-
24
-    /**
25
-     * @var string $host
26
-     */
27
-    private $host;
28
-
29
-    /**
30
-     * @var string $path
31
-     */
32
-    private $path;
33
-
34
-    /**
35
-     * @var string $query
36
-     */
37
-    private $query;
38
-
39
-    /**
40
-     * @var string $fragment
41
-     */
42
-    private $fragment;
43
-
44
-
45
-    /**
46
-     * Url constructor.
47
-     *
48
-     * @param $url
49
-     * @throws InvalidArgumentException
50
-     */
51
-    public function __construct($url)
52
-    {
53
-        if (! filter_var($url, FILTER_VALIDATE_URL)) {
54
-            throw new InvalidArgumentException(
55
-                esc_html__(
56
-                    'Invalid URL. Both the "Scheme" and "Host" are required.',
57
-                    'event_espresso'
58
-                )
59
-            );
60
-        }
61
-        $url = parse_url($url);
62
-        $this->setScheme($url);
63
-        $this->setHost($url);
64
-        $this->setPath($url);
65
-        $this->setQuery($url);
66
-        $this->setFragment($url);
67
-    }
68
-
69
-
70
-    /**
71
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
72
-     * will return a string like: 'abc://'
73
-     *
74
-     * @return string
75
-     */
76
-    public function scheme()
77
-    {
78
-        return $this->scheme;
79
-    }
80
-
81
-
82
-    /**
83
-     * @param array $url
84
-     */
85
-    private function setScheme($url)
86
-    {
87
-        $this->scheme = $url['scheme'] . '://';
88
-    }
89
-
90
-
91
-    /**
92
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
93
-     * will return a string like: 'example.com'
94
-     *
95
-     * @return string
96
-     */
97
-    public function host()
98
-    {
99
-        return $this->host;
100
-    }
101
-
102
-
103
-    /**
104
-     * @param array $url
105
-     */
106
-    private function setHost($url)
107
-    {
108
-        $this->host = $url['host'];
109
-    }
110
-
111
-
112
-    /**
113
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
114
-     * will return a string like: '/path/data'
115
-     *
116
-     * @return string
117
-     */
118
-    public function path()
119
-    {
120
-        return $this->path;
121
-    }
122
-
123
-
124
-    /**
125
-     * @param array $url
126
-     */
127
-    private function setPath($url)
128
-    {
129
-        $this->path = isset($url['path']) ? $url['path'] : '';
130
-    }
131
-
132
-
133
-    /**
134
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
135
-     * will return a string like: '?key=value'
136
-     *
137
-     * @return string
138
-     */
139
-    public function queryString()
140
-    {
141
-        return $this->query !== '' ? '?' . $this->query : '';
142
-    }
143
-
144
-
145
-    /**
146
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
147
-     * will return an array like: array('key' => 'value')
148
-     *
149
-     * @return array
150
-     */
151
-    public function queryParams()
152
-    {
153
-        return wp_parse_args($this->query);
154
-    }
155
-
156
-
157
-    /**
158
-     * @param array $url
159
-     */
160
-    private function setQuery($url)
161
-    {
162
-        $this->query = isset($url['query']) ? $url['query'] : '';
163
-    }
164
-
165
-
166
-    /**
167
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
168
-     * will return a string like: '#id'
169
-     *
170
-     * @return string
171
-     */
172
-    public function fragment()
173
-    {
174
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
175
-    }
176
-
177
-
178
-    /**
179
-     * @param array $url
180
-     */
181
-    private function setFragment($url)
182
-    {
183
-        $this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
184
-    }
185
-
186
-
187
-    /**
188
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
189
-     * will return a string like: 'abc://example.com/path/data?key=value#id'
190
-     *
191
-     * @return string
192
-     */
193
-    public function getFullUrl()
194
-    {
195
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
196
-    }
197
-
198
-
199
-    /**
200
-     * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
201
-     * will return a string like: 'abc://example.com/path/data?key=value#id'
202
-     *
203
-     * @return string
204
-     */
205
-    public function __toString()
206
-    {
207
-        return $this->getFullUrl();
208
-    }
19
+	/**
20
+	 * @var string $scheme
21
+	 */
22
+	private $scheme;
23
+
24
+	/**
25
+	 * @var string $host
26
+	 */
27
+	private $host;
28
+
29
+	/**
30
+	 * @var string $path
31
+	 */
32
+	private $path;
33
+
34
+	/**
35
+	 * @var string $query
36
+	 */
37
+	private $query;
38
+
39
+	/**
40
+	 * @var string $fragment
41
+	 */
42
+	private $fragment;
43
+
44
+
45
+	/**
46
+	 * Url constructor.
47
+	 *
48
+	 * @param $url
49
+	 * @throws InvalidArgumentException
50
+	 */
51
+	public function __construct($url)
52
+	{
53
+		if (! filter_var($url, FILTER_VALIDATE_URL)) {
54
+			throw new InvalidArgumentException(
55
+				esc_html__(
56
+					'Invalid URL. Both the "Scheme" and "Host" are required.',
57
+					'event_espresso'
58
+				)
59
+			);
60
+		}
61
+		$url = parse_url($url);
62
+		$this->setScheme($url);
63
+		$this->setHost($url);
64
+		$this->setPath($url);
65
+		$this->setQuery($url);
66
+		$this->setFragment($url);
67
+	}
68
+
69
+
70
+	/**
71
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
72
+	 * will return a string like: 'abc://'
73
+	 *
74
+	 * @return string
75
+	 */
76
+	public function scheme()
77
+	{
78
+		return $this->scheme;
79
+	}
80
+
81
+
82
+	/**
83
+	 * @param array $url
84
+	 */
85
+	private function setScheme($url)
86
+	{
87
+		$this->scheme = $url['scheme'] . '://';
88
+	}
89
+
90
+
91
+	/**
92
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
93
+	 * will return a string like: 'example.com'
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function host()
98
+	{
99
+		return $this->host;
100
+	}
101
+
102
+
103
+	/**
104
+	 * @param array $url
105
+	 */
106
+	private function setHost($url)
107
+	{
108
+		$this->host = $url['host'];
109
+	}
110
+
111
+
112
+	/**
113
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
114
+	 * will return a string like: '/path/data'
115
+	 *
116
+	 * @return string
117
+	 */
118
+	public function path()
119
+	{
120
+		return $this->path;
121
+	}
122
+
123
+
124
+	/**
125
+	 * @param array $url
126
+	 */
127
+	private function setPath($url)
128
+	{
129
+		$this->path = isset($url['path']) ? $url['path'] : '';
130
+	}
131
+
132
+
133
+	/**
134
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
135
+	 * will return a string like: '?key=value'
136
+	 *
137
+	 * @return string
138
+	 */
139
+	public function queryString()
140
+	{
141
+		return $this->query !== '' ? '?' . $this->query : '';
142
+	}
143
+
144
+
145
+	/**
146
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
147
+	 * will return an array like: array('key' => 'value')
148
+	 *
149
+	 * @return array
150
+	 */
151
+	public function queryParams()
152
+	{
153
+		return wp_parse_args($this->query);
154
+	}
155
+
156
+
157
+	/**
158
+	 * @param array $url
159
+	 */
160
+	private function setQuery($url)
161
+	{
162
+		$this->query = isset($url['query']) ? $url['query'] : '';
163
+	}
164
+
165
+
166
+	/**
167
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
168
+	 * will return a string like: '#id'
169
+	 *
170
+	 * @return string
171
+	 */
172
+	public function fragment()
173
+	{
174
+		return $this->fragment !== '' ? '#' . $this->fragment : '';
175
+	}
176
+
177
+
178
+	/**
179
+	 * @param array $url
180
+	 */
181
+	private function setFragment($url)
182
+	{
183
+		$this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
184
+	}
185
+
186
+
187
+	/**
188
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
189
+	 * will return a string like: 'abc://example.com/path/data?key=value#id'
190
+	 *
191
+	 * @return string
192
+	 */
193
+	public function getFullUrl()
194
+	{
195
+		return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
196
+	}
197
+
198
+
199
+	/**
200
+	 * For a URL like: abc://username:[email protected]:123/path/data?key=value#id
201
+	 * will return a string like: 'abc://example.com/path/data?key=value#id'
202
+	 *
203
+	 * @return string
204
+	 */
205
+	public function __toString()
206
+	{
207
+		return $this->getFullUrl();
208
+	}
209 209
 }
Please login to merge, or discard this patch.