Completed
Branch dependabot/composer/wp-graphql... (64393b)
by
unknown
04:29
created
core/domain/DomainBase.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
91 91
     {
92
-        if (! $this->initialized) {
92
+        if ( ! $this->initialized) {
93 93
             $this->plugin_basename = plugin_basename($this->pluginFile());
94 94
             $this->plugin_path     = plugin_dir_path($this->pluginFile());
95 95
             $this->plugin_url      = plugin_dir_url($this->pluginFile());
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
108 108
     {
109
-        if (! $this->asset_namespace) {
109
+        if ( ! $this->asset_namespace) {
110 110
             $this->asset_namespace = sanitize_key(
111 111
                 // convert directory separators to dashes and remove file extension
112 112
                 str_replace(['/', '.php'], ['-', ''], $asset_namespace)
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
     private function setDistributionAssetsPath()
123 123
     {
124 124
         $assets_folder_paths = [
125
-            $this->plugin_path . DomainBase::ASSETS_FOLDER,
126
-            $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER,
125
+            $this->plugin_path.DomainBase::ASSETS_FOLDER,
126
+            $this->plugin_path.'src/'.DomainBase::ASSETS_FOLDER,
127 127
         ];
128 128
         foreach ($assets_folder_paths as $assets_folder_path) {
129 129
             if (is_readable($assets_folder_path)) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function pluginPath($additional_path = ''): string
170 170
     {
171 171
         return is_string($additional_path) && $additional_path !== ''
172
-            ? $this->plugin_path . $additional_path
172
+            ? $this->plugin_path.$additional_path
173 173
             : $this->plugin_path;
174 174
     }
175 175
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     public function pluginUrl($additional_path = ''): string
182 182
     {
183 183
         return is_string($additional_path) && $additional_path !== ''
184
-            ? $this->plugin_url . $additional_path
184
+            ? $this->plugin_url.$additional_path
185 185
             : $this->plugin_url;
186 186
     }
187 187
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     public function distributionAssetsPath($additional_path = ''): string
221 221
     {
222 222
         return is_string($additional_path) && $additional_path !== ''
223
-            ? $this->assets_path . $additional_path
223
+            ? $this->assets_path.$additional_path
224 224
             : $this->assets_path;
225 225
     }
226 226
 
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
     public function distributionAssetsUrl($additional_path = ''): string
233 233
     {
234 234
         return is_string($additional_path) && $additional_path !== ''
235
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
236
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
235
+            ? $this->plugin_url.DomainBase::ASSETS_FOLDER.$additional_path
236
+            : $this->plugin_url.DomainBase::ASSETS_FOLDER;
237 237
     }
238 238
 
239 239
 
Please login to merge, or discard this patch.
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -16,231 +16,231 @@
 block discarded – undo
16 16
  */
17 17
 abstract class DomainBase implements DomainInterface
18 18
 {
19
-    const ASSETS_FOLDER = 'assets/';
20
-
21
-    /**
22
-     * Equivalent to `__FILE__` for main plugin file.
23
-     *
24
-     * @var FilePath
25
-     */
26
-    private $plugin_file;
27
-
28
-    /**
29
-     * String indicating version for plugin
30
-     *
31
-     * @var string
32
-     */
33
-    private $version;
34
-
35
-    /**
36
-     * @var string $plugin_basename
37
-     */
38
-    private $plugin_basename;
39
-
40
-    /**
41
-     * @var string $plugin_path
42
-     */
43
-    private $plugin_path;
44
-
45
-    /**
46
-     * @var string $plugin_url
47
-     */
48
-    private $plugin_url;
49
-
50
-    /**
51
-     * @var string $asset_namespace
52
-     */
53
-    private $asset_namespace;
54
-
55
-    /**
56
-     * @var string $assets_path
57
-     */
58
-    private $assets_path;
59
-
60
-    /**
61
-     * @var bool
62
-     */
63
-    protected $initialized = false;
64
-
65
-
66
-    /**
67
-     * Initializes internal properties.
68
-     *
69
-     * @param FilePath $plugin_file
70
-     * @param Version  $version
71
-     * @param string $asset_namespace
72
-     */
73
-    public function __construct(
74
-        FilePath $plugin_file,
75
-        Version $version,
76
-        string $asset_namespace = Domain::ASSET_NAMESPACE
77
-    ) {
78
-        $this->plugin_file = $plugin_file;
79
-        $this->version     = $version;
80
-        $this->initialize($asset_namespace);
81
-    }
82
-
83
-
84
-    /**
85
-     * @param string $asset_namespace
86
-     * @return void
87
-     * @since 5.0.0.p
88
-     */
89
-    public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
90
-    {
91
-        if (! $this->initialized) {
92
-            $this->plugin_basename = plugin_basename($this->pluginFile());
93
-            $this->plugin_path     = plugin_dir_path($this->pluginFile());
94
-            $this->plugin_url      = plugin_dir_url($this->pluginFile());
95
-            $this->setAssetNamespace($asset_namespace);
96
-            $this->setDistributionAssetsPath();
97
-            $this->initialized = true;
98
-        }
99
-    }
100
-
101
-
102
-    /**
103
-     * @param string $asset_namespace
104
-     * @return void
105
-     */
106
-    public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
107
-    {
108
-        if (! $this->asset_namespace) {
109
-            $this->asset_namespace = sanitize_key(
110
-                // convert directory separators to dashes and remove file extension
111
-                str_replace(['/', '.php'], ['-', ''], $asset_namespace)
112
-            );
113
-        }
114
-    }
115
-
116
-
117
-    /**
118
-     * @throws DomainException
119
-     * @since 5.0.0.p
120
-     */
121
-    private function setDistributionAssetsPath()
122
-    {
123
-        $assets_folder_paths = [
124
-            $this->plugin_path . DomainBase::ASSETS_FOLDER,
125
-            $this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER,
126
-        ];
127
-        foreach ($assets_folder_paths as $assets_folder_path) {
128
-            if (is_readable($assets_folder_path)) {
129
-                $this->assets_path = trailingslashit($assets_folder_path);
130
-                // once we find a valid path, just break out of loop
131
-                break;
132
-            }
133
-        }
134
-    }
135
-
136
-
137
-    /**
138
-     * @return string
139
-     */
140
-    public function pluginFile(): string
141
-    {
142
-        return (string) $this->plugin_file;
143
-    }
144
-
145
-
146
-    /**
147
-     * @return FilePath
148
-     */
149
-    public function pluginFileObject(): FilePath
150
-    {
151
-        return $this->plugin_file;
152
-    }
153
-
154
-
155
-    /**
156
-     * @return string
157
-     */
158
-    public function pluginBasename(): string
159
-    {
160
-        return $this->plugin_basename;
161
-    }
162
-
163
-
164
-    /**
165
-     * @param string $additional_path
166
-     * @return string
167
-     */
168
-    public function pluginPath($additional_path = ''): string
169
-    {
170
-        return is_string($additional_path) && $additional_path !== ''
171
-            ? $this->plugin_path . $additional_path
172
-            : $this->plugin_path;
173
-    }
174
-
175
-
176
-    /**
177
-     * @param string $additional_path
178
-     * @return string
179
-     */
180
-    public function pluginUrl($additional_path = ''): string
181
-    {
182
-        return is_string($additional_path) && $additional_path !== ''
183
-            ? $this->plugin_url . $additional_path
184
-            : $this->plugin_url;
185
-    }
186
-
187
-
188
-    /**
189
-     * @return string
190
-     */
191
-    public function version(): string
192
-    {
193
-        return (string) $this->version;
194
-    }
195
-
196
-
197
-    /**
198
-     * @return Version
199
-     */
200
-    public function versionValueObject()
201
-    {
202
-        return $this->version;
203
-    }
204
-
205
-
206
-    /**
207
-     * @return string
208
-     */
209
-    public function distributionAssetsFolder(): string
210
-    {
211
-        return DomainBase::ASSETS_FOLDER;
212
-    }
213
-
214
-
215
-    /**
216
-     * @param string $additional_path
217
-     * @return string
218
-     */
219
-    public function distributionAssetsPath($additional_path = ''): string
220
-    {
221
-        return is_string($additional_path) && $additional_path !== ''
222
-            ? $this->assets_path . $additional_path
223
-            : $this->assets_path;
224
-    }
225
-
226
-
227
-    /**
228
-     * @param string $additional_path
229
-     * @return string
230
-     */
231
-    public function distributionAssetsUrl($additional_path = ''): string
232
-    {
233
-        return is_string($additional_path) && $additional_path !== ''
234
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
235
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
236
-    }
237
-
238
-
239
-    /**
240
-     * @return string
241
-     */
242
-    public function assetNamespace(): string
243
-    {
244
-        return $this->asset_namespace;
245
-    }
19
+	const ASSETS_FOLDER = 'assets/';
20
+
21
+	/**
22
+	 * Equivalent to `__FILE__` for main plugin file.
23
+	 *
24
+	 * @var FilePath
25
+	 */
26
+	private $plugin_file;
27
+
28
+	/**
29
+	 * String indicating version for plugin
30
+	 *
31
+	 * @var string
32
+	 */
33
+	private $version;
34
+
35
+	/**
36
+	 * @var string $plugin_basename
37
+	 */
38
+	private $plugin_basename;
39
+
40
+	/**
41
+	 * @var string $plugin_path
42
+	 */
43
+	private $plugin_path;
44
+
45
+	/**
46
+	 * @var string $plugin_url
47
+	 */
48
+	private $plugin_url;
49
+
50
+	/**
51
+	 * @var string $asset_namespace
52
+	 */
53
+	private $asset_namespace;
54
+
55
+	/**
56
+	 * @var string $assets_path
57
+	 */
58
+	private $assets_path;
59
+
60
+	/**
61
+	 * @var bool
62
+	 */
63
+	protected $initialized = false;
64
+
65
+
66
+	/**
67
+	 * Initializes internal properties.
68
+	 *
69
+	 * @param FilePath $plugin_file
70
+	 * @param Version  $version
71
+	 * @param string $asset_namespace
72
+	 */
73
+	public function __construct(
74
+		FilePath $plugin_file,
75
+		Version $version,
76
+		string $asset_namespace = Domain::ASSET_NAMESPACE
77
+	) {
78
+		$this->plugin_file = $plugin_file;
79
+		$this->version     = $version;
80
+		$this->initialize($asset_namespace);
81
+	}
82
+
83
+
84
+	/**
85
+	 * @param string $asset_namespace
86
+	 * @return void
87
+	 * @since 5.0.0.p
88
+	 */
89
+	public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
90
+	{
91
+		if (! $this->initialized) {
92
+			$this->plugin_basename = plugin_basename($this->pluginFile());
93
+			$this->plugin_path     = plugin_dir_path($this->pluginFile());
94
+			$this->plugin_url      = plugin_dir_url($this->pluginFile());
95
+			$this->setAssetNamespace($asset_namespace);
96
+			$this->setDistributionAssetsPath();
97
+			$this->initialized = true;
98
+		}
99
+	}
100
+
101
+
102
+	/**
103
+	 * @param string $asset_namespace
104
+	 * @return void
105
+	 */
106
+	public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
107
+	{
108
+		if (! $this->asset_namespace) {
109
+			$this->asset_namespace = sanitize_key(
110
+				// convert directory separators to dashes and remove file extension
111
+				str_replace(['/', '.php'], ['-', ''], $asset_namespace)
112
+			);
113
+		}
114
+	}
115
+
116
+
117
+	/**
118
+	 * @throws DomainException
119
+	 * @since 5.0.0.p
120
+	 */
121
+	private function setDistributionAssetsPath()
122
+	{
123
+		$assets_folder_paths = [
124
+			$this->plugin_path . DomainBase::ASSETS_FOLDER,
125
+			$this->plugin_path . 'src/' . DomainBase::ASSETS_FOLDER,
126
+		];
127
+		foreach ($assets_folder_paths as $assets_folder_path) {
128
+			if (is_readable($assets_folder_path)) {
129
+				$this->assets_path = trailingslashit($assets_folder_path);
130
+				// once we find a valid path, just break out of loop
131
+				break;
132
+			}
133
+		}
134
+	}
135
+
136
+
137
+	/**
138
+	 * @return string
139
+	 */
140
+	public function pluginFile(): string
141
+	{
142
+		return (string) $this->plugin_file;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @return FilePath
148
+	 */
149
+	public function pluginFileObject(): FilePath
150
+	{
151
+		return $this->plugin_file;
152
+	}
153
+
154
+
155
+	/**
156
+	 * @return string
157
+	 */
158
+	public function pluginBasename(): string
159
+	{
160
+		return $this->plugin_basename;
161
+	}
162
+
163
+
164
+	/**
165
+	 * @param string $additional_path
166
+	 * @return string
167
+	 */
168
+	public function pluginPath($additional_path = ''): string
169
+	{
170
+		return is_string($additional_path) && $additional_path !== ''
171
+			? $this->plugin_path . $additional_path
172
+			: $this->plugin_path;
173
+	}
174
+
175
+
176
+	/**
177
+	 * @param string $additional_path
178
+	 * @return string
179
+	 */
180
+	public function pluginUrl($additional_path = ''): string
181
+	{
182
+		return is_string($additional_path) && $additional_path !== ''
183
+			? $this->plugin_url . $additional_path
184
+			: $this->plugin_url;
185
+	}
186
+
187
+
188
+	/**
189
+	 * @return string
190
+	 */
191
+	public function version(): string
192
+	{
193
+		return (string) $this->version;
194
+	}
195
+
196
+
197
+	/**
198
+	 * @return Version
199
+	 */
200
+	public function versionValueObject()
201
+	{
202
+		return $this->version;
203
+	}
204
+
205
+
206
+	/**
207
+	 * @return string
208
+	 */
209
+	public function distributionAssetsFolder(): string
210
+	{
211
+		return DomainBase::ASSETS_FOLDER;
212
+	}
213
+
214
+
215
+	/**
216
+	 * @param string $additional_path
217
+	 * @return string
218
+	 */
219
+	public function distributionAssetsPath($additional_path = ''): string
220
+	{
221
+		return is_string($additional_path) && $additional_path !== ''
222
+			? $this->assets_path . $additional_path
223
+			: $this->assets_path;
224
+	}
225
+
226
+
227
+	/**
228
+	 * @param string $additional_path
229
+	 * @return string
230
+	 */
231
+	public function distributionAssetsUrl($additional_path = ''): string
232
+	{
233
+		return is_string($additional_path) && $additional_path !== ''
234
+			? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
235
+			: $this->plugin_url . DomainBase::ASSETS_FOLDER;
236
+	}
237
+
238
+
239
+	/**
240
+	 * @return string
241
+	 */
242
+	public function assetNamespace(): string
243
+	{
244
+		return $this->asset_namespace;
245
+	}
246 246
 }
Please login to merge, or discard this patch.
admin_pages/messages/help_tabs/messages_templates.help_tab.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,25 +3,25 @@
 block discarded – undo
3 3
 </p>
4 4
 <p>
5 5
     <?php
6
-    printf(
7
-        esc_html__(
8
-            'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.',
9
-            'event_espresso'
10
-        ),
11
-        '<em>',
12
-        '</em>'
13
-    );
14
-    ?>
6
+	printf(
7
+		esc_html__(
8
+			'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.',
9
+			'event_espresso'
10
+		),
11
+		'<em>',
12
+		'</em>'
13
+	);
14
+	?>
15 15
 </p>
16 16
 <p>
17 17
     <?php esc_html_e(
18
-        'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant.  Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).',
19
-        'event_espresso'
20
-    ); ?>
18
+		'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant.  Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).',
19
+		'event_espresso'
20
+	); ?>
21 21
 </p>
22 22
 <p>
23 23
     <?php esc_html_e(
24
-        'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").',
25
-        'event_espresso'
26
-    ); ?>
24
+		'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").',
25
+		'event_espresso'
26
+	); ?>
27 27
 </p>
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_List_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     private function _get_datetimes_from_event(EE_Event $event)
169 169
     {
170 170
         return isset($this->_extra_data['data']->events)
171
-            ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
171
+            ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs']
172 172
             : [];
173 173
     }
174 174
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     private function _get_datetimes_from_ticket(EE_Ticket $ticket)
183 183
     {
184 184
         return isset($this->_extra_data['data']->tickets)
185
-            ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
185
+            ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs']
186 186
             : [];
187 187
     }
188 188
 }
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -18,169 +18,169 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Datetime_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    protected function _init_props()
22
-    {
23
-        $this->label       = esc_html__('Datetime List Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso');
25
-        $this->_shortcodes = [
26
-            '[DATETIME_LIST]' => esc_html__(
27
-                'Will output a list of datetimes according to the layout specified in the datetime list field.',
28
-                'event_espresso'
29
-            ),
30
-        ];
31
-    }
32
-
33
-
34
-    /**
35
-     * @param string $shortcode
36
-     * @return string
37
-     * @throws EE_Error
38
-     * @throws ReflectionException
39
-     */
40
-    protected function _parser($shortcode)
41
-    {
42
-        switch ($shortcode) {
43
-            case '[DATETIME_LIST]':
44
-                return $this->_get_datetime_list();
45
-        }
46
-        return '';
47
-    }
48
-
49
-
50
-    /**
51
-     * figure out what the incoming data is and then return the appropriate parsed value.
52
-     *
53
-     * @return string
54
-     * @throws EE_Error
55
-     * @throws ReflectionException
56
-     */
57
-    private function _get_datetime_list()
58
-    {
59
-        $this->_validate_list_requirements();
60
-
61
-        if ($this->_data['data'] instanceof EE_Ticket) {
62
-            return $this->_get_datetime_list_for_ticket();
63
-        }
64
-        if ($this->_data['data'] instanceof EE_Event) {
65
-            return $this->_get_datetime_list_for_event();
66
-        }
67
-        if (
68
-            $this->_data['data'] instanceof EE_Messages_Addressee
69
-            && $this->_data['data']->reg_obj instanceof EE_Registration
70
-        ) {
71
-            return $this->_get_datetime_list_for_registration();
72
-        }
73
-        // prevent recursive loop
74
-        return '';
75
-    }
76
-
77
-
78
-    /**
79
-     * return parsed list of datetimes for an event
80
-     *
81
-     * @return string
82
-     * @throws EE_Error
83
-     * @throws ReflectionException
84
-     */
85
-    private function _get_datetime_list_for_event()
86
-    {
87
-        $event            = $this->_data['data'];
88
-        $valid_shortcodes = ['datetime', 'attendee'];
89
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
90
-            ? $this->_data['template']['datetime_list']
91
-            : $this->_extra_data['template']['datetime_list'];
92
-
93
-        // here we're setting up the datetimes for the datetime list template for THIS event.
94
-        $dtt_parsed = '';
95
-        $datetimes  = $this->_get_datetimes_from_event($event);
96
-
97
-        // each datetime in this case should be an datetime object.
98
-        foreach ($datetimes as $datetime) {
99
-            $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
100
-                $template,
101
-                $datetime,
102
-                $valid_shortcodes,
103
-                $this->_extra_data
104
-            );
105
-        }
106
-
107
-        return $dtt_parsed;
108
-    }
109
-
110
-
111
-    /**
112
-     * return parsed list of datetimes for an ticket
113
-     *
114
-     * @return string
115
-     * @throws EE_Error
116
-     */
117
-    private function _get_datetime_list_for_ticket()
118
-    {
119
-        $valid_shortcodes = ['datetime', 'attendee'];
120
-
121
-        $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
122
-            ? $this->_data['template']['datetime_list']
123
-            : $this->_extra_data['template']['datetime_list'];
124
-        $ticket   = $this->_data['data'];
125
-
126
-        // here we're setting up the datetimes for the datetime list template for THIS ticket.
127
-        $dtt_parsed = '';
128
-        $datetimes  = $this->_get_datetimes_from_ticket($ticket);
129
-
130
-        // each datetime in this case should be an datetime object.
131
-        foreach ($datetimes as $datetime) {
132
-            $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
133
-                $template,
134
-                $datetime,
135
-                $valid_shortcodes,
136
-                $this->_extra_data
137
-            );
138
-        }
139
-
140
-        return $dtt_parsed;
141
-    }
142
-
143
-
144
-    /**
145
-     * return parsed list of datetimes from a given registration.
146
-     *
147
-     * @return string
148
-     * @throws EE_Error
149
-     * @throws EE_Error
150
-     */
151
-    private function _get_datetime_list_for_registration()
152
-    {
153
-        $registration = $this->_data['data']->reg_obj;
154
-
155
-        // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket();
156
-        $this->_data['data'] = $registration->ticket();
157
-        return $this->_get_datetime_list_for_ticket();
158
-    }
159
-
160
-
161
-    /**
162
-     * @param EE_Event $event
163
-     * @return array|mixed
164
-     * @throws EE_Error
165
-     * @throws ReflectionException
166
-     */
167
-    private function _get_datetimes_from_event(EE_Event $event)
168
-    {
169
-        return isset($this->_extra_data['data']->events)
170
-            ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
171
-            : [];
172
-    }
173
-
174
-
175
-    /**
176
-     * @param EE_Ticket $ticket
177
-     * @return array|mixed
178
-     * @throws EE_Error
179
-     */
180
-    private function _get_datetimes_from_ticket(EE_Ticket $ticket)
181
-    {
182
-        return isset($this->_extra_data['data']->tickets)
183
-            ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
184
-            : [];
185
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label       = esc_html__('Datetime List Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso');
25
+		$this->_shortcodes = [
26
+			'[DATETIME_LIST]' => esc_html__(
27
+				'Will output a list of datetimes according to the layout specified in the datetime list field.',
28
+				'event_espresso'
29
+			),
30
+		];
31
+	}
32
+
33
+
34
+	/**
35
+	 * @param string $shortcode
36
+	 * @return string
37
+	 * @throws EE_Error
38
+	 * @throws ReflectionException
39
+	 */
40
+	protected function _parser($shortcode)
41
+	{
42
+		switch ($shortcode) {
43
+			case '[DATETIME_LIST]':
44
+				return $this->_get_datetime_list();
45
+		}
46
+		return '';
47
+	}
48
+
49
+
50
+	/**
51
+	 * figure out what the incoming data is and then return the appropriate parsed value.
52
+	 *
53
+	 * @return string
54
+	 * @throws EE_Error
55
+	 * @throws ReflectionException
56
+	 */
57
+	private function _get_datetime_list()
58
+	{
59
+		$this->_validate_list_requirements();
60
+
61
+		if ($this->_data['data'] instanceof EE_Ticket) {
62
+			return $this->_get_datetime_list_for_ticket();
63
+		}
64
+		if ($this->_data['data'] instanceof EE_Event) {
65
+			return $this->_get_datetime_list_for_event();
66
+		}
67
+		if (
68
+			$this->_data['data'] instanceof EE_Messages_Addressee
69
+			&& $this->_data['data']->reg_obj instanceof EE_Registration
70
+		) {
71
+			return $this->_get_datetime_list_for_registration();
72
+		}
73
+		// prevent recursive loop
74
+		return '';
75
+	}
76
+
77
+
78
+	/**
79
+	 * return parsed list of datetimes for an event
80
+	 *
81
+	 * @return string
82
+	 * @throws EE_Error
83
+	 * @throws ReflectionException
84
+	 */
85
+	private function _get_datetime_list_for_event()
86
+	{
87
+		$event            = $this->_data['data'];
88
+		$valid_shortcodes = ['datetime', 'attendee'];
89
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
90
+			? $this->_data['template']['datetime_list']
91
+			: $this->_extra_data['template']['datetime_list'];
92
+
93
+		// here we're setting up the datetimes for the datetime list template for THIS event.
94
+		$dtt_parsed = '';
95
+		$datetimes  = $this->_get_datetimes_from_event($event);
96
+
97
+		// each datetime in this case should be an datetime object.
98
+		foreach ($datetimes as $datetime) {
99
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
100
+				$template,
101
+				$datetime,
102
+				$valid_shortcodes,
103
+				$this->_extra_data
104
+			);
105
+		}
106
+
107
+		return $dtt_parsed;
108
+	}
109
+
110
+
111
+	/**
112
+	 * return parsed list of datetimes for an ticket
113
+	 *
114
+	 * @return string
115
+	 * @throws EE_Error
116
+	 */
117
+	private function _get_datetime_list_for_ticket()
118
+	{
119
+		$valid_shortcodes = ['datetime', 'attendee'];
120
+
121
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list'])
122
+			? $this->_data['template']['datetime_list']
123
+			: $this->_extra_data['template']['datetime_list'];
124
+		$ticket   = $this->_data['data'];
125
+
126
+		// here we're setting up the datetimes for the datetime list template for THIS ticket.
127
+		$dtt_parsed = '';
128
+		$datetimes  = $this->_get_datetimes_from_ticket($ticket);
129
+
130
+		// each datetime in this case should be an datetime object.
131
+		foreach ($datetimes as $datetime) {
132
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template(
133
+				$template,
134
+				$datetime,
135
+				$valid_shortcodes,
136
+				$this->_extra_data
137
+			);
138
+		}
139
+
140
+		return $dtt_parsed;
141
+	}
142
+
143
+
144
+	/**
145
+	 * return parsed list of datetimes from a given registration.
146
+	 *
147
+	 * @return string
148
+	 * @throws EE_Error
149
+	 * @throws EE_Error
150
+	 */
151
+	private function _get_datetime_list_for_registration()
152
+	{
153
+		$registration = $this->_data['data']->reg_obj;
154
+
155
+		// now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket();
156
+		$this->_data['data'] = $registration->ticket();
157
+		return $this->_get_datetime_list_for_ticket();
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param EE_Event $event
163
+	 * @return array|mixed
164
+	 * @throws EE_Error
165
+	 * @throws ReflectionException
166
+	 */
167
+	private function _get_datetimes_from_event(EE_Event $event)
168
+	{
169
+		return isset($this->_extra_data['data']->events)
170
+			? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs']
171
+			: [];
172
+	}
173
+
174
+
175
+	/**
176
+	 * @param EE_Ticket $ticket
177
+	 * @return array|mixed
178
+	 * @throws EE_Error
179
+	 */
180
+	private function _get_datetimes_from_ticket(EE_Ticket $ticket)
181
+	{
182
+		return isset($this->_extra_data['data']->tickets)
183
+			? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs']
184
+			: [];
185
+	}
186 186
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Ticket_List_Shortcodes.lib.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     private function _get_tickets_from_event(EE_Event $event)
203 203
     {
204 204
         return isset($this->_extra_data['data']->events)
205
-            ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
205
+            ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs']
206 206
             : [];
207 207
     }
208 208
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     private function _get_ticket_list_from_registration(EE_Registration $registration)
217 217
     {
218 218
         return isset($this->_extra_data['data']->registrations)
219
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
219
+            ? [$this->_extra_data['data']->registrations[$registration->ID()]['tkt_obj']]
220 220
             : [];
221 221
     }
222 222
 }
Please login to merge, or discard this patch.
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -18,204 +18,204 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Ticket_List_Shortcodes extends EE_Shortcodes
20 20
 {
21
-    protected function _init_props()
22
-    {
23
-        $this->label       = esc_html__('Ticket List Shortcodes', 'event_espresso');
24
-        $this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso');
25
-        $this->_shortcodes = [
26
-            '[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'),
27
-        ];
28
-    }
29
-
30
-
31
-    /**
32
-     * @param string $shortcode
33
-     * @return string
34
-     * @throws EE_Error
35
-     * @throws ReflectionException
36
-     */
37
-    protected function _parser($shortcode)
38
-    {
39
-        switch ($shortcode) {
40
-            case '[TICKET_LIST]':
41
-                return $this->_get_ticket_list();
42
-        }
43
-        return '';
44
-    }
45
-
46
-
47
-    /**
48
-     * figure out what the incoming data is and then return the appropriate parsed value.
49
-     *
50
-     * @return string
51
-     * @throws EE_Error
52
-     * @throws ReflectionException
53
-     */
54
-    private function _get_ticket_list()
55
-    {
56
-        $this->_validate_list_requirements();
57
-
58
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
59
-            return $this->_get_ticket_list_for_main();
60
-        }
61
-        if ($this->_data['data'] instanceof EE_Registration) {
62
-            return $this->_get_ticket_list_for_attendee();
63
-        }
64
-        if ($this->_data['data'] instanceof EE_Event) {
65
-            return $this->_get_ticket_list_for_event();
66
-        }
67
-        // prevent recursive loop
68
-        return '';
69
-    }
70
-
71
-
72
-    /**
73
-     * This returns the parsed ticket list for main template;
74
-     */
75
-    private function _get_ticket_list_for_main()
76
-    {
77
-        $valid_shortcodes = [
78
-            'ticket',
79
-            'event_list',
80
-            'attendee_list',
81
-            'datetime_list',
82
-            'attendee',
83
-            'line_item_list',
84
-            'primary_registration_details',
85
-            'recipient_details',
86
-        ];
87
-        $template         = $this->_data['template'];
88
-        $data             = $this->_data['data'];
89
-        $ticket_list      = '';
90
-
91
-
92
-        // now we need to loop through the ticket list and send data to the EE_Parser helper.
93
-        foreach ($data->tickets as $ticket) {
94
-            $ticket_list .= $this->_shortcode_helper->parse_ticket_list_template(
95
-                $template,
96
-                $ticket['ticket'],
97
-                $valid_shortcodes,
98
-                $this->_extra_data
99
-            );
100
-        }
101
-
102
-        return $ticket_list;
103
-    }
104
-
105
-
106
-    /**
107
-     * return parsed list of tickets for an event
108
-     *
109
-     * @return string
110
-     * @throws EE_Error
111
-     * @throws ReflectionException
112
-     */
113
-    private function _get_ticket_list_for_event()
114
-    {
115
-        $valid_shortcodes = [
116
-            'ticket',
117
-            'attendee_list',
118
-            'datetime_list',
119
-            'attendee',
120
-            'venue',
121
-            'line_item_list',
122
-            'primary_registration_details',
123
-            'recipient_details',
124
-        ];
125
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
126
-            ? $this->_data['template']['ticket_list']
127
-            : $this->_extra_data['template']['ticket_list'];
128
-        $event            = $this->_data['data'];
129
-
130
-        // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion.
131
-        $template = str_replace('[EVENT_LIST]', '', $template);
132
-
133
-        // here we're setting up the tickets for the ticket list template for THIS event.
134
-        $tkt_parsed = '';
135
-        $tickets    = $this->_get_tickets_from_event($event);
136
-
137
-        // each ticket in this case should be an ticket object.
138
-        foreach ($tickets as $ticket) {
139
-            $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
140
-                $template,
141
-                $ticket,
142
-                $valid_shortcodes,
143
-                $this->_extra_data
144
-            );
145
-        }
146
-
147
-        return $tkt_parsed;
148
-    }
149
-
150
-
151
-    /**
152
-     * return parsed list of tickets for an attendee
153
-     *
154
-     * @return string
155
-     * @throws EE_Error
156
-     * @throws ReflectionException
157
-     */
158
-    private function _get_ticket_list_for_attendee()
159
-    {
160
-        $valid_shortcodes = [
161
-            'ticket',
162
-            'event_list',
163
-            'datetime_list',
164
-            'attendee',
165
-            'primary_registration_details',
166
-            'recipient_details',
167
-        ];
168
-
169
-        $template     = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
170
-            ? $this->_data['template']['ticket_list']
171
-            : $this->_extra_data['template']['ticket_list'];
172
-        $registration = $this->_data['data'];
173
-
174
-        // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion.
175
-        $template = str_replace('[ATTENDEE_LIST]', '', $template);
176
-
177
-        // here we're setting up the tickets for the ticket list template for THIS attendee.
178
-        $tkt_parsed = '';
179
-        $tickets    = $this->_get_ticket_list_from_registration($registration);
180
-
181
-        // each ticket in this case should be an ticket object.
182
-        foreach ($tickets as $ticket) {
183
-            $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
184
-                $template,
185
-                $ticket,
186
-                $valid_shortcodes,
187
-                $this->_extra_data
188
-            );
189
-        }
190
-
191
-        return $tkt_parsed;
192
-    }
193
-
194
-
195
-    /**
196
-     * @param EE_Event $event
197
-     * @return array|mixed
198
-     * @throws EE_Error
199
-     * @throws ReflectionException
200
-     */
201
-    private function _get_tickets_from_event(EE_Event $event)
202
-    {
203
-        return isset($this->_extra_data['data']->events)
204
-            ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
205
-            : [];
206
-    }
207
-
208
-
209
-    /**
210
-     * @param EE_Registration $registration
211
-     * @return array
212
-     * @throws EE_Error
213
-     * @throws ReflectionException
214
-     */
215
-    private function _get_ticket_list_from_registration(EE_Registration $registration)
216
-    {
217
-        return isset($this->_extra_data['data']->registrations)
218
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
219
-            : [];
220
-    }
21
+	protected function _init_props()
22
+	{
23
+		$this->label       = esc_html__('Ticket List Shortcodes', 'event_espresso');
24
+		$this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso');
25
+		$this->_shortcodes = [
26
+			'[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'),
27
+		];
28
+	}
29
+
30
+
31
+	/**
32
+	 * @param string $shortcode
33
+	 * @return string
34
+	 * @throws EE_Error
35
+	 * @throws ReflectionException
36
+	 */
37
+	protected function _parser($shortcode)
38
+	{
39
+		switch ($shortcode) {
40
+			case '[TICKET_LIST]':
41
+				return $this->_get_ticket_list();
42
+		}
43
+		return '';
44
+	}
45
+
46
+
47
+	/**
48
+	 * figure out what the incoming data is and then return the appropriate parsed value.
49
+	 *
50
+	 * @return string
51
+	 * @throws EE_Error
52
+	 * @throws ReflectionException
53
+	 */
54
+	private function _get_ticket_list()
55
+	{
56
+		$this->_validate_list_requirements();
57
+
58
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
59
+			return $this->_get_ticket_list_for_main();
60
+		}
61
+		if ($this->_data['data'] instanceof EE_Registration) {
62
+			return $this->_get_ticket_list_for_attendee();
63
+		}
64
+		if ($this->_data['data'] instanceof EE_Event) {
65
+			return $this->_get_ticket_list_for_event();
66
+		}
67
+		// prevent recursive loop
68
+		return '';
69
+	}
70
+
71
+
72
+	/**
73
+	 * This returns the parsed ticket list for main template;
74
+	 */
75
+	private function _get_ticket_list_for_main()
76
+	{
77
+		$valid_shortcodes = [
78
+			'ticket',
79
+			'event_list',
80
+			'attendee_list',
81
+			'datetime_list',
82
+			'attendee',
83
+			'line_item_list',
84
+			'primary_registration_details',
85
+			'recipient_details',
86
+		];
87
+		$template         = $this->_data['template'];
88
+		$data             = $this->_data['data'];
89
+		$ticket_list      = '';
90
+
91
+
92
+		// now we need to loop through the ticket list and send data to the EE_Parser helper.
93
+		foreach ($data->tickets as $ticket) {
94
+			$ticket_list .= $this->_shortcode_helper->parse_ticket_list_template(
95
+				$template,
96
+				$ticket['ticket'],
97
+				$valid_shortcodes,
98
+				$this->_extra_data
99
+			);
100
+		}
101
+
102
+		return $ticket_list;
103
+	}
104
+
105
+
106
+	/**
107
+	 * return parsed list of tickets for an event
108
+	 *
109
+	 * @return string
110
+	 * @throws EE_Error
111
+	 * @throws ReflectionException
112
+	 */
113
+	private function _get_ticket_list_for_event()
114
+	{
115
+		$valid_shortcodes = [
116
+			'ticket',
117
+			'attendee_list',
118
+			'datetime_list',
119
+			'attendee',
120
+			'venue',
121
+			'line_item_list',
122
+			'primary_registration_details',
123
+			'recipient_details',
124
+		];
125
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
126
+			? $this->_data['template']['ticket_list']
127
+			: $this->_extra_data['template']['ticket_list'];
128
+		$event            = $this->_data['data'];
129
+
130
+		// let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion.
131
+		$template = str_replace('[EVENT_LIST]', '', $template);
132
+
133
+		// here we're setting up the tickets for the ticket list template for THIS event.
134
+		$tkt_parsed = '';
135
+		$tickets    = $this->_get_tickets_from_event($event);
136
+
137
+		// each ticket in this case should be an ticket object.
138
+		foreach ($tickets as $ticket) {
139
+			$tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
140
+				$template,
141
+				$ticket,
142
+				$valid_shortcodes,
143
+				$this->_extra_data
144
+			);
145
+		}
146
+
147
+		return $tkt_parsed;
148
+	}
149
+
150
+
151
+	/**
152
+	 * return parsed list of tickets for an attendee
153
+	 *
154
+	 * @return string
155
+	 * @throws EE_Error
156
+	 * @throws ReflectionException
157
+	 */
158
+	private function _get_ticket_list_for_attendee()
159
+	{
160
+		$valid_shortcodes = [
161
+			'ticket',
162
+			'event_list',
163
+			'datetime_list',
164
+			'attendee',
165
+			'primary_registration_details',
166
+			'recipient_details',
167
+		];
168
+
169
+		$template     = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list'])
170
+			? $this->_data['template']['ticket_list']
171
+			: $this->_extra_data['template']['ticket_list'];
172
+		$registration = $this->_data['data'];
173
+
174
+		// let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion.
175
+		$template = str_replace('[ATTENDEE_LIST]', '', $template);
176
+
177
+		// here we're setting up the tickets for the ticket list template for THIS attendee.
178
+		$tkt_parsed = '';
179
+		$tickets    = $this->_get_ticket_list_from_registration($registration);
180
+
181
+		// each ticket in this case should be an ticket object.
182
+		foreach ($tickets as $ticket) {
183
+			$tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template(
184
+				$template,
185
+				$ticket,
186
+				$valid_shortcodes,
187
+				$this->_extra_data
188
+			);
189
+		}
190
+
191
+		return $tkt_parsed;
192
+	}
193
+
194
+
195
+	/**
196
+	 * @param EE_Event $event
197
+	 * @return array|mixed
198
+	 * @throws EE_Error
199
+	 * @throws ReflectionException
200
+	 */
201
+	private function _get_tickets_from_event(EE_Event $event)
202
+	{
203
+		return isset($this->_extra_data['data']->events)
204
+			? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs']
205
+			: [];
206
+	}
207
+
208
+
209
+	/**
210
+	 * @param EE_Registration $registration
211
+	 * @return array
212
+	 * @throws EE_Error
213
+	 * @throws ReflectionException
214
+	 */
215
+	private function _get_ticket_list_from_registration(EE_Registration $registration)
216
+	{
217
+		return isset($this->_extra_data['data']->registrations)
218
+			? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']]
219
+			: [];
220
+	}
221 221
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_List_Shortcodes.lib.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
     private function _get_events_from_registration(EE_Registration $registration)
164 164
     {
165 165
         return isset($this->_extra_data['data']->registrations)
166
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
166
+            ? [$this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']]
167 167
             : [];
168 168
     }
169 169
 }
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -18,156 +18,156 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Event_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__('Event List Shortcodes', 'event_espresso');
30
-        $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso');
31
-        $this->_shortcodes = [
32
-            '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'),
33
-        ];
34
-    }
35
-
36
-
37
-    /**
38
-     * @param string $shortcode
39
-     * @return string
40
-     * @throws EE_Error
41
-     * @throws ReflectionException
42
-     */
43
-    protected function _parser($shortcode)
44
-    {
45
-        switch ($shortcode) {
46
-            case '[EVENT_LIST]':
47
-                return $this->_get_event_list();
48
-        }
49
-        return '';
50
-    }
51
-
52
-
53
-    /**
54
-     * figure out what the incoming data is and then return the appropriate parsed value.
55
-     *
56
-     * @return string
57
-     * @throws EE_Error
58
-     * @throws ReflectionException
59
-     */
60
-    private function _get_event_list()
61
-    {
62
-        $this->_validate_list_requirements();
63
-
64
-        if ($this->_data['data'] instanceof EE_Messages_Addressee) {
65
-            return $this->_get_event_list_for_main();
66
-        }
67
-        if ($this->_data['data'] instanceof EE_Registration) {
68
-            return $this->_get_event_list_for_registration();
69
-        }
70
-        // prevent recursive loop
71
-        return '';
72
-    }
73
-
74
-
75
-    /**
76
-     * This returns the parsed event list for main template
77
-     *
78
-     * @return string
79
-     */
80
-    private function _get_event_list_for_main()
81
-    {
82
-
83
-        $valid_shortcodes = [
84
-            'event',
85
-            'attendee_list',
86
-            'ticket_list',
87
-            'datetime_list',
88
-            'venue',
89
-            'attendee',
90
-            'recipient_list',
91
-            'recipient_details',
92
-            'primary_registration_list',
93
-            'primary_registration_details',
94
-            'event_author',
95
-            'organization',
96
-        ];
97
-        $template         = $this->_data['template'];
98
-        $data             = $this->_data['data'];
99
-        $events           = '';
100
-
101
-        // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
102
-        foreach ($data->events as $event) {
103
-            $events .= $this->_shortcode_helper->parse_event_list_template(
104
-                $template,
105
-                $event['event'],
106
-                $valid_shortcodes,
107
-                $this->_extra_data
108
-            );
109
-        }
110
-        return $events;
111
-    }
112
-
113
-
114
-    /**
115
-     * This returns the parsed event list for an attendee
116
-     *
117
-     * @return string
118
-     * @throws EE_Error
119
-     * @throws ReflectionException
120
-     */
121
-    private function _get_event_list_for_registration()
122
-    {
123
-        $valid_shortcodes = [
124
-            'event',
125
-            'ticket_list',
126
-            'datetime_list',
127
-            'attendee',
128
-            'event_author',
129
-            'recipient_details',
130
-            'recipient_list',
131
-            'venue',
132
-            'organization',
133
-        ];
134
-        $template         = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
135
-            ? $this->_data['template']['event_list']
136
-            : $this->_extra_data['template']['event_list'];
137
-        $registration     = $this->_data['data'];
138
-
139
-        // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
140
-        $template = str_replace('[ATTENDEE_LIST]', '', $template);
141
-
142
-        // here we're setting up the events for the event_list template for THIS registration.
143
-        $all_events = $this->_get_events_from_registration($registration);
144
-
145
-        // we're NOT going to prepare a list of attendees this time around
146
-        $events = '';
147
-
148
-        foreach ($all_events as $event) {
149
-            $events .= $this->_shortcode_helper->parse_event_list_template(
150
-                $template,
151
-                $event,
152
-                $valid_shortcodes,
153
-                $this->_extra_data
154
-            );
155
-        }
156
-
157
-        return $events;
158
-    }
159
-
160
-
161
-    /**
162
-     * @param EE_Registration $registration
163
-     * @return array
164
-     * @throws EE_Error
165
-     * @throws ReflectionException
166
-     */
167
-    private function _get_events_from_registration(EE_Registration $registration)
168
-    {
169
-        return isset($this->_extra_data['data']->registrations)
170
-            ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
171
-            : [];
172
-    }
21
+	public function __construct()
22
+	{
23
+		parent::__construct();
24
+	}
25
+
26
+
27
+	protected function _init_props()
28
+	{
29
+		$this->label       = esc_html__('Event List Shortcodes', 'event_espresso');
30
+		$this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso');
31
+		$this->_shortcodes = [
32
+			'[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'),
33
+		];
34
+	}
35
+
36
+
37
+	/**
38
+	 * @param string $shortcode
39
+	 * @return string
40
+	 * @throws EE_Error
41
+	 * @throws ReflectionException
42
+	 */
43
+	protected function _parser($shortcode)
44
+	{
45
+		switch ($shortcode) {
46
+			case '[EVENT_LIST]':
47
+				return $this->_get_event_list();
48
+		}
49
+		return '';
50
+	}
51
+
52
+
53
+	/**
54
+	 * figure out what the incoming data is and then return the appropriate parsed value.
55
+	 *
56
+	 * @return string
57
+	 * @throws EE_Error
58
+	 * @throws ReflectionException
59
+	 */
60
+	private function _get_event_list()
61
+	{
62
+		$this->_validate_list_requirements();
63
+
64
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
65
+			return $this->_get_event_list_for_main();
66
+		}
67
+		if ($this->_data['data'] instanceof EE_Registration) {
68
+			return $this->_get_event_list_for_registration();
69
+		}
70
+		// prevent recursive loop
71
+		return '';
72
+	}
73
+
74
+
75
+	/**
76
+	 * This returns the parsed event list for main template
77
+	 *
78
+	 * @return string
79
+	 */
80
+	private function _get_event_list_for_main()
81
+	{
82
+
83
+		$valid_shortcodes = [
84
+			'event',
85
+			'attendee_list',
86
+			'ticket_list',
87
+			'datetime_list',
88
+			'venue',
89
+			'attendee',
90
+			'recipient_list',
91
+			'recipient_details',
92
+			'primary_registration_list',
93
+			'primary_registration_details',
94
+			'event_author',
95
+			'organization',
96
+		];
97
+		$template         = $this->_data['template'];
98
+		$data             = $this->_data['data'];
99
+		$events           = '';
100
+
101
+		// now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
102
+		foreach ($data->events as $event) {
103
+			$events .= $this->_shortcode_helper->parse_event_list_template(
104
+				$template,
105
+				$event['event'],
106
+				$valid_shortcodes,
107
+				$this->_extra_data
108
+			);
109
+		}
110
+		return $events;
111
+	}
112
+
113
+
114
+	/**
115
+	 * This returns the parsed event list for an attendee
116
+	 *
117
+	 * @return string
118
+	 * @throws EE_Error
119
+	 * @throws ReflectionException
120
+	 */
121
+	private function _get_event_list_for_registration()
122
+	{
123
+		$valid_shortcodes = [
124
+			'event',
125
+			'ticket_list',
126
+			'datetime_list',
127
+			'attendee',
128
+			'event_author',
129
+			'recipient_details',
130
+			'recipient_list',
131
+			'venue',
132
+			'organization',
133
+		];
134
+		$template         = is_array($this->_data['template']) && isset($this->_data['template']['event_list'])
135
+			? $this->_data['template']['event_list']
136
+			: $this->_extra_data['template']['event_list'];
137
+		$registration     = $this->_data['data'];
138
+
139
+		// let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
140
+		$template = str_replace('[ATTENDEE_LIST]', '', $template);
141
+
142
+		// here we're setting up the events for the event_list template for THIS registration.
143
+		$all_events = $this->_get_events_from_registration($registration);
144
+
145
+		// we're NOT going to prepare a list of attendees this time around
146
+		$events = '';
147
+
148
+		foreach ($all_events as $event) {
149
+			$events .= $this->_shortcode_helper->parse_event_list_template(
150
+				$template,
151
+				$event,
152
+				$valid_shortcodes,
153
+				$this->_extra_data
154
+			);
155
+		}
156
+
157
+		return $events;
158
+	}
159
+
160
+
161
+	/**
162
+	 * @param EE_Registration $registration
163
+	 * @return array
164
+	 * @throws EE_Error
165
+	 * @throws ReflectionException
166
+	 */
167
+	private function _get_events_from_registration(EE_Registration $registration)
168
+	{
169
+		return isset($this->_extra_data['data']->registrations)
170
+			? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']]
171
+			: [];
172
+	}
173 173
 }
Please login to merge, or discard this patch.
templates/admin_general_metabox_contents_espresso_sponsors.template.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
     <p>
3 3
         <?php
4
-        printf(
5
-            esc_html__(
6
-                'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!',
7
-                'event_espresso'
8
-            ),
9
-            '<a
4
+		printf(
5
+			esc_html__(
6
+				'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!',
7
+				'event_espresso'
8
+			),
9
+			'<a
10 10
             href="https://eventespresso.com/pricing/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link"
11 11
             target="_blank">',
12
-            '</a>'
13
-        );
14
-        ?>
12
+			'</a>'
13
+		);
14
+		?>
15 15
     </p>
16 16
     <p>
17 17
         <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner'
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
     </p>
24 24
     <p>
25 25
         <?php
26
-        printf(
27
-            esc_html__(
28
-                'Visit %1$sEvent Espresso%2$s for more details.',
29
-                'event_espresso'
30
-            ),
31
-            '<a
26
+		printf(
27
+			esc_html__(
28
+				'Visit %1$sEvent Espresso%2$s for more details.',
29
+				'event_espresso'
30
+			),
31
+			'<a
32 32
             href="https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link"
33 33
             target="_blank">',
34
-            '</a>'
35
-        );
36
-        ?>
34
+			'</a>'
35
+		);
36
+		?>
37 37
         </p>
38 38
 </div>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner'
18 18
            target='_blank'>
19 19
             <img alt="<?php esc_html_e('manage events faster', 'event_espresso'); ?>"
20
-                 src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/manage-events-faster-240x240.jpg'); ?>"
20
+                 src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/manage-events-faster-240x240.jpg'); ?>"
21 21
             />
22 22
         </a>
23 23
     </p>
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
                     'table_alias'         => $field_obj->get_table_alias(),
84 84
                     'table_column'        => $field_obj->get_table_column(),
85 85
                 );
86
-                $fields_json[ $field_json['name'] ] = $field_json;
86
+                $fields_json[$field_json['name']] = $field_json;
87 87
             }
88 88
             $fields_json = array_merge(
89 89
                 $fields_json,
90 90
                 $this->getModelVersionInfo()->extraResourcePropertiesForModel($model)
91 91
             );
92
-            $response[ $model_name ]['fields'] = apply_filters(
92
+            $response[$model_name]['fields'] = apply_filters(
93 93
                 'FHEE__Meta__handle_request_models_meta__fields',
94 94
                 $fields_json,
95 95
                 $model
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
                     'type'   => str_replace('EE_', '', get_class($relation_obj)),
102 102
                     'single' => $relation_obj instanceof EE_Belongs_To_Relation,
103 103
                 );
104
-                $relations_json[ $relation_name ] = $relation_json;
104
+                $relations_json[$relation_name] = $relation_json;
105 105
             }
106
-            $response[ $model_name ]['relations'] = apply_filters(
106
+            $response[$model_name]['relations'] = apply_filters(
107 107
                 'FHEE__Meta__handle_request_models_meta__relations',
108 108
                 $relations_json,
109 109
                 $model
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 'name'    => $addon->name(),
129 129
                 'version' => $addon->version(),
130 130
             );
131
-            $addons[ $addon_json['name'] ] = $addon_json;
131
+            $addons[$addon_json['name']] = $addon_json;
132 132
         }
133 133
         $response_data['ee'] = array(
134 134
             'version'              => EEM_System_Status::instance()->get_ee_version(),
Please login to merge, or discard this patch.
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -24,122 +24,122 @@
 block discarded – undo
24 24
  */
25 25
 class Meta extends Base
26 26
 {
27
-    /**
28
-     * @param WP_REST_Request $request
29
-     * @param string           $version
30
-     * @return array|WP_REST_Response
31
-     */
32
-    public static function handleRequestModelsMeta(WP_REST_Request $request, $version)
33
-    {
34
-        $controller = new Meta();
35
-        try {
36
-            $controller->setRequestedVersion($version);
37
-            return $controller->sendResponse($controller->getModelsMetadataEntity());
38
-        } catch (Exception $e) {
39
-            return $controller->sendResponse($e);
40
-        }
41
-    }
27
+	/**
28
+	 * @param WP_REST_Request $request
29
+	 * @param string           $version
30
+	 * @return array|WP_REST_Response
31
+	 */
32
+	public static function handleRequestModelsMeta(WP_REST_Request $request, $version)
33
+	{
34
+		$controller = new Meta();
35
+		try {
36
+			$controller->setRequestedVersion($version);
37
+			return $controller->sendResponse($controller->getModelsMetadataEntity());
38
+		} catch (Exception $e) {
39
+			return $controller->sendResponse($e);
40
+		}
41
+	}
42 42
 
43 43
 
44
-    /*
44
+	/*
45 45
      * Gets the model metadata resource entity
46 46
      * @return array for JSON response, describing all the models available in teh requested version
47 47
      */
48
-    protected function getModelsMetadataEntity()
49
-    {
50
-        $response = array();
51
-        foreach ($this->getModelVersionInfo()->modelsForRequestedVersion() as $model_name => $model_classname) {
52
-            $model = $this->getModelVersionInfo()->loadModel($model_name);
53
-            $fields_json = array();
54
-            foreach ($this->getModelVersionInfo()->fieldsOnModelInThisVersion($model) as $field_name => $field_obj) {
55
-                if ($this->getModelVersionInfo()->fieldIsIgnored($field_obj)) {
56
-                    continue;
57
-                }
58
-                if ($field_obj instanceof EE_Boolean_Field) {
59
-                    $datatype = 'Boolean';
60
-                } elseif ($field_obj->get_wpdb_data_type() == '%d') {
61
-                    $datatype = 'Number';
62
-                } elseif ($field_name instanceof EE_Serialized_Text_Field) {
63
-                    $datatype = 'Object';
64
-                } else {
65
-                    $datatype = 'String';
66
-                }
67
-                $default_value = ModelDataTranslator::prepareFieldValueForJson(
68
-                    $field_obj,
69
-                    $field_obj->get_default_value(),
70
-                    $this->getModelVersionInfo()->requestedVersion()
71
-                );
72
-                $field_json = array(
73
-                    'name'                => $field_name,
74
-                    'nicename'            => wp_specialchars_decode($field_obj->get_nicename(), ENT_QUOTES),
75
-                    'has_rendered_format' => $this->getModelVersionInfo()->fieldHasRenderedFormat($field_obj),
76
-                    'has_pretty_format'   => $this->getModelVersionInfo()->fieldHasPrettyFormat($field_obj),
77
-                    'type'                => str_replace('EE_', '', get_class($field_obj)),
78
-                    'datatype'            => $datatype,
79
-                    'nullable'            => $field_obj->is_nullable(),
80
-                    'default'             => $default_value,
81
-                    'table_alias'         => $field_obj->get_table_alias(),
82
-                    'table_column'        => $field_obj->get_table_column(),
83
-                );
84
-                $fields_json[ $field_json['name'] ] = $field_json;
85
-            }
86
-            $fields_json = array_merge(
87
-                $fields_json,
88
-                $this->getModelVersionInfo()->extraResourcePropertiesForModel($model)
89
-            );
90
-            $response[ $model_name ]['fields'] = apply_filters(
91
-                'FHEE__Meta__handle_request_models_meta__fields',
92
-                $fields_json,
93
-                $model
94
-            );
95
-            $relations_json = array();
96
-            foreach ($model->relation_settings() as $relation_name => $relation_obj) {
97
-                $relation_json = array(
98
-                    'name'   => $relation_name,
99
-                    'type'   => str_replace('EE_', '', get_class($relation_obj)),
100
-                    'single' => $relation_obj instanceof EE_Belongs_To_Relation,
101
-                );
102
-                $relations_json[ $relation_name ] = $relation_json;
103
-            }
104
-            $response[ $model_name ]['relations'] = apply_filters(
105
-                'FHEE__Meta__handle_request_models_meta__relations',
106
-                $relations_json,
107
-                $model
108
-            );
109
-        }
110
-        return $response;
111
-    }
48
+	protected function getModelsMetadataEntity()
49
+	{
50
+		$response = array();
51
+		foreach ($this->getModelVersionInfo()->modelsForRequestedVersion() as $model_name => $model_classname) {
52
+			$model = $this->getModelVersionInfo()->loadModel($model_name);
53
+			$fields_json = array();
54
+			foreach ($this->getModelVersionInfo()->fieldsOnModelInThisVersion($model) as $field_name => $field_obj) {
55
+				if ($this->getModelVersionInfo()->fieldIsIgnored($field_obj)) {
56
+					continue;
57
+				}
58
+				if ($field_obj instanceof EE_Boolean_Field) {
59
+					$datatype = 'Boolean';
60
+				} elseif ($field_obj->get_wpdb_data_type() == '%d') {
61
+					$datatype = 'Number';
62
+				} elseif ($field_name instanceof EE_Serialized_Text_Field) {
63
+					$datatype = 'Object';
64
+				} else {
65
+					$datatype = 'String';
66
+				}
67
+				$default_value = ModelDataTranslator::prepareFieldValueForJson(
68
+					$field_obj,
69
+					$field_obj->get_default_value(),
70
+					$this->getModelVersionInfo()->requestedVersion()
71
+				);
72
+				$field_json = array(
73
+					'name'                => $field_name,
74
+					'nicename'            => wp_specialchars_decode($field_obj->get_nicename(), ENT_QUOTES),
75
+					'has_rendered_format' => $this->getModelVersionInfo()->fieldHasRenderedFormat($field_obj),
76
+					'has_pretty_format'   => $this->getModelVersionInfo()->fieldHasPrettyFormat($field_obj),
77
+					'type'                => str_replace('EE_', '', get_class($field_obj)),
78
+					'datatype'            => $datatype,
79
+					'nullable'            => $field_obj->is_nullable(),
80
+					'default'             => $default_value,
81
+					'table_alias'         => $field_obj->get_table_alias(),
82
+					'table_column'        => $field_obj->get_table_column(),
83
+				);
84
+				$fields_json[ $field_json['name'] ] = $field_json;
85
+			}
86
+			$fields_json = array_merge(
87
+				$fields_json,
88
+				$this->getModelVersionInfo()->extraResourcePropertiesForModel($model)
89
+			);
90
+			$response[ $model_name ]['fields'] = apply_filters(
91
+				'FHEE__Meta__handle_request_models_meta__fields',
92
+				$fields_json,
93
+				$model
94
+			);
95
+			$relations_json = array();
96
+			foreach ($model->relation_settings() as $relation_name => $relation_obj) {
97
+				$relation_json = array(
98
+					'name'   => $relation_name,
99
+					'type'   => str_replace('EE_', '', get_class($relation_obj)),
100
+					'single' => $relation_obj instanceof EE_Belongs_To_Relation,
101
+				);
102
+				$relations_json[ $relation_name ] = $relation_json;
103
+			}
104
+			$response[ $model_name ]['relations'] = apply_filters(
105
+				'FHEE__Meta__handle_request_models_meta__relations',
106
+				$relations_json,
107
+				$model
108
+			);
109
+		}
110
+		return $response;
111
+	}
112 112
 
113 113
 
114
-    /**
115
-     * Adds EE metadata to the index
116
-     *
117
-     * @param WP_REST_Response $rest_response_obj
118
-     * @return WP_REST_Response
119
-     */
120
-    public static function filterEeMetadataIntoIndex(WP_REST_Response $rest_response_obj)
121
-    {
122
-        $response_data = $rest_response_obj->get_data();
123
-        $addons = array();
124
-        foreach (EE_Registry::instance()->addons as $addon) {
125
-            $addon_json = array(
126
-                'name'    => $addon->name(),
127
-                'version' => $addon->version(),
128
-            );
129
-            $addons[ $addon_json['name'] ] = $addon_json;
130
-        }
131
-        $response_data['ee'] = array(
132
-            'version'              => EEM_System_Status::instance()->get_ee_version(),
133
-            // @codingStandardsIgnoreStart
134
-            'documentation_url'    => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API',
135
-            // @codingStandardsIgnoreEnd
136
-            'addons'               => $addons,
137
-            'maintenance_mode'     => EE_Maintenance_Mode::instance()->real_level(),
138
-            'served_core_versions' => array_keys(EED_Core_Rest_Api::versions_served()),
139
-        );
140
-        $rest_response_obj->set_data($response_data);
141
-        return $rest_response_obj;
142
-    }
114
+	/**
115
+	 * Adds EE metadata to the index
116
+	 *
117
+	 * @param WP_REST_Response $rest_response_obj
118
+	 * @return WP_REST_Response
119
+	 */
120
+	public static function filterEeMetadataIntoIndex(WP_REST_Response $rest_response_obj)
121
+	{
122
+		$response_data = $rest_response_obj->get_data();
123
+		$addons = array();
124
+		foreach (EE_Registry::instance()->addons as $addon) {
125
+			$addon_json = array(
126
+				'name'    => $addon->name(),
127
+				'version' => $addon->version(),
128
+			);
129
+			$addons[ $addon_json['name'] ] = $addon_json;
130
+		}
131
+		$response_data['ee'] = array(
132
+			'version'              => EEM_System_Status::instance()->get_ee_version(),
133
+			// @codingStandardsIgnoreStart
134
+			'documentation_url'    => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API',
135
+			// @codingStandardsIgnoreEnd
136
+			'addons'               => $addons,
137
+			'maintenance_mode'     => EE_Maintenance_Mode::instance()->real_level(),
138
+			'served_core_versions' => array_keys(EED_Core_Rest_Api::versions_served()),
139
+		);
140
+		$rest_response_obj->set_data($response_data);
141
+		return $rest_response_obj;
142
+	}
143 143
 }
144 144
 
145 145
 
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/PriceConnectionResolver.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
81 81
          */
82 82
         $input_fields = [];
83
-        if (! empty($this->args['where'])) {
83
+        if ( ! empty($this->args['where'])) {
84 84
             $input_fields = $this->sanitizeInputFields($this->args['where']);
85 85
 
86 86
             // Use the proper operator.
87
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
87
+            if ( ! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
88 88
                 $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
89 89
             }
90
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
90
+            if ( ! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
91 91
                 $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
92 92
             }
93
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
93
+            if ( ! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
94 94
                 $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
95 95
             }
96
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
96
+            if ( ! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
97 97
                 $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
98 98
             }
99 99
             // if event ID is passed but not a ticket ID
100
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
100
+            if ( ! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
101 101
                 $event_id = $input_fields['Event.EVT_ID'];
102 102
                 // Ensure that this doesn't go to the query.
103 103
                 // After all there is no DB relation between event and price
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         /**
133 133
          * Merge the input_fields with the default query_args
134 134
          */
135
-        if (! empty($input_fields)) {
135
+        if ( ! empty($input_fields)) {
136 136
             $where_params = array_merge($where_params, $input_fields);
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $default_prices_params = [];
142 142
 
143 143
         // If default ticket prices should be included.
144
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
144
+        if ( ! empty($this->args['where']['includeDefaultTicketsPrices'])) {
145 145
             $default_ticket_ids = EEM_Ticket::instance()->get_col([
146 146
                 [
147 147
                     'TKT_is_default' => 1,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             ]);
151 151
 
152 152
             // if we have default tickets
153
-            if (! empty($default_ticket_ids)) {
153
+            if ( ! empty($default_ticket_ids)) {
154 154
                 $default_prices_params['OR'] = [
155 155
                     'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
156 156
                 ];
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         // If default prices should be included.
161
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
161
+        if ( ! empty($this->args['where']['includeDefaultPrices'])) {
162 162
             $default_prices_params['AND'] = [
163 163
                 'PRC_deleted'    => 0,
164 164
                 'PRC_is_default' => 1,
165 165
             ];
166 166
         }
167 167
 
168
-        if (! empty($default_prices_params)) {
168
+        if ( ! empty($default_prices_params)) {
169 169
             if (empty($where_params)) {
170 170
                 $where_params['OR'] = $default_prices_params;
171 171
             } else {
Please login to merge, or discard this patch.
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -17,219 +17,219 @@
 block discarded – undo
17 17
  */
18 18
 class PriceConnectionResolver extends AbstractConnectionResolver
19 19
 {
20
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
-    public function get_loader_name(): string
22
-    {
23
-        return 'espresso_price';
24
-    }
25
-
26
-    /**
27
-     * @return EEM_Price
28
-     * @throws EE_Error
29
-     * @throws InvalidArgumentException
30
-     * @throws InvalidDataTypeException
31
-     * @throws InvalidInterfaceException
32
-     * @throws ReflectionException
33
-     */
34
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
35
-    public function get_query(): EEM_Price
36
-    {
37
-        return EEM_Price::instance();
38
-    }
39
-
40
-
41
-    /**
42
-     * Return an array of item IDs from the query
43
-     *
44
-     * @return array
45
-     */
46
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
-    public function get_ids(): array
48
-    {
49
-        $results = $this->query->get_col($this->query_args);
50
-
51
-        return ! empty($results) ? $results : [];
52
-    }
53
-
54
-
55
-    /**
56
-     * Here, we map the args from the input, then we make sure that we're only querying
57
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
58
-     * handle batch resolution of the posts.
59
-     *
60
-     * @return array
61
-     * @throws EE_Error
62
-     * @throws InvalidArgumentException
63
-     * @throws ReflectionException
64
-     * @throws InvalidDataTypeException
65
-     * @throws InvalidInterfaceException
66
-     */
67
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
-    public function get_query_args(): array
69
-    {
70
-        $where_params = [];
71
-        $query_args   = [];
72
-
73
-        $query_args['limit'] = $this->getLimit();
74
-
75
-        // Avoid multiple entries by join.
76
-        $query_args['group_by'] = 'PRC_ID';
77
-
78
-        $query_args['default_where_conditions'] = 'minimum';
79
-
80
-        /**
81
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
82
-         */
83
-        $input_fields = [];
84
-        if (! empty($this->args['where'])) {
85
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
86
-
87
-            // Use the proper operator.
88
-            if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
89
-                $input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
90
-            }
91
-            if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
92
-                $input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
93
-            }
94
-            if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
95
-                $input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
96
-            }
97
-            if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
98
-                $input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
99
-            }
100
-            // if event ID is passed but not a ticket ID
101
-            if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
102
-                $event_id = $input_fields['Event.EVT_ID'];
103
-                // Ensure that this doesn't go to the query.
104
-                // After all there is no DB relation between event and price
105
-                unset($input_fields['Event.EVT_ID']);
106
-                // get all the datetimeIds of the event
107
-                $event_datetime_ids = EEM_Datetime::instance()->get_col([
108
-                    [
109
-                        'EVT_ID'      => $event_id,
110
-                    ],
111
-                    'default_where_conditions' => 'minimum'
112
-                ]);
113
-                // get all the related ticket Ids
114
-                $ticket_ids = EEM_Ticket::instance()->get_col([
115
-                    [
116
-                        'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
117
-                    ],
118
-                    'default_where_conditions' => 'minimum'
119
-                ]);
120
-
121
-                // add tickets relation to the query
122
-                $input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
123
-            }
124
-        }
125
-
126
-        /**
127
-         * Determine where we're at in the Graph and adjust the query context appropriately.
128
-         */
129
-        if ($this->source instanceof EE_Ticket) {
130
-            $where_params['Ticket.TKT_ID'] = $this->source->ID();
131
-        }
132
-
133
-        /**
134
-         * Merge the input_fields with the default query_args
135
-         */
136
-        if (! empty($input_fields)) {
137
-            $where_params = array_merge($where_params, $input_fields);
138
-        }
139
-
140
-        [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
141
-
142
-        $default_prices_params = [];
143
-
144
-        // If default ticket prices should be included.
145
-        if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
146
-            $default_ticket_ids = EEM_Ticket::instance()->get_col([
147
-                [
148
-                    'TKT_is_default' => 1,
149
-                ],
150
-                'default_where_conditions' => 'minimum'
151
-            ]);
152
-
153
-            // if we have default tickets
154
-            if (! empty($default_ticket_ids)) {
155
-                $default_prices_params['OR'] = [
156
-                    'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
157
-                ];
158
-            }
159
-        }
160
-
161
-        // If default prices should be included.
162
-        if (! empty($this->args['where']['includeDefaultPrices'])) {
163
-            $default_prices_params['AND'] = [
164
-                'PRC_deleted'    => 0,
165
-                'PRC_is_default' => 1,
166
-            ];
167
-        }
168
-
169
-        if (! empty($default_prices_params)) {
170
-            if (empty($where_params)) {
171
-                $where_params['OR'] = $default_prices_params;
172
-            } else {
173
-                $where_params = [
174
-                    'OR' => [
175
-                        'OR'  => $default_prices_params,
176
-                        'AND' => $where_params,
177
-                    ],
178
-                ];
179
-            }
180
-        }
181
-
182
-        $where_params = apply_filters(
183
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
184
-            $where_params,
185
-            $this->source,
186
-            $this->args
187
-        );
188
-
189
-        $query_args[] = $where_params;
190
-
191
-        /**
192
-         * Return the $query_args
193
-         */
194
-        return apply_filters(
195
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
196
-            $query_args,
197
-            $this->source,
198
-            $this->args
199
-        );
200
-    }
201
-
202
-
203
-    /**
204
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
205
-     * friendly keys.
206
-     *
207
-     * @param array $where_args
208
-     * @return array
209
-     */
210
-    public function sanitizeInputFields(array $where_args): array
211
-    {
212
-        $arg_mapping = [
213
-            'in'              => 'PRC_ID',
214
-            'idIn'            => 'PRC_ID',
215
-            'isDefault'       => 'PRC_is_default',
216
-            'event'           => 'Event.EVT_ID',
217
-            'eventId'         => 'Event.EVT_ID', // priority.
218
-            'ticket'          => 'Ticket.TKT_ID',
219
-            'ticketIn'        => 'Ticket.TKT_ID',
220
-            'ticketIdIn'      => 'Ticket.TKT_ID',
221
-            'ticketId'        => 'Ticket.TKT_ID', // priority.
222
-            'priceType'       => 'Price_Type.PRT_ID',
223
-            'priceTypeIn'     => 'Price_Type.PRT_ID',
224
-            'priceTypeIdIn'   => 'Price_Type.PRT_ID',
225
-            'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
226
-            'priceBaseType'   => 'Price_Type.PBT_ID',
227
-            'priceBaseTypeIn' => 'Price_Type.PBT_ID',
228
-        ];
229
-        return $this->sanitizeWhereArgsForInputFields(
230
-            $where_args,
231
-            $arg_mapping,
232
-            ['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
233
-        );
234
-    }
20
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
21
+	public function get_loader_name(): string
22
+	{
23
+		return 'espresso_price';
24
+	}
25
+
26
+	/**
27
+	 * @return EEM_Price
28
+	 * @throws EE_Error
29
+	 * @throws InvalidArgumentException
30
+	 * @throws InvalidDataTypeException
31
+	 * @throws InvalidInterfaceException
32
+	 * @throws ReflectionException
33
+	 */
34
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
35
+	public function get_query(): EEM_Price
36
+	{
37
+		return EEM_Price::instance();
38
+	}
39
+
40
+
41
+	/**
42
+	 * Return an array of item IDs from the query
43
+	 *
44
+	 * @return array
45
+	 */
46
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
+	public function get_ids(): array
48
+	{
49
+		$results = $this->query->get_col($this->query_args);
50
+
51
+		return ! empty($results) ? $results : [];
52
+	}
53
+
54
+
55
+	/**
56
+	 * Here, we map the args from the input, then we make sure that we're only querying
57
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
58
+	 * handle batch resolution of the posts.
59
+	 *
60
+	 * @return array
61
+	 * @throws EE_Error
62
+	 * @throws InvalidArgumentException
63
+	 * @throws ReflectionException
64
+	 * @throws InvalidDataTypeException
65
+	 * @throws InvalidInterfaceException
66
+	 */
67
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
+	public function get_query_args(): array
69
+	{
70
+		$where_params = [];
71
+		$query_args   = [];
72
+
73
+		$query_args['limit'] = $this->getLimit();
74
+
75
+		// Avoid multiple entries by join.
76
+		$query_args['group_by'] = 'PRC_ID';
77
+
78
+		$query_args['default_where_conditions'] = 'minimum';
79
+
80
+		/**
81
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
82
+		 */
83
+		$input_fields = [];
84
+		if (! empty($this->args['where'])) {
85
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
86
+
87
+			// Use the proper operator.
88
+			if (! empty($input_fields['PRC_ID']) && is_array($input_fields['PRC_ID'])) {
89
+				$input_fields['PRC_ID'] = ['in', $input_fields['PRC_ID']];
90
+			}
91
+			if (! empty($input_fields['Ticket.TKT_ID']) && is_array($input_fields['Ticket.TKT_ID'])) {
92
+				$input_fields['Ticket.TKT_ID'] = ['in', $input_fields['Ticket.TKT_ID']];
93
+			}
94
+			if (! empty($input_fields['Price_Type.PBT_ID']) && is_array($input_fields['Price_Type.PBT_ID'])) {
95
+				$input_fields['Price_Type.PBT_ID'] = ['in', $input_fields['Price_Type.PBT_ID']];
96
+			}
97
+			if (! empty($input_fields['Price_Type.PRT_ID']) && is_array($input_fields['Price_Type.PRT_ID'])) {
98
+				$input_fields['Price_Type.PRT_ID'] = ['in', $input_fields['Price_Type.PRT_ID']];
99
+			}
100
+			// if event ID is passed but not a ticket ID
101
+			if (! isset($input_fields['Ticket.TKT_ID']) && isset($input_fields['Event.EVT_ID'])) {
102
+				$event_id = $input_fields['Event.EVT_ID'];
103
+				// Ensure that this doesn't go to the query.
104
+				// After all there is no DB relation between event and price
105
+				unset($input_fields['Event.EVT_ID']);
106
+				// get all the datetimeIds of the event
107
+				$event_datetime_ids = EEM_Datetime::instance()->get_col([
108
+					[
109
+						'EVT_ID'      => $event_id,
110
+					],
111
+					'default_where_conditions' => 'minimum'
112
+				]);
113
+				// get all the related ticket Ids
114
+				$ticket_ids = EEM_Ticket::instance()->get_col([
115
+					[
116
+						'Datetime.DTT_ID' => ['IN', $event_datetime_ids],
117
+					],
118
+					'default_where_conditions' => 'minimum'
119
+				]);
120
+
121
+				// add tickets relation to the query
122
+				$input_fields['Ticket.TKT_ID'] = ['IN', $ticket_ids];
123
+			}
124
+		}
125
+
126
+		/**
127
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
128
+		 */
129
+		if ($this->source instanceof EE_Ticket) {
130
+			$where_params['Ticket.TKT_ID'] = $this->source->ID();
131
+		}
132
+
133
+		/**
134
+		 * Merge the input_fields with the default query_args
135
+		 */
136
+		if (! empty($input_fields)) {
137
+			$where_params = array_merge($where_params, $input_fields);
138
+		}
139
+
140
+		[$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'PRC_ID');
141
+
142
+		$default_prices_params = [];
143
+
144
+		// If default ticket prices should be included.
145
+		if (! empty($this->args['where']['includeDefaultTicketsPrices'])) {
146
+			$default_ticket_ids = EEM_Ticket::instance()->get_col([
147
+				[
148
+					'TKT_is_default' => 1,
149
+				],
150
+				'default_where_conditions' => 'minimum'
151
+			]);
152
+
153
+			// if we have default tickets
154
+			if (! empty($default_ticket_ids)) {
155
+				$default_prices_params['OR'] = [
156
+					'Ticket.TKT_ID' => ['IN', $default_ticket_ids],
157
+				];
158
+			}
159
+		}
160
+
161
+		// If default prices should be included.
162
+		if (! empty($this->args['where']['includeDefaultPrices'])) {
163
+			$default_prices_params['AND'] = [
164
+				'PRC_deleted'    => 0,
165
+				'PRC_is_default' => 1,
166
+			];
167
+		}
168
+
169
+		if (! empty($default_prices_params)) {
170
+			if (empty($where_params)) {
171
+				$where_params['OR'] = $default_prices_params;
172
+			} else {
173
+				$where_params = [
174
+					'OR' => [
175
+						'OR'  => $default_prices_params,
176
+						'AND' => $where_params,
177
+					],
178
+				];
179
+			}
180
+		}
181
+
182
+		$where_params = apply_filters(
183
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_where_params',
184
+			$where_params,
185
+			$this->source,
186
+			$this->args
187
+		);
188
+
189
+		$query_args[] = $where_params;
190
+
191
+		/**
192
+		 * Return the $query_args
193
+		 */
194
+		return apply_filters(
195
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__price_query_args',
196
+			$query_args,
197
+			$this->source,
198
+			$this->args
199
+		);
200
+	}
201
+
202
+
203
+	/**
204
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
205
+	 * friendly keys.
206
+	 *
207
+	 * @param array $where_args
208
+	 * @return array
209
+	 */
210
+	public function sanitizeInputFields(array $where_args): array
211
+	{
212
+		$arg_mapping = [
213
+			'in'              => 'PRC_ID',
214
+			'idIn'            => 'PRC_ID',
215
+			'isDefault'       => 'PRC_is_default',
216
+			'event'           => 'Event.EVT_ID',
217
+			'eventId'         => 'Event.EVT_ID', // priority.
218
+			'ticket'          => 'Ticket.TKT_ID',
219
+			'ticketIn'        => 'Ticket.TKT_ID',
220
+			'ticketIdIn'      => 'Ticket.TKT_ID',
221
+			'ticketId'        => 'Ticket.TKT_ID', // priority.
222
+			'priceType'       => 'Price_Type.PRT_ID',
223
+			'priceTypeIn'     => 'Price_Type.PRT_ID',
224
+			'priceTypeIdIn'   => 'Price_Type.PRT_ID',
225
+			'priceTypeId'     => 'Price_Type.PRT_ID', // priority.
226
+			'priceBaseType'   => 'Price_Type.PBT_ID',
227
+			'priceBaseTypeIn' => 'Price_Type.PBT_ID',
228
+		];
229
+		return $this->sanitizeWhereArgsForInputFields(
230
+			$where_args,
231
+			$arg_mapping,
232
+			['in', 'event', 'ticket', 'ticketIn', 'priceType', 'priceTypeIn']
233
+		);
234
+	}
235 235
 }
Please login to merge, or discard this patch.
domain/services/graphql/connection_resolvers/TicketConnectionResolver.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
          * Collect the input_fields and sanitize them to prepare them for sending to the Query
79 79
          */
80 80
         $input_fields = [];
81
-        if (! empty($this->args['where'])) {
81
+        if ( ! empty($this->args['where'])) {
82 82
             $input_fields = $this->sanitizeInputFields($this->args['where']);
83 83
 
84 84
             // Use the proper operator.
85
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
85
+            if ( ! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
86 86
                 $input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
87 87
             }
88
-            if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
88
+            if ( ! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
89 89
                 $input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
90 90
             }
91 91
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         /**
101 101
          * Merge the input_fields with the default query_args
102 102
          */
103
-        if (! empty($input_fields)) {
103
+        if ( ! empty($input_fields)) {
104 104
             $where_params = array_merge($where_params, $input_fields);
105 105
         }
106 106
 
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 
109 109
         $search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
110 110
 
111
-        if (! empty($search)) {
111
+        if ( ! empty($search)) {
112 112
             // use OR operator to search in any of the fields
113 113
             $where_params['OR'] = array(
114
-                'TKT_name'        => array('LIKE', '%' . $search . '%'),
115
-                'TKT_description' => array('LIKE', '%' . $search . '%'),
114
+                'TKT_name'        => array('LIKE', '%'.$search.'%'),
115
+                'TKT_description' => array('LIKE', '%'.$search.'%'),
116 116
             );
117 117
         }
118 118
 
119 119
         // If default tickets should be included.
120
-        if (! empty($this->args['where']['includeDefaultTickets'])) {
120
+        if ( ! empty($this->args['where']['includeDefaultTickets'])) {
121 121
             /**
122 122
              * We need to get each ticket that
123 123
              * - satisfies $where_params above
Please login to merge, or discard this patch.
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -15,178 +15,178 @@
 block discarded – undo
15 15
  */
16 16
 class TicketConnectionResolver extends AbstractConnectionResolver
17 17
 {
18
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
-    public function get_loader_name(): string
20
-    {
21
-        return 'espresso_ticket';
22
-    }
23
-
24
-    /**
25
-     * @return EEM_Ticket
26
-     * @throws EE_Error
27
-     * @throws InvalidArgumentException
28
-     * @throws InvalidDataTypeException
29
-     * @throws InvalidInterfaceException
30
-     * @throws ReflectionException
31
-     */
32
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
33
-    public function get_query(): EEM_Ticket
34
-    {
35
-        return EEM_Ticket::instance();
36
-    }
37
-
38
-
39
-    /**
40
-     * Return an array of item IDs from the query
41
-     *
42
-     * @return array
43
-     */
44
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
-    public function get_ids(): array
46
-    {
47
-        $results = $this->query->get_col($this->query_args);
48
-
49
-        return ! empty($results) ? $results : [];
50
-    }
51
-
52
-
53
-    /**
54
-     * Here, we map the args from the input, then we make sure that we're only querying
55
-     * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
56
-     * handle batch resolution of the posts.
57
-     *
58
-     * @return array
59
-     * @throws EE_Error
60
-     * @throws InvalidArgumentException
61
-     * @throws ReflectionException
62
-     * @throws InvalidDataTypeException
63
-     * @throws InvalidInterfaceException
64
-     */
65
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
66
-    public function get_query_args(): array
67
-    {
68
-        $where_params = ['TKT_deleted' => ['IN', [true, false]]];
69
-        $query_args   = [];
70
-
71
-        $query_args['limit'] = $this->getLimit();
72
-
73
-        // Avoid multiple entries by join.
74
-        $query_args['group_by'] = 'TKT_ID';
75
-
76
-        $query_args['default_where_conditions'] = 'minimum';
77
-
78
-        /**
79
-         * Collect the input_fields and sanitize them to prepare them for sending to the Query
80
-         */
81
-        $input_fields = [];
82
-        if (! empty($this->args['where'])) {
83
-            $input_fields = $this->sanitizeInputFields($this->args['where']);
84
-
85
-            // Use the proper operator.
86
-            if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
87
-                $input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
88
-            }
89
-            if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
90
-                $input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
91
-            }
92
-        }
93
-
94
-        /**
95
-         * Determine where we're at in the Graph and adjust the query context appropriately.
96
-         */
97
-        if ($this->source instanceof EE_Datetime) {
98
-            $where_params['Datetime.DTT_ID'] = $this->source->ID();
99
-        }
100
-
101
-        /**
102
-         * Merge the input_fields with the default query_args
103
-         */
104
-        if (! empty($input_fields)) {
105
-            $where_params = array_merge($where_params, $input_fields);
106
-        }
107
-
108
-        [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
109
-
110
-        $search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
111
-
112
-        if (! empty($search)) {
113
-            // use OR operator to search in any of the fields
114
-            $where_params['OR'] = array(
115
-                'TKT_name'        => array('LIKE', '%' . $search . '%'),
116
-                'TKT_description' => array('LIKE', '%' . $search . '%'),
117
-            );
118
-        }
119
-
120
-        // If default tickets should be included.
121
-        if (! empty($this->args['where']['includeDefaultTickets'])) {
122
-            /**
123
-             * We need to get each ticket that
124
-             * - satisfies $where_params above
125
-             * OR
126
-             * - it's a default ticket
127
-             */
128
-            $where_params = [
129
-                'OR' => [
130
-                    // use extra OR instead of AND to avoid it getting overridden
131
-                    'OR' => [
132
-                        'AND' => [
133
-                            'TKT_deleted'    => ['IN', [true, false]],
134
-                            'TKT_is_default' => 1,
135
-                        ]
136
-                    ],
137
-                    'AND' => $where_params,
138
-                ],
139
-            ];
140
-        }
141
-
142
-        $where_params = apply_filters(
143
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params',
144
-            $where_params,
145
-            $this->source,
146
-            $this->args
147
-        );
148
-
149
-        $query_args[] = $where_params;
150
-
151
-        /**
152
-         * Return the $query_args
153
-         */
154
-        return apply_filters(
155
-            'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args',
156
-            $query_args,
157
-            $this->source,
158
-            $this->args
159
-        );
160
-    }
161
-
162
-
163
-    /**
164
-     * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
165
-     * friendly keys.
166
-     *
167
-     * @param array $where_args
168
-     * @return array
169
-     */
170
-    public function sanitizeInputFields(array $where_args): array
171
-    {
172
-        $arg_mapping = [
173
-            'event'        => 'Datetime.EVT_ID',
174
-            'eventIn'      => 'Datetime.EVT_ID',
175
-            'eventIdIn'    => 'Datetime.EVT_ID',
176
-            'eventId'      => 'Datetime.EVT_ID', // priority.
177
-            'datetime'     => 'Datetime.DTT_ID',
178
-            'datetimeIn'   => 'Datetime.DTT_ID',
179
-            'datetimeIdIn' => 'Datetime.DTT_ID',
180
-            'datetimeId'   => 'Datetime.DTT_ID', // priority.
181
-            'isDefault'    => 'TKT_is_default',
182
-            'isRequired'   => 'TKT_required',
183
-            'isTaxable'    => 'TKT_taxable',
184
-            'isTrashed'    => 'TKT_deleted',
185
-        ];
186
-        return $this->sanitizeWhereArgsForInputFields(
187
-            $where_args,
188
-            $arg_mapping,
189
-            ['datetime', 'datetimeIn', 'event', 'eventIn']
190
-        );
191
-    }
18
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
19
+	public function get_loader_name(): string
20
+	{
21
+		return 'espresso_ticket';
22
+	}
23
+
24
+	/**
25
+	 * @return EEM_Ticket
26
+	 * @throws EE_Error
27
+	 * @throws InvalidArgumentException
28
+	 * @throws InvalidDataTypeException
29
+	 * @throws InvalidInterfaceException
30
+	 * @throws ReflectionException
31
+	 */
32
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
33
+	public function get_query(): EEM_Ticket
34
+	{
35
+		return EEM_Ticket::instance();
36
+	}
37
+
38
+
39
+	/**
40
+	 * Return an array of item IDs from the query
41
+	 *
42
+	 * @return array
43
+	 */
44
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
+	public function get_ids(): array
46
+	{
47
+		$results = $this->query->get_col($this->query_args);
48
+
49
+		return ! empty($results) ? $results : [];
50
+	}
51
+
52
+
53
+	/**
54
+	 * Here, we map the args from the input, then we make sure that we're only querying
55
+	 * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers
56
+	 * handle batch resolution of the posts.
57
+	 *
58
+	 * @return array
59
+	 * @throws EE_Error
60
+	 * @throws InvalidArgumentException
61
+	 * @throws ReflectionException
62
+	 * @throws InvalidDataTypeException
63
+	 * @throws InvalidInterfaceException
64
+	 */
65
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
66
+	public function get_query_args(): array
67
+	{
68
+		$where_params = ['TKT_deleted' => ['IN', [true, false]]];
69
+		$query_args   = [];
70
+
71
+		$query_args['limit'] = $this->getLimit();
72
+
73
+		// Avoid multiple entries by join.
74
+		$query_args['group_by'] = 'TKT_ID';
75
+
76
+		$query_args['default_where_conditions'] = 'minimum';
77
+
78
+		/**
79
+		 * Collect the input_fields and sanitize them to prepare them for sending to the Query
80
+		 */
81
+		$input_fields = [];
82
+		if (! empty($this->args['where'])) {
83
+			$input_fields = $this->sanitizeInputFields($this->args['where']);
84
+
85
+			// Use the proper operator.
86
+			if (! empty($input_fields['Datetime.DTT_ID']) && is_array($input_fields['Datetime.DTT_ID'])) {
87
+				$input_fields['Datetime.DTT_ID'] = ['IN', $input_fields['Datetime.DTT_ID']];
88
+			}
89
+			if (! empty($input_fields['Datetime.EVT_ID']) && is_array($input_fields['Datetime.EVT_ID'])) {
90
+				$input_fields['Datetime.EVT_ID'] = ['IN', $input_fields['Datetime.EVT_ID']];
91
+			}
92
+		}
93
+
94
+		/**
95
+		 * Determine where we're at in the Graph and adjust the query context appropriately.
96
+		 */
97
+		if ($this->source instanceof EE_Datetime) {
98
+			$where_params['Datetime.DTT_ID'] = $this->source->ID();
99
+		}
100
+
101
+		/**
102
+		 * Merge the input_fields with the default query_args
103
+		 */
104
+		if (! empty($input_fields)) {
105
+			$where_params = array_merge($where_params, $input_fields);
106
+		}
107
+
108
+		[$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'TKT_ID');
109
+
110
+		$search = isset($this->args['where']) ? $this->getSearchKeywords($this->args['where']) : '';
111
+
112
+		if (! empty($search)) {
113
+			// use OR operator to search in any of the fields
114
+			$where_params['OR'] = array(
115
+				'TKT_name'        => array('LIKE', '%' . $search . '%'),
116
+				'TKT_description' => array('LIKE', '%' . $search . '%'),
117
+			);
118
+		}
119
+
120
+		// If default tickets should be included.
121
+		if (! empty($this->args['where']['includeDefaultTickets'])) {
122
+			/**
123
+			 * We need to get each ticket that
124
+			 * - satisfies $where_params above
125
+			 * OR
126
+			 * - it's a default ticket
127
+			 */
128
+			$where_params = [
129
+				'OR' => [
130
+					// use extra OR instead of AND to avoid it getting overridden
131
+					'OR' => [
132
+						'AND' => [
133
+							'TKT_deleted'    => ['IN', [true, false]],
134
+							'TKT_is_default' => 1,
135
+						]
136
+					],
137
+					'AND' => $where_params,
138
+				],
139
+			];
140
+		}
141
+
142
+		$where_params = apply_filters(
143
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_where_params',
144
+			$where_params,
145
+			$this->source,
146
+			$this->args
147
+		);
148
+
149
+		$query_args[] = $where_params;
150
+
151
+		/**
152
+		 * Return the $query_args
153
+		 */
154
+		return apply_filters(
155
+			'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__ticket_query_args',
156
+			$query_args,
157
+			$this->source,
158
+			$this->args
159
+		);
160
+	}
161
+
162
+
163
+	/**
164
+	 * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model
165
+	 * friendly keys.
166
+	 *
167
+	 * @param array $where_args
168
+	 * @return array
169
+	 */
170
+	public function sanitizeInputFields(array $where_args): array
171
+	{
172
+		$arg_mapping = [
173
+			'event'        => 'Datetime.EVT_ID',
174
+			'eventIn'      => 'Datetime.EVT_ID',
175
+			'eventIdIn'    => 'Datetime.EVT_ID',
176
+			'eventId'      => 'Datetime.EVT_ID', // priority.
177
+			'datetime'     => 'Datetime.DTT_ID',
178
+			'datetimeIn'   => 'Datetime.DTT_ID',
179
+			'datetimeIdIn' => 'Datetime.DTT_ID',
180
+			'datetimeId'   => 'Datetime.DTT_ID', // priority.
181
+			'isDefault'    => 'TKT_is_default',
182
+			'isRequired'   => 'TKT_required',
183
+			'isTaxable'    => 'TKT_taxable',
184
+			'isTrashed'    => 'TKT_deleted',
185
+		];
186
+		return $this->sanitizeWhereArgsForInputFields(
187
+			$where_args,
188
+			$arg_mapping,
189
+			['datetime', 'datetimeIn', 'event', 'eventIn']
190
+		);
191
+	}
192 192
 }
Please login to merge, or discard this patch.