Completed
Branch dependabot/composer/wp-graphql... (5a0e42)
by
unknown
18:09 queued 13:06
created
core/domain/services/custom_post_types/RewriteRules.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
38 38
             add_action(
39 39
                 'shutdown',
40
-                static function () {
40
+                static function() {
41 41
                     flush_rewrite_rules();
42 42
                     update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
43 43
                 }
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@
 block discarded – undo
12 12
  */
13 13
 class RewriteRules
14 14
 {
15
-    const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
15
+	const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
16 16
 
17 17
 
18
-    /**
19
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
20
-     *
21
-     * @return void
22
-     */
23
-    public function flush()
24
-    {
25
-        update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
26
-    }
18
+	/**
19
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
20
+	 *
21
+	 * @return void
22
+	 */
23
+	public function flush()
24
+	{
25
+		update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
31
-     *
32
-     * @return void
33
-     */
34
-    public function flushRewriteRules()
35
-    {
36
-        if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
37
-            add_action(
38
-                'shutdown',
39
-                static function () {
40
-                    flush_rewrite_rules();
41
-                    update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
42
-                }
43
-            );
44
-        }
45
-    }
29
+	/**
30
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function flushRewriteRules()
35
+	{
36
+		if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
37
+			add_action(
38
+				'shutdown',
39
+				static function () {
40
+					flush_rewrite_rules();
41
+					update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
42
+				}
43
+			);
44
+		}
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/services/orm/tree_traversal/BaseNode.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      */
69 69
     public function visit($model_objects_to_identify)
70 70
     {
71
-        if (! $this->isDiscovered()) {
71
+        if ( ! $this->isDiscovered()) {
72 72
             $this->discover();
73 73
         }
74 74
         if ($this->isComplete()) {
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -31,105 +31,105 @@
 block discarded – undo
31 31
  */
32 32
 abstract class BaseNode
33 33
 {
34
-    /**
35
-     * @var boolean
36
-     */
37
-    protected $complete;
34
+	/**
35
+	 * @var boolean
36
+	 */
37
+	protected $complete;
38 38
 
39 39
 
40
-    /**
41
-     * @var array of model names we don't want to traverse
42
-     */
43
-    protected $dont_traverse_models;
40
+	/**
41
+	 * @var array of model names we don't want to traverse
42
+	 */
43
+	protected $dont_traverse_models;
44 44
 
45
-    /**
46
-     * Whether this item has already been initialized
47
-     */
48
-    abstract protected function isDiscovered();
45
+	/**
46
+	 * Whether this item has already been initialized
47
+	 */
48
+	abstract protected function isDiscovered();
49 49
 
50
-    /**
51
-     * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling
52
-     * discover().
53
-     * @since 4.10.12.p
54
-     * @return boolean
55
-     */
56
-    abstract public function isComplete();
50
+	/**
51
+	 * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling
52
+	 * discover().
53
+	 * @since 4.10.12.p
54
+	 * @return boolean
55
+	 */
56
+	abstract public function isComplete();
57 57
 
58
-    /**
59
-     * Discovers what work needs to be done to complete traversing this node and its children.
60
-     * Note that this is separate from the constructor, so we can create child nodes without
61
-     * discovering them immediately.
62
-     * @since 4.10.12.p
63
-     * @return mixed
64
-     */
65
-    abstract protected function discover();
58
+	/**
59
+	 * Discovers what work needs to be done to complete traversing this node and its children.
60
+	 * Note that this is separate from the constructor, so we can create child nodes without
61
+	 * discovering them immediately.
62
+	 * @since 4.10.12.p
63
+	 * @return mixed
64
+	 */
65
+	abstract protected function discover();
66 66
 
67
-    /**
68
-     * Identifies model objects, up to the limit $model_objects_to_identify.
69
-     * @since 4.10.12.p
70
-     * @param int $model_objects_to_identify
71
-     * @return int units of work done
72
-     */
73
-    abstract protected function work($model_objects_to_identify);
67
+	/**
68
+	 * Identifies model objects, up to the limit $model_objects_to_identify.
69
+	 * @since 4.10.12.p
70
+	 * @param int $model_objects_to_identify
71
+	 * @return int units of work done
72
+	 */
73
+	abstract protected function work($model_objects_to_identify);
74 74
 
75
-    /**
76
-     * Shows the entity/relation node as an array.
77
-     * @since 4.10.12.p
78
-     * @return array
79
-     */
80
-    abstract public function toArray();
75
+	/**
76
+	 * Shows the entity/relation node as an array.
77
+	 * @since 4.10.12.p
78
+	 * @return array
79
+	 */
80
+	abstract public function toArray();
81 81
 
82
-    /**
83
-     * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work.
84
-     * Note: do not call when site is in maintenance mode level 2.
85
-     *
86
-     * @since 4.10.12.p
87
-     * @param $model_objects_to_identify
88
-     * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue
89
-     * where we left off.
90
-     */
91
-    public function visit($model_objects_to_identify)
92
-    {
93
-        if (! $this->isDiscovered()) {
94
-            $this->discover();
95
-        }
96
-        if ($this->isComplete()) {
97
-            return 0;
98
-        }
99
-        return $this->work($model_objects_to_identify);
100
-    }
82
+	/**
83
+	 * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work.
84
+	 * Note: do not call when site is in maintenance mode level 2.
85
+	 *
86
+	 * @since 4.10.12.p
87
+	 * @param $model_objects_to_identify
88
+	 * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue
89
+	 * where we left off.
90
+	 */
91
+	public function visit($model_objects_to_identify)
92
+	{
93
+		if (! $this->isDiscovered()) {
94
+			$this->discover();
95
+		}
96
+		if ($this->isComplete()) {
97
+			return 0;
98
+		}
99
+		return $this->work($model_objects_to_identify);
100
+	}
101 101
 
102
-    /**
103
-     * Gets the IDs of completely identified model objects that can be deleted.
104
-     * @since 4.10.12.p
105
-     * @return mixed
106
-     */
107
-    abstract public function getIds();
102
+	/**
103
+	 * Gets the IDs of completely identified model objects that can be deleted.
104
+	 * @since 4.10.12.p
105
+	 * @return mixed
106
+	 */
107
+	abstract public function getIds();
108 108
 
109
-    /**
110
-     * Make sure we encode whether its complete or not, but don't use such a long name.
111
-     * @since 4.10.12.p
112
-     * @return array
113
-     */
114
-    public function __sleep()
115
-    {
116
-        $this->c = $this->complete;
117
-        $this->dtm = $this->dont_traverse_models;
118
-        return [
119
-            'c',
120
-            'dtm'
121
-        ];
122
-    }
109
+	/**
110
+	 * Make sure we encode whether its complete or not, but don't use such a long name.
111
+	 * @since 4.10.12.p
112
+	 * @return array
113
+	 */
114
+	public function __sleep()
115
+	{
116
+		$this->c = $this->complete;
117
+		$this->dtm = $this->dont_traverse_models;
118
+		return [
119
+			'c',
120
+			'dtm'
121
+		];
122
+	}
123 123
 
124
-    /**
125
-     * Use the dynamic property to set the "complete" property.
126
-     * @since 4.10.12.p
127
-     */
128
-    public function __wakeup()
129
-    {
130
-        $this->complete = $this->c;
131
-        $this->dont_traverse_models = $this->dtm;
132
-    }
124
+	/**
125
+	 * Use the dynamic property to set the "complete" property.
126
+	 * @since 4.10.12.p
127
+	 */
128
+	public function __wakeup()
129
+	{
130
+		$this->complete = $this->c;
131
+		$this->dont_traverse_models = $this->dtm;
132
+	}
133 133
 }
134 134
 // End of file BaseNode.php
135 135
 // Location: EventEspresso\core\services\orm\tree_traversal/BaseNode.php
Please login to merge, or discard this patch.
core/db_classes/EE_Price.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@
 block discarded – undo
419 419
     {
420 420
         return ! $this->is_percent()
421 421
             ? $this->get_pretty('PRC_amount')
422
-            : $this->get('PRC_amount') . '%';
422
+            : $this->get('PRC_amount').'%';
423 423
     }
424 424
 
425 425
 
Please login to merge, or discard this patch.
Indentation   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -14,373 +14,373 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Price extends EE_Soft_Delete_Base_Class
16 16
 {
17
-    /**
18
-     * @param array  $props_n_values          incoming values
19
-     * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
20
-     *                                        used.)
21
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
-     *                                        date_format and the second value is the time format
23
-     * @return EE_Price
24
-     * @throws EE_Error
25
-     * @throws ReflectionException
26
-     */
27
-    public static function new_instance($props_n_values = [], $timezone = '', $date_formats = [])
28
-    {
29
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
31
-    }
32
-
33
-
34
-    /**
35
-     * @param array  $props_n_values  incoming values from the database
36
-     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
37
-     *                                the website will be used.
38
-     * @return EE_Price
39
-     * @throws EE_Error
40
-     * @throws ReflectionException
41
-     */
42
-    public static function new_instance_from_db($props_n_values = [], $timezone = '')
43
-    {
44
-        return new self($props_n_values, true, $timezone);
45
-    }
46
-
47
-
48
-    /**
49
-     * Set Price type ID
50
-     *
51
-     * @param int $PRT_ID
52
-     * @throws EE_Error
53
-     * @throws ReflectionException
54
-     */
55
-    public function set_type($PRT_ID = 0)
56
-    {
57
-        $this->set('PRT_ID', $PRT_ID);
58
-    }
59
-
60
-
61
-    /**
62
-     * Set Price Amount
63
-     *
64
-     * @param float $PRC_amount
65
-     * @throws EE_Error
66
-     * @throws ReflectionException
67
-     */
68
-    public function set_amount($PRC_amount = 0.00)
69
-    {
70
-        $this->set('PRC_amount', $PRC_amount);
71
-    }
72
-
73
-
74
-    /**
75
-     * Set Price Name
76
-     *
77
-     * @param string $PRC_name
78
-     * @throws EE_Error
79
-     * @throws ReflectionException
80
-     */
81
-    public function set_name($PRC_name = '')
82
-    {
83
-        $this->set('PRC_name', $PRC_name);
84
-    }
85
-
86
-
87
-    /**
88
-     * Set Price Description
89
-     *
90
-     * @param string $PRC_desc
91
-     * @throws EE_Error
92
-     * @throws ReflectionException
93
-     */
94
-    public function set_description($PRC_desc = '')
95
-    {
96
-        $this->Set('PRC_desc', $PRC_desc);
97
-    }
98
-
99
-
100
-    /**
101
-     * set is_default
102
-     *
103
-     * @param bool $PRC_is_default
104
-     * @throws EE_Error
105
-     * @throws ReflectionException
106
-     */
107
-    public function set_is_default($PRC_is_default = false)
108
-    {
109
-        $this->set('PRC_is_default', $PRC_is_default);
110
-    }
111
-
112
-
113
-    /**
114
-     * set deleted
115
-     *
116
-     * @param bool $PRC_deleted
117
-     * @throws EE_Error
118
-     * @throws ReflectionException
119
-     */
120
-    public function set_deleted($PRC_deleted = null)
121
-    {
122
-        $this->set('PRC_deleted', $PRC_deleted);
123
-    }
124
-
125
-
126
-    /**
127
-     * get Price type
128
-     *
129
-     * @return int
130
-     * @throws EE_Error
131
-     * @throws ReflectionException
132
-     */
133
-    public function type(): int
134
-    {
135
-        return (int) $this->get('PRT_ID');
136
-    }
137
-
138
-
139
-    /**
140
-     * get Price Amount
141
-     *
142
-     * @return float
143
-     * @throws EE_Error
144
-     * @throws ReflectionException
145
-     */
146
-    public function amount(): float
147
-    {
148
-        return (float) $this->get('PRC_amount');
149
-    }
150
-
151
-
152
-    /**
153
-     * get Price Name
154
-     *
155
-     * @return        string
156
-     * @throws EE_Error
157
-     * @throws ReflectionException
158
-     */
159
-    public function name()
160
-    {
161
-        return $this->get('PRC_name');
162
-    }
163
-
164
-
165
-    /**
166
-     * get Price description
167
-     *
168
-     * @return        string
169
-     * @throws EE_Error
170
-     * @throws ReflectionException
171
-     */
172
-    public function desc()
173
-    {
174
-        return $this->get('PRC_desc');
175
-    }
176
-
177
-
178
-    /**
179
-     * get overrides
180
-     *
181
-     * @return        int
182
-     * @throws EE_Error
183
-     * @throws ReflectionException
184
-     */
185
-    public function overrides()
186
-    {
187
-        return $this->get('PRC_overrides');
188
-    }
189
-
190
-
191
-    /**
192
-     * get order
193
-     *
194
-     * @return int
195
-     * @throws EE_Error
196
-     * @throws ReflectionException
197
-     */
198
-    public function order()
199
-    {
200
-        return $this->get('PRC_order');
201
-    }
202
-
203
-
204
-    /**
205
-     * get the author of the price
206
-     *
207
-     * @return int
208
-     * @throws EE_Error
209
-     * @throws ReflectionException
210
-     * @since 4.5.0
211
-     */
212
-    public function wp_user()
213
-    {
214
-        return $this->get('PRC_wp_user');
215
-    }
216
-
217
-
218
-    /**
219
-     * get is_default
220
-     *
221
-     * @return bool
222
-     * @throws EE_Error
223
-     * @throws ReflectionException
224
-     */
225
-    public function is_default()
226
-    {
227
-        return $this->get('PRC_is_default');
228
-    }
229
-
230
-
231
-    /**
232
-     * get deleted
233
-     *
234
-     * @return bool
235
-     * @throws EE_Error
236
-     * @throws ReflectionException
237
-     */
238
-    public function deleted()
239
-    {
240
-        return $this->get('PRC_deleted');
241
-    }
242
-
243
-
244
-    /**
245
-     * @return bool
246
-     * @throws EE_Error
247
-     * @throws ReflectionException
248
-     */
249
-    public function parent()
250
-    {
251
-        return $this->get('PRC_parent');
252
-    }
253
-
254
-
255
-    // some helper methods for getting info on the price_type for this price
256
-
257
-    /**
258
-     * @return EE_Price_Type|null
259
-     * @throws EE_Error
260
-     * @throws ReflectionException
261
-     */
262
-    public function type_obj(): ?EE_Price_Type
263
-    {
264
-        return $this->get_first_related('Price_Type');
265
-    }
266
-
267
-
268
-    /**
269
-     * @return int
270
-     * @throws EE_Error
271
-     * @throws ReflectionException
272
-     */
273
-    public function type_order(): int
274
-    {
275
-        $price_type = $this->type_obj();
276
-        return $price_type instanceof EE_Price_Type ? $price_type->order() : 0;
277
-    }
278
-
279
-
280
-    /**
281
-     * return whether the price is a base price or not
282
-     *
283
-     * @return bool
284
-     * @throws EE_Error
285
-     * @throws InvalidArgumentException
286
-     * @throws InvalidDataTypeException
287
-     * @throws InvalidInterfaceException
288
-     * @throws ReflectionException
289
-     */
290
-    public function is_base_price(): bool
291
-    {
292
-        $price_type = $this->type_obj();
293
-        return $price_type instanceof EE_Price_Type && $price_type->is_base_price();
294
-    }
295
-
296
-
297
-    /**
298
-     * Simply indicates whether this price increases or decreases the total
299
-     *
300
-     * @return bool true = discount, otherwise adds to the total
301
-     * @throws EE_Error
302
-     * @throws ReflectionException
303
-     */
304
-    public function is_discount(): bool
305
-    {
306
-        $price_type = $this->type_obj();
307
-        return $price_type instanceof EE_Price_Type && $price_type->is_discount();
308
-    }
309
-
310
-
311
-    /**
312
-     * whether the price is a percentage or not
313
-     *
314
-     * @return bool
315
-     * @throws EE_Error
316
-     * @throws InvalidArgumentException
317
-     * @throws InvalidDataTypeException
318
-     * @throws InvalidInterfaceException
319
-     * @throws ReflectionException
320
-     */
321
-    public function is_percent(): bool
322
-    {
323
-        $price_type = $this->type_obj();
324
-        return $price_type instanceof EE_Price_Type && $price_type->is_percent();
325
-    }
326
-
327
-
328
-    /**
329
-     * whether the price is a percentage or not
330
-     *
331
-     * @return bool
332
-     * @throws EE_Error
333
-     * @throws ReflectionException
334
-     */
335
-    public function is_surcharge(): bool
336
-    {
337
-        $price_type = $this->type_obj();
338
-        return $price_type instanceof EE_Price_Type && $price_type->is_surcharge();
339
-    }
340
-
341
-
342
-
343
-    /**
344
-     * whether the price is a percentage or not
345
-     *
346
-     * @return bool
347
-     * @throws EE_Error
348
-     * @throws ReflectionException
349
-     */
350
-    public function is_tax(): bool
351
-    {
352
-        $price_type = $this->type_obj();
353
-        return $price_type instanceof EE_Price_Type && $price_type->is_tax();
354
-    }
355
-
356
-
357
-    /**
358
-     * return pretty price dependant on whether its a dollar or percent.
359
-     *
360
-     * @return string
361
-     * @throws EE_Error
362
-     * @throws ReflectionException
363
-     * @since 4.4.0
364
-     */
365
-    public function pretty_price(): string
366
-    {
367
-        return ! $this->is_percent()
368
-            ? $this->get_pretty('PRC_amount')
369
-            : $this->get('PRC_amount') . '%';
370
-    }
371
-
372
-
373
-    /**
374
-     * @return mixed
375
-     * @throws EE_Error
376
-     * @throws ReflectionException
377
-     */
378
-    public function get_price_without_currency_symbol()
379
-    {
380
-        return str_replace(
381
-            EE_Registry::instance()->CFG->currency->sign,
382
-            '',
383
-            $this->get_pretty('PRC_amount')
384
-        );
385
-    }
17
+	/**
18
+	 * @param array  $props_n_values          incoming values
19
+	 * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
20
+	 *                                        used.)
21
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
+	 *                                        date_format and the second value is the time format
23
+	 * @return EE_Price
24
+	 * @throws EE_Error
25
+	 * @throws ReflectionException
26
+	 */
27
+	public static function new_instance($props_n_values = [], $timezone = '', $date_formats = [])
28
+	{
29
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @param array  $props_n_values  incoming values from the database
36
+	 * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
37
+	 *                                the website will be used.
38
+	 * @return EE_Price
39
+	 * @throws EE_Error
40
+	 * @throws ReflectionException
41
+	 */
42
+	public static function new_instance_from_db($props_n_values = [], $timezone = '')
43
+	{
44
+		return new self($props_n_values, true, $timezone);
45
+	}
46
+
47
+
48
+	/**
49
+	 * Set Price type ID
50
+	 *
51
+	 * @param int $PRT_ID
52
+	 * @throws EE_Error
53
+	 * @throws ReflectionException
54
+	 */
55
+	public function set_type($PRT_ID = 0)
56
+	{
57
+		$this->set('PRT_ID', $PRT_ID);
58
+	}
59
+
60
+
61
+	/**
62
+	 * Set Price Amount
63
+	 *
64
+	 * @param float $PRC_amount
65
+	 * @throws EE_Error
66
+	 * @throws ReflectionException
67
+	 */
68
+	public function set_amount($PRC_amount = 0.00)
69
+	{
70
+		$this->set('PRC_amount', $PRC_amount);
71
+	}
72
+
73
+
74
+	/**
75
+	 * Set Price Name
76
+	 *
77
+	 * @param string $PRC_name
78
+	 * @throws EE_Error
79
+	 * @throws ReflectionException
80
+	 */
81
+	public function set_name($PRC_name = '')
82
+	{
83
+		$this->set('PRC_name', $PRC_name);
84
+	}
85
+
86
+
87
+	/**
88
+	 * Set Price Description
89
+	 *
90
+	 * @param string $PRC_desc
91
+	 * @throws EE_Error
92
+	 * @throws ReflectionException
93
+	 */
94
+	public function set_description($PRC_desc = '')
95
+	{
96
+		$this->Set('PRC_desc', $PRC_desc);
97
+	}
98
+
99
+
100
+	/**
101
+	 * set is_default
102
+	 *
103
+	 * @param bool $PRC_is_default
104
+	 * @throws EE_Error
105
+	 * @throws ReflectionException
106
+	 */
107
+	public function set_is_default($PRC_is_default = false)
108
+	{
109
+		$this->set('PRC_is_default', $PRC_is_default);
110
+	}
111
+
112
+
113
+	/**
114
+	 * set deleted
115
+	 *
116
+	 * @param bool $PRC_deleted
117
+	 * @throws EE_Error
118
+	 * @throws ReflectionException
119
+	 */
120
+	public function set_deleted($PRC_deleted = null)
121
+	{
122
+		$this->set('PRC_deleted', $PRC_deleted);
123
+	}
124
+
125
+
126
+	/**
127
+	 * get Price type
128
+	 *
129
+	 * @return int
130
+	 * @throws EE_Error
131
+	 * @throws ReflectionException
132
+	 */
133
+	public function type(): int
134
+	{
135
+		return (int) $this->get('PRT_ID');
136
+	}
137
+
138
+
139
+	/**
140
+	 * get Price Amount
141
+	 *
142
+	 * @return float
143
+	 * @throws EE_Error
144
+	 * @throws ReflectionException
145
+	 */
146
+	public function amount(): float
147
+	{
148
+		return (float) $this->get('PRC_amount');
149
+	}
150
+
151
+
152
+	/**
153
+	 * get Price Name
154
+	 *
155
+	 * @return        string
156
+	 * @throws EE_Error
157
+	 * @throws ReflectionException
158
+	 */
159
+	public function name()
160
+	{
161
+		return $this->get('PRC_name');
162
+	}
163
+
164
+
165
+	/**
166
+	 * get Price description
167
+	 *
168
+	 * @return        string
169
+	 * @throws EE_Error
170
+	 * @throws ReflectionException
171
+	 */
172
+	public function desc()
173
+	{
174
+		return $this->get('PRC_desc');
175
+	}
176
+
177
+
178
+	/**
179
+	 * get overrides
180
+	 *
181
+	 * @return        int
182
+	 * @throws EE_Error
183
+	 * @throws ReflectionException
184
+	 */
185
+	public function overrides()
186
+	{
187
+		return $this->get('PRC_overrides');
188
+	}
189
+
190
+
191
+	/**
192
+	 * get order
193
+	 *
194
+	 * @return int
195
+	 * @throws EE_Error
196
+	 * @throws ReflectionException
197
+	 */
198
+	public function order()
199
+	{
200
+		return $this->get('PRC_order');
201
+	}
202
+
203
+
204
+	/**
205
+	 * get the author of the price
206
+	 *
207
+	 * @return int
208
+	 * @throws EE_Error
209
+	 * @throws ReflectionException
210
+	 * @since 4.5.0
211
+	 */
212
+	public function wp_user()
213
+	{
214
+		return $this->get('PRC_wp_user');
215
+	}
216
+
217
+
218
+	/**
219
+	 * get is_default
220
+	 *
221
+	 * @return bool
222
+	 * @throws EE_Error
223
+	 * @throws ReflectionException
224
+	 */
225
+	public function is_default()
226
+	{
227
+		return $this->get('PRC_is_default');
228
+	}
229
+
230
+
231
+	/**
232
+	 * get deleted
233
+	 *
234
+	 * @return bool
235
+	 * @throws EE_Error
236
+	 * @throws ReflectionException
237
+	 */
238
+	public function deleted()
239
+	{
240
+		return $this->get('PRC_deleted');
241
+	}
242
+
243
+
244
+	/**
245
+	 * @return bool
246
+	 * @throws EE_Error
247
+	 * @throws ReflectionException
248
+	 */
249
+	public function parent()
250
+	{
251
+		return $this->get('PRC_parent');
252
+	}
253
+
254
+
255
+	// some helper methods for getting info on the price_type for this price
256
+
257
+	/**
258
+	 * @return EE_Price_Type|null
259
+	 * @throws EE_Error
260
+	 * @throws ReflectionException
261
+	 */
262
+	public function type_obj(): ?EE_Price_Type
263
+	{
264
+		return $this->get_first_related('Price_Type');
265
+	}
266
+
267
+
268
+	/**
269
+	 * @return int
270
+	 * @throws EE_Error
271
+	 * @throws ReflectionException
272
+	 */
273
+	public function type_order(): int
274
+	{
275
+		$price_type = $this->type_obj();
276
+		return $price_type instanceof EE_Price_Type ? $price_type->order() : 0;
277
+	}
278
+
279
+
280
+	/**
281
+	 * return whether the price is a base price or not
282
+	 *
283
+	 * @return bool
284
+	 * @throws EE_Error
285
+	 * @throws InvalidArgumentException
286
+	 * @throws InvalidDataTypeException
287
+	 * @throws InvalidInterfaceException
288
+	 * @throws ReflectionException
289
+	 */
290
+	public function is_base_price(): bool
291
+	{
292
+		$price_type = $this->type_obj();
293
+		return $price_type instanceof EE_Price_Type && $price_type->is_base_price();
294
+	}
295
+
296
+
297
+	/**
298
+	 * Simply indicates whether this price increases or decreases the total
299
+	 *
300
+	 * @return bool true = discount, otherwise adds to the total
301
+	 * @throws EE_Error
302
+	 * @throws ReflectionException
303
+	 */
304
+	public function is_discount(): bool
305
+	{
306
+		$price_type = $this->type_obj();
307
+		return $price_type instanceof EE_Price_Type && $price_type->is_discount();
308
+	}
309
+
310
+
311
+	/**
312
+	 * whether the price is a percentage or not
313
+	 *
314
+	 * @return bool
315
+	 * @throws EE_Error
316
+	 * @throws InvalidArgumentException
317
+	 * @throws InvalidDataTypeException
318
+	 * @throws InvalidInterfaceException
319
+	 * @throws ReflectionException
320
+	 */
321
+	public function is_percent(): bool
322
+	{
323
+		$price_type = $this->type_obj();
324
+		return $price_type instanceof EE_Price_Type && $price_type->is_percent();
325
+	}
326
+
327
+
328
+	/**
329
+	 * whether the price is a percentage or not
330
+	 *
331
+	 * @return bool
332
+	 * @throws EE_Error
333
+	 * @throws ReflectionException
334
+	 */
335
+	public function is_surcharge(): bool
336
+	{
337
+		$price_type = $this->type_obj();
338
+		return $price_type instanceof EE_Price_Type && $price_type->is_surcharge();
339
+	}
340
+
341
+
342
+
343
+	/**
344
+	 * whether the price is a percentage or not
345
+	 *
346
+	 * @return bool
347
+	 * @throws EE_Error
348
+	 * @throws ReflectionException
349
+	 */
350
+	public function is_tax(): bool
351
+	{
352
+		$price_type = $this->type_obj();
353
+		return $price_type instanceof EE_Price_Type && $price_type->is_tax();
354
+	}
355
+
356
+
357
+	/**
358
+	 * return pretty price dependant on whether its a dollar or percent.
359
+	 *
360
+	 * @return string
361
+	 * @throws EE_Error
362
+	 * @throws ReflectionException
363
+	 * @since 4.4.0
364
+	 */
365
+	public function pretty_price(): string
366
+	{
367
+		return ! $this->is_percent()
368
+			? $this->get_pretty('PRC_amount')
369
+			: $this->get('PRC_amount') . '%';
370
+	}
371
+
372
+
373
+	/**
374
+	 * @return mixed
375
+	 * @throws EE_Error
376
+	 * @throws ReflectionException
377
+	 */
378
+	public function get_price_without_currency_symbol()
379
+	{
380
+		return str_replace(
381
+			EE_Registry::instance()->CFG->currency->sign,
382
+			'',
383
+			$this->get_pretty('PRC_amount')
384
+		);
385
+	}
386 386
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/DatetimesConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'DatetimesConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
  */
15 15
 class DatetimesConnectionOrderbyEnum extends EnumBase
16 16
 {
17
-    /**
18
-     * DatetimesConnectionOrderbyEnum constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
-        parent::__construct();
25
-    }
17
+	/**
18
+	 * DatetimesConnectionOrderbyEnum constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
+		parent::__construct();
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    protected function getValues(): array
32
-    {
33
-        return [
34
-            'NAME'     => [
35
-                'value'       => 'DTT_name',
36
-                'description' => esc_html__('Order by name', 'event_espresso'),
37
-            ],
38
-            'START_DATE'     => [
39
-                'value'       => 'DTT_EVT_start',
40
-                'description' => esc_html__('Order by start date', 'event_espresso'),
41
-            ],
42
-        ];
43
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	protected function getValues(): array
32
+	{
33
+		return [
34
+			'NAME'     => [
35
+				'value'       => 'DTT_name',
36
+				'description' => esc_html__('Order by name', 'event_espresso'),
37
+			],
38
+			'START_DATE'     => [
39
+				'value'       => 'DTT_EVT_start',
40
+				'description' => esc_html__('Order by start date', 'event_espresso'),
41
+			],
42
+		];
43
+	}
44 44
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/TicketsConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'TicketsConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
  */
15 15
 class TicketsConnectionOrderbyEnum extends EnumBase
16 16
 {
17
-    /**
18
-     * TicketsConnectionOrderbyEnum constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
23
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
-        parent::__construct();
25
-    }
17
+	/**
18
+	 * TicketsConnectionOrderbyEnum constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
23
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
+		parent::__construct();
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    protected function getValues(): array
32
-    {
33
-        return [
34
-            'NAME'     => [
35
-                'value'       => 'TKT_name',
36
-                'description' => esc_html__('Order by name', 'event_espresso'),
37
-            ],
38
-            'START_DATE'     => [
39
-                'value'       => 'TKT_start_date',
40
-                'description' => esc_html__('Order by start date', 'event_espresso'),
41
-            ],
42
-        ];
43
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	protected function getValues(): array
32
+	{
33
+		return [
34
+			'NAME'     => [
35
+				'value'       => 'TKT_name',
36
+				'description' => esc_html__('Order by name', 'event_espresso'),
37
+			],
38
+			'START_DATE'     => [
39
+				'value'       => 'TKT_start_date',
40
+				'description' => esc_html__('Order by start date', 'event_espresso'),
41
+			],
42
+		];
43
+	}
44 44
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/PriceBaseTypeEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct()
23 23
     {
24
-        $this->setName($this->namespace . 'PriceBaseTypeEnum');
24
+        $this->setName($this->namespace.'PriceBaseTypeEnum');
25 25
         $this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26 26
         parent::__construct();
27 27
     }
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@
 block discarded – undo
15 15
  */
16 16
 class PriceBaseTypeEnum extends EnumBase
17 17
 {
18
-    /**
19
-     * PriceBaseTypeEnum constructor.
20
-     */
21
-    public function __construct()
22
-    {
23
-        $this->setName($this->namespace . 'PriceBaseTypeEnum');
24
-        $this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
25
-        parent::__construct();
26
-    }
18
+	/**
19
+	 * PriceBaseTypeEnum constructor.
20
+	 */
21
+	public function __construct()
22
+	{
23
+		$this->setName($this->namespace . 'PriceBaseTypeEnum');
24
+		$this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    protected function getValues(): array
33
-    {
34
-        return [
35
-            'BASE_PRICE'     => [
36
-                'value'       => EEM_Price_Type::base_type_base_price,
37
-            ],
38
-            'DISCOUNT'     => [
39
-                'value'       => EEM_Price_Type::base_type_discount,
40
-            ],
41
-            'SURCHARGE'     => [
42
-                'value'       => EEM_Price_Type::base_type_surcharge,
43
-            ],
44
-            'TAX'     => [
45
-                'value'       => EEM_Price_Type::base_type_tax,
46
-            ],
47
-        ];
48
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	protected function getValues(): array
33
+	{
34
+		return [
35
+			'BASE_PRICE'     => [
36
+				'value'       => EEM_Price_Type::base_type_base_price,
37
+			],
38
+			'DISCOUNT'     => [
39
+				'value'       => EEM_Price_Type::base_type_discount,
40
+			],
41
+			'SURCHARGE'     => [
42
+				'value'       => EEM_Price_Type::base_type_surcharge,
43
+			],
44
+			'TAX'     => [
45
+				'value'       => EEM_Price_Type::base_type_tax,
46
+			],
47
+		];
48
+	}
49 49
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/DatetimesConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct()
26 26
     {
27
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
27
+        $this->setName($this->namespace.'DatetimesConnectionOrderbyInput');
28 28
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
29 29
         parent::__construct();
30 30
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         return [
40 40
             new GraphQLField(
41 41
                 'field',
42
-                ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
42
+                ['non_null' => $this->namespace.'DatetimesConnectionOrderbyEnum']
43 43
             ),
44 44
             new GraphQLField(
45 45
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
  */
17 17
 class DatetimesConnectionOrderbyInput extends InputBase
18 18
 {
19
-    /**
20
-     * DatetimesConnectionOrderbyInput constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
25
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * DatetimesConnectionOrderbyInput constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
25
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return GraphQLFieldInterface[]
32
-     */
33
-    protected function getFields(): array
34
-    {
35
-        return [
36
-            new GraphQLField(
37
-                'field',
38
-                ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
39
-            ),
40
-            new GraphQLField(
41
-                'order',
42
-                'OrderEnum'
43
-            ),
44
-        ];
45
-    }
30
+	/**
31
+	 * @return GraphQLFieldInterface[]
32
+	 */
33
+	protected function getFields(): array
34
+	{
35
+		return [
36
+			new GraphQLField(
37
+				'field',
38
+				['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
39
+			),
40
+			new GraphQLField(
41
+				'order',
42
+				'OrderEnum'
43
+			),
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/TicketsConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function __construct()
26 26
     {
27
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
27
+        $this->setName($this->namespace.'TicketsConnectionOrderbyInput');
28 28
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
29 29
         parent::__construct();
30 30
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         return [
40 40
             new GraphQLField(
41 41
                 'field',
42
-                ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
42
+                ['non_null' => $this->namespace.'TicketsConnectionOrderbyEnum']
43 43
             ),
44 44
             new GraphQLField(
45 45
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
  */
17 17
 class TicketsConnectionOrderbyInput extends InputBase
18 18
 {
19
-    /**
20
-     * TicketsConnectionOrderbyInput constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
25
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * TicketsConnectionOrderbyInput constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'TicketsConnectionOrderbyInput');
25
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return GraphQLFieldInterface[]
32
-     */
33
-    protected function getFields(): array
34
-    {
35
-        return [
36
-            new GraphQLField(
37
-                'field',
38
-                ['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
39
-            ),
40
-            new GraphQLField(
41
-                'order',
42
-                'OrderEnum'
43
-            ),
44
-        ];
45
-    }
30
+	/**
31
+	 * @return GraphQLFieldInterface[]
32
+	 */
33
+	protected function getFields(): array
34
+	{
35
+		return [
36
+			new GraphQLField(
37
+				'field',
38
+				['non_null' => $this->namespace . 'TicketsConnectionOrderbyEnum']
39
+			),
40
+			new GraphQLField(
41
+				'order',
42
+				'OrderEnum'
43
+			),
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryPricesConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Price',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
41
+            'toType'             => $this->namespace.'Price',
42
+            'fromFieldName'      => lcfirst($this->namespace).'Prices',
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
44 44
             'connectionArgs'     => TicketPricesConnection::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -18,43 +18,43 @@
 block discarded – undo
18 18
  */
19 19
 class RootQueryPricesConnection extends AbstractRootQueryConnection
20 20
 {
21
-    /**
22
-     * PriceConnection constructor.
23
-     *
24
-     * @param EEM_Price               $model
25
-     */
26
-    public function __construct(EEM_Price $model)
27
-    {
28
-        parent::__construct($model);
29
-    }
21
+	/**
22
+	 * PriceConnection constructor.
23
+	 *
24
+	 * @param EEM_Price               $model
25
+	 */
26
+	public function __construct(EEM_Price $model)
27
+	{
28
+		parent::__construct($model);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @return array
34
-     */
35
-    public function config(): array
36
-    {
37
-        return [
38
-            'fromType'           => 'RootQuery',
39
-            'toType'             => $this->namespace . 'Price',
40
-            'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
41
-            'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
42
-            'connectionArgs'     => TicketPricesConnection::get_connection_args(),
43
-            'resolve'            => [$this, 'resolveConnection'],
44
-        ];
45
-    }
32
+	/**
33
+	 * @return array
34
+	 */
35
+	public function config(): array
36
+	{
37
+		return [
38
+			'fromType'           => 'RootQuery',
39
+			'toType'             => $this->namespace . 'Price',
40
+			'fromFieldName'      => lcfirst($this->namespace) . 'Prices',
41
+			'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection",
42
+			'connectionArgs'     => TicketPricesConnection::get_connection_args(),
43
+			'resolve'            => [$this, 'resolveConnection'],
44
+		];
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @param $entity
50
-     * @param $args
51
-     * @param $context
52
-     * @param $info
53
-     * @return PriceConnectionResolver
54
-     * @throws Exception
55
-     */
56
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
-    {
58
-        return new PriceConnectionResolver($entity, $args, $context, $info);
59
-    }
48
+	/**
49
+	 * @param $entity
50
+	 * @param $args
51
+	 * @param $context
52
+	 * @param $info
53
+	 * @return PriceConnectionResolver
54
+	 * @throws Exception
55
+	 */
56
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
+	{
58
+		return new PriceConnectionResolver($entity, $args, $context, $info);
59
+	}
60 60
 }
Please login to merge, or discard this patch.