Completed
Branch EDTR/master (f9130a)
by
unknown
46:59 queued 38:09
created
core/services/graphql/enums/EnumCollection.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class EnumCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_enums';
23
+	const COLLECTION_NAME = 'espresso_graphql_enums';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * EnumCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\enums\EnumInterface',
39
-            EnumCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * EnumCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\enums\EnumInterface',
39
+			EnumCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since $VID:$
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    EnumCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\enums\EnumInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\enums']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since $VID:$
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					EnumCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\enums\EnumInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\enums']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since $VID:$
82
-     */
83
-    public function loadEnums()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since $VID:$
82
+	 */
83
+	public function loadEnums()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
core/services/graphql/inputs/InputInterface.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@
 block discarded – undo
15 15
 interface InputInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @return string
20
-     */
21
-    public function name();
18
+	/**
19
+	 * @return string
20
+	 */
21
+	public function name();
22 22
 
23 23
 
24
-    /**
25
-     * @return string
26
-     */
27
-    public function description();
24
+	/**
25
+	 * @return string
26
+	 */
27
+	public function description();
28 28
 
29 29
 
30
-    /**
31
-     * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
32
-     * @since $VID:$
33
-     */
34
-    public function fields();
30
+	/**
31
+	 * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
32
+	 * @since $VID:$
33
+	 */
34
+	public function fields();
35 35
 }
Please login to merge, or discard this patch.
core/services/graphql/inputs/InputCollection.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class InputCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_inputs';
23
+	const COLLECTION_NAME = 'espresso_graphql_inputs';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * InputCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\inputs\InputInterface',
39
-            InputCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * InputCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\inputs\InputInterface',
39
+			InputCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since $VID:$
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    InputCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\inputs\InputInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\inputs']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since $VID:$
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					InputCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\inputs\InputInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\inputs']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since $VID:$
82
-     */
83
-    public function loadInputs()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since $VID:$
82
+	 */
83
+	public function loadInputs()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
core/services/graphql/inputs/InputBase.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@
 block discarded – undo
16 16
 abstract class InputBase implements InputInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @var string $name
21
-     */
22
-    protected $name = '';
23
-
24
-    /**
25
-     * @var string $description
26
-     */
27
-    protected $description = '';
28
-
29
-    /**
30
-     * @var \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] $fields
31
-     */
32
-    protected $fields = [];
33
-
34
-    /**
35
-     * InputBase constructor.
36
-     */
37
-    public function __construct()
38
-    {
39
-        $this->setFields($this->getFields());
40
-    }
41
-
42
-
43
-    /**
44
-     * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
45
-     * @since $VID:$
46
-     */
47
-    abstract protected function getFields();
48
-
49
-
50
-    /**
51
-     * @return string
52
-     */
53
-    public function name()
54
-    {
55
-        return $this->name;
56
-    }
57
-
58
-
59
-    /**
60
-     * @param string $name
61
-     */
62
-    protected function setName($name)
63
-    {
64
-        $this->name = $name;
65
-    }
66
-
67
-
68
-    /**
69
-     * @return string
70
-     */
71
-    public function description()
72
-    {
73
-        return $this->description;
74
-    }
75
-
76
-
77
-    /**
78
-     * @param string $description
79
-     */
80
-    protected function setDescription($description)
81
-    {
82
-        $this->description = $description;
83
-    }
84
-
85
-
86
-    /**
87
-     * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
88
-     * @since $VID:$
89
-     */
90
-    public function fields()
91
-    {
92
-        return (array) $this->fields;
93
-    }
94
-
95
-
96
-    /**
97
-     * @param \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] $fields
98
-     */
99
-    protected function setFields(array $fields)
100
-    {
101
-        foreach ($fields as $field) {
102
-            if ($field instanceof GraphQLField) {
103
-                $this->fields[] = $field;
104
-            }
105
-        }
106
-    }
19
+	/**
20
+	 * @var string $name
21
+	 */
22
+	protected $name = '';
23
+
24
+	/**
25
+	 * @var string $description
26
+	 */
27
+	protected $description = '';
28
+
29
+	/**
30
+	 * @var \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] $fields
31
+	 */
32
+	protected $fields = [];
33
+
34
+	/**
35
+	 * InputBase constructor.
36
+	 */
37
+	public function __construct()
38
+	{
39
+		$this->setFields($this->getFields());
40
+	}
41
+
42
+
43
+	/**
44
+	 * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
45
+	 * @since $VID:$
46
+	 */
47
+	abstract protected function getFields();
48
+
49
+
50
+	/**
51
+	 * @return string
52
+	 */
53
+	public function name()
54
+	{
55
+		return $this->name;
56
+	}
57
+
58
+
59
+	/**
60
+	 * @param string $name
61
+	 */
62
+	protected function setName($name)
63
+	{
64
+		$this->name = $name;
65
+	}
66
+
67
+
68
+	/**
69
+	 * @return string
70
+	 */
71
+	public function description()
72
+	{
73
+		return $this->description;
74
+	}
75
+
76
+
77
+	/**
78
+	 * @param string $description
79
+	 */
80
+	protected function setDescription($description)
81
+	{
82
+		$this->description = $description;
83
+	}
84
+
85
+
86
+	/**
87
+	 * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[]
88
+	 * @since $VID:$
89
+	 */
90
+	public function fields()
91
+	{
92
+		return (array) $this->fields;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @param \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] $fields
98
+	 */
99
+	protected function setFields(array $fields)
100
+	{
101
+		foreach ($fields as $field) {
102
+			if ($field instanceof GraphQLField) {
103
+				$this->fields[] = $field;
104
+			}
105
+		}
106
+	}
107 107
 }
Please login to merge, or discard this patch.
core/services/graphql/EnumsManager.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,60 +18,60 @@
 block discarded – undo
18 18
 class EnumsManager
19 19
 {
20 20
 
21
-    /**
22
-     * @var EnumCollection|EnumInterface[] $enums
23
-     */
24
-    private $enums;
21
+	/**
22
+	 * @var EnumCollection|EnumInterface[] $enums
23
+	 */
24
+	private $enums;
25 25
 
26 26
 
27
-    /**
28
-     * EnumsManager constructor.
29
-     *
30
-     * @param EnumCollection|EnumInterface[] $enums
31
-     */
32
-    public function __construct(EnumCollection $enums)
33
-    {
34
-        $this->enums = $enums;
35
-    }
27
+	/**
28
+	 * EnumsManager constructor.
29
+	 *
30
+	 * @param EnumCollection|EnumInterface[] $enums
31
+	 */
32
+	public function __construct(EnumCollection $enums)
33
+	{
34
+		$this->enums = $enums;
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @throws CollectionDetailsException
40
-     * @throws CollectionLoaderException
41
-     * @since $VID:$
42
-     */
43
-    public function init()
44
-    {
45
-        $this->enums->loadEnums();
46
-        add_action('graphql_register_types', [$this, 'configureEnums'], 8);
47
-    }
38
+	/**
39
+	 * @throws CollectionDetailsException
40
+	 * @throws CollectionLoaderException
41
+	 * @since $VID:$
42
+	 */
43
+	public function init()
44
+	{
45
+		$this->enums->loadEnums();
46
+		add_action('graphql_register_types', [$this, 'configureEnums'], 8);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @since $VID:$
52
-     */
53
-    public function configureEnums()
54
-    {
55
-        // loop through the collection of enums and register their fields
56
-        foreach ($this->enums as $enum) {
57
-            $this->registerEnum($enum);
58
-        }
59
-    }
50
+	/**
51
+	 * @since $VID:$
52
+	 */
53
+	public function configureEnums()
54
+	{
55
+		// loop through the collection of enums and register their fields
56
+		foreach ($this->enums as $enum) {
57
+			$this->registerEnum($enum);
58
+		}
59
+	}
60 60
 
61 61
 
62
-    /**
63
-     * @param EnumInterface $enum
64
-     * @since $VID:$
65
-     */
66
-    public function registerEnum(EnumInterface $enum)
67
-    {
68
-        // Register the enum type.
69
-        register_graphql_enum_type(
70
-            $enum->name(),
71
-            [
72
-                'description' => $enum->description(),
73
-                'values'      => $enum->values(),
74
-            ]
75
-        );
76
-    }
62
+	/**
63
+	 * @param EnumInterface $enum
64
+	 * @since $VID:$
65
+	 */
66
+	public function registerEnum(EnumInterface $enum)
67
+	{
68
+		// Register the enum type.
69
+		register_graphql_enum_type(
70
+			$enum->name(),
71
+			[
72
+				'description' => $enum->description(),
73
+				'values'      => $enum->values(),
74
+			]
75
+		);
76
+	}
77 77
 }
Please login to merge, or discard this patch.
core/services/graphql/GraphQLManager.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -16,58 +16,58 @@
 block discarded – undo
16 16
 class GraphQLManager
17 17
 {
18 18
 
19
-    /**
20
-     * @var TypesManager $types_manager
21
-     */
22
-    protected $types_manager;
19
+	/**
20
+	 * @var TypesManager $types_manager
21
+	 */
22
+	protected $types_manager;
23 23
 
24
-    /**
25
-     * @var InputsManager $inputs_manager
26
-     */
27
-    protected $inputs_manager;
24
+	/**
25
+	 * @var InputsManager $inputs_manager
26
+	 */
27
+	protected $inputs_manager;
28 28
 
29
-    /**
30
-     * @var EnumsManager $enums_manager
31
-     */
32
-    protected $enums_manager;
29
+	/**
30
+	 * @var EnumsManager $enums_manager
31
+	 */
32
+	protected $enums_manager;
33 33
 
34
-    /**
35
-     * @var ConnectionsManager $connections_manager
36
-     */
37
-    protected $connections_manager;
34
+	/**
35
+	 * @var ConnectionsManager $connections_manager
36
+	 */
37
+	protected $connections_manager;
38 38
 
39 39
 
40
-    /**
41
-     * GraphQLManager constructor.
42
-     *
43
-     * @param TypesManager $types_manager
44
-     * @param InputsManager $inputs_manager
45
-     * @param EnumsManager $enums_manager
46
-     * @param ConnectionsManager $connections_manager
47
-     */
48
-    public function __construct(
49
-        TypesManager $types_manager,
50
-        InputsManager $inputs_manager,
51
-        EnumsManager $enums_manager,
52
-        ConnectionsManager $connections_manager
53
-    ) {
54
-        $this->types_manager = $types_manager;
55
-        $this->inputs_manager = $inputs_manager;
56
-        $this->enums_manager = $enums_manager;
57
-        $this->connections_manager = $connections_manager;
58
-    }
40
+	/**
41
+	 * GraphQLManager constructor.
42
+	 *
43
+	 * @param TypesManager $types_manager
44
+	 * @param InputsManager $inputs_manager
45
+	 * @param EnumsManager $enums_manager
46
+	 * @param ConnectionsManager $connections_manager
47
+	 */
48
+	public function __construct(
49
+		TypesManager $types_manager,
50
+		InputsManager $inputs_manager,
51
+		EnumsManager $enums_manager,
52
+		ConnectionsManager $connections_manager
53
+	) {
54
+		$this->types_manager = $types_manager;
55
+		$this->inputs_manager = $inputs_manager;
56
+		$this->enums_manager = $enums_manager;
57
+		$this->connections_manager = $connections_manager;
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @throws CollectionDetailsException
63
-     * @throws CollectionLoaderException
64
-     * @since $VID:$
65
-     */
66
-    public function init()
67
-    {
68
-        $this->types_manager->init();
69
-        $this->inputs_manager->init();
70
-        $this->enums_manager->init();
71
-        $this->connections_manager->init();
72
-    }
61
+	/**
62
+	 * @throws CollectionDetailsException
63
+	 * @throws CollectionLoaderException
64
+	 * @since $VID:$
65
+	 */
66
+	public function init()
67
+	{
68
+		$this->types_manager->init();
69
+		$this->inputs_manager->init();
70
+		$this->enums_manager->init();
71
+		$this->connections_manager->init();
72
+	}
73 73
 }
Please login to merge, or discard this patch.
core/services/graphql/InputsManager.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -18,65 +18,65 @@
 block discarded – undo
18 18
 class InputsManager
19 19
 {
20 20
 
21
-    /**
22
-     * @var InputCollection|InputInterface[] $inputs
23
-     */
24
-    private $inputs;
21
+	/**
22
+	 * @var InputCollection|InputInterface[] $inputs
23
+	 */
24
+	private $inputs;
25 25
 
26 26
 
27
-    /**
28
-     * InputsManager constructor.
29
-     *
30
-     * @param InputCollection|InputInterface[] $inputs
31
-     */
32
-    public function __construct(InputCollection $inputs)
33
-    {
34
-        $this->inputs = $inputs;
35
-    }
27
+	/**
28
+	 * InputsManager constructor.
29
+	 *
30
+	 * @param InputCollection|InputInterface[] $inputs
31
+	 */
32
+	public function __construct(InputCollection $inputs)
33
+	{
34
+		$this->inputs = $inputs;
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * @throws CollectionDetailsException
40
-     * @throws CollectionLoaderException
41
-     * @since $VID:$
42
-     */
43
-    public function init()
44
-    {
45
-        $this->inputs->loadInputs();
46
-        add_action('graphql_register_types', [$this, 'configureInputs'], 9);
47
-    }
38
+	/**
39
+	 * @throws CollectionDetailsException
40
+	 * @throws CollectionLoaderException
41
+	 * @since $VID:$
42
+	 */
43
+	public function init()
44
+	{
45
+		$this->inputs->loadInputs();
46
+		add_action('graphql_register_types', [$this, 'configureInputs'], 9);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @since $VID:$
52
-     */
53
-    public function configureInputs()
54
-    {
55
-        // loop through the collection of inputs and register their fields
56
-        foreach ($this->inputs as $input) {
57
-            $this->registerInput($input);
58
-        }
59
-    }
50
+	/**
51
+	 * @since $VID:$
52
+	 */
53
+	public function configureInputs()
54
+	{
55
+		// loop through the collection of inputs and register their fields
56
+		foreach ($this->inputs as $input) {
57
+			$this->registerInput($input);
58
+		}
59
+	}
60 60
 
61 61
 
62
-    /**
63
-     * @param InputInterface $input
64
-     * @since $VID:$
65
-     */
66
-    public function registerInput(InputInterface $input)
67
-    {
68
-        $inputFields = [];
69
-        foreach ($input->fields() as $field) {
70
-            $fieldName = $field->name();
71
-            $inputFields[ $fieldName ] = $field->toArray();
72
-        }
73
-        // Register the input type.
74
-        register_graphql_input_type(
75
-            $input->name(),
76
-            [
77
-                'description' => $input->description(),
78
-                'fields'      => $inputFields,
79
-            ]
80
-        );
81
-    }
62
+	/**
63
+	 * @param InputInterface $input
64
+	 * @since $VID:$
65
+	 */
66
+	public function registerInput(InputInterface $input)
67
+	{
68
+		$inputFields = [];
69
+		foreach ($input->fields() as $field) {
70
+			$fieldName = $field->name();
71
+			$inputFields[ $fieldName ] = $field->toArray();
72
+		}
73
+		// Register the input type.
74
+		register_graphql_input_type(
75
+			$input->name(),
76
+			[
77
+				'description' => $input->description(),
78
+				'fields'      => $inputFields,
79
+			]
80
+		);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         $inputFields = [];
69 69
         foreach ($input->fields() as $field) {
70 70
             $fieldName = $field->name();
71
-            $inputFields[ $fieldName ] = $field->toArray();
71
+            $inputFields[$fieldName] = $field->toArray();
72 72
         }
73 73
         // Register the input type.
74 74
         register_graphql_input_type(
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/DatetimeTicketsConnection.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -19,97 +19,97 @@
 block discarded – undo
19 19
 class DatetimeTicketsConnection implements ConnectionInterface
20 20
 {
21 21
 
22
-    /**
23
-     * @var EEM_Ticket $model
24
-     */
25
-    protected $model;
22
+	/**
23
+	 * @var EEM_Ticket $model
24
+	 */
25
+	protected $model;
26 26
 
27 27
 
28
-    /**
29
-     * DatetimeConnection constructor.
30
-     *
31
-     * @param EEM_Ticket $model
32
-     */
33
-    public function __construct(EEM_Ticket $model)
34
-    {
35
-        $this->model = $model;
36
-    }
28
+	/**
29
+	 * DatetimeConnection constructor.
30
+	 *
31
+	 * @param EEM_Ticket $model
32
+	 */
33
+	public function __construct(EEM_Ticket $model)
34
+	{
35
+		$this->model = $model;
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     * @return array
41
-     * @since $VID:$
42
-     */
43
-    public function config()
44
-    {
45
-        return [
46
-            'fromType'           => 'Datetime',
47
-            'toType'             => 'Ticket',
48
-            'fromFieldName'      => 'tickets',
49
-            'connectionTypeName' => 'DatetimeTicketsConnection',
50
-            'connectionArgs'     => self::get_connection_args(),
51
-            'resolve'            => [$this, 'resolveConnection'],
52
-            'resolveNode'        => [$this, 'resolveNode']
53
-        ];
54
-    }
39
+	/**
40
+	 * @return array
41
+	 * @since $VID:$
42
+	 */
43
+	public function config()
44
+	{
45
+		return [
46
+			'fromType'           => 'Datetime',
47
+			'toType'             => 'Ticket',
48
+			'fromFieldName'      => 'tickets',
49
+			'connectionTypeName' => 'DatetimeTicketsConnection',
50
+			'connectionArgs'     => self::get_connection_args(),
51
+			'resolve'            => [$this, 'resolveConnection'],
52
+			'resolveNode'        => [$this, 'resolveNode']
53
+		];
54
+	}
55 55
 
56 56
 
57
-    /**
58
-     * @param $entity
59
-     * @param $args
60
-     * @param $context
61
-     * @param $info
62
-     * @return array
63
-     * @throws Exception
64
-     * @since $VID:$
65
-     */
66
-    public function resolveConnection($entity, $args, $context, $info)
67
-    {
68
-        $resolver = new TicketConnectionResolver($entity, $args, $context, $info);
69
-        return $resolver->get_connection();
70
-    }
57
+	/**
58
+	 * @param $entity
59
+	 * @param $args
60
+	 * @param $context
61
+	 * @param $info
62
+	 * @return array
63
+	 * @throws Exception
64
+	 * @since $VID:$
65
+	 */
66
+	public function resolveConnection($entity, $args, $context, $info)
67
+	{
68
+		$resolver = new TicketConnectionResolver($entity, $args, $context, $info);
69
+		return $resolver->get_connection();
70
+	}
71 71
 
72 72
 
73
-    /**
74
-     * @param $id
75
-     * @param $args
76
-     * @param $context
77
-     * @param $info
78
-     * @return EE_Base_Class
79
-     * @since $VID:$
80
-     */
81
-    public function resolveNode($id, $args, $context, $info)
82
-    {
83
-        return $this->model->get_one_by_ID($id);
84
-    }
73
+	/**
74
+	 * @param $id
75
+	 * @param $args
76
+	 * @param $context
77
+	 * @param $info
78
+	 * @return EE_Base_Class
79
+	 * @since $VID:$
80
+	 */
81
+	public function resolveNode($id, $args, $context, $info)
82
+	{
83
+		return $this->model->get_one_by_ID($id);
84
+	}
85 85
 
86
-    /**
87
-     * Given an optional array of args, this returns the args to be used in the connection
88
-     *
89
-     * @access public
90
-     * @param array $args The args to modify the defaults
91
-     *
92
-     * @return array
93
-     */
94
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
95
-    public static function get_connection_args($args = [])
96
-    {
97
-        return array_merge(
98
-            [
99
-                'orderby'      => [
100
-                    'type'        => ['list_of' => 'TicketsConnectionOrderbyInput'],
101
-                    'description' => esc_html__('What paramater to use to order the objects by.', 'event_espresso'),
102
-                ],
103
-                'datetimeId' => [
104
-                    'type'        => 'Int',
105
-                    'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
106
-                ],
107
-                'datetimeIn' => [
108
-                    'type'        => ['list_of' => 'Int'],
109
-                    'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
110
-                ],
111
-            ],
112
-            $args
113
-        );
114
-    }
86
+	/**
87
+	 * Given an optional array of args, this returns the args to be used in the connection
88
+	 *
89
+	 * @access public
90
+	 * @param array $args The args to modify the defaults
91
+	 *
92
+	 * @return array
93
+	 */
94
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
95
+	public static function get_connection_args($args = [])
96
+	{
97
+		return array_merge(
98
+			[
99
+				'orderby'      => [
100
+					'type'        => ['list_of' => 'TicketsConnectionOrderbyInput'],
101
+					'description' => esc_html__('What paramater to use to order the objects by.', 'event_espresso'),
102
+				],
103
+				'datetimeId' => [
104
+					'type'        => 'Int',
105
+					'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'),
106
+				],
107
+				'datetimeIn' => [
108
+					'type'        => ['list_of' => 'Int'],
109
+					'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'),
110
+				],
111
+			],
112
+			$args
113
+		);
114
+	}
115 115
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Ticket.php 1 patch
Indentation   +257 added lines, -257 removed lines patch added patch discarded remove patch
@@ -25,267 +25,267 @@
 block discarded – undo
25 25
 class Ticket extends TypeBase
26 26
 {
27 27
 
28
-    /**
29
-     * Ticket constructor.
30
-     *
31
-     * @param EEM_Ticket $ticket_model
32
-     */
33
-    public function __construct(EEM_Ticket $ticket_model)
34
-    {
35
-        $this->model = $ticket_model;
36
-        $this->setName('Ticket');
37
-        $this->setDescription(__('A ticket for an event date', 'event_espresso'));
38
-        $this->setIsCustomPostType(false);
39
-        parent::__construct();
40
-    }
28
+	/**
29
+	 * Ticket constructor.
30
+	 *
31
+	 * @param EEM_Ticket $ticket_model
32
+	 */
33
+	public function __construct(EEM_Ticket $ticket_model)
34
+	{
35
+		$this->model = $ticket_model;
36
+		$this->setName('Ticket');
37
+		$this->setDescription(__('A ticket for an event date', 'event_espresso'));
38
+		$this->setIsCustomPostType(false);
39
+		parent::__construct();
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @return GraphQLFieldInterface[]
45
-     * @since $VID:$
46
-     */
47
-    protected function getFields()
48
-    {
49
-        return [
50
-            new GraphQLField(
51
-                'id',
52
-                ['non_null' => 'Int'],
53
-                'ID',
54
-                esc_html__('Ticket ID', 'event_espresso')
55
-            ),
56
-            new GraphQLField(
57
-                'name',
58
-                'String',
59
-                'name',
60
-                esc_html__('Ticket Name', 'event_espresso')
61
-            ),
62
-            new GraphQLField(
63
-                'description',
64
-                'String',
65
-                'description',
66
-                esc_html__('Description of Ticket', 'event_espresso')
67
-            ),
68
-            new GraphQLField(
69
-                'startDate',
70
-                'String',
71
-                'start_date',
72
-                esc_html__('Start time/date of Ticket', 'event_espresso')
73
-            ),
74
-            new GraphQLField(
75
-                'endDate',
76
-                'String',
77
-                'end_date',
78
-                esc_html__('End time/date of Ticket', 'event_espresso')
79
-            ),
80
-            new GraphQLField(
81
-                'min',
82
-                'Int',
83
-                'min',
84
-                esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
85
-            ),
86
-            new GraphQLField(
87
-                'max',
88
-                'Int',
89
-                'max',
90
-                esc_html__(
91
-                    'Maximum quantity of this ticket that can be purchased in one transaction',
92
-                    'event_espresso'
93
-                ),
94
-                [$this, 'parseInfiniteValue']
95
-            ),
96
-            new GraphQLField(
97
-                'price',
98
-                'Float',
99
-                'price',
100
-                esc_html__('Final calculated price for ticket', 'event_espresso')
101
-            ),
102
-            new GraphQLField(
103
-                'sold',
104
-                'Int',
105
-                'sold',
106
-                esc_html__('Number of this ticket sold', 'event_espresso')
107
-            ),
108
-            new GraphQLField(
109
-                'quantity',
110
-                'Int',
111
-                'qty',
112
-                esc_html__('Quantity of this ticket that is available', 'event_espresso'),
113
-                [$this, 'parseInfiniteValue']
114
-            ),
115
-            new GraphQLField(
116
-                'reserved',
117
-                'Int',
118
-                'reserved',
119
-                esc_html__(
120
-                    'Quantity of this ticket that is reserved, but not yet fully purchased',
121
-                    'event_espresso'
122
-                )
123
-            ),
124
-            new GraphQLField(
125
-                'uses',
126
-                'Int',
127
-                'uses',
128
-                esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
129
-                [$this, 'parseInfiniteValue']
130
-            ),
131
-            new GraphQLField(
132
-                'isRequired',
133
-                'Boolean',
134
-                'required',
135
-                esc_html__(
136
-                    'Flag indicating whether this ticket must be purchased with a transaction',
137
-                    'event_espresso'
138
-                )
139
-            ),
140
-            new GraphQLField(
141
-                'isTaxable',
142
-                'Boolean',
143
-                'taxable',
144
-                esc_html__(
145
-                    'Flag indicating whether there is tax applied on this ticket',
146
-                    'event_espresso'
147
-                )
148
-            ),
149
-            new GraphQLField(
150
-                'isDefault',
151
-                'Boolean',
152
-                'is_default',
153
-                esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
154
-            ),
155
-            new GraphQLField(
156
-                'order',
157
-                'Int',
158
-                'order',
159
-                esc_html__('The order in which the Datetime is displayed', 'event_espresso')
160
-            ),
161
-            new GraphQLField(
162
-                'row',
163
-                'Int',
164
-                'row',
165
-                esc_html__('How tickets are displayed in the ui', 'event_espresso')
166
-            ),
167
-            new GraphQLOutputField(
168
-                'wpUser',
169
-                'User',
170
-                null,
171
-                esc_html__('Ticket Creator', 'event_espresso')
172
-            ),
173
-            new GraphQLInputField(
174
-                'wpUser',
175
-                'Int',
176
-                null,
177
-                esc_html__('Ticket Creator ID', 'event_espresso')
178
-            ),
179
-            new GraphQLOutputField(
180
-                'parent',
181
-                'Ticket',
182
-                null,
183
-                esc_html__('The parent ticket of the current ticket', 'event_espresso')
184
-            ),
185
-            new GraphQLInputField(
186
-                'parent',
187
-                'Int',
188
-                null,
189
-                esc_html__('The parent ticket ID', 'event_espresso')
190
-            ),
191
-            new GraphQLField(
192
-                'reverseCalculate',
193
-                'Boolean',
194
-                'reverse_calculate',
195
-                esc_html__(
196
-                    'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
197
-                    'event_espresso'
198
-                )
199
-            ),
200
-            new GraphQLField(
201
-                'isFree',
202
-                'Boolean',
203
-                'is_free',
204
-                esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
205
-            ),
206
-            new GraphQLOutputField(
207
-                'event',
208
-                'Event',
209
-                null,
210
-                esc_html__('Event of the ticket.', 'event_espresso')
211
-            ),
212
-            new GraphQLInputField(
213
-                'datetimes',
214
-                ['list_of' => 'Int'],
215
-                null,
216
-                sprintf(
217
-                    '%1$s %2$s',
218
-                    esc_html__('IDs of the datetimes related to the ticket.', 'event_espresso'),
219
-                    esc_html__('Ignored if empty.', 'event_espresso')
220
-                )
221
-            ),
222
-        ];
223
-    }
43
+	/**
44
+	 * @return GraphQLFieldInterface[]
45
+	 * @since $VID:$
46
+	 */
47
+	protected function getFields()
48
+	{
49
+		return [
50
+			new GraphQLField(
51
+				'id',
52
+				['non_null' => 'Int'],
53
+				'ID',
54
+				esc_html__('Ticket ID', 'event_espresso')
55
+			),
56
+			new GraphQLField(
57
+				'name',
58
+				'String',
59
+				'name',
60
+				esc_html__('Ticket Name', 'event_espresso')
61
+			),
62
+			new GraphQLField(
63
+				'description',
64
+				'String',
65
+				'description',
66
+				esc_html__('Description of Ticket', 'event_espresso')
67
+			),
68
+			new GraphQLField(
69
+				'startDate',
70
+				'String',
71
+				'start_date',
72
+				esc_html__('Start time/date of Ticket', 'event_espresso')
73
+			),
74
+			new GraphQLField(
75
+				'endDate',
76
+				'String',
77
+				'end_date',
78
+				esc_html__('End time/date of Ticket', 'event_espresso')
79
+			),
80
+			new GraphQLField(
81
+				'min',
82
+				'Int',
83
+				'min',
84
+				esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
85
+			),
86
+			new GraphQLField(
87
+				'max',
88
+				'Int',
89
+				'max',
90
+				esc_html__(
91
+					'Maximum quantity of this ticket that can be purchased in one transaction',
92
+					'event_espresso'
93
+				),
94
+				[$this, 'parseInfiniteValue']
95
+			),
96
+			new GraphQLField(
97
+				'price',
98
+				'Float',
99
+				'price',
100
+				esc_html__('Final calculated price for ticket', 'event_espresso')
101
+			),
102
+			new GraphQLField(
103
+				'sold',
104
+				'Int',
105
+				'sold',
106
+				esc_html__('Number of this ticket sold', 'event_espresso')
107
+			),
108
+			new GraphQLField(
109
+				'quantity',
110
+				'Int',
111
+				'qty',
112
+				esc_html__('Quantity of this ticket that is available', 'event_espresso'),
113
+				[$this, 'parseInfiniteValue']
114
+			),
115
+			new GraphQLField(
116
+				'reserved',
117
+				'Int',
118
+				'reserved',
119
+				esc_html__(
120
+					'Quantity of this ticket that is reserved, but not yet fully purchased',
121
+					'event_espresso'
122
+				)
123
+			),
124
+			new GraphQLField(
125
+				'uses',
126
+				'Int',
127
+				'uses',
128
+				esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
129
+				[$this, 'parseInfiniteValue']
130
+			),
131
+			new GraphQLField(
132
+				'isRequired',
133
+				'Boolean',
134
+				'required',
135
+				esc_html__(
136
+					'Flag indicating whether this ticket must be purchased with a transaction',
137
+					'event_espresso'
138
+				)
139
+			),
140
+			new GraphQLField(
141
+				'isTaxable',
142
+				'Boolean',
143
+				'taxable',
144
+				esc_html__(
145
+					'Flag indicating whether there is tax applied on this ticket',
146
+					'event_espresso'
147
+				)
148
+			),
149
+			new GraphQLField(
150
+				'isDefault',
151
+				'Boolean',
152
+				'is_default',
153
+				esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
154
+			),
155
+			new GraphQLField(
156
+				'order',
157
+				'Int',
158
+				'order',
159
+				esc_html__('The order in which the Datetime is displayed', 'event_espresso')
160
+			),
161
+			new GraphQLField(
162
+				'row',
163
+				'Int',
164
+				'row',
165
+				esc_html__('How tickets are displayed in the ui', 'event_espresso')
166
+			),
167
+			new GraphQLOutputField(
168
+				'wpUser',
169
+				'User',
170
+				null,
171
+				esc_html__('Ticket Creator', 'event_espresso')
172
+			),
173
+			new GraphQLInputField(
174
+				'wpUser',
175
+				'Int',
176
+				null,
177
+				esc_html__('Ticket Creator ID', 'event_espresso')
178
+			),
179
+			new GraphQLOutputField(
180
+				'parent',
181
+				'Ticket',
182
+				null,
183
+				esc_html__('The parent ticket of the current ticket', 'event_espresso')
184
+			),
185
+			new GraphQLInputField(
186
+				'parent',
187
+				'Int',
188
+				null,
189
+				esc_html__('The parent ticket ID', 'event_espresso')
190
+			),
191
+			new GraphQLField(
192
+				'reverseCalculate',
193
+				'Boolean',
194
+				'reverse_calculate',
195
+				esc_html__(
196
+					'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
197
+					'event_espresso'
198
+				)
199
+			),
200
+			new GraphQLField(
201
+				'isFree',
202
+				'Boolean',
203
+				'is_free',
204
+				esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
205
+			),
206
+			new GraphQLOutputField(
207
+				'event',
208
+				'Event',
209
+				null,
210
+				esc_html__('Event of the ticket.', 'event_espresso')
211
+			),
212
+			new GraphQLInputField(
213
+				'datetimes',
214
+				['list_of' => 'Int'],
215
+				null,
216
+				sprintf(
217
+					'%1$s %2$s',
218
+					esc_html__('IDs of the datetimes related to the ticket.', 'event_espresso'),
219
+					esc_html__('Ignored if empty.', 'event_espresso')
220
+				)
221
+			),
222
+		];
223
+	}
224 224
 
225 225
 
226
-    /**
227
-     * @param array $inputFields The mutation input fields.
228
-     * @throws InvalidArgumentException
229
-     * @throws ReflectionException
230
-     * @since $VID:$
231
-     */
232
-    public function registerMutations(array $inputFields)
233
-    {
234
-        // Register mutation to update an entity.
235
-        register_graphql_mutation(
236
-            'update' . $this->name(),
237
-            [
238
-                'inputFields'         => $inputFields,
239
-                'outputFields'        => [
240
-                    lcfirst($this->name()) => [
241
-                        'type'    => $this->name(),
242
-                        'resolve' => [$this, 'resolveFromPayload'],
243
-                    ],
244
-                ],
245
-                'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
246
-            ]
247
-        );
248
-        // Register mutation to delete an entity.
249
-        register_graphql_mutation(
250
-            'delete' . $this->name(),
251
-            [
252
-                'inputFields'         => [
253
-                    'id'                => $inputFields['id'],
254
-                    'deletePermanently' => [
255
-                        'type'        => 'Boolean',
256
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
257
-                    ],
258
-                ],
259
-                'outputFields'        => [
260
-                    lcfirst($this->name()) => [
261
-                        'type'        => $this->name(),
262
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
263
-                        'resolve'     => static function ($payload) {
264
-                            $deleted = (object) $payload['deleted'];
226
+	/**
227
+	 * @param array $inputFields The mutation input fields.
228
+	 * @throws InvalidArgumentException
229
+	 * @throws ReflectionException
230
+	 * @since $VID:$
231
+	 */
232
+	public function registerMutations(array $inputFields)
233
+	{
234
+		// Register mutation to update an entity.
235
+		register_graphql_mutation(
236
+			'update' . $this->name(),
237
+			[
238
+				'inputFields'         => $inputFields,
239
+				'outputFields'        => [
240
+					lcfirst($this->name()) => [
241
+						'type'    => $this->name(),
242
+						'resolve' => [$this, 'resolveFromPayload'],
243
+					],
244
+				],
245
+				'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
246
+			]
247
+		);
248
+		// Register mutation to delete an entity.
249
+		register_graphql_mutation(
250
+			'delete' . $this->name(),
251
+			[
252
+				'inputFields'         => [
253
+					'id'                => $inputFields['id'],
254
+					'deletePermanently' => [
255
+						'type'        => 'Boolean',
256
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
257
+					],
258
+				],
259
+				'outputFields'        => [
260
+					lcfirst($this->name()) => [
261
+						'type'        => $this->name(),
262
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
263
+						'resolve'     => static function ($payload) {
264
+							$deleted = (object) $payload['deleted'];
265 265
 
266
-                            return ! empty($deleted) ? $deleted : null;
267
-                        },
268
-                    ],
269
-                ],
270
-                'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
271
-            ]
272
-        );
266
+							return ! empty($deleted) ? $deleted : null;
267
+						},
268
+					],
269
+				],
270
+				'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
271
+			]
272
+		);
273 273
 
274
-        // remove primary key from input.
275
-        unset($inputFields['id']);
276
-        // Register mutation to update an entity.
277
-        register_graphql_mutation(
278
-            'create' . $this->name(),
279
-            [
280
-                'inputFields'         => $inputFields,
281
-                'outputFields'        => [
282
-                    lcfirst($this->name()) => [
283
-                        'type'    => $this->name(),
284
-                        'resolve' => [$this, 'resolveFromPayload'],
285
-                    ],
286
-                ],
287
-                'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
288
-            ]
289
-        );
290
-    }
274
+		// remove primary key from input.
275
+		unset($inputFields['id']);
276
+		// Register mutation to update an entity.
277
+		register_graphql_mutation(
278
+			'create' . $this->name(),
279
+			[
280
+				'inputFields'         => $inputFields,
281
+				'outputFields'        => [
282
+					lcfirst($this->name()) => [
283
+						'type'    => $this->name(),
284
+						'resolve' => [$this, 'resolveFromPayload'],
285
+					],
286
+				],
287
+				'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
288
+			]
289
+		);
290
+	}
291 291
 }
Please login to merge, or discard this patch.