Completed
Branch dependabot/composer/wp-graphql... (5a0e42)
by
unknown
18:09 queued 13:06
created
core/libraries/shortcodes/EE_Recipient_List_Shortcodes.lib.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         // first get registrations just for this attendee.
81 81
         $att = $data->att_obj;
82
-        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
82
+        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array();
83 83
         $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
84 84
             ? array($data->reg_obj) : $registrations_on_attendee;
85 85
         $tkts = array();
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
             // tickets will be tickets for all registrations on this attendee.
102 102
             foreach ($registrations_on_attendee as $reg) {
103 103
                 if ($reg instanceof EE_Registration) {
104
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
105
-                        $data->registrations[ $reg->ID() ]
106
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
107
-                    ) ]['tkt_obj'] : null;
104
+                    $ticket = isset($data->registrations[$reg->ID()]) && is_array(
105
+                        $data->registrations[$reg->ID()]
106
+                    ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID(
107
+                    )]['tkt_obj'] : null;
108 108
                     if ($ticket instanceof EE_Ticket) {
109
-                        $tkts[ $ticket->ID() ] = $ticket;
109
+                        $tkts[$ticket->ID()] = $ticket;
110 110
                     }
111 111
                 }
112 112
             }
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
             // data will be tickets for this event for this recipient.
124 124
             foreach ($registrations_on_attendee as $reg) {
125 125
                 if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
126
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
127
-                        $data->registrations[ $reg->ID() ]
128
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
129
-                    ) ]['tkt_obj'] : null;
126
+                    $ticket = isset($data->registrations[$reg->ID()]) && is_array(
127
+                        $data->registrations[$reg->ID()]
128
+                    ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID(
129
+                    )]['tkt_obj'] : null;
130 130
                     if ($ticket instanceof EE_Ticket) {
131
-                        $tkts[ $ticket->ID() ] = $ticket;
131
+                        $tkts[$ticket->ID()] = $ticket;
132 132
                     }
133 133
                 }
134 134
             }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     {
171 171
         // first get registrations just for this attendee.
172 172
         $att = $data->att_obj;
173
-        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
173
+        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array();
174 174
         $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
175 175
             ? array($data->reg_obj)
176 176
             : $registrations_on_attendee;
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
             // dtts will be datetimes for all registrations on this attendee
186 186
             foreach ($registrations_on_attendee as $reg) {
187 187
                 if ($reg instanceof EE_Registration) {
188
-                    $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array(
189
-                        $data->registrations[ $reg->ID() ]
190
-                    ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID(
191
-                    ) ]['dtt_objs'] : array();
188
+                    $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array(
189
+                        $data->registrations[$reg->ID()]
190
+                    ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID(
191
+                    )]['dtt_objs'] : array();
192 192
                     $dtt_objs = (array) $dtt_objs;
193 193
                     foreach ($dtt_objs as $dtt_obj) {
194 194
                         if ($dtt_obj instanceof EE_Datetime) {
195
-                            $dtts[ $dtt_obj->ID() ] = $dtt_obj;
195
+                            $dtts[$dtt_obj->ID()] = $dtt_obj;
196 196
                         }
197 197
                     }
198 198
                 }
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
             // data will be datetimes for this event for this recipient
209 209
             foreach ($registrations_on_attendee as $reg) {
210 210
                 if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
211
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
212
-                        $data->registrations[ $reg->ID() ]
213
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
214
-                    ) ]['tkt_obj'] : null;
211
+                    $ticket = isset($data->registrations[$reg->ID()]) && is_array(
212
+                        $data->registrations[$reg->ID()]
213
+                    ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID(
214
+                    )]['tkt_obj'] : null;
215 215
                     if ($ticket instanceof EE_Ticket) {
216
-                        $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array(
217
-                            $data->tickets[ $ticket->ID() ]
218
-                        ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID(
219
-                        ) ]['dtt_objs'] : array();
216
+                        $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array(
217
+                            $data->tickets[$ticket->ID()]
218
+                        ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID(
219
+                        )]['dtt_objs'] : array();
220 220
                         $dtt_objs = (array) $dtt_objs;
221 221
                         foreach ($dtt_objs as $dtt_obj) {
222 222
                             if ($dtt_obj instanceof EE_Datetime) {
223
-                                $dtts[ $dtt_obj->ID() ] = $dtt_obj;
223
+                                $dtts[$dtt_obj->ID()] = $dtt_obj;
224 224
                             }
225 225
                         }
226 226
                     }
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -18,223 +18,223 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Recipient_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    public function __construct()
22
-    {
23
-        parent::__construct();
24
-    }
25
-
26
-
27
-    protected function _init_props()
28
-    {
29
-        $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso');
30
-        $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso');
31
-        $this->_shortcodes = array(
32
-            '[RECIPIENT_TICKET_LIST]' => esc_html__(
33
-                'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.',
34
-                'event_espresso'
35
-            ),
36
-            '[RECIPIENT_DATETIME_LIST]' => esc_html__(
37
-                'Will output a list of datetimes that the person receiving this message has been registered for.',
38
-                'event_espresso'
39
-            ),
40
-        );
41
-    }
42
-
43
-
44
-    protected function _parser($shortcode)
45
-    {
46
-        switch ($shortcode) {
47
-            case '[RECIPIENT_TICKET_LIST]':
48
-                return $this->_get_recipient_ticket_list();
49
-
50
-            case '[RECIPIENT_DATETIME_LIST]':
51
-                return $this->_get_recipient_datetime_list();
52
-        }
53
-        return '';
54
-    }
55
-
56
-
57
-    /**
58
-     * figure out what the incoming data is and then return the appropriate parsed value
59
-     *
60
-     * @return string
61
-     */
62
-    private function _get_recipient_ticket_list()
63
-    {
64
-        $this->_validate_list_requirements();
65
-
66
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
67
-            return $this->_get_recipient_ticket_list_parsed($this->_data['data']);
68
-        } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) {
69
-            return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']);
70
-        } else {
71
-            return '';
72
-        }
73
-    }
74
-
75
-
76
-    private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data)
77
-    {
78
-        // first get registrations just for this attendee.
79
-        $att = $data->att_obj;
80
-        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
81
-        $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
82
-            ? array($data->reg_obj) : $registrations_on_attendee;
83
-        $tkts = array();
84
-
85
-        // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee.
86
-        // which means we want to get tickets for all events this addressee is a part of.
87
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
88
-            $valid_shortcodes = array(
89
-                'ticket',
90
-                'event_list',
91
-                'attendee_list',
92
-                'datetime_list',
93
-                'registration_details',
94
-                'attendee',
95
-                'recipient_details',
96
-            );
97
-            $template = $this->_data['template'];
98
-
99
-            // tickets will be tickets for all registrations on this attendee.
100
-            foreach ($registrations_on_attendee as $reg) {
101
-                if ($reg instanceof EE_Registration) {
102
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
103
-                        $data->registrations[ $reg->ID() ]
104
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
105
-                    ) ]['tkt_obj'] : null;
106
-                    if ($ticket instanceof EE_Ticket) {
107
-                        $tkts[ $ticket->ID() ] = $ticket;
108
-                    }
109
-                }
110
-            }
111
-        }
112
-
113
-        // if coming from the context of the event list parser, then let's return just the tickets for that event.
114
-        $event = $this->_data['data'];
115
-        if ($event instanceof EE_Event) {
116
-            $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details');
117
-            $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
118
-                ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list'];
119
-            // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion.
120
-            $template = str_replace('[EVENT_LIST]', '', $template);
121
-            // data will be tickets for this event for this recipient.
122
-            foreach ($registrations_on_attendee as $reg) {
123
-                if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
124
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
125
-                        $data->registrations[ $reg->ID() ]
126
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
127
-                    ) ]['tkt_obj'] : null;
128
-                    if ($ticket instanceof EE_Ticket) {
129
-                        $tkts[ $ticket->ID() ] = $ticket;
130
-                    }
131
-                }
132
-            }
133
-        }
134
-
135
-        $tkt_parsed = '';
136
-        foreach ($tkts as $ticket) {
137
-            $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
138
-                $template,
139
-                $ticket,
140
-                $valid_shortcodes,
141
-                $this->_extra_data
142
-            );
143
-        }
144
-        return $tkt_parsed;
145
-    }
146
-
147
-
148
-    /**
149
-     * figure out what the incoming data is and then return the appropriate parsed value
150
-     *
151
-     * @return string
152
-     */
153
-    private function _get_recipient_datetime_list()
154
-    {
155
-        $this->_validate_list_requirements();
156
-
157
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
158
-            return $this->_get_recipient_datetime_list_parsed($this->_data['data']);
159
-        } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) {
160
-            return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']);
161
-        } else {
162
-            return '';
163
-        }
164
-    }
165
-
166
-
167
-    private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data)
168
-    {
169
-        // first get registrations just for this attendee.
170
-        $att = $data->att_obj;
171
-        $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
172
-        $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
173
-            ? array($data->reg_obj)
174
-            : $registrations_on_attendee;
175
-        $valid_shortcodes = array('datetime', 'attendee', 'recipient_details');
176
-        $template = '';
177
-        $dtts = array();
178
-
179
-        // setup valid shortcodes depending on what the status of the $this->_data property is
180
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
181
-            $template = $this->_data['template'];
182
-
183
-            // dtts will be datetimes for all registrations on this attendee
184
-            foreach ($registrations_on_attendee as $reg) {
185
-                if ($reg instanceof EE_Registration) {
186
-                    $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array(
187
-                        $data->registrations[ $reg->ID() ]
188
-                    ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID(
189
-                    ) ]['dtt_objs'] : array();
190
-                    $dtt_objs = (array) $dtt_objs;
191
-                    foreach ($dtt_objs as $dtt_obj) {
192
-                        if ($dtt_obj instanceof EE_Datetime) {
193
-                            $dtts[ $dtt_obj->ID() ] = $dtt_obj;
194
-                        }
195
-                    }
196
-                }
197
-            }
198
-        }
199
-
200
-        // if coming from the context of the event list parser, then let's just return the datetimes for the specific event.
201
-        $event = $this->_data['data'];
202
-        if ($event instanceof EE_Event) {
203
-            $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
204
-                ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
205
-
206
-            // data will be datetimes for this event for this recipient
207
-            foreach ($registrations_on_attendee as $reg) {
208
-                if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
209
-                    $ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
210
-                        $data->registrations[ $reg->ID() ]
211
-                    ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
212
-                    ) ]['tkt_obj'] : null;
213
-                    if ($ticket instanceof EE_Ticket) {
214
-                        $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array(
215
-                            $data->tickets[ $ticket->ID() ]
216
-                        ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID(
217
-                        ) ]['dtt_objs'] : array();
218
-                        $dtt_objs = (array) $dtt_objs;
219
-                        foreach ($dtt_objs as $dtt_obj) {
220
-                            if ($dtt_obj instanceof EE_Datetime) {
221
-                                $dtts[ $dtt_obj->ID() ] = $dtt_obj;
222
-                            }
223
-                        }
224
-                    }
225
-                }
226
-            }
227
-        }
228
-
229
-        $dtt_parsed = '';
230
-        foreach ($dtts as $datetime) {
231
-            $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
232
-                $template,
233
-                $datetime,
234
-                $valid_shortcodes,
235
-                $this->_extra_data
236
-            );
237
-        }
238
-        return $dtt_parsed;
239
-    }
21
+	public function __construct()
22
+	{
23
+		parent::__construct();
24
+	}
25
+
26
+
27
+	protected function _init_props()
28
+	{
29
+		$this->label = esc_html__('Recipient List Shortcodes', 'event_espresso');
30
+		$this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso');
31
+		$this->_shortcodes = array(
32
+			'[RECIPIENT_TICKET_LIST]' => esc_html__(
33
+				'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.',
34
+				'event_espresso'
35
+			),
36
+			'[RECIPIENT_DATETIME_LIST]' => esc_html__(
37
+				'Will output a list of datetimes that the person receiving this message has been registered for.',
38
+				'event_espresso'
39
+			),
40
+		);
41
+	}
42
+
43
+
44
+	protected function _parser($shortcode)
45
+	{
46
+		switch ($shortcode) {
47
+			case '[RECIPIENT_TICKET_LIST]':
48
+				return $this->_get_recipient_ticket_list();
49
+
50
+			case '[RECIPIENT_DATETIME_LIST]':
51
+				return $this->_get_recipient_datetime_list();
52
+		}
53
+		return '';
54
+	}
55
+
56
+
57
+	/**
58
+	 * figure out what the incoming data is and then return the appropriate parsed value
59
+	 *
60
+	 * @return string
61
+	 */
62
+	private function _get_recipient_ticket_list()
63
+	{
64
+		$this->_validate_list_requirements();
65
+
66
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
67
+			return $this->_get_recipient_ticket_list_parsed($this->_data['data']);
68
+		} elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) {
69
+			return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']);
70
+		} else {
71
+			return '';
72
+		}
73
+	}
74
+
75
+
76
+	private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data)
77
+	{
78
+		// first get registrations just for this attendee.
79
+		$att = $data->att_obj;
80
+		$registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
81
+		$registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
82
+			? array($data->reg_obj) : $registrations_on_attendee;
83
+		$tkts = array();
84
+
85
+		// if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee.
86
+		// which means we want to get tickets for all events this addressee is a part of.
87
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
88
+			$valid_shortcodes = array(
89
+				'ticket',
90
+				'event_list',
91
+				'attendee_list',
92
+				'datetime_list',
93
+				'registration_details',
94
+				'attendee',
95
+				'recipient_details',
96
+			);
97
+			$template = $this->_data['template'];
98
+
99
+			// tickets will be tickets for all registrations on this attendee.
100
+			foreach ($registrations_on_attendee as $reg) {
101
+				if ($reg instanceof EE_Registration) {
102
+					$ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
103
+						$data->registrations[ $reg->ID() ]
104
+					) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
105
+					) ]['tkt_obj'] : null;
106
+					if ($ticket instanceof EE_Ticket) {
107
+						$tkts[ $ticket->ID() ] = $ticket;
108
+					}
109
+				}
110
+			}
111
+		}
112
+
113
+		// if coming from the context of the event list parser, then let's return just the tickets for that event.
114
+		$event = $this->_data['data'];
115
+		if ($event instanceof EE_Event) {
116
+			$valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details');
117
+			$template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
118
+				? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list'];
119
+			// let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion.
120
+			$template = str_replace('[EVENT_LIST]', '', $template);
121
+			// data will be tickets for this event for this recipient.
122
+			foreach ($registrations_on_attendee as $reg) {
123
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
124
+					$ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
125
+						$data->registrations[ $reg->ID() ]
126
+					) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
127
+					) ]['tkt_obj'] : null;
128
+					if ($ticket instanceof EE_Ticket) {
129
+						$tkts[ $ticket->ID() ] = $ticket;
130
+					}
131
+				}
132
+			}
133
+		}
134
+
135
+		$tkt_parsed = '';
136
+		foreach ($tkts as $ticket) {
137
+			$tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
138
+				$template,
139
+				$ticket,
140
+				$valid_shortcodes,
141
+				$this->_extra_data
142
+			);
143
+		}
144
+		return $tkt_parsed;
145
+	}
146
+
147
+
148
+	/**
149
+	 * figure out what the incoming data is and then return the appropriate parsed value
150
+	 *
151
+	 * @return string
152
+	 */
153
+	private function _get_recipient_datetime_list()
154
+	{
155
+		$this->_validate_list_requirements();
156
+
157
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
158
+			return $this->_get_recipient_datetime_list_parsed($this->_data['data']);
159
+		} elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) {
160
+			return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']);
161
+		} else {
162
+			return '';
163
+		}
164
+	}
165
+
166
+
167
+	private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data)
168
+	{
169
+		// first get registrations just for this attendee.
170
+		$att = $data->att_obj;
171
+		$registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array();
172
+		$registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration
173
+			? array($data->reg_obj)
174
+			: $registrations_on_attendee;
175
+		$valid_shortcodes = array('datetime', 'attendee', 'recipient_details');
176
+		$template = '';
177
+		$dtts = array();
178
+
179
+		// setup valid shortcodes depending on what the status of the $this->_data property is
180
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
181
+			$template = $this->_data['template'];
182
+
183
+			// dtts will be datetimes for all registrations on this attendee
184
+			foreach ($registrations_on_attendee as $reg) {
185
+				if ($reg instanceof EE_Registration) {
186
+					$dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array(
187
+						$data->registrations[ $reg->ID() ]
188
+					) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID(
189
+					) ]['dtt_objs'] : array();
190
+					$dtt_objs = (array) $dtt_objs;
191
+					foreach ($dtt_objs as $dtt_obj) {
192
+						if ($dtt_obj instanceof EE_Datetime) {
193
+							$dtts[ $dtt_obj->ID() ] = $dtt_obj;
194
+						}
195
+					}
196
+				}
197
+			}
198
+		}
199
+
200
+		// if coming from the context of the event list parser, then let's just return the datetimes for the specific event.
201
+		$event = $this->_data['data'];
202
+		if ($event instanceof EE_Event) {
203
+			$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
204
+				? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
205
+
206
+			// data will be datetimes for this event for this recipient
207
+			foreach ($registrations_on_attendee as $reg) {
208
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
209
+					$ticket = isset($data->registrations[ $reg->ID() ]) && is_array(
210
+						$data->registrations[ $reg->ID() ]
211
+					) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID(
212
+					) ]['tkt_obj'] : null;
213
+					if ($ticket instanceof EE_Ticket) {
214
+						$dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array(
215
+							$data->tickets[ $ticket->ID() ]
216
+						) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID(
217
+						) ]['dtt_objs'] : array();
218
+						$dtt_objs = (array) $dtt_objs;
219
+						foreach ($dtt_objs as $dtt_obj) {
220
+							if ($dtt_obj instanceof EE_Datetime) {
221
+								$dtts[ $dtt_obj->ID() ] = $dtt_obj;
222
+							}
223
+						}
224
+					}
225
+				}
226
+			}
227
+		}
228
+
229
+		$dtt_parsed = '';
230
+		foreach ($dtts as $datetime) {
231
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
232
+				$template,
233
+				$datetime,
234
+				$valid_shortcodes,
235
+				$this->_extra_data
236
+			);
237
+		}
238
+		return $dtt_parsed;
239
+	}
240 240
 }
Please login to merge, or discard this patch.
core/domain/services/converters/json/DatetimeToJson.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $jsonDates = [];
38 38
         foreach ($datetimes as $datetime) {
39 39
             if ($datetime instanceof EE_Datetime) {
40
-                $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime);
40
+                $jsonDates[$datetime->ID()] = $this->convertAndEncode($datetime);
41 41
             }
42 42
         }
43 43
         return $jsonDates;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $arrayOfDates = [];
76 76
         foreach ($datetimes as $datetime) {
77 77
             if ($datetime instanceof EE_Datetime) {
78
-                $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime);
78
+                $arrayOfDates[$datetime->ID()] = $this->convert($datetime);
79 79
             }
80 80
         }
81 81
         return $arrayOfDates;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $jsonDates = [];
128 128
         foreach ($datetimes as $datetime) {
129 129
             if ($datetime instanceof EE_Datetime) {
130
-                $jsonDates[ $datetime->ID() ] = $this->encode($datetime);
130
+                $jsonDates[$datetime->ID()] = $this->encode($datetime);
131 131
             }
132 132
         }
133 133
         return $jsonDates;
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -21,125 +21,125 @@
 block discarded – undo
21 21
  */
22 22
 class DatetimeToJson implements ModelObjectToJsonConverterInterface
23 23
 {
24
-    /**
25
-     * @param EE_Datetime[] $datetimes
26
-     * @return array
27
-     * @throws EE_Error
28
-     * @throws InvalidArgumentException
29
-     * @throws InvalidDataTypeException
30
-     * @throws InvalidInterfaceException
31
-     * @throws ReflectionException
32
-     * @since 5.0.0.p
33
-     */
34
-    public function convertAndEncodeArrayOf(array $datetimes)
35
-    {
36
-        $jsonDates = [];
37
-        foreach ($datetimes as $datetime) {
38
-            if ($datetime instanceof EE_Datetime) {
39
-                $jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime);
40
-            }
41
-        }
42
-        return $jsonDates;
43
-    }
24
+	/**
25
+	 * @param EE_Datetime[] $datetimes
26
+	 * @return array
27
+	 * @throws EE_Error
28
+	 * @throws InvalidArgumentException
29
+	 * @throws InvalidDataTypeException
30
+	 * @throws InvalidInterfaceException
31
+	 * @throws ReflectionException
32
+	 * @since 5.0.0.p
33
+	 */
34
+	public function convertAndEncodeArrayOf(array $datetimes)
35
+	{
36
+		$jsonDates = [];
37
+		foreach ($datetimes as $datetime) {
38
+			if ($datetime instanceof EE_Datetime) {
39
+				$jsonDates[ $datetime->ID() ] = $this->convertAndEncode($datetime);
40
+			}
41
+		}
42
+		return $jsonDates;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * @param EE_Datetime $datetime
48
-     * @return false|string
49
-     * @throws EE_Error
50
-     * @throws InvalidArgumentException
51
-     * @throws InvalidDataTypeException
52
-     * @throws InvalidInterfaceException
53
-     * @throws ReflectionException
54
-     * @since 5.0.0.p
55
-     */
56
-    public function convertAndEncode($datetime)
57
-    {
58
-        return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false;
59
-    }
46
+	/**
47
+	 * @param EE_Datetime $datetime
48
+	 * @return false|string
49
+	 * @throws EE_Error
50
+	 * @throws InvalidArgumentException
51
+	 * @throws InvalidDataTypeException
52
+	 * @throws InvalidInterfaceException
53
+	 * @throws ReflectionException
54
+	 * @since 5.0.0.p
55
+	 */
56
+	public function convertAndEncode($datetime)
57
+	{
58
+		return $datetime instanceof EE_Datetime ? $this->encode($this->convert($datetime)) : false;
59
+	}
60 60
 
61 61
 
62
-    /**
63
-     * @param EE_Datetime[] $datetimes
64
-     * @return array
65
-     * @throws EE_Error
66
-     * @throws InvalidArgumentException
67
-     * @throws InvalidDataTypeException
68
-     * @throws InvalidInterfaceException
69
-     * @throws ReflectionException
70
-     * @since 5.0.0.p
71
-     */
72
-    public function convertArrayOf(array $datetimes)
73
-    {
74
-        $arrayOfDates = [];
75
-        foreach ($datetimes as $datetime) {
76
-            if ($datetime instanceof EE_Datetime) {
77
-                $arrayOfDates[ $datetime->ID() ] = $this->convert($datetime);
78
-            }
79
-        }
80
-        return $arrayOfDates;
81
-    }
62
+	/**
63
+	 * @param EE_Datetime[] $datetimes
64
+	 * @return array
65
+	 * @throws EE_Error
66
+	 * @throws InvalidArgumentException
67
+	 * @throws InvalidDataTypeException
68
+	 * @throws InvalidInterfaceException
69
+	 * @throws ReflectionException
70
+	 * @since 5.0.0.p
71
+	 */
72
+	public function convertArrayOf(array $datetimes)
73
+	{
74
+		$arrayOfDates = [];
75
+		foreach ($datetimes as $datetime) {
76
+			if ($datetime instanceof EE_Datetime) {
77
+				$arrayOfDates[ $datetime->ID() ] = $this->convert($datetime);
78
+			}
79
+		}
80
+		return $arrayOfDates;
81
+	}
82 82
 
83 83
 
84
-    /**
85
-     * @param EE_Datetime $datetime
86
-     * @return array
87
-     * @throws EE_Error
88
-     * @throws InvalidDataTypeException
89
-     * @throws InvalidInterfaceException
90
-     * @throws InvalidArgumentException
91
-     * @throws ReflectionException
92
-     * @since 5.0.0.p
93
-     */
94
-    public function convert($datetime)
95
-    {
96
-        return $datetime instanceof EE_Datetime ? [
97
-            'DTT_ID'          => $datetime->ID(),
98
-            'EVT_ID'          => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0,
99
-            'DTT_name'        => $datetime->name(),
100
-            'DTT_description' => $datetime->description(),
101
-            'DTT_EVT_start'   => $datetime->start_date(DATE_ATOM),
102
-            'DTT_EVT_end'     => $datetime->end_date(DATE_ATOM),
103
-            'DTT_sold'        => $datetime->sold(),
104
-            'DTT_reserved'    => $datetime->reserved(),
105
-            'DTT_reg_limit'   => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(),
106
-            'DTT_is_primary'  => $datetime->get_active_status(),
107
-            'DTT_order'       => $datetime->order(),
108
-            'DTT_parent'      => $datetime->parent(),
109
-            'DTT_deleted'     => $datetime->get('DTT_deleted'),
110
-        ] : [];
111
-    }
84
+	/**
85
+	 * @param EE_Datetime $datetime
86
+	 * @return array
87
+	 * @throws EE_Error
88
+	 * @throws InvalidDataTypeException
89
+	 * @throws InvalidInterfaceException
90
+	 * @throws InvalidArgumentException
91
+	 * @throws ReflectionException
92
+	 * @since 5.0.0.p
93
+	 */
94
+	public function convert($datetime)
95
+	{
96
+		return $datetime instanceof EE_Datetime ? [
97
+			'DTT_ID'          => $datetime->ID(),
98
+			'EVT_ID'          => $datetime->event() instanceof EE_Event ? $datetime->event()->ID() : 0,
99
+			'DTT_name'        => $datetime->name(),
100
+			'DTT_description' => $datetime->description(),
101
+			'DTT_EVT_start'   => $datetime->start_date(DATE_ATOM),
102
+			'DTT_EVT_end'     => $datetime->end_date(DATE_ATOM),
103
+			'DTT_sold'        => $datetime->sold(),
104
+			'DTT_reserved'    => $datetime->reserved(),
105
+			'DTT_reg_limit'   => $datetime->reg_limit() === INF ? -1 : $datetime->reg_limit(),
106
+			'DTT_is_primary'  => $datetime->get_active_status(),
107
+			'DTT_order'       => $datetime->order(),
108
+			'DTT_parent'      => $datetime->parent(),
109
+			'DTT_deleted'     => $datetime->get('DTT_deleted'),
110
+		] : [];
111
+	}
112 112
 
113 113
 
114
-    /**
115
-     * @param EE_Datetime[] $datetimes
116
-     * @return array
117
-     * @throws EE_Error
118
-     * @throws InvalidArgumentException
119
-     * @throws InvalidDataTypeException
120
-     * @throws InvalidInterfaceException
121
-     * @throws ReflectionException
122
-     * @since 5.0.0.p
123
-     */
124
-    public function encodeArrayOf(array $datetimes)
125
-    {
126
-        $jsonDates = [];
127
-        foreach ($datetimes as $datetime) {
128
-            if ($datetime instanceof EE_Datetime) {
129
-                $jsonDates[ $datetime->ID() ] = $this->encode($datetime);
130
-            }
131
-        }
132
-        return $jsonDates;
133
-    }
114
+	/**
115
+	 * @param EE_Datetime[] $datetimes
116
+	 * @return array
117
+	 * @throws EE_Error
118
+	 * @throws InvalidArgumentException
119
+	 * @throws InvalidDataTypeException
120
+	 * @throws InvalidInterfaceException
121
+	 * @throws ReflectionException
122
+	 * @since 5.0.0.p
123
+	 */
124
+	public function encodeArrayOf(array $datetimes)
125
+	{
126
+		$jsonDates = [];
127
+		foreach ($datetimes as $datetime) {
128
+			if ($datetime instanceof EE_Datetime) {
129
+				$jsonDates[ $datetime->ID() ] = $this->encode($datetime);
130
+			}
131
+		}
132
+		return $jsonDates;
133
+	}
134 134
 
135 135
 
136
-    /**
137
-     * @param array $datetime_array
138
-     * @return false|string
139
-     * @since 5.0.0.p
140
-     */
141
-    public function encode(array $datetime_array)
142
-    {
143
-        return wp_json_encode($datetime_array);
144
-    }
136
+	/**
137
+	 * @param array $datetime_array
138
+	 * @return false|string
139
+	 * @since 5.0.0.p
140
+	 */
141
+	public function encode(array $datetime_array)
142
+	{
143
+		return wp_json_encode($datetime_array);
144
+	}
145 145
 }
Please login to merge, or discard this patch.
core/domain/services/converters/RestApiSpoofer.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getOneApiResult(EEM_Base $model, array $query_params, $include = '')
118 118
     {
119
-        if (! array_key_exists('limit', $query_params)) {
119
+        if ( ! array_key_exists('limit', $query_params)) {
120 120
             $query_params['limit'] = 1;
121 121
         }
122 122
         $result = $this->getApiResults($model, $query_params, $include);
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function getApiResults(EEM_Base $model, array $query_params, $include = '')
145 145
     {
146
-        if (! array_key_exists('caps', $query_params)) {
146
+        if ( ! array_key_exists('caps', $query_params)) {
147 147
             $query_params['caps'] = EEM_Base::caps_read_admin;
148 148
         }
149
-        if (! array_key_exists('default_where_conditions', $query_params)) {
149
+        if ( ! array_key_exists('default_where_conditions', $query_params)) {
150 150
             $query_params['default_where_conditions'] = 'none';
151 151
         }
152 152
         /** @type array $results */
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -49,137 +49,137 @@
 block discarded – undo
49 49
  */
50 50
 class RestApiSpoofer
51 51
 {
52
-    /**
53
-     * @var WP_REST_Server $wp_rest_server
54
-     */
55
-    protected $wp_rest_server;
52
+	/**
53
+	 * @var WP_REST_Server $wp_rest_server
54
+	 */
55
+	protected $wp_rest_server;
56 56
 
57
-    /**
58
-     * @var Read
59
-     */
60
-    protected $rest_controller;
57
+	/**
58
+	 * @var Read
59
+	 */
60
+	protected $rest_controller;
61 61
 
62
-    /**
63
-     * @var EED_Core_Rest_Api $rest_module
64
-     */
65
-    protected $rest_module;
62
+	/**
63
+	 * @var EED_Core_Rest_Api $rest_module
64
+	 */
65
+	protected $rest_module;
66 66
 
67 67
 
68
-    /**
69
-     * RestApiSpoofer constructor.
70
-     *
71
-     * @param WP_REST_Server        $wp_rest_server
72
-     * @param EED_Core_Rest_Api $rest_module
73
-     * @param Read                  $rest_api
74
-     * @param string                $api_version
75
-     */
76
-    public function __construct(
77
-        WP_REST_Server $wp_rest_server,
78
-        EED_Core_Rest_Api $rest_module,
79
-        Read $rest_api,
80
-        $api_version = '4.8.36'
81
-    ) {
82
-        $this->wp_rest_server = $wp_rest_server;
83
-        $this->rest_module = $rest_module;
84
-        $this->rest_controller = $rest_api;
85
-        $this->rest_controller->setRequestedVersion($api_version);
86
-        $this->setUpRestServer();
87
-    }
68
+	/**
69
+	 * RestApiSpoofer constructor.
70
+	 *
71
+	 * @param WP_REST_Server        $wp_rest_server
72
+	 * @param EED_Core_Rest_Api $rest_module
73
+	 * @param Read                  $rest_api
74
+	 * @param string                $api_version
75
+	 */
76
+	public function __construct(
77
+		WP_REST_Server $wp_rest_server,
78
+		EED_Core_Rest_Api $rest_module,
79
+		Read $rest_api,
80
+		$api_version = '4.8.36'
81
+	) {
82
+		$this->wp_rest_server = $wp_rest_server;
83
+		$this->rest_module = $rest_module;
84
+		$this->rest_controller = $rest_api;
85
+		$this->rest_controller->setRequestedVersion($api_version);
86
+		$this->setUpRestServer();
87
+	}
88 88
 
89 89
 
90
-    private function setUpRestServer()
91
-    {
92
-        /* @var WP_REST_Server $wp_rest_server */
93
-        global $wp_rest_server;
94
-        $wp_rest_server = $this->wp_rest_server;
95
-        EED_Core_Rest_Api::set_hooks_both();
96
-        do_action('rest_api_init', $this->wp_rest_server);
97
-    }
90
+	private function setUpRestServer()
91
+	{
92
+		/* @var WP_REST_Server $wp_rest_server */
93
+		global $wp_rest_server;
94
+		$wp_rest_server = $this->wp_rest_server;
95
+		EED_Core_Rest_Api::set_hooks_both();
96
+		do_action('rest_api_init', $this->wp_rest_server);
97
+	}
98 98
 
99
-    /**
100
-     * @param EEM_Base $model
101
-     * @param array    $query_params
102
-     * @param string   $include
103
-     * @return array
104
-     * @throws EE_Error
105
-     * @throws InvalidArgumentException
106
-     * @throws InvalidDataTypeException
107
-     * @throws InvalidInterfaceException
108
-     * @throws ModelConfigurationException
109
-     * @throws ReflectionException
110
-     * @throws RestException
111
-     * @throws RestPasswordIncorrectException
112
-     * @throws RestPasswordRequiredException
113
-     * @throws UnexpectedEntityException
114
-     * @throws DomainException
115
-     * @since 5.0.0.p
116
-     */
117
-    public function getOneApiResult(EEM_Base $model, array $query_params, $include = '')
118
-    {
119
-        if (! array_key_exists('limit', $query_params)) {
120
-            $query_params['limit'] = 1;
121
-        }
122
-        $result = $this->getApiResults($model, $query_params, $include);
123
-        return is_array($result) && isset($result[0]) ? $result[0] : [];
124
-    }
99
+	/**
100
+	 * @param EEM_Base $model
101
+	 * @param array    $query_params
102
+	 * @param string   $include
103
+	 * @return array
104
+	 * @throws EE_Error
105
+	 * @throws InvalidArgumentException
106
+	 * @throws InvalidDataTypeException
107
+	 * @throws InvalidInterfaceException
108
+	 * @throws ModelConfigurationException
109
+	 * @throws ReflectionException
110
+	 * @throws RestException
111
+	 * @throws RestPasswordIncorrectException
112
+	 * @throws RestPasswordRequiredException
113
+	 * @throws UnexpectedEntityException
114
+	 * @throws DomainException
115
+	 * @since 5.0.0.p
116
+	 */
117
+	public function getOneApiResult(EEM_Base $model, array $query_params, $include = '')
118
+	{
119
+		if (! array_key_exists('limit', $query_params)) {
120
+			$query_params['limit'] = 1;
121
+		}
122
+		$result = $this->getApiResults($model, $query_params, $include);
123
+		return is_array($result) && isset($result[0]) ? $result[0] : [];
124
+	}
125 125
 
126
-    /**
127
-     * @param EEM_Base $model
128
-     * @param array    $query_params
129
-     * @param string   $include
130
-     * @return array
131
-     * @throws EE_Error
132
-     * @throws InvalidArgumentException
133
-     * @throws InvalidDataTypeException
134
-     * @throws InvalidInterfaceException
135
-     * @throws ModelConfigurationException
136
-     * @throws ReflectionException
137
-     * @throws RestException
138
-     * @throws RestPasswordIncorrectException
139
-     * @throws RestPasswordRequiredException
140
-     * @throws UnexpectedEntityException
141
-     * @throws DomainException
142
-     * @since 5.0.0.p
143
-     */
144
-    public function getApiResults(EEM_Base $model, array $query_params, $include = '')
145
-    {
146
-        if (! array_key_exists('caps', $query_params)) {
147
-            $query_params['caps'] = EEM_Base::caps_read_admin;
148
-        }
149
-        if (! array_key_exists('default_where_conditions', $query_params)) {
150
-            $query_params['default_where_conditions'] = 'none';
151
-        }
152
-        /** @type array $results */
153
-        $results = $model->get_all_wpdb_results($query_params);
154
-        $rest_request = new WP_REST_Request();
155
-        $rest_request->set_param('include', $include);
156
-        $rest_request->set_param('caps', 'edit');
157
-        $nice_results = array();
158
-        foreach ($results as $result) {
159
-            $nice_results[] = $this->rest_controller->createEntityFromWpdbResult(
160
-                $model,
161
-                $result,
162
-                $rest_request
163
-            );
164
-        }
165
-        return $nice_results;
166
-    }
126
+	/**
127
+	 * @param EEM_Base $model
128
+	 * @param array    $query_params
129
+	 * @param string   $include
130
+	 * @return array
131
+	 * @throws EE_Error
132
+	 * @throws InvalidArgumentException
133
+	 * @throws InvalidDataTypeException
134
+	 * @throws InvalidInterfaceException
135
+	 * @throws ModelConfigurationException
136
+	 * @throws ReflectionException
137
+	 * @throws RestException
138
+	 * @throws RestPasswordIncorrectException
139
+	 * @throws RestPasswordRequiredException
140
+	 * @throws UnexpectedEntityException
141
+	 * @throws DomainException
142
+	 * @since 5.0.0.p
143
+	 */
144
+	public function getApiResults(EEM_Base $model, array $query_params, $include = '')
145
+	{
146
+		if (! array_key_exists('caps', $query_params)) {
147
+			$query_params['caps'] = EEM_Base::caps_read_admin;
148
+		}
149
+		if (! array_key_exists('default_where_conditions', $query_params)) {
150
+			$query_params['default_where_conditions'] = 'none';
151
+		}
152
+		/** @type array $results */
153
+		$results = $model->get_all_wpdb_results($query_params);
154
+		$rest_request = new WP_REST_Request();
155
+		$rest_request->set_param('include', $include);
156
+		$rest_request->set_param('caps', 'edit');
157
+		$nice_results = array();
158
+		foreach ($results as $result) {
159
+			$nice_results[] = $this->rest_controller->createEntityFromWpdbResult(
160
+				$model,
161
+				$result,
162
+				$rest_request
163
+			);
164
+		}
165
+		return $nice_results;
166
+	}
167 167
 
168 168
 
169
-    /**
170
-     * @param string $endpoint
171
-     * @return array
172
-     * @throws EE_Error
173
-     * @since 5.0.0.p
174
-     */
175
-    public function getModelSchema($endpoint)
176
-    {
177
-        $response = $this->wp_rest_server->dispatch(
178
-            new WP_REST_Request(
179
-                'OPTIONS',
180
-                "/ee/v4.8.36/{$endpoint}"
181
-            )
182
-        );
183
-        return $response->get_data();
184
-    }
169
+	/**
170
+	 * @param string $endpoint
171
+	 * @return array
172
+	 * @throws EE_Error
173
+	 * @since 5.0.0.p
174
+	 */
175
+	public function getModelSchema($endpoint)
176
+	{
177
+		$response = $this->wp_rest_server->dispatch(
178
+			new WP_REST_Request(
179
+				'OPTIONS',
180
+				"/ee/v4.8.36/{$endpoint}"
181
+			)
182
+		);
183
+		return $response->get_data();
184
+	}
185 185
 }
Please login to merge, or discard this patch.
core/services/graphql/TypesManager.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
             $config = $field->toArray();
76 76
             if ($field->useForInput()) {
77 77
                 // Register input fields for existing mutations.
78
-                register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
79
-                register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
78
+                register_graphql_field('Update'.$typeName.'Input', $fieldName, $config);
79
+                register_graphql_field('Create'.$typeName.'Input', $fieldName, $config);
80 80
             }
81 81
             if ($field->useForOutput()) {
82 82
                 $config['resolve'] = [$type, 'resolveField'];
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
             $fieldName = $field->name();
103 103
             $config = $field->toArray();
104 104
             if ($field->useForInput()) {
105
-                $inputFields[ $fieldName ] = $config;
105
+                $inputFields[$fieldName] = $config;
106 106
             }
107 107
             if ($field->useForOutput()) {
108 108
                 $config['resolve'] = [$type, 'resolveField'];
109
-                $outputFields[ $fieldName ] = $config;
109
+                $outputFields[$fieldName] = $config;
110 110
             }
111 111
         }
112 112
         $typeName = $type->name();
113
-        if (! empty($outputFields)) {
113
+        if ( ! empty($outputFields)) {
114 114
             // Register the object type.
115 115
             register_graphql_object_type(
116 116
                 $typeName,
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -17,113 +17,113 @@
 block discarded – undo
17 17
  */
18 18
 class TypesManager implements GQLManagerInterface
19 19
 {
20
-    /**
21
-     * @var TypeCollection|TypeInterface[] $types
22
-     */
23
-    private $types;
20
+	/**
21
+	 * @var TypeCollection|TypeInterface[] $types
22
+	 */
23
+	private $types;
24 24
 
25 25
 
26
-    /**
27
-     * TypesManager constructor.
28
-     *
29
-     * @param TypeCollection|TypeInterface[] $types
30
-     */
31
-    public function __construct(TypeCollection $types)
32
-    {
33
-        $this->types = $types;
34
-    }
26
+	/**
27
+	 * TypesManager constructor.
28
+	 *
29
+	 * @param TypeCollection|TypeInterface[] $types
30
+	 */
31
+	public function __construct(TypeCollection $types)
32
+	{
33
+		$this->types = $types;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * @throws CollectionDetailsException
39
-     * @throws CollectionLoaderException
40
-     * @since 5.0.0.p
41
-     */
42
-    public function init()
43
-    {
44
-        $this->types->loadTypes();
45
-        add_action('graphql_register_types', [$this, 'configureTypes'], 10);
46
-    }
37
+	/**
38
+	 * @throws CollectionDetailsException
39
+	 * @throws CollectionLoaderException
40
+	 * @since 5.0.0.p
41
+	 */
42
+	public function init()
43
+	{
44
+		$this->types->loadTypes();
45
+		add_action('graphql_register_types', [$this, 'configureTypes'], 10);
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * @since 5.0.0.p
51
-     */
52
-    public function configureTypes()
53
-    {
54
-        // loop through the collection of types and register their fields
55
-        foreach ($this->types as $type) {
56
-            if ($type->isCustomPostType()) {
57
-                $this->extendCustomPostType($type);
58
-            } else {
59
-                $this->registerType($type);
60
-            }
61
-        }
62
-    }
49
+	/**
50
+	 * @since 5.0.0.p
51
+	 */
52
+	public function configureTypes()
53
+	{
54
+		// loop through the collection of types and register their fields
55
+		foreach ($this->types as $type) {
56
+			if ($type->isCustomPostType()) {
57
+				$this->extendCustomPostType($type);
58
+			} else {
59
+				$this->registerType($type);
60
+			}
61
+		}
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     * @param TypeInterface $type
67
-     * @since 5.0.0.p
68
-     */
69
-    public function extendCustomPostType(TypeInterface $type)
70
-    {
71
-        $typeName = $type->name();
72
-        foreach ($type->fields() as $field) {
73
-            $fieldName = $field->name();
74
-            $config = $field->toArray();
75
-            if ($field->useForInput()) {
76
-                // Register input fields for existing mutations.
77
-                register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
78
-                register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
79
-            }
80
-            if ($field->useForOutput()) {
81
-                $config['resolve'] = [$type, 'resolveField'];
82
-                // Register fields for queries.
83
-                register_graphql_field($typeName, $fieldName, $config);
84
-            }
85
-        }
86
-        if (is_callable([$type, 'extendMutations'])) {
87
-            /** @disregard P1013 */
88
-            $type->extendMutations();
89
-        }
90
-    }
65
+	/**
66
+	 * @param TypeInterface $type
67
+	 * @since 5.0.0.p
68
+	 */
69
+	public function extendCustomPostType(TypeInterface $type)
70
+	{
71
+		$typeName = $type->name();
72
+		foreach ($type->fields() as $field) {
73
+			$fieldName = $field->name();
74
+			$config = $field->toArray();
75
+			if ($field->useForInput()) {
76
+				// Register input fields for existing mutations.
77
+				register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config);
78
+				register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config);
79
+			}
80
+			if ($field->useForOutput()) {
81
+				$config['resolve'] = [$type, 'resolveField'];
82
+				// Register fields for queries.
83
+				register_graphql_field($typeName, $fieldName, $config);
84
+			}
85
+		}
86
+		if (is_callable([$type, 'extendMutations'])) {
87
+			/** @disregard P1013 */
88
+			$type->extendMutations();
89
+		}
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * @param TypeInterface $type
95
-     * @since 5.0.0.p
96
-     */
97
-    public function registerType(TypeInterface $type)
98
-    {
99
-        $outputFields = [];
100
-        $inputFields = [];
101
-        foreach ($type->fields() as $field) {
102
-            $fieldName = $field->name();
103
-            $config = $field->toArray();
104
-            if ($field->useForInput()) {
105
-                $inputFields[ $fieldName ] = $config;
106
-            }
107
-            if ($field->useForOutput()) {
108
-                $config['resolve'] = [$type, 'resolveField'];
109
-                $outputFields[ $fieldName ] = $config;
110
-            }
111
-        }
112
-        $typeName = $type->name();
113
-        if (! empty($outputFields)) {
114
-            // Register the object type.
115
-            register_graphql_object_type(
116
-                $typeName,
117
-                [
118
-                    'description' => $type->description(),
119
-                    'fields'      => $outputFields,
120
-                    'interfaces'  => $type->interfaces(),
121
-                ]
122
-            );
123
-        }
124
-        if (is_callable([$type, 'registerMutations'])) {
125
-            /** @disregard P1013 */
126
-            $type->registerMutations($inputFields);
127
-        }
128
-    }
93
+	/**
94
+	 * @param TypeInterface $type
95
+	 * @since 5.0.0.p
96
+	 */
97
+	public function registerType(TypeInterface $type)
98
+	{
99
+		$outputFields = [];
100
+		$inputFields = [];
101
+		foreach ($type->fields() as $field) {
102
+			$fieldName = $field->name();
103
+			$config = $field->toArray();
104
+			if ($field->useForInput()) {
105
+				$inputFields[ $fieldName ] = $config;
106
+			}
107
+			if ($field->useForOutput()) {
108
+				$config['resolve'] = [$type, 'resolveField'];
109
+				$outputFields[ $fieldName ] = $config;
110
+			}
111
+		}
112
+		$typeName = $type->name();
113
+		if (! empty($outputFields)) {
114
+			// Register the object type.
115
+			register_graphql_object_type(
116
+				$typeName,
117
+				[
118
+					'description' => $type->description(),
119
+					'fields'      => $outputFields,
120
+					'interfaces'  => $type->interfaces(),
121
+				]
122
+			);
123
+		}
124
+		if (is_callable([$type, 'registerMutations'])) {
125
+			/** @disregard P1013 */
126
+			$type->registerMutations($inputFields);
127
+		}
128
+	}
129 129
 }
Please login to merge, or discard this patch.
core/services/graphql/resolvers/ResolverCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
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.
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 ResolverCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_resolvers';
23
+	const COLLECTION_NAME = 'espresso_graphql_resolvers';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * ResolverCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\ResolverInterface',
39
-            ResolverCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * ResolverCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\ResolverInterface',
39
+			ResolverCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since 5.0.0.p
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    ResolverCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\ResolverInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\resolvers']
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 5.0.0.p
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					ResolverCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\ResolverInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\resolvers']
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 5.0.0.p
82
-     */
83
-    public function loadResolvers()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since 5.0.0.p
82
+	 */
83
+	public function loadResolvers()
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.
core/services/graphql/enums/EnumCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
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.
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 5.0.0.p
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 5.0.0.p
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 5.0.0.p
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 5.0.0.p
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.
core/services/graphql/inputs/InputCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
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.
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 5.0.0.p
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 5.0.0.p
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 5.0.0.p
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 5.0.0.p
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.
core/services/graphql/types/TypeCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
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.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -20,89 +20,89 @@
 block discarded – undo
20 20
  */
21 21
 class TypeCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_types';
23
+	const COLLECTION_NAME = 'espresso_graphql_types';
24 24
 
25
-    const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface';
25
+	const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface';
26 26
 
27
-    /**
28
-     * @var CollectionLoader $loader
29
-     */
30
-    protected $loader;
27
+	/**
28
+	 * @var CollectionLoader $loader
29
+	 */
30
+	protected $loader;
31 31
 
32 32
 
33
-    /**
34
-     * TypeCollection constructor
35
-     *
36
-     * @throws InvalidInterfaceException
37
-     */
38
-    public function __construct()
39
-    {
40
-        parent::__construct(
41
-            TypeCollection::COLLECTION_INTERFACE,
42
-            TypeCollection::COLLECTION_NAME
43
-        );
44
-    }
33
+	/**
34
+	 * TypeCollection constructor
35
+	 *
36
+	 * @throws InvalidInterfaceException
37
+	 */
38
+	public function __construct()
39
+	{
40
+		parent::__construct(
41
+			TypeCollection::COLLECTION_INTERFACE,
42
+			TypeCollection::COLLECTION_NAME
43
+		);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * @throws CollectionDetailsException
49
-     * @throws CollectionLoaderException
50
-     * @since 5.0.0.p
51
-     */
52
-    private function loadCollection()
53
-    {
54
-        if (! $this->loader instanceof CollectionLoader) {
55
-            $this->loader = new CollectionLoader(
56
-                new CollectionDetails(
57
-                    // collection name
58
-                    TypeCollection::COLLECTION_NAME,
59
-                    // collection interface
60
-                    TypeCollection::COLLECTION_INTERFACE,
61
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
62
-                    apply_filters(
63
-                        'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs',
64
-                        ['EventEspresso\core\domain\services\graphql\types']
65
-                    ),
66
-                    // filepaths to classes to add
67
-                    array(),
68
-                    // file mask to use if parsing folder for files to add
69
-                    '',
70
-                    // what to use as identifier for collection entities
71
-                    // using CLASS NAME prevents duplicates (works like a singleton)
72
-                    CollectionDetails::ID_CLASS_NAME
73
-                ),
74
-                $this
75
-            );
76
-        }
77
-    }
47
+	/**
48
+	 * @throws CollectionDetailsException
49
+	 * @throws CollectionLoaderException
50
+	 * @since 5.0.0.p
51
+	 */
52
+	private function loadCollection()
53
+	{
54
+		if (! $this->loader instanceof CollectionLoader) {
55
+			$this->loader = new CollectionLoader(
56
+				new CollectionDetails(
57
+					// collection name
58
+					TypeCollection::COLLECTION_NAME,
59
+					// collection interface
60
+					TypeCollection::COLLECTION_INTERFACE,
61
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
62
+					apply_filters(
63
+						'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs',
64
+						['EventEspresso\core\domain\services\graphql\types']
65
+					),
66
+					// filepaths to classes to add
67
+					array(),
68
+					// file mask to use if parsing folder for files to add
69
+					'',
70
+					// what to use as identifier for collection entities
71
+					// using CLASS NAME prevents duplicates (works like a singleton)
72
+					CollectionDetails::ID_CLASS_NAME
73
+				),
74
+				$this
75
+			);
76
+		}
77
+	}
78 78
 
79 79
 
80
-    /**
81
-     * @return CollectionInterface
82
-     * @throws CollectionDetailsException
83
-     * @throws CollectionLoaderException
84
-     * @since 5.0.0.p
85
-     */
86
-    public function loadTypes()
87
-    {
88
-        $this->loadCollection();
89
-        return $this->loader->getCollection();
90
-    }
80
+	/**
81
+	 * @return CollectionInterface
82
+	 * @throws CollectionDetailsException
83
+	 * @throws CollectionLoaderException
84
+	 * @since 5.0.0.p
85
+	 */
86
+	public function loadTypes()
87
+	{
88
+		$this->loadCollection();
89
+		return $this->loader->getCollection();
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * getIdentifier
95
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
96
-     * If no $identifier is supplied, then the  fully qualified class name is used
97
-     *
98
-     * @param        $object
99
-     * @param mixed  $identifier
100
-     * @return bool
101
-     */
102
-    public function getIdentifier($object, $identifier = null)
103
-    {
104
-        return ! empty($identifier)
105
-            ? $identifier
106
-            : get_class($object);
107
-    }
93
+	/**
94
+	 * getIdentifier
95
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
96
+	 * If no $identifier is supplied, then the  fully qualified class name is used
97
+	 *
98
+	 * @param        $object
99
+	 * @param mixed  $identifier
100
+	 * @return bool
101
+	 */
102
+	public function getIdentifier($object, $identifier = null)
103
+	{
104
+		return ! empty($identifier)
105
+			? $identifier
106
+			: get_class($object);
107
+	}
108 108
 }
Please login to merge, or discard this patch.
core/services/graphql/InputsManager.php 2 patches
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.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -17,65 +17,65 @@
 block discarded – undo
17 17
  */
18 18
 class InputsManager implements GQLManagerInterface
19 19
 {
20
-    /**
21
-     * @var InputCollection|InputInterface[] $inputs
22
-     */
23
-    private $inputs;
20
+	/**
21
+	 * @var InputCollection|InputInterface[] $inputs
22
+	 */
23
+	private $inputs;
24 24
 
25 25
 
26
-    /**
27
-     * InputsManager constructor.
28
-     *
29
-     * @param InputCollection|InputInterface[] $inputs
30
-     */
31
-    public function __construct(InputCollection $inputs)
32
-    {
33
-        $this->inputs = $inputs;
34
-    }
26
+	/**
27
+	 * InputsManager constructor.
28
+	 *
29
+	 * @param InputCollection|InputInterface[] $inputs
30
+	 */
31
+	public function __construct(InputCollection $inputs)
32
+	{
33
+		$this->inputs = $inputs;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * @throws CollectionDetailsException
39
-     * @throws CollectionLoaderException
40
-     * @since 5.0.0.p
41
-     */
42
-    public function init()
43
-    {
44
-        $this->inputs->loadInputs();
45
-        add_action('graphql_register_types', [$this, 'configureInputs'], 9);
46
-    }
37
+	/**
38
+	 * @throws CollectionDetailsException
39
+	 * @throws CollectionLoaderException
40
+	 * @since 5.0.0.p
41
+	 */
42
+	public function init()
43
+	{
44
+		$this->inputs->loadInputs();
45
+		add_action('graphql_register_types', [$this, 'configureInputs'], 9);
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * @since 5.0.0.p
51
-     */
52
-    public function configureInputs()
53
-    {
54
-        // loop through the collection of inputs and register their fields
55
-        foreach ($this->inputs as $input) {
56
-            $this->registerInput($input);
57
-        }
58
-    }
49
+	/**
50
+	 * @since 5.0.0.p
51
+	 */
52
+	public function configureInputs()
53
+	{
54
+		// loop through the collection of inputs and register their fields
55
+		foreach ($this->inputs as $input) {
56
+			$this->registerInput($input);
57
+		}
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @param InputInterface $input
63
-     * @since 5.0.0.p
64
-     */
65
-    public function registerInput(InputInterface $input)
66
-    {
67
-        $inputFields = [];
68
-        foreach ($input->fields() as $field) {
69
-            $fieldName = $field->name();
70
-            $inputFields[ $fieldName ] = $field->toArray();
71
-        }
72
-        // Register the input type.
73
-        register_graphql_input_type(
74
-            $input->name(),
75
-            [
76
-                'description' => $input->description(),
77
-                'fields'      => $inputFields,
78
-            ]
79
-        );
80
-    }
61
+	/**
62
+	 * @param InputInterface $input
63
+	 * @since 5.0.0.p
64
+	 */
65
+	public function registerInput(InputInterface $input)
66
+	{
67
+		$inputFields = [];
68
+		foreach ($input->fields() as $field) {
69
+			$fieldName = $field->name();
70
+			$inputFields[ $fieldName ] = $field->toArray();
71
+		}
72
+		// Register the input type.
73
+		register_graphql_input_type(
74
+			$input->name(),
75
+			[
76
+				'description' => $input->description(),
77
+				'fields'      => $inputFields,
78
+			]
79
+		);
80
+	}
81 81
 }
Please login to merge, or discard this patch.