Completed
Branch EDTR/refactor-fast-api-fetch (52a0d8)
by
unknown
09:42 queued 58s
created
core/domain/services/graphql/resolvers/FieldResolver.php 2 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 class FieldResolver extends ResolverBase
43 43
 {
44 44
 
45
-    /**
46
-     * @var mixed $model
47
-     */
48
-    protected $model;
45
+	/**
46
+	 * @var mixed $model
47
+	 */
48
+	protected $model;
49 49
 
50
-    /**
51
-     * @var array $graphql_to_model_map.
52
-     */
53
-    protected $graphql_to_model_map;
50
+	/**
51
+	 * @var array $graphql_to_model_map.
52
+	 */
53
+	protected $graphql_to_model_map;
54 54
 
55 55
 
56
-    /**
57
-     * FieldResolver constructor.
58
-     *
56
+	/**
57
+	 * FieldResolver constructor.
58
+	 *
59 59
 	 * @param mixed   $model                The model instance.
60
-     * @param array   $graphql_to_model_map The GQL to model map for the fields.
61
-     */
62
-    public function __construct($model, array $graphql_to_model_map )
63
-    {
60
+	 * @param array   $graphql_to_model_map The GQL to model map for the fields.
61
+	 */
62
+	public function __construct($model, array $graphql_to_model_map )
63
+	{
64 64
 		$this->model                = $model;
65 65
 		$this->graphql_to_model_map = $graphql_to_model_map;
66
-    }
67
-
68
-    /**
69
-     * @param mixed       $source     The source that's passed down the GraphQL queries
70
-     * @param array       $args       The inputArgs on the field
71
-     * @param AppContext  $context    The AppContext passed down the GraphQL tree
72
-     * @param ResolveInfo $info       The ResolveInfo passed down the GraphQL tree
73
-     * @return string
74
-     * @since $VID:$
75
-     */
76
-    public function resolve($source, $args, AppContext $context, ResolveInfo $info)
77
-    {
66
+	}
67
+
68
+	/**
69
+	 * @param mixed       $source     The source that's passed down the GraphQL queries
70
+	 * @param array       $args       The inputArgs on the field
71
+	 * @param AppContext  $context    The AppContext passed down the GraphQL tree
72
+	 * @param ResolveInfo $info       The ResolveInfo passed down the GraphQL tree
73
+	 * @return string
74
+	 * @since $VID:$
75
+	 */
76
+	public function resolve($source, $args, AppContext $context, ResolveInfo $info)
77
+	{
78 78
 		$fieldName = $info->fieldName;
79 79
 
80 80
 		if (isset($this->graphql_to_model_map[$fieldName])) {
@@ -106,135 +106,135 @@  discard block
 block discarded – undo
106 106
 			case 'country': // State, Venue
107 107
 				return $this->resolveCountry($source);
108 108
 		}
109
-    }
110
-
111
-
112
-    /**
113
-     * @param int $value
114
-     * @return int
115
-     * @since $VID:$
116
-     */
117
-    protected function parseInfiniteValue($value)
118
-    {
119
-        return $value === EE_INF || is_infinite($value) ? -1 : $value;
120
-    }
121
-
122
-
123
-    /**
124
-     * @param mixed     $source
125
-     * @param           $args
126
-     * @param           $context
127
-     * @return Deferred|null
128
-     * @throws EE_Error
129
-     * @throws InvalidArgumentException
130
-     * @throws InvalidDataTypeException
131
-     * @throws InvalidInterfaceException
132
-     * @throws ReflectionException
133
-     * @throws UserError
134
-     * @since $VID:$
135
-     */
136
-    public function resolveWpUser($source, $args, $context)
137
-    {
138
-        $user_id = $source->wp_user();
139
-        return $user_id
140
-            ? DataSource::resolve_user($user_id, $context)
141
-            : null;
142
-    }
143
-
144
-
145
-    /**
146
-     * @param mixed $source
147
-     * @return EE_Base_Class|null
148
-     * @throws EE_Error
149
-     * @throws InvalidArgumentException
150
-     * @throws InvalidDataTypeException
151
-     * @throws InvalidInterfaceException
152
-     * @throws ReflectionException
153
-     * @since $VID:$
154
-     */
155
-    public function resolveParent($source)
156
-    {
157
-        return $this->model->get_one_by_ID($source->parent());
158
-    }
159
-
160
-
161
-    /**
162
-     * @param mixed       $source
163
-     * @param             $args
164
-     * @param             $context
165
-     * @return Deferred|null
166
-     * @throws EE_Error
167
-     * @throws InvalidDataTypeException
168
-     * @throws InvalidInterfaceException
169
-     * @throws UserError
170
-     * @throws InvalidArgumentException
171
-     * @throws ReflectionException
172
-     * @since $VID:$
173
-     */
174
-    public function resolveEvent($source, $args, $context)
175
-    {
176
-        switch (true) {
177
-            case $source instanceof EE_Datetime:
178
-                $event = $source->event();
179
-                break;
180
-            case $source instanceof EE_Venue:
181
-                $event = $source->get_related_event();
182
-                break;
183
-            default:
184
-                $event = null;
185
-                break;
186
-        }
187
-        return $event instanceof EE_Event
188
-            ? DataSource::resolve_post_object($event->ID(), $context)
189
-            : null;
190
-    }
191
-
192
-
193
-    /**
194
-     * @param mixed $source The source instance.
195
-     * @return int
196
-     * @since $VID:$
197
-     */
198
-    public function resolveState($source)
199
-    {
200
-        switch (true) {
201
-            case $source instanceof EE_Venue:
202
-                $state_id = $source->state_ID();
203
-                break;
204
-            default:
205
-                $state_id = null;
206
-                break;
207
-        }
208
-
209
-        if ($state_id) {
210
-            return EEM_State::instance()->get_one_by_ID($state_id);
211
-        }
212
-        return null;
213
-    }
214
-
215
-
216
-    /**
217
-     * @param mixed $source The source instance.
218
-     * @return int
219
-     * @since $VID:$
220
-     */
221
-    public function resolveCountry($source)
222
-    {
223
-        switch (true) {
224
-            case $source instanceof EE_State:
225
-                $country_iso = $source->country_iso();
226
-                break;
227
-            case $source instanceof EE_Venue:
228
-                $country_iso = $source->country_ID();
229
-                break;
230
-            default:
231
-                $country_iso = null;
232
-                break;
233
-        }
234
-
235
-        if ($country_iso) {
236
-            return EEM_Country::instance()->get_one_by_ID($country_iso);
237
-        }
238
-        return null;
239
-    }
109
+	}
110
+
111
+
112
+	/**
113
+	 * @param int $value
114
+	 * @return int
115
+	 * @since $VID:$
116
+	 */
117
+	protected function parseInfiniteValue($value)
118
+	{
119
+		return $value === EE_INF || is_infinite($value) ? -1 : $value;
120
+	}
121
+
122
+
123
+	/**
124
+	 * @param mixed     $source
125
+	 * @param           $args
126
+	 * @param           $context
127
+	 * @return Deferred|null
128
+	 * @throws EE_Error
129
+	 * @throws InvalidArgumentException
130
+	 * @throws InvalidDataTypeException
131
+	 * @throws InvalidInterfaceException
132
+	 * @throws ReflectionException
133
+	 * @throws UserError
134
+	 * @since $VID:$
135
+	 */
136
+	public function resolveWpUser($source, $args, $context)
137
+	{
138
+		$user_id = $source->wp_user();
139
+		return $user_id
140
+			? DataSource::resolve_user($user_id, $context)
141
+			: null;
142
+	}
143
+
144
+
145
+	/**
146
+	 * @param mixed $source
147
+	 * @return EE_Base_Class|null
148
+	 * @throws EE_Error
149
+	 * @throws InvalidArgumentException
150
+	 * @throws InvalidDataTypeException
151
+	 * @throws InvalidInterfaceException
152
+	 * @throws ReflectionException
153
+	 * @since $VID:$
154
+	 */
155
+	public function resolveParent($source)
156
+	{
157
+		return $this->model->get_one_by_ID($source->parent());
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param mixed       $source
163
+	 * @param             $args
164
+	 * @param             $context
165
+	 * @return Deferred|null
166
+	 * @throws EE_Error
167
+	 * @throws InvalidDataTypeException
168
+	 * @throws InvalidInterfaceException
169
+	 * @throws UserError
170
+	 * @throws InvalidArgumentException
171
+	 * @throws ReflectionException
172
+	 * @since $VID:$
173
+	 */
174
+	public function resolveEvent($source, $args, $context)
175
+	{
176
+		switch (true) {
177
+			case $source instanceof EE_Datetime:
178
+				$event = $source->event();
179
+				break;
180
+			case $source instanceof EE_Venue:
181
+				$event = $source->get_related_event();
182
+				break;
183
+			default:
184
+				$event = null;
185
+				break;
186
+		}
187
+		return $event instanceof EE_Event
188
+			? DataSource::resolve_post_object($event->ID(), $context)
189
+			: null;
190
+	}
191
+
192
+
193
+	/**
194
+	 * @param mixed $source The source instance.
195
+	 * @return int
196
+	 * @since $VID:$
197
+	 */
198
+	public function resolveState($source)
199
+	{
200
+		switch (true) {
201
+			case $source instanceof EE_Venue:
202
+				$state_id = $source->state_ID();
203
+				break;
204
+			default:
205
+				$state_id = null;
206
+				break;
207
+		}
208
+
209
+		if ($state_id) {
210
+			return EEM_State::instance()->get_one_by_ID($state_id);
211
+		}
212
+		return null;
213
+	}
214
+
215
+
216
+	/**
217
+	 * @param mixed $source The source instance.
218
+	 * @return int
219
+	 * @since $VID:$
220
+	 */
221
+	public function resolveCountry($source)
222
+	{
223
+		switch (true) {
224
+			case $source instanceof EE_State:
225
+				$country_iso = $source->country_iso();
226
+				break;
227
+			case $source instanceof EE_Venue:
228
+				$country_iso = $source->country_ID();
229
+				break;
230
+			default:
231
+				$country_iso = null;
232
+				break;
233
+		}
234
+
235
+		if ($country_iso) {
236
+			return EEM_Country::instance()->get_one_by_ID($country_iso);
237
+		}
238
+		return null;
239
+	}
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 * @param mixed   $model                The model instance.
60 60
      * @param array   $graphql_to_model_map The GQL to model map for the fields.
61 61
      */
62
-    public function __construct($model, array $graphql_to_model_map )
62
+    public function __construct($model, array $graphql_to_model_map)
63 63
     {
64 64
 		$this->model                = $model;
65 65
 		$this->graphql_to_model_map = $graphql_to_model_map;
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Event.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -34,145 +34,145 @@
 block discarded – undo
34 34
 class Event extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * Event constructor.
39
-     *
40
-     * @param EEM_Event $event_model
41
-     */
42
-    public function __construct(EEM_Event $event_model)
43
-    {
44
-        $this->model = $event_model;
45
-        $this->setName('Event');
46
-        $this->setIsCustomPostType(true);
47
-        $this->setGraphQLToModelMap([
48
-            'name'                  => 'name',
49
-            'desc'                  => 'description',
50
-            'shortDesc'             => 'short_description',
51
-            'created'               => 'created',
52
-            'order'                 => 'order',
53
-            'displayDesc'           => 'display_description',
54
-            'displayTicketSelector' => 'display_ticket_selector',
55
-            'visibleOn'             => 'visible_on',
56
-            'additionalLimit'       => 'additional_limit',
57
-            'phone'                 => 'phone',
58
-            'memberOnly'            => 'member_only',
59
-            'allowOverflow'         => 'allow_overflow',
60
-            'timezoneString'        => 'timezone_string',
61
-            'externalUrl'           => 'external_url',
62
-            'donations'             => 'donations',
63
-            'isSoldOut'             => 'is_sold_out',
64
-            'isPostponed'           => 'is_postponed',
65
-            'isCancelled'           => 'is_cancelled',
66
-            'isUpcoming'            => 'is_upcoming',
67
-            'isActive'              => 'is_active',
68
-            'isInactive'            => 'is_inactive',
69
-            'isExpired'             => 'is_expired',
70
-        ]);
37
+	/**
38
+	 * Event constructor.
39
+	 *
40
+	 * @param EEM_Event $event_model
41
+	 */
42
+	public function __construct(EEM_Event $event_model)
43
+	{
44
+		$this->model = $event_model;
45
+		$this->setName('Event');
46
+		$this->setIsCustomPostType(true);
47
+		$this->setGraphQLToModelMap([
48
+			'name'                  => 'name',
49
+			'desc'                  => 'description',
50
+			'shortDesc'             => 'short_description',
51
+			'created'               => 'created',
52
+			'order'                 => 'order',
53
+			'displayDesc'           => 'display_description',
54
+			'displayTicketSelector' => 'display_ticket_selector',
55
+			'visibleOn'             => 'visible_on',
56
+			'additionalLimit'       => 'additional_limit',
57
+			'phone'                 => 'phone',
58
+			'memberOnly'            => 'member_only',
59
+			'allowOverflow'         => 'allow_overflow',
60
+			'timezoneString'        => 'timezone_string',
61
+			'externalUrl'           => 'external_url',
62
+			'donations'             => 'donations',
63
+			'isSoldOut'             => 'is_sold_out',
64
+			'isPostponed'           => 'is_postponed',
65
+			'isCancelled'           => 'is_cancelled',
66
+			'isUpcoming'            => 'is_upcoming',
67
+			'isActive'              => 'is_active',
68
+			'isInactive'            => 'is_inactive',
69
+			'isExpired'             => 'is_expired',
70
+		]);
71 71
 
72
-        parent::__construct();
73
-    }
72
+		parent::__construct();
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * @return array
78
-     * @since $VID:$
79
-     */
80
-    public static function getFieldDefinitions()
81
-    {
82
-        return [
83
-            'name'                  => [
84
-                'type'        => 'String',
85
-                'description' => __('Event Name', 'event_espresso'),
86
-            ],
87
-            'desc'                  => [
88
-                'type'        => 'String',
89
-                'description' => __('Event Description', 'event_espresso'),
90
-            ],
91
-            'shortDesc'             => [
92
-                'type'        => 'String',
93
-                'description' => __('Event Short Description', 'event_espresso'),
94
-            ],
95
-            'created'               => [
96
-                'type'        => 'String',
97
-                'description' => __('Date/Time Event Created', 'event_espresso'),
98
-            ],
99
-            'wpUser'                => [
100
-                'type'        => 'User',
101
-                'description' => __('Event Creator', 'event_espresso'),
102
-            ],
103
-            'order'                 => [
104
-                'type'        => 'Int',
105
-                'description' => __('Event Menu Order', 'event_espresso'),
106
-            ],
107
-            'displayDesc'           => [
108
-                'type'        => 'Boolean',
109
-                'description' => __('Display Description Flag', 'event_espresso'),
110
-            ],
111
-            'displayTicketSelector' => [
112
-                'type'        => 'Boolean',
113
-                'description' => __('Display Ticket Selector Flag', 'event_espresso'),
114
-            ],
115
-            'visibleOn'             => [
116
-                'type'        => 'String',
117
-                'description' => __('Event Visible Date', 'event_espresso'),
118
-            ],
119
-            'additionalLimit'       => [
120
-                'type'        => 'String',
121
-                'description' => __('Limit of Additional Registrations on Same Transaction', 'event_espresso'),
122
-            ],
123
-            'phone'                 => [
124
-                'type'        => 'String',
125
-                'description' => __('Event Phone Number', 'event_espresso'),
126
-            ],
127
-            'memberOnly'            => [
128
-                'type'        => 'Boolean',
129
-                'description' => __('Member-Only Event Flag', 'event_espresso'),
130
-            ],
131
-            'allowOverflow'         => [
132
-                'type'        => 'Boolean',
133
-                'description' => __('Allow Overflow on Event', 'event_espresso'),
134
-            ],
135
-            'timezoneString'        => [
136
-                'type'        => 'String',
137
-                'description' => __('Timezone (name) for Event times', 'event_espresso'),
138
-            ],
139
-            'externalUrl'           => [
140
-                'type'        => 'String',
141
-                'description' => __('URL of Event Page if hosted elsewhere', 'event_espresso'),
142
-            ],
143
-            'donations'             => [
144
-                'type'        => 'Boolean',
145
-                'description' => __('Accept Donations?', 'event_espresso'),
146
-            ],
147
-            'isSoldOut'             => [
148
-                'type'        => 'Boolean',
149
-                'description' => __('Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
150
-                    'event_espresso'),
151
-            ],
152
-            'isPostponed'           => [
153
-                'type'        => 'Boolean',
154
-                'description' => __('Flag indicating whether the event is marked as postponed', 'event_espresso'),
155
-            ],
156
-            'isCancelled'           => [
157
-                'type'        => 'Boolean',
158
-                'description' => __('Flag indicating whether the event is marked as cancelled', 'event_espresso'),
159
-            ],
160
-            'isUpcoming'            => [
161
-                'type'        => 'Boolean',
162
-                'description' => __('Whether the event is upcoming', 'event_espresso'),
163
-            ],
164
-            'isActive'              => [
165
-                'type'        => 'Boolean',
166
-                'description' => __('Flag indicating event is active', 'event_espresso'),
167
-            ],
168
-            'isInactive'            => [
169
-                'type'        => 'Boolean',
170
-                'description' => __('Flag indicating event is inactive', 'event_espresso'),
171
-            ],
172
-            'isExpired'             => [
173
-                'type'        => 'Boolean',
174
-                'description' => __('Flag indicating event is expired or not', 'event_espresso'),
175
-            ],
176
-        ];
177
-    }
76
+	/**
77
+	 * @return array
78
+	 * @since $VID:$
79
+	 */
80
+	public static function getFieldDefinitions()
81
+	{
82
+		return [
83
+			'name'                  => [
84
+				'type'        => 'String',
85
+				'description' => __('Event Name', 'event_espresso'),
86
+			],
87
+			'desc'                  => [
88
+				'type'        => 'String',
89
+				'description' => __('Event Description', 'event_espresso'),
90
+			],
91
+			'shortDesc'             => [
92
+				'type'        => 'String',
93
+				'description' => __('Event Short Description', 'event_espresso'),
94
+			],
95
+			'created'               => [
96
+				'type'        => 'String',
97
+				'description' => __('Date/Time Event Created', 'event_espresso'),
98
+			],
99
+			'wpUser'                => [
100
+				'type'        => 'User',
101
+				'description' => __('Event Creator', 'event_espresso'),
102
+			],
103
+			'order'                 => [
104
+				'type'        => 'Int',
105
+				'description' => __('Event Menu Order', 'event_espresso'),
106
+			],
107
+			'displayDesc'           => [
108
+				'type'        => 'Boolean',
109
+				'description' => __('Display Description Flag', 'event_espresso'),
110
+			],
111
+			'displayTicketSelector' => [
112
+				'type'        => 'Boolean',
113
+				'description' => __('Display Ticket Selector Flag', 'event_espresso'),
114
+			],
115
+			'visibleOn'             => [
116
+				'type'        => 'String',
117
+				'description' => __('Event Visible Date', 'event_espresso'),
118
+			],
119
+			'additionalLimit'       => [
120
+				'type'        => 'String',
121
+				'description' => __('Limit of Additional Registrations on Same Transaction', 'event_espresso'),
122
+			],
123
+			'phone'                 => [
124
+				'type'        => 'String',
125
+				'description' => __('Event Phone Number', 'event_espresso'),
126
+			],
127
+			'memberOnly'            => [
128
+				'type'        => 'Boolean',
129
+				'description' => __('Member-Only Event Flag', 'event_espresso'),
130
+			],
131
+			'allowOverflow'         => [
132
+				'type'        => 'Boolean',
133
+				'description' => __('Allow Overflow on Event', 'event_espresso'),
134
+			],
135
+			'timezoneString'        => [
136
+				'type'        => 'String',
137
+				'description' => __('Timezone (name) for Event times', 'event_espresso'),
138
+			],
139
+			'externalUrl'           => [
140
+				'type'        => 'String',
141
+				'description' => __('URL of Event Page if hosted elsewhere', 'event_espresso'),
142
+			],
143
+			'donations'             => [
144
+				'type'        => 'Boolean',
145
+				'description' => __('Accept Donations?', 'event_espresso'),
146
+			],
147
+			'isSoldOut'             => [
148
+				'type'        => 'Boolean',
149
+				'description' => __('Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
150
+					'event_espresso'),
151
+			],
152
+			'isPostponed'           => [
153
+				'type'        => 'Boolean',
154
+				'description' => __('Flag indicating whether the event is marked as postponed', 'event_espresso'),
155
+			],
156
+			'isCancelled'           => [
157
+				'type'        => 'Boolean',
158
+				'description' => __('Flag indicating whether the event is marked as cancelled', 'event_espresso'),
159
+			],
160
+			'isUpcoming'            => [
161
+				'type'        => 'Boolean',
162
+				'description' => __('Whether the event is upcoming', 'event_espresso'),
163
+			],
164
+			'isActive'              => [
165
+				'type'        => 'Boolean',
166
+				'description' => __('Flag indicating event is active', 'event_espresso'),
167
+			],
168
+			'isInactive'            => [
169
+				'type'        => 'Boolean',
170
+				'description' => __('Flag indicating event is inactive', 'event_espresso'),
171
+			],
172
+			'isExpired'             => [
173
+				'type'        => 'Boolean',
174
+				'description' => __('Flag indicating event is expired or not', 'event_espresso'),
175
+			],
176
+		];
177
+	}
178 178
 }
179 179
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/services/graphql/types/State.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
 class State extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * State constructor.
39
-     *
40
-     * @param EEM_State $state_model
41
-     */
42
-    public function __construct(EEM_State $state_model)
43
-    {
44
-        $this->model = $state_model;
45
-        $this->setName('State');
46
-        $this->setDescription(__('A state', 'event_espresso'));
47
-        $this->setIsCustomPostType(false);
48
-        $this->setGraphQLToModelMap([
49
-            'id'           => 'ID',
50
-            'abbreviation' => 'abbrev',
51
-            'name'         => 'name' ,
52
-            'isActive'     => 'active',
53
-        ]);
37
+	/**
38
+	 * State constructor.
39
+	 *
40
+	 * @param EEM_State $state_model
41
+	 */
42
+	public function __construct(EEM_State $state_model)
43
+	{
44
+		$this->model = $state_model;
45
+		$this->setName('State');
46
+		$this->setDescription(__('A state', 'event_espresso'));
47
+		$this->setIsCustomPostType(false);
48
+		$this->setGraphQLToModelMap([
49
+			'id'           => 'ID',
50
+			'abbreviation' => 'abbrev',
51
+			'name'         => 'name' ,
52
+			'isActive'     => 'active',
53
+		]);
54 54
 
55
-        parent::__construct();
56
-    }
55
+		parent::__construct();
56
+	}
57 57
 
58 58
 
59
-    /**
60
-     * @return array
61
-     * @since $VID:$
62
-     */
63
-    public static function getFieldDefinitions()
64
-    {
65
-        return [
66
-            'id'           => [
67
-                'type'        => [
68
-                    'non_null' => 'Int',
69
-                ],
70
-                'description' => __( 'State ID', 'event_espresso' ),
71
-            ],
72
-            'abbreviation' => [
73
-                'type'        => 'String',
74
-                'description' => __( 'State Abbreviation', 'event_espresso' ),
75
-            ],
76
-            'name'         => [
77
-                'type'        => 'String',
78
-                'description' => __('State Name', 'event_espresso'),
79
-            ],
80
-            'isActive'     => [
81
-                'type'        => 'Boolean',
82
-                'description' => __('State Active Flag', 'event_espresso'),
83
-            ],
84
-            'country'      => [
85
-                'type'        => 'Country',
86
-                'description' => __('Country for the state', 'event_espresso'),
87
-            ],
88
-        ];
89
-    }
59
+	/**
60
+	 * @return array
61
+	 * @since $VID:$
62
+	 */
63
+	public static function getFieldDefinitions()
64
+	{
65
+		return [
66
+			'id'           => [
67
+				'type'        => [
68
+					'non_null' => 'Int',
69
+				],
70
+				'description' => __( 'State ID', 'event_espresso' ),
71
+			],
72
+			'abbreviation' => [
73
+				'type'        => 'String',
74
+				'description' => __( 'State Abbreviation', 'event_espresso' ),
75
+			],
76
+			'name'         => [
77
+				'type'        => 'String',
78
+				'description' => __('State Name', 'event_espresso'),
79
+			],
80
+			'isActive'     => [
81
+				'type'        => 'Boolean',
82
+				'description' => __('State Active Flag', 'event_espresso'),
83
+			],
84
+			'country'      => [
85
+				'type'        => 'Country',
86
+				'description' => __('Country for the state', 'event_espresso'),
87
+			],
88
+		];
89
+	}
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $this->setGraphQLToModelMap([
49 49
             'id'           => 'ID',
50 50
             'abbreviation' => 'abbrev',
51
-            'name'         => 'name' ,
51
+            'name'         => 'name',
52 52
             'isActive'     => 'active',
53 53
         ]);
54 54
 
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
                 'type'        => [
68 68
                     'non_null' => 'Int',
69 69
                 ],
70
-                'description' => __( 'State ID', 'event_espresso' ),
70
+                'description' => __('State ID', 'event_espresso'),
71 71
             ],
72 72
             'abbreviation' => [
73 73
                 'type'        => 'String',
74
-                'description' => __( 'State Abbreviation', 'event_espresso' ),
74
+                'description' => __('State Abbreviation', 'event_espresso'),
75 75
             ],
76 76
             'name'         => [
77 77
                 'type'        => 'String',
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Ticket.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -34,133 +34,133 @@
 block discarded – undo
34 34
 class Ticket extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * Ticket constructor.
39
-     *
40
-     * @param EEM_Ticket $ticket_model
41
-     */
42
-    public function __construct(EEM_Ticket $ticket_model)
43
-    {
44
-        $this->model = $ticket_model;
45
-        $this->setName('Ticket');
46
-        $this->setDescription(__('A ticket for an event date', 'event_espresso'));
47
-        $this->setIsCustomPostType(false);
48
-        $this->setGraphQLToModelMap([
49
-            'id'               => 'ID',
50
-            'name'             => 'name',
51
-            'description'      => 'description',
52
-            'startDate'        => 'start_date',
53
-            'endDate'          => 'end_date',
54
-            'min'              => 'min',
55
-            'price'            => 'price',
56
-            'sold'             => 'sold',
57
-            'reserved'         => 'reserved',
58
-            'isRequired'       => 'required',
59
-            'isTaxable'        => 'taxable',
60
-            'isDefault'        => 'is_default',
61
-            'order'            => 'order',
62
-            'row'              => 'row',
63
-            'reverseCalculate' => 'reverse_calculate',
64
-            'isFree'           => 'is_free',
65
-        ]);
37
+	/**
38
+	 * Ticket constructor.
39
+	 *
40
+	 * @param EEM_Ticket $ticket_model
41
+	 */
42
+	public function __construct(EEM_Ticket $ticket_model)
43
+	{
44
+		$this->model = $ticket_model;
45
+		$this->setName('Ticket');
46
+		$this->setDescription(__('A ticket for an event date', 'event_espresso'));
47
+		$this->setIsCustomPostType(false);
48
+		$this->setGraphQLToModelMap([
49
+			'id'               => 'ID',
50
+			'name'             => 'name',
51
+			'description'      => 'description',
52
+			'startDate'        => 'start_date',
53
+			'endDate'          => 'end_date',
54
+			'min'              => 'min',
55
+			'price'            => 'price',
56
+			'sold'             => 'sold',
57
+			'reserved'         => 'reserved',
58
+			'isRequired'       => 'required',
59
+			'isTaxable'        => 'taxable',
60
+			'isDefault'        => 'is_default',
61
+			'order'            => 'order',
62
+			'row'              => 'row',
63
+			'reverseCalculate' => 'reverse_calculate',
64
+			'isFree'           => 'is_free',
65
+		]);
66 66
 
67
-        parent::__construct();
68
-    }
67
+		parent::__construct();
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * @return array
73
-     * @since $VID:$
74
-     */
75
-    public static function getFieldDefinitions()
76
-    {
77
-        return [
78
-            'id'               => [
79
-                'type'        => [
80
-                    'non_null' => 'Int',
81
-                ],
82
-                'description' => __('Ticket ID', 'event_espresso'),
83
-            ],
84
-            'name'             => [
85
-                'type'        => 'String',
86
-                'description' => __('Ticket Name', 'event_espresso'),
87
-            ],
88
-            'description'      => [
89
-                'type'        => 'String',
90
-                'description' => __('Description of Ticket', 'event_espresso'),
91
-            ],
92
-            'startDate'        => [
93
-                'type'        => 'String',
94
-                'description' => __('Start time/date of Ticket', 'event_espresso'),
95
-            ],
96
-            'endDate'          => [
97
-                'type'        => 'String',
98
-                'description' => __('End time/date of Ticket', 'event_espresso'),
99
-            ],
100
-            'min'              => [
101
-                'type'        => 'Int',
102
-                'description' => __('Minimum quantity of this ticket that must be purchased', 'event_espresso'),
103
-            ],
104
-            'max'              => [
105
-                'type'        => 'Int',
106
-                'description' => __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'),
107
-            ],
108
-            'price'            => [
109
-                'type'        => 'Float',
110
-                'description' => __('Final calculated price for ticket', 'event_espresso'),
111
-            ],
112
-            'sold'             => [
113
-                'type'        => 'Int',
114
-                'description' => __('Number of this ticket sold', 'event_espresso'),
115
-            ],
116
-            'quantity'         => [
117
-                'type'        => 'Int',
118
-                'description' => __('Quantity of this ticket that is available', 'event_espresso'),
119
-            ],
120
-            'reserved'         => [
121
-                'type'        => 'Int',
122
-                'description' => __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso'),
123
-            ],
124
-            'uses'             => [
125
-                'type'        => 'Int',
126
-                'description' => __('Number of datetimes this ticket can be used at', 'event_espresso'),
127
-            ],
128
-            'isRequired'       => [
129
-                'type'        => 'Boolean',
130
-                'description' => __('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso'),
131
-            ],
132
-            'isTaxable'        => [
133
-                'type'        => 'Boolean',
134
-                'description' => __('Flag indicating whether there is tax applied on this ticket', 'event_espresso'),
135
-            ],
136
-            'isDefault'        => [
137
-                'type'        => 'Boolean',
138
-                'description' => __('Flag indicating that this ticket is a default ticket', 'event_espresso'),
139
-            ],
140
-            'order'            => [
141
-                'type'        => 'Int',
142
-                'description' => __('The order in which the Datetime is displayed', 'event_espresso'),
143
-            ],
144
-            'row'              => [
145
-                'type'        => 'Int',
146
-                'description' => __('How tickets are displayed in the ui', 'event_espresso'),
147
-            ],
148
-            'wpUser'           => [
149
-                'type'        => 'User',
150
-                'description' => __('Ticket Creator ID', 'event_espresso'),
151
-            ],
152
-            'parent'           => [
153
-                'type'        => 'Ticket',
154
-                'description' => __('The parent ticket of the current ticket', 'event_espresso'),
155
-            ],
156
-            'reverseCalculate' => [
157
-                'type'        => 'Boolean',
158
-                'description' => __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso'),
159
-            ],
160
-            'isFree'           => [
161
-                'type'        => 'Boolean',
162
-                'description' => __('Flag indicating whether the ticket is free.', 'event_espresso'),
163
-            ],
164
-        ];
165
-    }
71
+	/**
72
+	 * @return array
73
+	 * @since $VID:$
74
+	 */
75
+	public static function getFieldDefinitions()
76
+	{
77
+		return [
78
+			'id'               => [
79
+				'type'        => [
80
+					'non_null' => 'Int',
81
+				],
82
+				'description' => __('Ticket ID', 'event_espresso'),
83
+			],
84
+			'name'             => [
85
+				'type'        => 'String',
86
+				'description' => __('Ticket Name', 'event_espresso'),
87
+			],
88
+			'description'      => [
89
+				'type'        => 'String',
90
+				'description' => __('Description of Ticket', 'event_espresso'),
91
+			],
92
+			'startDate'        => [
93
+				'type'        => 'String',
94
+				'description' => __('Start time/date of Ticket', 'event_espresso'),
95
+			],
96
+			'endDate'          => [
97
+				'type'        => 'String',
98
+				'description' => __('End time/date of Ticket', 'event_espresso'),
99
+			],
100
+			'min'              => [
101
+				'type'        => 'Int',
102
+				'description' => __('Minimum quantity of this ticket that must be purchased', 'event_espresso'),
103
+			],
104
+			'max'              => [
105
+				'type'        => 'Int',
106
+				'description' => __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'),
107
+			],
108
+			'price'            => [
109
+				'type'        => 'Float',
110
+				'description' => __('Final calculated price for ticket', 'event_espresso'),
111
+			],
112
+			'sold'             => [
113
+				'type'        => 'Int',
114
+				'description' => __('Number of this ticket sold', 'event_espresso'),
115
+			],
116
+			'quantity'         => [
117
+				'type'        => 'Int',
118
+				'description' => __('Quantity of this ticket that is available', 'event_espresso'),
119
+			],
120
+			'reserved'         => [
121
+				'type'        => 'Int',
122
+				'description' => __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso'),
123
+			],
124
+			'uses'             => [
125
+				'type'        => 'Int',
126
+				'description' => __('Number of datetimes this ticket can be used at', 'event_espresso'),
127
+			],
128
+			'isRequired'       => [
129
+				'type'        => 'Boolean',
130
+				'description' => __('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso'),
131
+			],
132
+			'isTaxable'        => [
133
+				'type'        => 'Boolean',
134
+				'description' => __('Flag indicating whether there is tax applied on this ticket', 'event_espresso'),
135
+			],
136
+			'isDefault'        => [
137
+				'type'        => 'Boolean',
138
+				'description' => __('Flag indicating that this ticket is a default ticket', 'event_espresso'),
139
+			],
140
+			'order'            => [
141
+				'type'        => 'Int',
142
+				'description' => __('The order in which the Datetime is displayed', 'event_espresso'),
143
+			],
144
+			'row'              => [
145
+				'type'        => 'Int',
146
+				'description' => __('How tickets are displayed in the ui', 'event_espresso'),
147
+			],
148
+			'wpUser'           => [
149
+				'type'        => 'User',
150
+				'description' => __('Ticket Creator ID', 'event_espresso'),
151
+			],
152
+			'parent'           => [
153
+				'type'        => 'Ticket',
154
+				'description' => __('The parent ticket of the current ticket', 'event_espresso'),
155
+			],
156
+			'reverseCalculate' => [
157
+				'type'        => 'Boolean',
158
+				'description' => __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso'),
159
+			],
160
+			'isFree'           => [
161
+				'type'        => 'Boolean',
162
+				'description' => __('Flag indicating whether the ticket is free.', 'event_espresso'),
163
+			],
164
+		];
165
+	}
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Datetime.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -34,136 +34,136 @@
 block discarded – undo
34 34
 class Datetime extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * EventDate constructor.
39
-     *
40
-     * @param EEM_Datetime $datetime_model
41
-     */
42
-    public function __construct(EEM_Datetime $datetime_model)
43
-    {
44
-        $this->model = $datetime_model;
45
-        $this->setName('Datetime');
46
-        $this->setDescription(__('An event date', 'event_espresso'));
47
-        $this->setIsCustomPostType(false);
48
-        $this->setGraphQLToModelMap([
49
-            'id'          => 'ID',
50
-            'name'        => 'name',
51
-            'description' => 'description',
52
-            'start'       => 'start',
53
-            'startDate'   => 'start_date',
54
-            'end'         => 'end',
55
-            'endDate'     => 'end_date',
56
-            'startTime'   => 'start_time',
57
-            'endTime'     => 'end_time',
58
-            'sold'        => 'sold',
59
-            'reserved'    => 'reserved',
60
-            'order'       => 'order',
61
-            'length'      => 'length',
62
-            'isPrimary'   => 'is_primary',
63
-            'isSoldOut'   => 'sold_out',
64
-            'isUpcoming'  => 'is_upcoming',
65
-            'isActive'    => 'is_active',
66
-            'isExpired'   => 'is_expired',
67
-        ]);
37
+	/**
38
+	 * EventDate constructor.
39
+	 *
40
+	 * @param EEM_Datetime $datetime_model
41
+	 */
42
+	public function __construct(EEM_Datetime $datetime_model)
43
+	{
44
+		$this->model = $datetime_model;
45
+		$this->setName('Datetime');
46
+		$this->setDescription(__('An event date', 'event_espresso'));
47
+		$this->setIsCustomPostType(false);
48
+		$this->setGraphQLToModelMap([
49
+			'id'          => 'ID',
50
+			'name'        => 'name',
51
+			'description' => 'description',
52
+			'start'       => 'start',
53
+			'startDate'   => 'start_date',
54
+			'end'         => 'end',
55
+			'endDate'     => 'end_date',
56
+			'startTime'   => 'start_time',
57
+			'endTime'     => 'end_time',
58
+			'sold'        => 'sold',
59
+			'reserved'    => 'reserved',
60
+			'order'       => 'order',
61
+			'length'      => 'length',
62
+			'isPrimary'   => 'is_primary',
63
+			'isSoldOut'   => 'sold_out',
64
+			'isUpcoming'  => 'is_upcoming',
65
+			'isActive'    => 'is_active',
66
+			'isExpired'   => 'is_expired',
67
+		]);
68 68
 
69
-        parent::__construct();
70
-    }
69
+		parent::__construct();
70
+	}
71 71
 
72 72
 
73
-    /**
74
-     * @return array
75
-     * @since $VID:$
76
-     */
77
-    public static function getFieldDefinitions()
78
-    {
79
-        return [
80
-            'id'          => [
81
-                'type'        => [
82
-                    'non_null' => 'Int',
83
-                ],
84
-                'description' => __('The datetime ID.', 'event_espresso'),
85
-            ],
86
-            'name'        => [
87
-                'type'        => 'String',
88
-                'description' => __('Datetime Name', 'event_espresso'),
89
-            ],
90
-            'description' => [
91
-                'type'        => 'String',
92
-                'description' => __('Description for Datetime', 'event_espresso'),
93
-            ],
94
-            'start'       => [
95
-                'type'        => 'String',
96
-                'description' => __('Start timestamp of Event', 'event_espresso'),
97
-            ],
98
-            'startDate'   => [
99
-                'type'        => 'String',
100
-                'description' => __('Start time/date of Event', 'event_espresso'),
101
-            ],
102
-            'end'         => [
103
-                'type'        => 'String',
104
-                'description' => __('End timestamp of Event', 'event_espresso'),
105
-            ],
106
-            'endDate'     => [
107
-                'type'        => 'String',
108
-                'description' => __('End time/date of Event', 'event_espresso'),
109
-            ],
110
-            'startTime'   => [
111
-                'type'        => 'String',
112
-                'description' => __('Start time of Event', 'event_espresso'),
113
-            ],
114
-            'endTime'     => [
115
-                'type'        => 'String',
116
-                'description' => __('End time of Event', 'event_espresso'),
117
-            ],
118
-            'capacity'    => [
119
-                'type'        => 'Int',
120
-                'description' => __('Registration Limit for this time', 'event_espresso'),
121
-            ],
122
-            'sold'        => [
123
-                'type'        => 'Int',
124
-                'description' => __('How many sales for this Datetime that have occurred', 'event_espresso'),
125
-            ],
126
-            'reserved'    => [
127
-                'type'        => 'Int',
128
-                'description' => __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
129
-            ],
130
-            'order'       => [
131
-                'type'        => 'Int',
132
-                'description' => __('The order in which the Datetime is displayed', 'event_espresso'),
133
-            ],
134
-            'length'      => [
135
-                'type'        => 'Int',
136
-                'description' => __('The length of the event (start to end time) in seconds', 'event_espresso'),
137
-            ],
138
-            'parent'      => [
139
-                'type'        => 'Datetime',
140
-                'description' => __('The parent datetime of the current datetime', 'event_espresso'),
141
-            ],
142
-            'isPrimary'   => [
143
-                'type'        => 'Boolean',
144
-                'description' => __('Flag indicating datetime is primary one for event', 'event_espresso'),
145
-            ],
146
-            'isSoldOut'   => [
147
-                'type'        => 'Boolean',
148
-                'description' => __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
149
-                    'event_espresso'),
150
-            ],
151
-            'isUpcoming'  => [
152
-                'type'        => 'Boolean',
153
-                'description' => __('Whether the date is upcoming', 'event_espresso'),
154
-            ],
155
-            'isActive'    => [
156
-                'type'        => 'Boolean',
157
-                'description' => __('Flag indicating datetime is active', 'event_espresso'),
158
-            ],
159
-            'isExpired'   => [
160
-                'type'        => 'Boolean',
161
-                'description' => __('Flag indicating datetime is expired or not', 'event_espresso'),
162
-            ],
163
-            'event'       => [
164
-                'type'        => 'Event',
165
-                'description' => __('Event of the datetime.', 'event_espresso'),
166
-            ],
167
-        ];
168
-    }
73
+	/**
74
+	 * @return array
75
+	 * @since $VID:$
76
+	 */
77
+	public static function getFieldDefinitions()
78
+	{
79
+		return [
80
+			'id'          => [
81
+				'type'        => [
82
+					'non_null' => 'Int',
83
+				],
84
+				'description' => __('The datetime ID.', 'event_espresso'),
85
+			],
86
+			'name'        => [
87
+				'type'        => 'String',
88
+				'description' => __('Datetime Name', 'event_espresso'),
89
+			],
90
+			'description' => [
91
+				'type'        => 'String',
92
+				'description' => __('Description for Datetime', 'event_espresso'),
93
+			],
94
+			'start'       => [
95
+				'type'        => 'String',
96
+				'description' => __('Start timestamp of Event', 'event_espresso'),
97
+			],
98
+			'startDate'   => [
99
+				'type'        => 'String',
100
+				'description' => __('Start time/date of Event', 'event_espresso'),
101
+			],
102
+			'end'         => [
103
+				'type'        => 'String',
104
+				'description' => __('End timestamp of Event', 'event_espresso'),
105
+			],
106
+			'endDate'     => [
107
+				'type'        => 'String',
108
+				'description' => __('End time/date of Event', 'event_espresso'),
109
+			],
110
+			'startTime'   => [
111
+				'type'        => 'String',
112
+				'description' => __('Start time of Event', 'event_espresso'),
113
+			],
114
+			'endTime'     => [
115
+				'type'        => 'String',
116
+				'description' => __('End time of Event', 'event_espresso'),
117
+			],
118
+			'capacity'    => [
119
+				'type'        => 'Int',
120
+				'description' => __('Registration Limit for this time', 'event_espresso'),
121
+			],
122
+			'sold'        => [
123
+				'type'        => 'Int',
124
+				'description' => __('How many sales for this Datetime that have occurred', 'event_espresso'),
125
+			],
126
+			'reserved'    => [
127
+				'type'        => 'Int',
128
+				'description' => __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'),
129
+			],
130
+			'order'       => [
131
+				'type'        => 'Int',
132
+				'description' => __('The order in which the Datetime is displayed', 'event_espresso'),
133
+			],
134
+			'length'      => [
135
+				'type'        => 'Int',
136
+				'description' => __('The length of the event (start to end time) in seconds', 'event_espresso'),
137
+			],
138
+			'parent'      => [
139
+				'type'        => 'Datetime',
140
+				'description' => __('The parent datetime of the current datetime', 'event_espresso'),
141
+			],
142
+			'isPrimary'   => [
143
+				'type'        => 'Boolean',
144
+				'description' => __('Flag indicating datetime is primary one for event', 'event_espresso'),
145
+			],
146
+			'isSoldOut'   => [
147
+				'type'        => 'Boolean',
148
+				'description' => __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
149
+					'event_espresso'),
150
+			],
151
+			'isUpcoming'  => [
152
+				'type'        => 'Boolean',
153
+				'description' => __('Whether the date is upcoming', 'event_espresso'),
154
+			],
155
+			'isActive'    => [
156
+				'type'        => 'Boolean',
157
+				'description' => __('Flag indicating datetime is active', 'event_espresso'),
158
+			],
159
+			'isExpired'   => [
160
+				'type'        => 'Boolean',
161
+				'description' => __('Flag indicating datetime is expired or not', 'event_espresso'),
162
+			],
163
+			'event'       => [
164
+				'type'        => 'Event',
165
+				'description' => __('Event of the datetime.', 'event_espresso'),
166
+			],
167
+		];
168
+	}
169 169
 }
170 170
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Country.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -34,76 +34,76 @@
 block discarded – undo
34 34
 class Country extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * Country constructor.
39
-     *
40
-     * @param EEM_Country $country_model
41
-     */
42
-    public function __construct(EEM_Country $country_model)
43
-    {
44
-        $this->model = $country_model;
45
-        $this->setName('Country');
46
-        $this->setDescription(__('A country', 'event_espresso'));
47
-        $this->setIsCustomPostType(false);
48
-        $this->setGraphQLToModelMap([
49
-            'name'                       => 'name',
50
-            'currencyCode'               => 'currency_code',
51
-            'currencySingular'           => 'currency_name_single',
52
-            'currencyPlural'             => 'currency_name_plural',
53
-            'currencySign'               => 'currency_sign',
54
-            'currencySignBeforeNumber'   => 'currency_sign_before',
55
-            'currencyDecimalPlaces'      => 'currency_decimal_places',
56
-            'currencyDecimalMark'        => 'currency_decimal_mark',
57
-            'currencyThousandsSeparator' => 'currency_thousands_separator',
58
-        ]);
37
+	/**
38
+	 * Country constructor.
39
+	 *
40
+	 * @param EEM_Country $country_model
41
+	 */
42
+	public function __construct(EEM_Country $country_model)
43
+	{
44
+		$this->model = $country_model;
45
+		$this->setName('Country');
46
+		$this->setDescription(__('A country', 'event_espresso'));
47
+		$this->setIsCustomPostType(false);
48
+		$this->setGraphQLToModelMap([
49
+			'name'                       => 'name',
50
+			'currencyCode'               => 'currency_code',
51
+			'currencySingular'           => 'currency_name_single',
52
+			'currencyPlural'             => 'currency_name_plural',
53
+			'currencySign'               => 'currency_sign',
54
+			'currencySignBeforeNumber'   => 'currency_sign_before',
55
+			'currencyDecimalPlaces'      => 'currency_decimal_places',
56
+			'currencyDecimalMark'        => 'currency_decimal_mark',
57
+			'currencyThousandsSeparator' => 'currency_thousands_separator',
58
+		]);
59 59
 
60
-        parent::__construct();
61
-    }
60
+		parent::__construct();
61
+	}
62 62
 
63 63
 
64
-    /**
65
-     * @return array
66
-     * @since $VID:$
67
-     */
68
-    public static function getFieldDefinitions()
69
-    {
70
-        return [
71
-            'name'                       => [
72
-                'type'        => 'String',
73
-                'description' => __('Country Name', 'event_espresso'),
74
-            ],
75
-            'currencyCode'               => [
76
-                'type'        => 'String',
77
-                'description' => __('Country Currency Code', 'event_espresso'),
78
-            ],
79
-            'currencySingular'           => [
80
-                'type'        => 'String',
81
-                'description' => __('Currency Name Singular', 'event_espresso'),
82
-            ],
83
-            'currencyPlural'             => [
84
-                'type'        => 'String',
85
-                'description' => __('Currency Name Plural', 'event_espresso'),
86
-            ],
87
-            'currencySign'               => [
88
-                'type'        => 'String',
89
-                'description' => __('Currency Sign', 'event_espresso'),
90
-            ],
91
-            'currencySignBeforeNumber'   => [
92
-                'type'        => 'String',
93
-                'description' => __('Currency Sign Before Number', 'event_espresso'),
94
-            ],
95
-            'currencyDecimalPlaces'      => [
96
-                'type'        => 'String',
97
-                'description' => __('Currency Decimal Places', 'event_espresso'),
98
-            ],
99
-            'currencyDecimalMark'        => [
100
-                'type'        => 'String',
101
-                'description' => __('Currency Decimal Mark', 'event_espresso'),
102
-            ],
103
-            'currencyThousandsSeparator' => [
104
-                'type'        => 'String',
105
-                'description' => __('Currency Thousands Separator', 'event_espresso'),
106
-            ],
107
-        ];
108
-    }
64
+	/**
65
+	 * @return array
66
+	 * @since $VID:$
67
+	 */
68
+	public static function getFieldDefinitions()
69
+	{
70
+		return [
71
+			'name'                       => [
72
+				'type'        => 'String',
73
+				'description' => __('Country Name', 'event_espresso'),
74
+			],
75
+			'currencyCode'               => [
76
+				'type'        => 'String',
77
+				'description' => __('Country Currency Code', 'event_espresso'),
78
+			],
79
+			'currencySingular'           => [
80
+				'type'        => 'String',
81
+				'description' => __('Currency Name Singular', 'event_espresso'),
82
+			],
83
+			'currencyPlural'             => [
84
+				'type'        => 'String',
85
+				'description' => __('Currency Name Plural', 'event_espresso'),
86
+			],
87
+			'currencySign'               => [
88
+				'type'        => 'String',
89
+				'description' => __('Currency Sign', 'event_espresso'),
90
+			],
91
+			'currencySignBeforeNumber'   => [
92
+				'type'        => 'String',
93
+				'description' => __('Currency Sign Before Number', 'event_espresso'),
94
+			],
95
+			'currencyDecimalPlaces'      => [
96
+				'type'        => 'String',
97
+				'description' => __('Currency Decimal Places', 'event_espresso'),
98
+			],
99
+			'currencyDecimalMark'        => [
100
+				'type'        => 'String',
101
+				'description' => __('Currency Decimal Mark', 'event_espresso'),
102
+			],
103
+			'currencyThousandsSeparator' => [
104
+				'type'        => 'String',
105
+				'description' => __('Currency Thousands Separator', 'event_espresso'),
106
+			],
107
+		];
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Venue.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -34,126 +34,126 @@
 block discarded – undo
34 34
 class Venue extends TypeBase
35 35
 {
36 36
 
37
-    /**
38
-     * Venue constructor.
39
-     *
40
-     * @param EEM_Venue $venue_model
41
-     */
42
-    public function __construct(EEM_Venue $venue_model)
43
-    {
44
-        $this->model = $venue_model;
45
-        $this->setName('Venue');
46
-        $this->setIsCustomPostType(true);
47
-        $this->setGraphQLToModelMap([
48
-            'name'          => 'name',
49
-            'desc'          => 'description',
50
-            'shortDesc'     => 'excerpt',
51
-            'identifier'    => 'identifier',
52
-            'created'       => 'created',
53
-            'order'         => 'order',
54
-            'address'       => 'address',
55
-            'address2'      => 'address2',
56
-            'city'          => 'city',
57
-            'zip'           => 'zip',
58
-            'phone'         => 'phone',
59
-            'virtualPhone'  => 'virtual_phone',
60
-            'url'           => 'venue_url',
61
-            'virtualUrl'    => 'virtual_url',
62
-            'googleMapLink' => 'google_map_link',
63
-            'enableForGmap' => 'enable_for_gmap',
64
-        ]);
37
+	/**
38
+	 * Venue constructor.
39
+	 *
40
+	 * @param EEM_Venue $venue_model
41
+	 */
42
+	public function __construct(EEM_Venue $venue_model)
43
+	{
44
+		$this->model = $venue_model;
45
+		$this->setName('Venue');
46
+		$this->setIsCustomPostType(true);
47
+		$this->setGraphQLToModelMap([
48
+			'name'          => 'name',
49
+			'desc'          => 'description',
50
+			'shortDesc'     => 'excerpt',
51
+			'identifier'    => 'identifier',
52
+			'created'       => 'created',
53
+			'order'         => 'order',
54
+			'address'       => 'address',
55
+			'address2'      => 'address2',
56
+			'city'          => 'city',
57
+			'zip'           => 'zip',
58
+			'phone'         => 'phone',
59
+			'virtualPhone'  => 'virtual_phone',
60
+			'url'           => 'venue_url',
61
+			'virtualUrl'    => 'virtual_url',
62
+			'googleMapLink' => 'google_map_link',
63
+			'enableForGmap' => 'enable_for_gmap',
64
+		]);
65 65
 
66
-        parent::__construct();
67
-    }
66
+		parent::__construct();
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * @return array
72
-     * @since $VID:$
73
-     */
74
-    public static function getFieldDefinitions()
75
-    {
76
-        return [
77
-            'name'          => [
78
-                'type'        => 'String',
79
-                'description' => __('Venue Name', 'event_espresso'),
80
-            ],
81
-            'desc'          => [
82
-                'type'        => 'String',
83
-                'description' => __('Venue Description', 'event_espresso'),
84
-            ],
85
-            'shortDesc'     => [
86
-                'type'        => 'String',
87
-                'description' => __('Short Description of Venue', 'event_espresso'),
88
-            ],
89
-            'identifier'    => [
90
-                'type'        => 'String',
91
-                'description' => __('Venue Identifier', 'event_espresso'),
92
-            ],
93
-            'created'       => [
94
-                'type'        => 'String',
95
-                'description' => __('Date Venue Created', 'event_espresso'),
96
-            ],
97
-            'order'         => [
98
-                'type'        => 'Int',
99
-                'description' => __('Venue order', 'event_espresso'),
100
-            ],
101
-            'wpUser'        => [
102
-                'type'        => 'User',
103
-                'description' => __('Venue Creator', 'event_espresso'),
104
-            ],
105
-            'address'       => [
106
-                'type'        => 'String',
107
-                'description' => __('Venue Address line 1', 'event_espresso'),
108
-            ],
109
-            'address2'      => [
110
-                'type'        => 'String',
111
-                'description' => __('Venue Address line 2', 'event_espresso'),
112
-            ],
113
-            'city'          => [
114
-                'type'        => 'String',
115
-                'description' => __('Venue City', 'event_espresso'),
116
-            ],
117
-            'state'  => [
118
-                'type'        => 'State',
119
-                'description' => __('Venue state', 'event_espresso'),
120
-            ],
121
-            'country'  => [
122
-                'type'        => 'Country',
123
-                'description' => __('Venue country', 'event_espresso'),
124
-            ],
125
-            'zip'           => [
126
-                'type'        => 'String',
127
-                'description' => __('Venue Zip/Postal Code', 'event_espresso'),
128
-            ],
129
-            'capacity'      => [
130
-                'type'        => 'Int',
131
-                'description' => __('Venue Capacity', 'event_espresso'),
132
-            ],
133
-            'phone'         => [
134
-                'type'        => 'String',
135
-                'description' => __('Venue Phone', 'event_espresso'),
136
-            ],
137
-            'virtualPhone'  => [
138
-                'type'        => 'String',
139
-                'description' => __('Call in Number', 'event_espresso'),
140
-            ],
141
-            'url'           => [
142
-                'type'        => 'String',
143
-                'description' => __('Venue Website', 'event_espresso'),
144
-            ],
145
-            'virtualUrl'    => [
146
-                'type'        => 'String',
147
-                'description' => __('Virtual URL', 'event_espresso'),
148
-            ],
149
-            'googleMapLink' => [
150
-                'type'        => 'String',
151
-                'description' => __('Google Map Link', 'event_espresso'),
152
-            ],
153
-            'enableForGmap' => [
154
-                'type'        => 'String',
155
-                'description' => __('Show Google Map?', 'event_espresso'),
156
-            ],
157
-        ];
158
-    }
70
+	/**
71
+	 * @return array
72
+	 * @since $VID:$
73
+	 */
74
+	public static function getFieldDefinitions()
75
+	{
76
+		return [
77
+			'name'          => [
78
+				'type'        => 'String',
79
+				'description' => __('Venue Name', 'event_espresso'),
80
+			],
81
+			'desc'          => [
82
+				'type'        => 'String',
83
+				'description' => __('Venue Description', 'event_espresso'),
84
+			],
85
+			'shortDesc'     => [
86
+				'type'        => 'String',
87
+				'description' => __('Short Description of Venue', 'event_espresso'),
88
+			],
89
+			'identifier'    => [
90
+				'type'        => 'String',
91
+				'description' => __('Venue Identifier', 'event_espresso'),
92
+			],
93
+			'created'       => [
94
+				'type'        => 'String',
95
+				'description' => __('Date Venue Created', 'event_espresso'),
96
+			],
97
+			'order'         => [
98
+				'type'        => 'Int',
99
+				'description' => __('Venue order', 'event_espresso'),
100
+			],
101
+			'wpUser'        => [
102
+				'type'        => 'User',
103
+				'description' => __('Venue Creator', 'event_espresso'),
104
+			],
105
+			'address'       => [
106
+				'type'        => 'String',
107
+				'description' => __('Venue Address line 1', 'event_espresso'),
108
+			],
109
+			'address2'      => [
110
+				'type'        => 'String',
111
+				'description' => __('Venue Address line 2', 'event_espresso'),
112
+			],
113
+			'city'          => [
114
+				'type'        => 'String',
115
+				'description' => __('Venue City', 'event_espresso'),
116
+			],
117
+			'state'  => [
118
+				'type'        => 'State',
119
+				'description' => __('Venue state', 'event_espresso'),
120
+			],
121
+			'country'  => [
122
+				'type'        => 'Country',
123
+				'description' => __('Venue country', 'event_espresso'),
124
+			],
125
+			'zip'           => [
126
+				'type'        => 'String',
127
+				'description' => __('Venue Zip/Postal Code', 'event_espresso'),
128
+			],
129
+			'capacity'      => [
130
+				'type'        => 'Int',
131
+				'description' => __('Venue Capacity', 'event_espresso'),
132
+			],
133
+			'phone'         => [
134
+				'type'        => 'String',
135
+				'description' => __('Venue Phone', 'event_espresso'),
136
+			],
137
+			'virtualPhone'  => [
138
+				'type'        => 'String',
139
+				'description' => __('Call in Number', 'event_espresso'),
140
+			],
141
+			'url'           => [
142
+				'type'        => 'String',
143
+				'description' => __('Venue Website', 'event_espresso'),
144
+			],
145
+			'virtualUrl'    => [
146
+				'type'        => 'String',
147
+				'description' => __('Virtual URL', 'event_espresso'),
148
+			],
149
+			'googleMapLink' => [
150
+				'type'        => 'String',
151
+				'description' => __('Google Map Link', 'event_espresso'),
152
+			],
153
+			'enableForGmap' => [
154
+				'type'        => 'String',
155
+				'description' => __('Show Google Map?', 'event_espresso'),
156
+			],
157
+		];
158
+	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/graphql/TypeBase.php 1 patch
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -48,223 +48,223 @@
 block discarded – undo
48 48
 abstract class TypeBase implements TypeInterface
49 49
 {
50 50
 
51
-    /**
52
-     * @var EEM_Base $model
53
-     */
54
-    protected $model;
55
-
56
-    /**
57
-     * @var string $name
58
-     */
59
-    protected $name = '';
60
-
61
-    /**
62
-     * @var string $description
63
-     */
64
-    protected $description = '';
65
-
66
-    /**
67
-     * @var array $fields
68
-     */
69
-    protected $fields = [];
70
-
71
-    /**
72
-     * @var array $graphql_to_model_map
73
-     */
74
-    protected $graphql_to_model_map = [];
75
-
76
-    /**
77
-     * @var FieldResolver $field_resolver
78
-     */
79
-    protected $field_resolver;
80
-
81
-    /**
82
-     * @var bool $is_custom_post_type
83
-     */
84
-    protected $is_custom_post_type = false;
85
-
86
-    /**
87
-     * TypeBase constructor.
88
-     *
89
-     */
90
-    public function __construct()
91
-    {
92
-        $this->field_resolver = new FieldResolver(
93
-            $this->model,
94
-            $this->graphql_to_model_map,
95
-        );
96
-
97
-        $this->setFields($this->getFields());
98
-    }
99
-
100
-
101
-    /**
102
-     * @return string
103
-     */
104
-    public function name()
105
-    {
106
-        return $this->name;
107
-    }
108
-
109
-
110
-    /**
111
-     * @param string $name
112
-     */
113
-    protected function setName($name)
114
-    {
115
-        $this->name = $name;
116
-    }
117
-
118
-
119
-    /**
120
-     * @return string
121
-     */
122
-    public function description()
123
-    {
124
-        return $this->description;
125
-    }
126
-
127
-
128
-    /**
129
-     * @param string $description
130
-     */
131
-    protected function setDescription($description)
132
-    {
133
-        $this->description = $description;
134
-    }
135
-
136
-
137
-    /**
138
-     * @return array
139
-     * @since $VID:$
140
-     */
141
-    public function fields()
142
-    {
143
-        return $this->fields;
144
-    }
145
-
146
-
147
-    /**
148
-     * @param array $fields
149
-     */
150
-    protected function setFields(array $fields)
151
-    {
152
-        $this->fields = $fields;
153
-    }
154
-
155
-
156
-    /**
157
-     * @param array $map
158
-     */
159
-    protected function setGraphQLToModelMap(array $map)
160
-    {
161
-        $this->graphql_to_model_map = $map;
162
-    }
163
-
164
-
165
-    /**
166
-     * @return bool
167
-     */
168
-    public function isCustomPostType()
169
-    {
170
-        return $this->is_custom_post_type;
171
-    }
172
-
173
-
174
-    /**
175
-     * @param bool $is_custom_post_type
176
-     */
177
-    protected function setIsCustomPostType($is_custom_post_type)
178
-    {
179
-        $this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN);
180
-    }
181
-
182
-
183
-    /**
184
-     * @return array
185
-     * @since $VID:$
186
-     */
187
-    public function getFields()
188
-    {
189
-        $fields = static::getFieldDefinitions();
190
-        foreach ($fields as $field => &$args) {
191
-            $args['resolve'] = [$this, 'resolveField'];
192
-        }
193
-        return $fields;
194
-    }
195
-
196
-
197
-    /**
198
-     * @param EE_Model_Field_Base $field
199
-     * @return string
200
-     * @since $VID:$
201
-     */
202
-    protected function parseFieldType(EE_Model_Field_Base $field)
203
-    {
204
-        $schema_type = $field->getSchemaType();
205
-        $schema_type = is_array($schema_type) ? array_shift($schema_type) : $schema_type;
206
-        switch ($schema_type) {
207
-            case 'boolean';
208
-                return 'Boolean';
209
-            case 'date-time';
210
-            case 'string';
211
-                return 'String';
212
-            case 'integer';
213
-                if ($field instanceof EE_WP_User_Field) {
214
-                    return 'User';
215
-                }
216
-                return 'Int';
217
-            case 'number';
218
-                return 'Float';
219
-            case 'object';
220
-                if ($field instanceof EE_Post_Content_Field) {
221
-                    return 'String';
222
-                }
223
-                if ($field instanceof EE_Enum_Text_Field) {
224
-                    return 'String';
225
-                }
226
-                return 'object';
227
-        }
228
-    }
229
-
230
-
231
-    /**
232
-     * @param mixed $source
233
-     * @return EE_Base_Class|null
234
-     * @since $VID:$
235
-     */
236
-    private function getModel($source)
237
-    {
238
-        // If it comes from a custom connection
239
-        // where the $source is already instantiated.
240
-        if (is_subclass_of($source, 'EE_Base_Class')) {
241
-            return $source;
242
-        }
243
-
244
-        $id = $source instanceof Post ? $source->ID : 0;
245
-
246
-        if ($id) {
247
-            return $this->model->get_one_by_ID($id);
248
-        }
249
-        return null;
250
-    }
251
-
252
-    /**
253
-     * @param mixed       $source     The source that's passed down the GraphQL queries
254
-     * @param array       $args       The inputArgs on the field
255
-     * @param AppContext  $context    The AppContext passed down the GraphQL tree
256
-     * @param ResolveInfo $info       The ResolveInfo passed down the GraphQL tree
257
-     * @return string
258
-     * @since $VID:$
259
-     */
260
-    public function resolveField($source, $args, AppContext $context, ResolveInfo $info)
261
-    {
262
-        $source = $this->getModel($source);
263
-        if (is_subclass_of($source, 'EE_Base_Class')) {
264
-
265
-            return $this->field_resolver->resolve($source, $args, $context, $info);
266
-        }
267
-        return null;
268
-    }
51
+	/**
52
+	 * @var EEM_Base $model
53
+	 */
54
+	protected $model;
55
+
56
+	/**
57
+	 * @var string $name
58
+	 */
59
+	protected $name = '';
60
+
61
+	/**
62
+	 * @var string $description
63
+	 */
64
+	protected $description = '';
65
+
66
+	/**
67
+	 * @var array $fields
68
+	 */
69
+	protected $fields = [];
70
+
71
+	/**
72
+	 * @var array $graphql_to_model_map
73
+	 */
74
+	protected $graphql_to_model_map = [];
75
+
76
+	/**
77
+	 * @var FieldResolver $field_resolver
78
+	 */
79
+	protected $field_resolver;
80
+
81
+	/**
82
+	 * @var bool $is_custom_post_type
83
+	 */
84
+	protected $is_custom_post_type = false;
85
+
86
+	/**
87
+	 * TypeBase constructor.
88
+	 *
89
+	 */
90
+	public function __construct()
91
+	{
92
+		$this->field_resolver = new FieldResolver(
93
+			$this->model,
94
+			$this->graphql_to_model_map,
95
+		);
96
+
97
+		$this->setFields($this->getFields());
98
+	}
99
+
100
+
101
+	/**
102
+	 * @return string
103
+	 */
104
+	public function name()
105
+	{
106
+		return $this->name;
107
+	}
108
+
109
+
110
+	/**
111
+	 * @param string $name
112
+	 */
113
+	protected function setName($name)
114
+	{
115
+		$this->name = $name;
116
+	}
117
+
118
+
119
+	/**
120
+	 * @return string
121
+	 */
122
+	public function description()
123
+	{
124
+		return $this->description;
125
+	}
126
+
127
+
128
+	/**
129
+	 * @param string $description
130
+	 */
131
+	protected function setDescription($description)
132
+	{
133
+		$this->description = $description;
134
+	}
135
+
136
+
137
+	/**
138
+	 * @return array
139
+	 * @since $VID:$
140
+	 */
141
+	public function fields()
142
+	{
143
+		return $this->fields;
144
+	}
145
+
146
+
147
+	/**
148
+	 * @param array $fields
149
+	 */
150
+	protected function setFields(array $fields)
151
+	{
152
+		$this->fields = $fields;
153
+	}
154
+
155
+
156
+	/**
157
+	 * @param array $map
158
+	 */
159
+	protected function setGraphQLToModelMap(array $map)
160
+	{
161
+		$this->graphql_to_model_map = $map;
162
+	}
163
+
164
+
165
+	/**
166
+	 * @return bool
167
+	 */
168
+	public function isCustomPostType()
169
+	{
170
+		return $this->is_custom_post_type;
171
+	}
172
+
173
+
174
+	/**
175
+	 * @param bool $is_custom_post_type
176
+	 */
177
+	protected function setIsCustomPostType($is_custom_post_type)
178
+	{
179
+		$this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN);
180
+	}
181
+
182
+
183
+	/**
184
+	 * @return array
185
+	 * @since $VID:$
186
+	 */
187
+	public function getFields()
188
+	{
189
+		$fields = static::getFieldDefinitions();
190
+		foreach ($fields as $field => &$args) {
191
+			$args['resolve'] = [$this, 'resolveField'];
192
+		}
193
+		return $fields;
194
+	}
195
+
196
+
197
+	/**
198
+	 * @param EE_Model_Field_Base $field
199
+	 * @return string
200
+	 * @since $VID:$
201
+	 */
202
+	protected function parseFieldType(EE_Model_Field_Base $field)
203
+	{
204
+		$schema_type = $field->getSchemaType();
205
+		$schema_type = is_array($schema_type) ? array_shift($schema_type) : $schema_type;
206
+		switch ($schema_type) {
207
+			case 'boolean';
208
+				return 'Boolean';
209
+			case 'date-time';
210
+			case 'string';
211
+				return 'String';
212
+			case 'integer';
213
+				if ($field instanceof EE_WP_User_Field) {
214
+					return 'User';
215
+				}
216
+				return 'Int';
217
+			case 'number';
218
+				return 'Float';
219
+			case 'object';
220
+				if ($field instanceof EE_Post_Content_Field) {
221
+					return 'String';
222
+				}
223
+				if ($field instanceof EE_Enum_Text_Field) {
224
+					return 'String';
225
+				}
226
+				return 'object';
227
+		}
228
+	}
229
+
230
+
231
+	/**
232
+	 * @param mixed $source
233
+	 * @return EE_Base_Class|null
234
+	 * @since $VID:$
235
+	 */
236
+	private function getModel($source)
237
+	{
238
+		// If it comes from a custom connection
239
+		// where the $source is already instantiated.
240
+		if (is_subclass_of($source, 'EE_Base_Class')) {
241
+			return $source;
242
+		}
243
+
244
+		$id = $source instanceof Post ? $source->ID : 0;
245
+
246
+		if ($id) {
247
+			return $this->model->get_one_by_ID($id);
248
+		}
249
+		return null;
250
+	}
251
+
252
+	/**
253
+	 * @param mixed       $source     The source that's passed down the GraphQL queries
254
+	 * @param array       $args       The inputArgs on the field
255
+	 * @param AppContext  $context    The AppContext passed down the GraphQL tree
256
+	 * @param ResolveInfo $info       The ResolveInfo passed down the GraphQL tree
257
+	 * @return string
258
+	 * @since $VID:$
259
+	 */
260
+	public function resolveField($source, $args, AppContext $context, ResolveInfo $info)
261
+	{
262
+		$source = $this->getModel($source);
263
+		if (is_subclass_of($source, 'EE_Base_Class')) {
264
+
265
+			return $this->field_resolver->resolve($source, $args, $context, $info);
266
+		}
267
+		return null;
268
+	}
269 269
 
270 270
 }
271 271
\ No newline at end of file
Please login to merge, or discard this patch.