Completed
Branch new-admin-design (7f58b2)
by
unknown
02:54
created
core/domain/services/custom_post_types/RewriteRules.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -13,35 +13,35 @@
 block discarded – undo
13 13
 class RewriteRules
14 14
 {
15 15
 
16
-    const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
16
+	const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
17 17
 
18 18
 
19
-    /**
20
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
21
-     *
22
-     * @return void
23
-     */
24
-    public function flush()
25
-    {
26
-        update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
27
-    }
19
+	/**
20
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
21
+	 *
22
+	 * @return void
23
+	 */
24
+	public function flush()
25
+	{
26
+		update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
32
-     *
33
-     * @return void
34
-     */
35
-    public function flushRewriteRules()
36
-    {
37
-        if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
38
-            add_action(
39
-                'shutdown',
40
-                static function () {
41
-                    flush_rewrite_rules();
42
-                    update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
43
-                }
44
-            );
45
-        }
46
-    }
30
+	/**
31
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
32
+	 *
33
+	 * @return void
34
+	 */
35
+	public function flushRewriteRules()
36
+	{
37
+		if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
38
+			add_action(
39
+				'shutdown',
40
+				static function () {
41
+					flush_rewrite_rules();
42
+					update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
43
+				}
44
+			);
45
+		}
46
+	}
47 47
 }
Please login to merge, or discard this patch.
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.
core/services/graphql/fields/GraphQLFieldInterface.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -16,100 +16,100 @@
 block discarded – undo
16 16
 interface GraphQLFieldInterface
17 17
 {
18 18
 
19
-    /**
20
-     * @return array
21
-     */
22
-    public function caps();
23
-
24
-
25
-    /**
26
-     * @return string
27
-     */
28
-    public function description();
29
-
30
-
31
-    /**
32
-     * @return string
33
-     */
34
-    public function key();
35
-
36
-
37
-    /**
38
-     * @return string
39
-     */
40
-    public function name();
41
-
42
-
43
-    /**
44
-     * @return string|string[]
45
-     */
46
-    public function type();
47
-
48
-
49
-    /**
50
-     * Convert the field to array to be
51
-     * able to pass as config to WP GraphQL
52
-     *
53
-     * @return array
54
-     */
55
-    public function toArray();
56
-
57
-
58
-    /**
59
-     * Whether the field should be used for
60
-     * mutation inputs.
61
-     *
62
-     * @return bool
63
-     */
64
-    public function useForInput();
65
-
66
-
67
-    /**
68
-     * Whether the field should be used for
69
-     * query outputs.
70
-     *
71
-     * @return bool
72
-     */
73
-    public function useForOutput();
74
-
75
-
76
-    /**
77
-     * Whether the field should resolve
78
-     * based on the user caps etc.
79
-     *
80
-     * @return boolean
81
-     */
82
-    public function shouldResolve();
83
-
84
-
85
-    /**
86
-     * Whether the field has an explicit resolver set.
87
-     *
88
-     * @return boolean
89
-     */
90
-    public function hasInternalResolver();
91
-
92
-
93
-    /**
94
-     * Whether the field has an explicit resolver set.
95
-     *
96
-     * @param mixed       $source  The source that's passed down the GraphQL queries
97
-     * @param array       $args    The inputArgs on the field
98
-     * @param AppContext  $context The AppContext passed down the GraphQL tree
99
-     * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
100
-     * @return mixed
101
-     * @throws LogicException
102
-     */
103
-    public function resolve($source, array $args, AppContext $context, ResolveInfo $info);
104
-
105
-
106
-    /**
107
-     * Checks if the format callback is set.
108
-     * If yes, then uses it to format the value.
109
-     *
110
-     * @param mixed         $value
111
-     * @param EE_Base_Class $source
112
-     * @return mixed The formatted value.
113
-     */
114
-    public function mayBeFormatValue($value, EE_Base_Class $source);
19
+	/**
20
+	 * @return array
21
+	 */
22
+	public function caps();
23
+
24
+
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function description();
29
+
30
+
31
+	/**
32
+	 * @return string
33
+	 */
34
+	public function key();
35
+
36
+
37
+	/**
38
+	 * @return string
39
+	 */
40
+	public function name();
41
+
42
+
43
+	/**
44
+	 * @return string|string[]
45
+	 */
46
+	public function type();
47
+
48
+
49
+	/**
50
+	 * Convert the field to array to be
51
+	 * able to pass as config to WP GraphQL
52
+	 *
53
+	 * @return array
54
+	 */
55
+	public function toArray();
56
+
57
+
58
+	/**
59
+	 * Whether the field should be used for
60
+	 * mutation inputs.
61
+	 *
62
+	 * @return bool
63
+	 */
64
+	public function useForInput();
65
+
66
+
67
+	/**
68
+	 * Whether the field should be used for
69
+	 * query outputs.
70
+	 *
71
+	 * @return bool
72
+	 */
73
+	public function useForOutput();
74
+
75
+
76
+	/**
77
+	 * Whether the field should resolve
78
+	 * based on the user caps etc.
79
+	 *
80
+	 * @return boolean
81
+	 */
82
+	public function shouldResolve();
83
+
84
+
85
+	/**
86
+	 * Whether the field has an explicit resolver set.
87
+	 *
88
+	 * @return boolean
89
+	 */
90
+	public function hasInternalResolver();
91
+
92
+
93
+	/**
94
+	 * Whether the field has an explicit resolver set.
95
+	 *
96
+	 * @param mixed       $source  The source that's passed down the GraphQL queries
97
+	 * @param array       $args    The inputArgs on the field
98
+	 * @param AppContext  $context The AppContext passed down the GraphQL tree
99
+	 * @param ResolveInfo $info    The ResolveInfo passed down the GraphQL tree
100
+	 * @return mixed
101
+	 * @throws LogicException
102
+	 */
103
+	public function resolve($source, array $args, AppContext $context, ResolveInfo $info);
104
+
105
+
106
+	/**
107
+	 * Checks if the format callback is set.
108
+	 * If yes, then uses it to format the value.
109
+	 *
110
+	 * @param mixed         $value
111
+	 * @param EE_Base_Class $source
112
+	 * @return mixed The formatted value.
113
+	 */
114
+	public function mayBeFormatValue($value, EE_Base_Class $source);
115 115
 }
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   +442 added lines, -442 removed lines patch added patch discarded remove patch
@@ -13,446 +13,446 @@
 block discarded – undo
13 13
 class EE_Price extends EE_Soft_Delete_Base_Class
14 14
 {
15 15
 
16
-    /**
17
-     * @param array  $props_n_values          incoming values
18
-     * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
19
-     *                                        used.)
20
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
21
-     *                                        date_format and the second value is the time format
22
-     * @return EE_Price
23
-     * @throws EE_Error
24
-     * @throws InvalidArgumentException
25
-     * @throws ReflectionException
26
-     * @throws InvalidDataTypeException
27
-     * @throws InvalidInterfaceException
28
-     */
29
-    public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
30
-    {
31
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
32
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
33
-    }
34
-
35
-
36
-    /**
37
-     * @param array  $props_n_values  incoming values from the database
38
-     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
39
-     *                                the website will be used.
40
-     * @return EE_Price
41
-     * @throws EE_Error
42
-     * @throws InvalidArgumentException
43
-     * @throws ReflectionException
44
-     * @throws InvalidDataTypeException
45
-     * @throws InvalidInterfaceException
46
-     */
47
-    public static function new_instance_from_db($props_n_values = array(), $timezone = null)
48
-    {
49
-        return new self($props_n_values, true, $timezone);
50
-    }
51
-
52
-
53
-    /**
54
-     * Set Price type ID
55
-     *
56
-     * @param int $PRT_ID
57
-     * @throws EE_Error
58
-     * @throws InvalidArgumentException
59
-     * @throws ReflectionException
60
-     * @throws InvalidDataTypeException
61
-     * @throws InvalidInterfaceException
62
-     */
63
-    public function set_type($PRT_ID = 0)
64
-    {
65
-        $this->set('PRT_ID', $PRT_ID);
66
-    }
67
-
68
-
69
-    /**
70
-     * Set Price Amount
71
-     *
72
-     * @param float $PRC_amount
73
-     * @throws EE_Error
74
-     * @throws InvalidArgumentException
75
-     * @throws ReflectionException
76
-     * @throws InvalidDataTypeException
77
-     * @throws InvalidInterfaceException
78
-     */
79
-    public function set_amount($PRC_amount = 0.00)
80
-    {
81
-        $this->set('PRC_amount', $PRC_amount);
82
-    }
83
-
84
-
85
-    /**
86
-     * Set Price Name
87
-     *
88
-     * @param string $PRC_name
89
-     * @throws EE_Error
90
-     * @throws InvalidArgumentException
91
-     * @throws ReflectionException
92
-     * @throws InvalidDataTypeException
93
-     * @throws InvalidInterfaceException
94
-     */
95
-    public function set_name($PRC_name = '')
96
-    {
97
-        $this->set('PRC_name', $PRC_name);
98
-    }
99
-
100
-
101
-    /**
102
-     * Set Price Description
103
-     *
104
-     * @param string $PRC_desc
105
-     * @throws EE_Error
106
-     * @throws InvalidArgumentException
107
-     * @throws ReflectionException
108
-     * @throws InvalidDataTypeException
109
-     * @throws InvalidInterfaceException
110
-     */
111
-    public function set_description($PRC_desc = '')
112
-    {
113
-        $this->Set('PRC_desc', $PRC_desc);
114
-    }
115
-
116
-
117
-    /**
118
-     * set is_default
119
-     *
120
-     * @param bool $PRC_is_default
121
-     * @throws EE_Error
122
-     * @throws InvalidArgumentException
123
-     * @throws ReflectionException
124
-     * @throws InvalidDataTypeException
125
-     * @throws InvalidInterfaceException
126
-     */
127
-    public function set_is_default($PRC_is_default = false)
128
-    {
129
-        $this->set('PRC_is_default', $PRC_is_default);
130
-    }
131
-
132
-
133
-    /**
134
-     * set deleted
135
-     *
136
-     * @param bool $PRC_deleted
137
-     * @throws EE_Error
138
-     * @throws InvalidArgumentException
139
-     * @throws ReflectionException
140
-     * @throws InvalidDataTypeException
141
-     * @throws InvalidInterfaceException
142
-     */
143
-    public function set_deleted($PRC_deleted = null)
144
-    {
145
-        $this->set('PRC_deleted', $PRC_deleted);
146
-    }
147
-
148
-
149
-    /**
150
-     * get Price type
151
-     *
152
-     * @return        int
153
-     * @throws EE_Error
154
-     * @throws InvalidArgumentException
155
-     * @throws ReflectionException
156
-     * @throws InvalidDataTypeException
157
-     * @throws InvalidInterfaceException
158
-     */
159
-    public function type()
160
-    {
161
-        return $this->get('PRT_ID');
162
-    }
163
-
164
-
165
-    /**
166
-     * get Price Amount
167
-     *
168
-     * @return        float
169
-     * @throws EE_Error
170
-     * @throws InvalidArgumentException
171
-     * @throws ReflectionException
172
-     * @throws InvalidDataTypeException
173
-     * @throws InvalidInterfaceException
174
-     */
175
-    public function amount()
176
-    {
177
-        return $this->get('PRC_amount');
178
-    }
179
-
180
-
181
-    /**
182
-     * get Price Name
183
-     *
184
-     * @return        string
185
-     * @throws EE_Error
186
-     * @throws InvalidArgumentException
187
-     * @throws ReflectionException
188
-     * @throws InvalidDataTypeException
189
-     * @throws InvalidInterfaceException
190
-     */
191
-    public function name()
192
-    {
193
-        return $this->get('PRC_name');
194
-    }
195
-
196
-
197
-    /**
198
-     * get Price description
199
-     *
200
-     * @return        string
201
-     * @throws EE_Error
202
-     * @throws InvalidArgumentException
203
-     * @throws ReflectionException
204
-     * @throws InvalidDataTypeException
205
-     * @throws InvalidInterfaceException
206
-     */
207
-    public function desc()
208
-    {
209
-        return $this->get('PRC_desc');
210
-    }
211
-
212
-
213
-    /**
214
-     * get overrides
215
-     *
216
-     * @return        int
217
-     * @throws EE_Error
218
-     * @throws InvalidArgumentException
219
-     * @throws ReflectionException
220
-     * @throws InvalidDataTypeException
221
-     * @throws InvalidInterfaceException
222
-     */
223
-    public function overrides()
224
-    {
225
-        return $this->get('PRC_overrides');
226
-    }
227
-
228
-
229
-    /**
230
-     * get order
231
-     *
232
-     * @return int
233
-     * @throws EE_Error
234
-     * @throws InvalidArgumentException
235
-     * @throws ReflectionException
236
-     * @throws InvalidDataTypeException
237
-     * @throws InvalidInterfaceException
238
-     */
239
-    public function order()
240
-    {
241
-        return $this->get('PRC_order');
242
-    }
243
-
244
-
245
-    /**
246
-     * get the author of the price
247
-     *
248
-     * @return int
249
-     * @throws EE_Error
250
-     * @throws InvalidArgumentException
251
-     * @throws ReflectionException
252
-     * @throws InvalidDataTypeException
253
-     * @throws InvalidInterfaceException
254
-     * @since 4.5.0
255
-     */
256
-    public function wp_user()
257
-    {
258
-        return $this->get('PRC_wp_user');
259
-    }
260
-
261
-
262
-    /**
263
-     * get is_default
264
-     *
265
-     * @return bool
266
-     * @throws EE_Error
267
-     * @throws InvalidArgumentException
268
-     * @throws ReflectionException
269
-     * @throws InvalidDataTypeException
270
-     * @throws InvalidInterfaceException
271
-     */
272
-    public function is_default()
273
-    {
274
-        return $this->get('PRC_is_default');
275
-    }
276
-
277
-
278
-    /**
279
-     * get deleted
280
-     *
281
-     * @return bool
282
-     * @throws EE_Error
283
-     * @throws InvalidArgumentException
284
-     * @throws ReflectionException
285
-     * @throws InvalidDataTypeException
286
-     * @throws InvalidInterfaceException
287
-     */
288
-    public function deleted()
289
-    {
290
-        return $this->get('PRC_deleted');
291
-    }
292
-
293
-
294
-    /**
295
-     * @return bool
296
-     * @throws EE_Error
297
-     * @throws InvalidArgumentException
298
-     * @throws ReflectionException
299
-     * @throws InvalidDataTypeException
300
-     * @throws InvalidInterfaceException
301
-     */
302
-    public function parent()
303
-    {
304
-        return $this->get('PRC_parent');
305
-    }
306
-
307
-
308
-    // some helper methods for getting info on the price_type for this price
309
-
310
-
311
-    /**
312
-     * return whether the price is a base price or not
313
-     *
314
-     * @return boolean
315
-     * @throws EE_Error
316
-     * @throws InvalidArgumentException
317
-     * @throws InvalidDataTypeException
318
-     * @throws InvalidInterfaceException
319
-     * @throws ReflectionException
320
-     */
321
-    public function is_base_price()
322
-    {
323
-        $price_type = $this->type_obj();
324
-        return $price_type->is_base_price();
325
-    }
326
-
327
-
328
-    /**
329
-     * @return EE_Base_Class|EE_Price_Type
330
-     * @throws EE_Error
331
-     * @throws InvalidArgumentException
332
-     * @throws ReflectionException
333
-     * @throws InvalidDataTypeException
334
-     * @throws InvalidInterfaceException
335
-     */
336
-    public function type_obj()
337
-    {
338
-        return $this->get_first_related('Price_Type');
339
-    }
340
-
341
-
342
-    /**
343
-     * @return int
344
-     * @throws EE_Error
345
-     * @throws InvalidArgumentException
346
-     * @throws ReflectionException
347
-     * @throws InvalidDataTypeException
348
-     * @throws InvalidInterfaceException
349
-     */
350
-    public function type_order()
351
-    {
352
-        return $this->get_first_related('Price_Type')->order();
353
-    }
354
-
355
-
356
-    /**
357
-     * Simply indicates whether this price increases or decreases the total
358
-     *
359
-     * @return boolean true = discount, otherwise adds to the total
360
-     * @throws EE_Error
361
-     * @throws InvalidArgumentException
362
-     * @throws ReflectionException
363
-     * @throws InvalidDataTypeException
364
-     * @throws InvalidInterfaceException
365
-     */
366
-    public function is_discount()
367
-    {
368
-        $price_type = $this->type_obj();
369
-        return $price_type->is_discount();
370
-    }
371
-
372
-
373
-    /**
374
-     * whether the price is a percentage or not
375
-     *
376
-     * @return boolean
377
-     * @throws EE_Error
378
-     * @throws InvalidArgumentException
379
-     * @throws InvalidDataTypeException
380
-     * @throws InvalidInterfaceException
381
-     * @throws ReflectionException
382
-     */
383
-    public function is_percent()
384
-    {
385
-        $price_type = $this->type_obj();
386
-        return $price_type->is_percent();
387
-    }
388
-
389
-
390
-    /**
391
-     * whether the price is a percentage or not
392
-     *
393
-     * @return boolean
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws ReflectionException
397
-     * @throws InvalidDataTypeException
398
-     * @throws InvalidInterfaceException
399
-     */
400
-    public function is_surcharge()
401
-    {
402
-        $price_type = $this->type_obj();
403
-        return $price_type->is_surcharge();
404
-    }
405
-
406
-    /**
407
-     * whether the price is a percentage or not
408
-     *
409
-     * @return boolean
410
-     * @throws EE_Error
411
-     * @throws InvalidArgumentException
412
-     * @throws ReflectionException
413
-     * @throws InvalidDataTypeException
414
-     * @throws InvalidInterfaceException
415
-     */
416
-    public function is_tax()
417
-    {
418
-        $price_type = $this->type_obj();
419
-        return $price_type->is_tax();
420
-    }
421
-
422
-
423
-    /**
424
-     * return pretty price dependant on whether its a dollar or percent.
425
-     *
426
-     * @return string
427
-     * @throws EE_Error
428
-     * @throws InvalidArgumentException
429
-     * @throws ReflectionException
430
-     * @throws InvalidDataTypeException
431
-     * @throws InvalidInterfaceException
432
-     * @since 4.4.0
433
-     */
434
-    public function pretty_price()
435
-    {
436
-        return ! $this->is_percent()
437
-            ? $this->get_pretty('PRC_amount')
438
-            : $this->get('PRC_amount') . '%';
439
-    }
440
-
441
-
442
-    /**
443
-     * @return mixed
444
-     * @throws EE_Error
445
-     * @throws InvalidArgumentException
446
-     * @throws ReflectionException
447
-     * @throws InvalidDataTypeException
448
-     * @throws InvalidInterfaceException
449
-     */
450
-    public function get_price_without_currency_symbol()
451
-    {
452
-        return str_replace(
453
-            EE_Registry::instance()->CFG->currency->sign,
454
-            '',
455
-            $this->get_pretty('PRC_amount')
456
-        );
457
-    }
16
+	/**
17
+	 * @param array  $props_n_values          incoming values
18
+	 * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
19
+	 *                                        used.)
20
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
21
+	 *                                        date_format and the second value is the time format
22
+	 * @return EE_Price
23
+	 * @throws EE_Error
24
+	 * @throws InvalidArgumentException
25
+	 * @throws ReflectionException
26
+	 * @throws InvalidDataTypeException
27
+	 * @throws InvalidInterfaceException
28
+	 */
29
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
30
+	{
31
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
32
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
33
+	}
34
+
35
+
36
+	/**
37
+	 * @param array  $props_n_values  incoming values from the database
38
+	 * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
39
+	 *                                the website will be used.
40
+	 * @return EE_Price
41
+	 * @throws EE_Error
42
+	 * @throws InvalidArgumentException
43
+	 * @throws ReflectionException
44
+	 * @throws InvalidDataTypeException
45
+	 * @throws InvalidInterfaceException
46
+	 */
47
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null)
48
+	{
49
+		return new self($props_n_values, true, $timezone);
50
+	}
51
+
52
+
53
+	/**
54
+	 * Set Price type ID
55
+	 *
56
+	 * @param int $PRT_ID
57
+	 * @throws EE_Error
58
+	 * @throws InvalidArgumentException
59
+	 * @throws ReflectionException
60
+	 * @throws InvalidDataTypeException
61
+	 * @throws InvalidInterfaceException
62
+	 */
63
+	public function set_type($PRT_ID = 0)
64
+	{
65
+		$this->set('PRT_ID', $PRT_ID);
66
+	}
67
+
68
+
69
+	/**
70
+	 * Set Price Amount
71
+	 *
72
+	 * @param float $PRC_amount
73
+	 * @throws EE_Error
74
+	 * @throws InvalidArgumentException
75
+	 * @throws ReflectionException
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws InvalidInterfaceException
78
+	 */
79
+	public function set_amount($PRC_amount = 0.00)
80
+	{
81
+		$this->set('PRC_amount', $PRC_amount);
82
+	}
83
+
84
+
85
+	/**
86
+	 * Set Price Name
87
+	 *
88
+	 * @param string $PRC_name
89
+	 * @throws EE_Error
90
+	 * @throws InvalidArgumentException
91
+	 * @throws ReflectionException
92
+	 * @throws InvalidDataTypeException
93
+	 * @throws InvalidInterfaceException
94
+	 */
95
+	public function set_name($PRC_name = '')
96
+	{
97
+		$this->set('PRC_name', $PRC_name);
98
+	}
99
+
100
+
101
+	/**
102
+	 * Set Price Description
103
+	 *
104
+	 * @param string $PRC_desc
105
+	 * @throws EE_Error
106
+	 * @throws InvalidArgumentException
107
+	 * @throws ReflectionException
108
+	 * @throws InvalidDataTypeException
109
+	 * @throws InvalidInterfaceException
110
+	 */
111
+	public function set_description($PRC_desc = '')
112
+	{
113
+		$this->Set('PRC_desc', $PRC_desc);
114
+	}
115
+
116
+
117
+	/**
118
+	 * set is_default
119
+	 *
120
+	 * @param bool $PRC_is_default
121
+	 * @throws EE_Error
122
+	 * @throws InvalidArgumentException
123
+	 * @throws ReflectionException
124
+	 * @throws InvalidDataTypeException
125
+	 * @throws InvalidInterfaceException
126
+	 */
127
+	public function set_is_default($PRC_is_default = false)
128
+	{
129
+		$this->set('PRC_is_default', $PRC_is_default);
130
+	}
131
+
132
+
133
+	/**
134
+	 * set deleted
135
+	 *
136
+	 * @param bool $PRC_deleted
137
+	 * @throws EE_Error
138
+	 * @throws InvalidArgumentException
139
+	 * @throws ReflectionException
140
+	 * @throws InvalidDataTypeException
141
+	 * @throws InvalidInterfaceException
142
+	 */
143
+	public function set_deleted($PRC_deleted = null)
144
+	{
145
+		$this->set('PRC_deleted', $PRC_deleted);
146
+	}
147
+
148
+
149
+	/**
150
+	 * get Price type
151
+	 *
152
+	 * @return        int
153
+	 * @throws EE_Error
154
+	 * @throws InvalidArgumentException
155
+	 * @throws ReflectionException
156
+	 * @throws InvalidDataTypeException
157
+	 * @throws InvalidInterfaceException
158
+	 */
159
+	public function type()
160
+	{
161
+		return $this->get('PRT_ID');
162
+	}
163
+
164
+
165
+	/**
166
+	 * get Price Amount
167
+	 *
168
+	 * @return        float
169
+	 * @throws EE_Error
170
+	 * @throws InvalidArgumentException
171
+	 * @throws ReflectionException
172
+	 * @throws InvalidDataTypeException
173
+	 * @throws InvalidInterfaceException
174
+	 */
175
+	public function amount()
176
+	{
177
+		return $this->get('PRC_amount');
178
+	}
179
+
180
+
181
+	/**
182
+	 * get Price Name
183
+	 *
184
+	 * @return        string
185
+	 * @throws EE_Error
186
+	 * @throws InvalidArgumentException
187
+	 * @throws ReflectionException
188
+	 * @throws InvalidDataTypeException
189
+	 * @throws InvalidInterfaceException
190
+	 */
191
+	public function name()
192
+	{
193
+		return $this->get('PRC_name');
194
+	}
195
+
196
+
197
+	/**
198
+	 * get Price description
199
+	 *
200
+	 * @return        string
201
+	 * @throws EE_Error
202
+	 * @throws InvalidArgumentException
203
+	 * @throws ReflectionException
204
+	 * @throws InvalidDataTypeException
205
+	 * @throws InvalidInterfaceException
206
+	 */
207
+	public function desc()
208
+	{
209
+		return $this->get('PRC_desc');
210
+	}
211
+
212
+
213
+	/**
214
+	 * get overrides
215
+	 *
216
+	 * @return        int
217
+	 * @throws EE_Error
218
+	 * @throws InvalidArgumentException
219
+	 * @throws ReflectionException
220
+	 * @throws InvalidDataTypeException
221
+	 * @throws InvalidInterfaceException
222
+	 */
223
+	public function overrides()
224
+	{
225
+		return $this->get('PRC_overrides');
226
+	}
227
+
228
+
229
+	/**
230
+	 * get order
231
+	 *
232
+	 * @return int
233
+	 * @throws EE_Error
234
+	 * @throws InvalidArgumentException
235
+	 * @throws ReflectionException
236
+	 * @throws InvalidDataTypeException
237
+	 * @throws InvalidInterfaceException
238
+	 */
239
+	public function order()
240
+	{
241
+		return $this->get('PRC_order');
242
+	}
243
+
244
+
245
+	/**
246
+	 * get the author of the price
247
+	 *
248
+	 * @return int
249
+	 * @throws EE_Error
250
+	 * @throws InvalidArgumentException
251
+	 * @throws ReflectionException
252
+	 * @throws InvalidDataTypeException
253
+	 * @throws InvalidInterfaceException
254
+	 * @since 4.5.0
255
+	 */
256
+	public function wp_user()
257
+	{
258
+		return $this->get('PRC_wp_user');
259
+	}
260
+
261
+
262
+	/**
263
+	 * get is_default
264
+	 *
265
+	 * @return bool
266
+	 * @throws EE_Error
267
+	 * @throws InvalidArgumentException
268
+	 * @throws ReflectionException
269
+	 * @throws InvalidDataTypeException
270
+	 * @throws InvalidInterfaceException
271
+	 */
272
+	public function is_default()
273
+	{
274
+		return $this->get('PRC_is_default');
275
+	}
276
+
277
+
278
+	/**
279
+	 * get deleted
280
+	 *
281
+	 * @return bool
282
+	 * @throws EE_Error
283
+	 * @throws InvalidArgumentException
284
+	 * @throws ReflectionException
285
+	 * @throws InvalidDataTypeException
286
+	 * @throws InvalidInterfaceException
287
+	 */
288
+	public function deleted()
289
+	{
290
+		return $this->get('PRC_deleted');
291
+	}
292
+
293
+
294
+	/**
295
+	 * @return bool
296
+	 * @throws EE_Error
297
+	 * @throws InvalidArgumentException
298
+	 * @throws ReflectionException
299
+	 * @throws InvalidDataTypeException
300
+	 * @throws InvalidInterfaceException
301
+	 */
302
+	public function parent()
303
+	{
304
+		return $this->get('PRC_parent');
305
+	}
306
+
307
+
308
+	// some helper methods for getting info on the price_type for this price
309
+
310
+
311
+	/**
312
+	 * return whether the price is a base price or not
313
+	 *
314
+	 * @return boolean
315
+	 * @throws EE_Error
316
+	 * @throws InvalidArgumentException
317
+	 * @throws InvalidDataTypeException
318
+	 * @throws InvalidInterfaceException
319
+	 * @throws ReflectionException
320
+	 */
321
+	public function is_base_price()
322
+	{
323
+		$price_type = $this->type_obj();
324
+		return $price_type->is_base_price();
325
+	}
326
+
327
+
328
+	/**
329
+	 * @return EE_Base_Class|EE_Price_Type
330
+	 * @throws EE_Error
331
+	 * @throws InvalidArgumentException
332
+	 * @throws ReflectionException
333
+	 * @throws InvalidDataTypeException
334
+	 * @throws InvalidInterfaceException
335
+	 */
336
+	public function type_obj()
337
+	{
338
+		return $this->get_first_related('Price_Type');
339
+	}
340
+
341
+
342
+	/**
343
+	 * @return int
344
+	 * @throws EE_Error
345
+	 * @throws InvalidArgumentException
346
+	 * @throws ReflectionException
347
+	 * @throws InvalidDataTypeException
348
+	 * @throws InvalidInterfaceException
349
+	 */
350
+	public function type_order()
351
+	{
352
+		return $this->get_first_related('Price_Type')->order();
353
+	}
354
+
355
+
356
+	/**
357
+	 * Simply indicates whether this price increases or decreases the total
358
+	 *
359
+	 * @return boolean true = discount, otherwise adds to the total
360
+	 * @throws EE_Error
361
+	 * @throws InvalidArgumentException
362
+	 * @throws ReflectionException
363
+	 * @throws InvalidDataTypeException
364
+	 * @throws InvalidInterfaceException
365
+	 */
366
+	public function is_discount()
367
+	{
368
+		$price_type = $this->type_obj();
369
+		return $price_type->is_discount();
370
+	}
371
+
372
+
373
+	/**
374
+	 * whether the price is a percentage or not
375
+	 *
376
+	 * @return boolean
377
+	 * @throws EE_Error
378
+	 * @throws InvalidArgumentException
379
+	 * @throws InvalidDataTypeException
380
+	 * @throws InvalidInterfaceException
381
+	 * @throws ReflectionException
382
+	 */
383
+	public function is_percent()
384
+	{
385
+		$price_type = $this->type_obj();
386
+		return $price_type->is_percent();
387
+	}
388
+
389
+
390
+	/**
391
+	 * whether the price is a percentage or not
392
+	 *
393
+	 * @return boolean
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws ReflectionException
397
+	 * @throws InvalidDataTypeException
398
+	 * @throws InvalidInterfaceException
399
+	 */
400
+	public function is_surcharge()
401
+	{
402
+		$price_type = $this->type_obj();
403
+		return $price_type->is_surcharge();
404
+	}
405
+
406
+	/**
407
+	 * whether the price is a percentage or not
408
+	 *
409
+	 * @return boolean
410
+	 * @throws EE_Error
411
+	 * @throws InvalidArgumentException
412
+	 * @throws ReflectionException
413
+	 * @throws InvalidDataTypeException
414
+	 * @throws InvalidInterfaceException
415
+	 */
416
+	public function is_tax()
417
+	{
418
+		$price_type = $this->type_obj();
419
+		return $price_type->is_tax();
420
+	}
421
+
422
+
423
+	/**
424
+	 * return pretty price dependant on whether its a dollar or percent.
425
+	 *
426
+	 * @return string
427
+	 * @throws EE_Error
428
+	 * @throws InvalidArgumentException
429
+	 * @throws ReflectionException
430
+	 * @throws InvalidDataTypeException
431
+	 * @throws InvalidInterfaceException
432
+	 * @since 4.4.0
433
+	 */
434
+	public function pretty_price()
435
+	{
436
+		return ! $this->is_percent()
437
+			? $this->get_pretty('PRC_amount')
438
+			: $this->get('PRC_amount') . '%';
439
+	}
440
+
441
+
442
+	/**
443
+	 * @return mixed
444
+	 * @throws EE_Error
445
+	 * @throws InvalidArgumentException
446
+	 * @throws ReflectionException
447
+	 * @throws InvalidDataTypeException
448
+	 * @throws InvalidInterfaceException
449
+	 */
450
+	public function get_price_without_currency_symbol()
451
+	{
452
+		return str_replace(
453
+			EE_Registry::instance()->CFG->currency->sign,
454
+			'',
455
+			$this->get_pretty('PRC_amount')
456
+		);
457
+	}
458 458
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Price_Type.class.php 1 patch
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -13,276 +13,276 @@
 block discarded – undo
13 13
 class EE_Price_Type extends EE_Soft_Delete_Base_Class
14 14
 {
15 15
 
16
-    /**
17
-     * @param array $props_n_values
18
-     * @return EE_Price_Type
19
-     * @throws EE_Error
20
-     * @throws InvalidArgumentException
21
-     * @throws ReflectionException
22
-     * @throws InvalidDataTypeException
23
-     * @throws InvalidInterfaceException
24
-     */
25
-    public static function new_instance($props_n_values = array())
26
-    {
27
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__);
28
-        return $has_object ? $has_object : new self($props_n_values);
29
-    }
30
-
31
-
32
-    /**
33
-     * @param array $props_n_values
34
-     * @return EE_Price_Type
35
-     * @throws EE_Error
36
-     * @throws InvalidArgumentException
37
-     * @throws ReflectionException
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidInterfaceException
40
-     */
41
-    public static function new_instance_from_db($props_n_values = array())
42
-    {
43
-        return new self($props_n_values, true);
44
-    }
45
-
46
-
47
-    /**
48
-     * Set Price Type Name
49
-     *
50
-     * @param string $PRT_name
51
-     * @throws EE_Error
52
-     * @throws InvalidArgumentException
53
-     * @throws ReflectionException
54
-     * @throws InvalidDataTypeException
55
-     * @throws InvalidInterfaceException
56
-     */
57
-    public function set_name($PRT_name = '')
58
-    {
59
-        $this->set('PRT_name', $PRT_name);
60
-    }
61
-
62
-
63
-    /**
64
-     * Set Price Type a percent
65
-     *
66
-     * @param bool $PRT_is_percent
67
-     * @throws EE_Error
68
-     * @throws InvalidArgumentException
69
-     * @throws ReflectionException
70
-     * @throws InvalidDataTypeException
71
-     * @throws InvalidInterfaceException
72
-     */
73
-    public function set_is_percent($PRT_is_percent = false)
74
-    {
75
-        $this->set('PRT_is_percent', $PRT_is_percent);
76
-    }
77
-
78
-
79
-    /**
80
-     * Set Price Type order
81
-     *
82
-     * @param int $PRT_order
83
-     * @throws EE_Error
84
-     * @throws InvalidArgumentException
85
-     * @throws ReflectionException
86
-     * @throws InvalidDataTypeException
87
-     * @throws InvalidInterfaceException
88
-     */
89
-    public function set_order($PRT_order = 0)
90
-    {
91
-        $this->set('PRT_order', $PRT_order);
92
-    }
93
-
94
-
95
-    /**
96
-     * @throws EE_Error
97
-     * @throws InvalidArgumentException
98
-     * @throws InvalidDataTypeException
99
-     * @throws InvalidInterfaceException
100
-     * @throws ReflectionException
101
-     */
102
-    public function move_to_trash()
103
-    {
104
-        $this->set('PRT_deleted', true);
105
-    }
106
-
107
-
108
-    /**
109
-     * @throws EE_Error
110
-     * @throws InvalidArgumentException
111
-     * @throws InvalidDataTypeException
112
-     * @throws InvalidInterfaceException
113
-     * @throws ReflectionException
114
-     */
115
-    public function restore_from_trash()
116
-    {
117
-        $this->set('PRT_deleted', false);
118
-    }
119
-
120
-
121
-    /**
122
-     * get Price Type Name
123
-     *
124
-     * @return mixed
125
-     * @throws EE_Error
126
-     * @throws InvalidArgumentException
127
-     * @throws InvalidDataTypeException
128
-     * @throws InvalidInterfaceException
129
-     * @throws ReflectionException
130
-     */
131
-    public function name()
132
-    {
133
-        return $this->get('PRT_name');
134
-    }
135
-
136
-
137
-    /**
138
-     * get base Price Type
139
-     *
140
-     * @return mixed
141
-     * @throws EE_Error
142
-     * @throws InvalidArgumentException
143
-     * @throws InvalidDataTypeException
144
-     * @throws InvalidInterfaceException
145
-     * @throws ReflectionException
146
-     */
147
-    public function base_type()
148
-    {
149
-        return $this->get('PBT_ID');
150
-    }
151
-
152
-
153
-    /**
154
-     * @return mixed
155
-     * @throws EE_Error
156
-     * @throws InvalidArgumentException
157
-     * @throws ReflectionException
158
-     * @throws InvalidDataTypeException
159
-     * @throws InvalidInterfaceException
160
-     */
161
-    public function base_type_name()
162
-    {
163
-        return $this->get_pretty('PBT_ID');
164
-    }
165
-
166
-
167
-    /**
168
-     * get is Price Type a percent?
169
-     *
170
-     * @return mixed
171
-     * @throws EE_Error
172
-     * @throws InvalidArgumentException
173
-     * @throws InvalidDataTypeException
174
-     * @throws InvalidInterfaceException
175
-     * @throws ReflectionException
176
-     */
177
-    public function is_base_price()
178
-    {
179
-        return $this->get('PBT_ID') === EEM_Price_Type::base_type_base_price;
180
-    }
181
-
182
-
183
-    /**
184
-     * get is Price Type a percent?
185
-     *
186
-     * @return mixed
187
-     * @throws EE_Error
188
-     * @throws InvalidArgumentException
189
-     * @throws InvalidDataTypeException
190
-     * @throws InvalidInterfaceException
191
-     * @throws ReflectionException
192
-     */
193
-    public function is_percent()
194
-    {
195
-        return $this->get('PRT_is_percent');
196
-    }
197
-
198
-
199
-    /**
200
-     * @return bool
201
-     * @throws EE_Error
202
-     * @throws InvalidArgumentException
203
-     * @throws ReflectionException
204
-     * @throws InvalidDataTypeException
205
-     * @throws InvalidInterfaceException
206
-     */
207
-    public function is_discount()
208
-    {
209
-        return $this->get('PBT_ID') === EEM_Price_Type::base_type_discount;
210
-    }
211
-
212
-
213
-    /**
214
-     * @return bool
215
-     * @throws EE_Error
216
-     * @throws InvalidArgumentException
217
-     * @throws ReflectionException
218
-     * @throws InvalidDataTypeException
219
-     * @throws InvalidInterfaceException
220
-     */
221
-    public function is_surcharge()
222
-    {
223
-        return $this->get('PBT_ID') === EEM_Price_Type::base_type_surcharge;
224
-    }
225
-
226
-
227
-    /**
228
-     * @return bool
229
-     * @throws EE_Error
230
-     * @throws InvalidArgumentException
231
-     * @throws ReflectionException
232
-     * @throws InvalidDataTypeException
233
-     * @throws InvalidInterfaceException
234
-     */
235
-    public function is_tax()
236
-    {
237
-        return $this->get('PBT_ID') === EEM_Price_Type::base_type_tax;
238
-    }
239
-
240
-
241
-    /**
242
-     * get the author of the price type.
243
-     *
244
-     * @return int
245
-     * @throws EE_Error
246
-     * @throws InvalidArgumentException
247
-     * @throws ReflectionException
248
-     * @throws InvalidDataTypeException
249
-     * @throws InvalidInterfaceException
250
-     * @since 4.5.0
251
-     */
252
-    public function wp_user()
253
-    {
254
-        return $this->get('PRT_wp_user');
255
-    }
256
-
257
-
258
-    /**
259
-     * get Price Type order
260
-     *
261
-     * @return int
262
-     * @throws EE_Error
263
-     * @throws InvalidArgumentException
264
-     * @throws InvalidDataTypeException
265
-     * @throws InvalidInterfaceException
266
-     * @throws ReflectionException
267
-     */
268
-    public function order()
269
-    {
270
-        return $this->get('PRT_order');
271
-    }
272
-
273
-
274
-    /**
275
-     * get  is Price Type deleted ?
276
-     *
277
-     * @return mixed
278
-     * @throws EE_Error
279
-     * @throws InvalidArgumentException
280
-     * @throws InvalidDataTypeException
281
-     * @throws InvalidInterfaceException
282
-     * @throws ReflectionException
283
-     */
284
-    public function deleted()
285
-    {
286
-        return $this->get('PRT_deleted');
287
-    }
16
+	/**
17
+	 * @param array $props_n_values
18
+	 * @return EE_Price_Type
19
+	 * @throws EE_Error
20
+	 * @throws InvalidArgumentException
21
+	 * @throws ReflectionException
22
+	 * @throws InvalidDataTypeException
23
+	 * @throws InvalidInterfaceException
24
+	 */
25
+	public static function new_instance($props_n_values = array())
26
+	{
27
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
28
+		return $has_object ? $has_object : new self($props_n_values);
29
+	}
30
+
31
+
32
+	/**
33
+	 * @param array $props_n_values
34
+	 * @return EE_Price_Type
35
+	 * @throws EE_Error
36
+	 * @throws InvalidArgumentException
37
+	 * @throws ReflectionException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidInterfaceException
40
+	 */
41
+	public static function new_instance_from_db($props_n_values = array())
42
+	{
43
+		return new self($props_n_values, true);
44
+	}
45
+
46
+
47
+	/**
48
+	 * Set Price Type Name
49
+	 *
50
+	 * @param string $PRT_name
51
+	 * @throws EE_Error
52
+	 * @throws InvalidArgumentException
53
+	 * @throws ReflectionException
54
+	 * @throws InvalidDataTypeException
55
+	 * @throws InvalidInterfaceException
56
+	 */
57
+	public function set_name($PRT_name = '')
58
+	{
59
+		$this->set('PRT_name', $PRT_name);
60
+	}
61
+
62
+
63
+	/**
64
+	 * Set Price Type a percent
65
+	 *
66
+	 * @param bool $PRT_is_percent
67
+	 * @throws EE_Error
68
+	 * @throws InvalidArgumentException
69
+	 * @throws ReflectionException
70
+	 * @throws InvalidDataTypeException
71
+	 * @throws InvalidInterfaceException
72
+	 */
73
+	public function set_is_percent($PRT_is_percent = false)
74
+	{
75
+		$this->set('PRT_is_percent', $PRT_is_percent);
76
+	}
77
+
78
+
79
+	/**
80
+	 * Set Price Type order
81
+	 *
82
+	 * @param int $PRT_order
83
+	 * @throws EE_Error
84
+	 * @throws InvalidArgumentException
85
+	 * @throws ReflectionException
86
+	 * @throws InvalidDataTypeException
87
+	 * @throws InvalidInterfaceException
88
+	 */
89
+	public function set_order($PRT_order = 0)
90
+	{
91
+		$this->set('PRT_order', $PRT_order);
92
+	}
93
+
94
+
95
+	/**
96
+	 * @throws EE_Error
97
+	 * @throws InvalidArgumentException
98
+	 * @throws InvalidDataTypeException
99
+	 * @throws InvalidInterfaceException
100
+	 * @throws ReflectionException
101
+	 */
102
+	public function move_to_trash()
103
+	{
104
+		$this->set('PRT_deleted', true);
105
+	}
106
+
107
+
108
+	/**
109
+	 * @throws EE_Error
110
+	 * @throws InvalidArgumentException
111
+	 * @throws InvalidDataTypeException
112
+	 * @throws InvalidInterfaceException
113
+	 * @throws ReflectionException
114
+	 */
115
+	public function restore_from_trash()
116
+	{
117
+		$this->set('PRT_deleted', false);
118
+	}
119
+
120
+
121
+	/**
122
+	 * get Price Type Name
123
+	 *
124
+	 * @return mixed
125
+	 * @throws EE_Error
126
+	 * @throws InvalidArgumentException
127
+	 * @throws InvalidDataTypeException
128
+	 * @throws InvalidInterfaceException
129
+	 * @throws ReflectionException
130
+	 */
131
+	public function name()
132
+	{
133
+		return $this->get('PRT_name');
134
+	}
135
+
136
+
137
+	/**
138
+	 * get base Price Type
139
+	 *
140
+	 * @return mixed
141
+	 * @throws EE_Error
142
+	 * @throws InvalidArgumentException
143
+	 * @throws InvalidDataTypeException
144
+	 * @throws InvalidInterfaceException
145
+	 * @throws ReflectionException
146
+	 */
147
+	public function base_type()
148
+	{
149
+		return $this->get('PBT_ID');
150
+	}
151
+
152
+
153
+	/**
154
+	 * @return mixed
155
+	 * @throws EE_Error
156
+	 * @throws InvalidArgumentException
157
+	 * @throws ReflectionException
158
+	 * @throws InvalidDataTypeException
159
+	 * @throws InvalidInterfaceException
160
+	 */
161
+	public function base_type_name()
162
+	{
163
+		return $this->get_pretty('PBT_ID');
164
+	}
165
+
166
+
167
+	/**
168
+	 * get is Price Type a percent?
169
+	 *
170
+	 * @return mixed
171
+	 * @throws EE_Error
172
+	 * @throws InvalidArgumentException
173
+	 * @throws InvalidDataTypeException
174
+	 * @throws InvalidInterfaceException
175
+	 * @throws ReflectionException
176
+	 */
177
+	public function is_base_price()
178
+	{
179
+		return $this->get('PBT_ID') === EEM_Price_Type::base_type_base_price;
180
+	}
181
+
182
+
183
+	/**
184
+	 * get is Price Type a percent?
185
+	 *
186
+	 * @return mixed
187
+	 * @throws EE_Error
188
+	 * @throws InvalidArgumentException
189
+	 * @throws InvalidDataTypeException
190
+	 * @throws InvalidInterfaceException
191
+	 * @throws ReflectionException
192
+	 */
193
+	public function is_percent()
194
+	{
195
+		return $this->get('PRT_is_percent');
196
+	}
197
+
198
+
199
+	/**
200
+	 * @return bool
201
+	 * @throws EE_Error
202
+	 * @throws InvalidArgumentException
203
+	 * @throws ReflectionException
204
+	 * @throws InvalidDataTypeException
205
+	 * @throws InvalidInterfaceException
206
+	 */
207
+	public function is_discount()
208
+	{
209
+		return $this->get('PBT_ID') === EEM_Price_Type::base_type_discount;
210
+	}
211
+
212
+
213
+	/**
214
+	 * @return bool
215
+	 * @throws EE_Error
216
+	 * @throws InvalidArgumentException
217
+	 * @throws ReflectionException
218
+	 * @throws InvalidDataTypeException
219
+	 * @throws InvalidInterfaceException
220
+	 */
221
+	public function is_surcharge()
222
+	{
223
+		return $this->get('PBT_ID') === EEM_Price_Type::base_type_surcharge;
224
+	}
225
+
226
+
227
+	/**
228
+	 * @return bool
229
+	 * @throws EE_Error
230
+	 * @throws InvalidArgumentException
231
+	 * @throws ReflectionException
232
+	 * @throws InvalidDataTypeException
233
+	 * @throws InvalidInterfaceException
234
+	 */
235
+	public function is_tax()
236
+	{
237
+		return $this->get('PBT_ID') === EEM_Price_Type::base_type_tax;
238
+	}
239
+
240
+
241
+	/**
242
+	 * get the author of the price type.
243
+	 *
244
+	 * @return int
245
+	 * @throws EE_Error
246
+	 * @throws InvalidArgumentException
247
+	 * @throws ReflectionException
248
+	 * @throws InvalidDataTypeException
249
+	 * @throws InvalidInterfaceException
250
+	 * @since 4.5.0
251
+	 */
252
+	public function wp_user()
253
+	{
254
+		return $this->get('PRT_wp_user');
255
+	}
256
+
257
+
258
+	/**
259
+	 * get Price Type order
260
+	 *
261
+	 * @return int
262
+	 * @throws EE_Error
263
+	 * @throws InvalidArgumentException
264
+	 * @throws InvalidDataTypeException
265
+	 * @throws InvalidInterfaceException
266
+	 * @throws ReflectionException
267
+	 */
268
+	public function order()
269
+	{
270
+		return $this->get('PRT_order');
271
+	}
272
+
273
+
274
+	/**
275
+	 * get  is Price Type deleted ?
276
+	 *
277
+	 * @return mixed
278
+	 * @throws EE_Error
279
+	 * @throws InvalidArgumentException
280
+	 * @throws InvalidDataTypeException
281
+	 * @throws InvalidInterfaceException
282
+	 * @throws ReflectionException
283
+	 */
284
+	public function deleted()
285
+	{
286
+		return $this->get('PRT_deleted');
287
+	}
288 288
 }
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
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 class DatetimesConnectionOrderbyEnum extends EnumBase
16 16
 {
17 17
 
18
-    /**
19
-     * DatetimesConnectionOrderbyEnum constructor.
20
-     */
21
-    public function __construct()
22
-    {
23
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
24
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
-        parent::__construct();
26
-    }
18
+	/**
19
+	 * DatetimesConnectionOrderbyEnum constructor.
20
+	 */
21
+	public function __construct()
22
+	{
23
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
24
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    protected function getValues(): array
33
-    {
34
-        return [
35
-            'NAME'     => [
36
-                'value'       => 'DTT_name',
37
-                'description' => esc_html__('Order by name', 'event_espresso'),
38
-            ],
39
-            'START_DATE'     => [
40
-                'value'       => 'DTT_EVT_start',
41
-                'description' => esc_html__('Order by start date', 'event_espresso'),
42
-            ],
43
-        ];
44
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	protected function getValues(): array
33
+	{
34
+		return [
35
+			'NAME'     => [
36
+				'value'       => 'DTT_name',
37
+				'description' => esc_html__('Order by name', 'event_espresso'),
38
+			],
39
+			'START_DATE'     => [
40
+				'value'       => 'DTT_EVT_start',
41
+				'description' => esc_html__('Order by start date', 'event_espresso'),
42
+			],
43
+		];
44
+	}
45 45
 }
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
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
 class TicketsConnectionOrderbyEnum extends EnumBase
16 16
 {
17 17
 
18
-    /**
19
-     * TicketsConnectionOrderbyEnum constructor.
20
-     */
21
-    public function __construct()
22
-    {
23
-        $this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
24
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
-        parent::__construct();
26
-    }
18
+	/**
19
+	 * TicketsConnectionOrderbyEnum constructor.
20
+	 */
21
+	public function __construct()
22
+	{
23
+		$this->setName($this->namespace . 'TicketsConnectionOrderbyEnum');
24
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    protected function getValues(): array
33
-    {
34
-        return [
35
-            'NAME'     => [
36
-                'value'       => 'TKT_name',
37
-                'description' => esc_html__('Order by name', 'event_espresso'),
38
-            ],
39
-            'START_DATE'     => [
40
-                'value'       => 'TKT_start_date',
41
-                'description' => esc_html__('Order by start date', 'event_espresso'),
42
-            ],
43
-        ];
44
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	protected function getValues(): array
33
+	{
34
+		return [
35
+			'NAME'     => [
36
+				'value'       => 'TKT_name',
37
+				'description' => esc_html__('Order by name', 'event_espresso'),
38
+			],
39
+			'START_DATE'     => [
40
+				'value'       => 'TKT_start_date',
41
+				'description' => esc_html__('Order by start date', 'event_espresso'),
42
+			],
43
+		];
44
+	}
45 45
 }
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
@@ -16,35 +16,35 @@
 block discarded – undo
16 16
 class PriceBaseTypeEnum extends EnumBase
17 17
 {
18 18
 
19
-    /**
20
-     * PriceBaseTypeEnum constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'PriceBaseTypeEnum');
25
-        $this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * PriceBaseTypeEnum constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'PriceBaseTypeEnum');
25
+		$this->setDescription(esc_html__('Price Base type ID', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    protected function getValues(): array
34
-    {
35
-        return [
36
-            'BASE_PRICE'     => [
37
-                'value'       => EEM_Price_Type::base_type_base_price,
38
-            ],
39
-            'DISCOUNT'     => [
40
-                'value'       => EEM_Price_Type::base_type_discount,
41
-            ],
42
-            'SURCHARGE'     => [
43
-                'value'       => EEM_Price_Type::base_type_surcharge,
44
-            ],
45
-            'TAX'     => [
46
-                'value'       => EEM_Price_Type::base_type_tax,
47
-            ],
48
-        ];
49
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	protected function getValues(): array
34
+	{
35
+		return [
36
+			'BASE_PRICE'     => [
37
+				'value'       => EEM_Price_Type::base_type_base_price,
38
+			],
39
+			'DISCOUNT'     => [
40
+				'value'       => EEM_Price_Type::base_type_discount,
41
+			],
42
+			'SURCHARGE'     => [
43
+				'value'       => EEM_Price_Type::base_type_surcharge,
44
+			],
45
+			'TAX'     => [
46
+				'value'       => EEM_Price_Type::base_type_tax,
47
+			],
48
+		];
49
+	}
50 50
 }
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
@@ -17,31 +17,31 @@
 block discarded – undo
17 17
 class DatetimesConnectionOrderbyInput extends InputBase
18 18
 {
19 19
 
20
-    /**
21
-     * DatetimesConnectionOrderbyInput constructor.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
26
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
-        parent::__construct();
28
-    }
20
+	/**
21
+	 * DatetimesConnectionOrderbyInput constructor.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyInput');
26
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27
+		parent::__construct();
28
+	}
29 29
 
30 30
 
31
-    /**
32
-     * @return GraphQLFieldInterface[]
33
-     */
34
-    protected function getFields(): array
35
-    {
36
-        return [
37
-            new GraphQLField(
38
-                'field',
39
-                ['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
40
-            ),
41
-            new GraphQLField(
42
-                'order',
43
-                'OrderEnum'
44
-            ),
45
-        ];
46
-    }
31
+	/**
32
+	 * @return GraphQLFieldInterface[]
33
+	 */
34
+	protected function getFields(): array
35
+	{
36
+		return [
37
+			new GraphQLField(
38
+				'field',
39
+				['non_null' => $this->namespace . 'DatetimesConnectionOrderbyEnum']
40
+			),
41
+			new GraphQLField(
42
+				'order',
43
+				'OrderEnum'
44
+			),
45
+		];
46
+	}
47 47
 }
Please login to merge, or discard this patch.