Completed
Branch yet-another-batch-of-ui-fixes (371f49)
by
unknown
30:27 queued 22:46
created
core/db_models/EEM_Change_Log.model.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
                 ),
114 114
             ),
115 115
         );
116
-        $this->_model_relations    = array();
116
+        $this->_model_relations = array();
117 117
         foreach ($models_this_can_attach_to as $model) {
118 118
             if ($model != 'Change_Log') {
119
-                $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
119
+                $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
120 120
             }
121 121
         }
122 122
         // use completely custom caps for this
123 123
         unset($this->_cap_restriction_generators);
124 124
         // caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
125 125
         foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
126
-            $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ]
126
+            $this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()]
127 127
                 = new EE_Return_None_Where_Conditions();
128 128
         }
129 129
         parent::__construct($timezone);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function gateway_log($message, $related_obj_id, $related_obj_type)
170 170
     {
171
-        if (! EE_Registry::instance()->is_model_name($related_obj_type)) {
171
+        if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
172 172
             throw new EE_Error(
173 173
                 sprintf(
174 174
                     esc_html__(
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         global $wpdb;
218 218
         return $wpdb->query(
219 219
             $wpdb->prepare(
220
-                'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
220
+                'DELETE FROM '.$this->table().' WHERE LOG_type = %s AND LOG_time < %s',
221 221
                 EEM_Change_Log::type_gateway,
222 222
                 $datetime->format(EE_Datetime_Field::mysql_timestamp_format)
223 223
             )
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $type_identifier_map = self::get_pretty_label_map_for_registered_types();
258 258
         // we fallback to the incoming type identifier if there is no localized label for it.
259
-        return isset($type_identifier_map[ $type_identifier ])
260
-            ? $type_identifier_map[ $type_identifier ]
259
+        return isset($type_identifier_map[$type_identifier])
260
+            ? $type_identifier_map[$type_identifier]
261 261
             : $type_identifier;
262 262
     }
263 263
 }
Please login to merge, or discard this patch.
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -10,93 +10,93 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class EEM_Change_Log extends EEM_Base
12 12
 {
13
-    /**
14
-     * the related object was created log type
15
-     */
16
-    const type_create = 'create';
17
-    /**
18
-     * the related object was updated (changed, or soft-deleted)
19
-     */
20
-    const type_update = 'update';
21
-    /**
22
-     * the related object was deleted permanently
23
-     */
24
-    const type_delete = 'delete';
25
-    /**
26
-     * the related item had something worth noting happen on it, but
27
-     * only for the purposes of debugging problems
28
-     */
29
-    const type_debug = 'debug';
30
-    /**
31
-     * the related item had an error occur on it
32
-     */
33
-    const type_error = 'error';
34
-    /**
35
-     * the related item is regarding some gateway interaction, like an IPN
36
-     * or request to process a payment
37
-     */
38
-    const type_gateway = 'gateway';
13
+	/**
14
+	 * the related object was created log type
15
+	 */
16
+	const type_create = 'create';
17
+	/**
18
+	 * the related object was updated (changed, or soft-deleted)
19
+	 */
20
+	const type_update = 'update';
21
+	/**
22
+	 * the related object was deleted permanently
23
+	 */
24
+	const type_delete = 'delete';
25
+	/**
26
+	 * the related item had something worth noting happen on it, but
27
+	 * only for the purposes of debugging problems
28
+	 */
29
+	const type_debug = 'debug';
30
+	/**
31
+	 * the related item had an error occur on it
32
+	 */
33
+	const type_error = 'error';
34
+	/**
35
+	 * the related item is regarding some gateway interaction, like an IPN
36
+	 * or request to process a payment
37
+	 */
38
+	const type_gateway = 'gateway';
39 39
 
40
-    /**
41
-     * private instance of the EEM_Change_Log object
42
-     *
43
-     * @access private
44
-     * @var EEM_Change_Log $_instance
45
-     */
46
-    protected static $_instance = null;
40
+	/**
41
+	 * private instance of the EEM_Change_Log object
42
+	 *
43
+	 * @access private
44
+	 * @var EEM_Change_Log $_instance
45
+	 */
46
+	protected static $_instance = null;
47 47
 
48 48
 
49
-    /**
50
-     * constructor
51
-     *
52
-     * @access protected
53
-     * @param null $timezone
54
-     * @throws EE_Error
55
-     */
56
-    protected function __construct($timezone = null)
57
-    {
58
-        global $current_user;
59
-        $this->singular_item       = esc_html__('Log', 'event_espresso');
60
-        $this->plural_item         = esc_html__('Logs', 'event_espresso');
61
-        $this->_tables             = array(
62
-            'Log' => new EE_Primary_Table('esp_log', 'LOG_ID'),
63
-        );
64
-        $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
65
-        $this->_fields             = array(
66
-            'Log' => array(
67
-                'LOG_ID'      => new EE_Primary_Key_Int_Field('LOG_ID', esc_html__('Log ID', 'event_espresso')),
68
-                'LOG_time'    => new EE_Datetime_Field(
69
-                    'LOG_time',
70
-                    esc_html__("Log Time", 'event_espresso'),
71
-                    false,
72
-                    EE_Datetime_Field::now
73
-                ),
74
-                'OBJ_ID'      => new EE_Foreign_Key_String_Field(
75
-                    'OBJ_ID',
76
-                    esc_html__("Object ID (int or string)", 'event_espresso'),
77
-                    true,
78
-                    null,
79
-                    $models_this_can_attach_to
80
-                ),
81
-                'OBJ_type'    => new EE_Any_Foreign_Model_Name_Field(
82
-                    'OBJ_type',
83
-                    esc_html__("Object Type", 'event_espresso'),
84
-                    true,
85
-                    null,
86
-                    $models_this_can_attach_to
87
-                ),
88
-                'LOG_type'    => new EE_Plain_Text_Field(
89
-                    'LOG_type',
90
-                    esc_html__("Type of log entry", "event_espresso"),
91
-                    false,
92
-                    self::type_debug
93
-                ),
94
-                'LOG_message' => new EE_Maybe_Serialized_Text_Field(
95
-                    'LOG_message',
96
-                    esc_html__("Log Message (body)", 'event_espresso'),
97
-                    true
98
-                ),
99
-                /*
49
+	/**
50
+	 * constructor
51
+	 *
52
+	 * @access protected
53
+	 * @param null $timezone
54
+	 * @throws EE_Error
55
+	 */
56
+	protected function __construct($timezone = null)
57
+	{
58
+		global $current_user;
59
+		$this->singular_item       = esc_html__('Log', 'event_espresso');
60
+		$this->plural_item         = esc_html__('Logs', 'event_espresso');
61
+		$this->_tables             = array(
62
+			'Log' => new EE_Primary_Table('esp_log', 'LOG_ID'),
63
+		);
64
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
65
+		$this->_fields             = array(
66
+			'Log' => array(
67
+				'LOG_ID'      => new EE_Primary_Key_Int_Field('LOG_ID', esc_html__('Log ID', 'event_espresso')),
68
+				'LOG_time'    => new EE_Datetime_Field(
69
+					'LOG_time',
70
+					esc_html__("Log Time", 'event_espresso'),
71
+					false,
72
+					EE_Datetime_Field::now
73
+				),
74
+				'OBJ_ID'      => new EE_Foreign_Key_String_Field(
75
+					'OBJ_ID',
76
+					esc_html__("Object ID (int or string)", 'event_espresso'),
77
+					true,
78
+					null,
79
+					$models_this_can_attach_to
80
+				),
81
+				'OBJ_type'    => new EE_Any_Foreign_Model_Name_Field(
82
+					'OBJ_type',
83
+					esc_html__("Object Type", 'event_espresso'),
84
+					true,
85
+					null,
86
+					$models_this_can_attach_to
87
+				),
88
+				'LOG_type'    => new EE_Plain_Text_Field(
89
+					'LOG_type',
90
+					esc_html__("Type of log entry", "event_espresso"),
91
+					false,
92
+					self::type_debug
93
+				),
94
+				'LOG_message' => new EE_Maybe_Serialized_Text_Field(
95
+					'LOG_message',
96
+					esc_html__("Log Message (body)", 'event_espresso'),
97
+					true
98
+				),
99
+				/*
100 100
                  * Note: when querying for a change log's user, the OBJ_ID and OBJ_type fields are used,
101 101
                  * not the LOG_wp_user field. E.g.,
102 102
                  * `EEM_Change_Log::instance()->get_all(array(array('WP_User.ID'=>1)))` will actually return
@@ -105,158 +105,158 @@  discard block
 block discarded – undo
105 105
                  *  If you want the latter, you can't use the model's magic joining. E.g, you would need to do
106 106
                  * `EEM_Change_Log::instance()->get_all(array(array('LOG_wp_user' => 1)))`.
107 107
                  */
108
-                'LOG_wp_user' => new EE_WP_User_Field(
109
-                    'LOG_wp_user',
110
-                    esc_html__("User who was logged in while this occurred", 'event_espresso'),
111
-                    true
112
-                ),
113
-            ),
114
-        );
115
-        $this->_model_relations    = array();
116
-        foreach ($models_this_can_attach_to as $model) {
117
-            if ($model != 'Change_Log') {
118
-                $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
119
-            }
120
-        }
121
-        // use completely custom caps for this
122
-        unset($this->_cap_restriction_generators);
123
-        // caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
124
-        foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
125
-            $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ]
126
-                = new EE_Return_None_Where_Conditions();
127
-        }
128
-        parent::__construct($timezone);
129
-    }
108
+				'LOG_wp_user' => new EE_WP_User_Field(
109
+					'LOG_wp_user',
110
+					esc_html__("User who was logged in while this occurred", 'event_espresso'),
111
+					true
112
+				),
113
+			),
114
+		);
115
+		$this->_model_relations    = array();
116
+		foreach ($models_this_can_attach_to as $model) {
117
+			if ($model != 'Change_Log') {
118
+				$this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
119
+			}
120
+		}
121
+		// use completely custom caps for this
122
+		unset($this->_cap_restriction_generators);
123
+		// caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
124
+		foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
125
+			$this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ]
126
+				= new EE_Return_None_Where_Conditions();
127
+		}
128
+		parent::__construct($timezone);
129
+	}
130 130
 
131
-    /**
132
-     * @param string        $log_type !see the acceptable values of LOG_type in EEM__Change_Log::__construct
133
-     * @param mixed         $message  array|string of the message you want to record
134
-     * @param EE_Base_Class $related_model_obj
135
-     * @return EE_Change_Log
136
-     * @throws EE_Error
137
-     */
138
-    public function log($log_type, $message, $related_model_obj)
139
-    {
140
-        if ($related_model_obj instanceof EE_Base_Class) {
141
-            $obj_id   = $related_model_obj->ID();
142
-            $obj_type = $related_model_obj->get_model()->get_this_model_name();
143
-        } else {
144
-            $obj_id   = null;
145
-            $obj_type = null;
146
-        }
147
-        /** @var EE_Change_Log $log */
148
-        $log = EE_Change_Log::new_instance(array(
149
-            'LOG_type'    => $log_type,
150
-            'LOG_message' => $message,
151
-            'OBJ_ID'      => $obj_id,
152
-            'OBJ_type'    => $obj_type,
153
-        ));
154
-        $log->save();
155
-        return $log;
156
-    }
131
+	/**
132
+	 * @param string        $log_type !see the acceptable values of LOG_type in EEM__Change_Log::__construct
133
+	 * @param mixed         $message  array|string of the message you want to record
134
+	 * @param EE_Base_Class $related_model_obj
135
+	 * @return EE_Change_Log
136
+	 * @throws EE_Error
137
+	 */
138
+	public function log($log_type, $message, $related_model_obj)
139
+	{
140
+		if ($related_model_obj instanceof EE_Base_Class) {
141
+			$obj_id   = $related_model_obj->ID();
142
+			$obj_type = $related_model_obj->get_model()->get_this_model_name();
143
+		} else {
144
+			$obj_id   = null;
145
+			$obj_type = null;
146
+		}
147
+		/** @var EE_Change_Log $log */
148
+		$log = EE_Change_Log::new_instance(array(
149
+			'LOG_type'    => $log_type,
150
+			'LOG_message' => $message,
151
+			'OBJ_ID'      => $obj_id,
152
+			'OBJ_type'    => $obj_type,
153
+		));
154
+		$log->save();
155
+		return $log;
156
+	}
157 157
 
158 158
 
159
-    /**
160
-     * Adds a gateway log for the specified object, given its ID and type
161
-     *
162
-     * @param string $message
163
-     * @param mixed  $related_obj_id
164
-     * @param string $related_obj_type
165
-     * @throws EE_Error
166
-     * @return EE_Change_Log
167
-     */
168
-    public function gateway_log($message, $related_obj_id, $related_obj_type)
169
-    {
170
-        if (! EE_Registry::instance()->is_model_name($related_obj_type)) {
171
-            throw new EE_Error(
172
-                sprintf(
173
-                    esc_html__(
174
-                        "'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc",
175
-                        "event_espresso"
176
-                    ),
177
-                    $related_obj_type
178
-                )
179
-            );
180
-        }
181
-        /** @var EE_Change_Log $log */
182
-        $log = EE_Change_Log::new_instance(array(
183
-            'LOG_type'    => EEM_Change_Log::type_gateway,
184
-            'LOG_message' => $message,
185
-            'OBJ_ID'      => $related_obj_id,
186
-            'OBJ_type'    => $related_obj_type,
187
-        ));
188
-        $log->save();
189
-        return $log;
190
-    }
159
+	/**
160
+	 * Adds a gateway log for the specified object, given its ID and type
161
+	 *
162
+	 * @param string $message
163
+	 * @param mixed  $related_obj_id
164
+	 * @param string $related_obj_type
165
+	 * @throws EE_Error
166
+	 * @return EE_Change_Log
167
+	 */
168
+	public function gateway_log($message, $related_obj_id, $related_obj_type)
169
+	{
170
+		if (! EE_Registry::instance()->is_model_name($related_obj_type)) {
171
+			throw new EE_Error(
172
+				sprintf(
173
+					esc_html__(
174
+						"'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc",
175
+						"event_espresso"
176
+					),
177
+					$related_obj_type
178
+				)
179
+			);
180
+		}
181
+		/** @var EE_Change_Log $log */
182
+		$log = EE_Change_Log::new_instance(array(
183
+			'LOG_type'    => EEM_Change_Log::type_gateway,
184
+			'LOG_message' => $message,
185
+			'OBJ_ID'      => $related_obj_id,
186
+			'OBJ_type'    => $related_obj_type,
187
+		));
188
+		$log->save();
189
+		return $log;
190
+	}
191 191
 
192 192
 
193
-    /**
194
-     * Just gets the bare-bones wpdb results as an array in cases where efficiency is essential
195
-     *
196
-     * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
197
-     * @return array of arrays
198
-     * @throws EE_Error
199
-     */
200
-    public function get_all_efficiently($query_params)
201
-    {
202
-        return $this->_get_all_wpdb_results($query_params);
203
-    }
193
+	/**
194
+	 * Just gets the bare-bones wpdb results as an array in cases where efficiency is essential
195
+	 *
196
+	 * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md
197
+	 * @return array of arrays
198
+	 * @throws EE_Error
199
+	 */
200
+	public function get_all_efficiently($query_params)
201
+	{
202
+		return $this->_get_all_wpdb_results($query_params);
203
+	}
204 204
 
205 205
 
206
-    /**
207
-     * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use
208
-     * models after this, they may be out-of-sync with the database
209
-     *
210
-     * @param DateTime $datetime
211
-     * @return false|int
212
-     * @throws EE_Error
213
-     */
214
-    public function delete_gateway_logs_older_than(DateTime $datetime)
215
-    {
216
-        global $wpdb;
217
-        return $wpdb->query(
218
-            $wpdb->prepare(
219
-                'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
220
-                EEM_Change_Log::type_gateway,
221
-                $datetime->format(EE_Datetime_Field::mysql_timestamp_format)
222
-            )
223
-        );
224
-    }
206
+	/**
207
+	 * Executes a database query to delete gateway logs. Does not affect model objects, so if you attempt to use
208
+	 * models after this, they may be out-of-sync with the database
209
+	 *
210
+	 * @param DateTime $datetime
211
+	 * @return false|int
212
+	 * @throws EE_Error
213
+	 */
214
+	public function delete_gateway_logs_older_than(DateTime $datetime)
215
+	{
216
+		global $wpdb;
217
+		return $wpdb->query(
218
+			$wpdb->prepare(
219
+				'DELETE FROM ' . $this->table() . ' WHERE LOG_type = %s AND LOG_time < %s',
220
+				EEM_Change_Log::type_gateway,
221
+				$datetime->format(EE_Datetime_Field::mysql_timestamp_format)
222
+			)
223
+		);
224
+	}
225 225
 
226 226
 
227
-    /**
228
-     * Returns the map of type to pretty label for identifiers used for `LOG_type`.  Client code can register their own
229
-     * map vai the given filter.
230
-     *
231
-     * @return array
232
-     */
233
-    public static function get_pretty_label_map_for_registered_types()
234
-    {
235
-        return apply_filters(
236
-            'FHEE__EEM_Change_Log__get_pretty_label_map_for_registered_types',
237
-            array(
238
-                self::type_create =>  esc_html__("Create", "event_espresso"),
239
-                self::type_update =>  esc_html__("Update", "event_espresso"),
240
-                self::type_delete => esc_html__("Delete", "event_espresso"),
241
-                self::type_debug =>  esc_html__("Debug", "event_espresso"),
242
-                self::type_error =>  esc_html__("Error", "event_espresso"),
243
-                self::type_gateway => esc_html__("Gateway Interaction (IPN or Direct Payment)", 'event_espresso')
244
-            )
245
-        );
246
-    }
227
+	/**
228
+	 * Returns the map of type to pretty label for identifiers used for `LOG_type`.  Client code can register their own
229
+	 * map vai the given filter.
230
+	 *
231
+	 * @return array
232
+	 */
233
+	public static function get_pretty_label_map_for_registered_types()
234
+	{
235
+		return apply_filters(
236
+			'FHEE__EEM_Change_Log__get_pretty_label_map_for_registered_types',
237
+			array(
238
+				self::type_create =>  esc_html__("Create", "event_espresso"),
239
+				self::type_update =>  esc_html__("Update", "event_espresso"),
240
+				self::type_delete => esc_html__("Delete", "event_espresso"),
241
+				self::type_debug =>  esc_html__("Debug", "event_espresso"),
242
+				self::type_error =>  esc_html__("Error", "event_espresso"),
243
+				self::type_gateway => esc_html__("Gateway Interaction (IPN or Direct Payment)", 'event_espresso')
244
+			)
245
+		);
246
+	}
247 247
 
248 248
 
249
-    /**
250
-     * Return the pretty (localized) label for the given log type identifier.
251
-     * @param string $type_identifier
252
-     * @return string
253
-     */
254
-    public static function get_pretty_label_for_type($type_identifier)
255
-    {
256
-        $type_identifier_map = self::get_pretty_label_map_for_registered_types();
257
-        // we fallback to the incoming type identifier if there is no localized label for it.
258
-        return isset($type_identifier_map[ $type_identifier ])
259
-            ? $type_identifier_map[ $type_identifier ]
260
-            : $type_identifier;
261
-    }
249
+	/**
250
+	 * Return the pretty (localized) label for the given log type identifier.
251
+	 * @param string $type_identifier
252
+	 * @return string
253
+	 */
254
+	public static function get_pretty_label_for_type($type_identifier)
255
+	{
256
+		$type_identifier_map = self::get_pretty_label_map_for_registered_types();
257
+		// we fallback to the incoming type identifier if there is no localized label for it.
258
+		return isset($type_identifier_map[ $type_identifier ])
259
+			? $type_identifier_map[ $type_identifier ]
260
+			: $type_identifier;
261
+	}
262 262
 }
Please login to merge, or discard this patch.
core/services/form/meta/inputs/Button.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class Button
6 6
 {
7
-    /**
8
-     * indicates that the HTML input type is 'button'
9
-     */
10
-    public const TYPE_BUTTON = 'button';
11
-
12
-    /**
13
-     * indicates that the HTML input type is 'reset'
14
-     */
15
-    public const TYPE_BUTTON_RESET = 'reset';
16
-
17
-    /**
18
-     * indicates that the HTML input type is 'submit'
19
-     */
20
-    public const TYPE_BUTTON_SUBMIT = 'submit';
21
-
22
-
23
-    /**
24
-     * @var array
25
-     */
26
-    private $valid_type_options;
27
-
28
-
29
-    public function __construct()
30
-    {
31
-        $this->valid_type_options = apply_filters(
32
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options',
33
-            [
34
-                Button::TYPE_BUTTON        => esc_html__('Button', 'event_espresso'),
35
-                Button::TYPE_BUTTON_RESET  => esc_html__('Reset Button', 'event_espresso'),
36
-                Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'),
37
-            ]
38
-        );
39
-    }
40
-
41
-
42
-    /**
43
-     * @param bool $constants_only
44
-     * @return array
45
-     */
46
-    public function validTypeOptions(bool $constants_only = false): array
47
-    {
48
-        return $constants_only
49
-            ? array_keys($this->valid_type_options)
50
-            : $this->valid_type_options;
51
-    }
7
+	/**
8
+	 * indicates that the HTML input type is 'button'
9
+	 */
10
+	public const TYPE_BUTTON = 'button';
11
+
12
+	/**
13
+	 * indicates that the HTML input type is 'reset'
14
+	 */
15
+	public const TYPE_BUTTON_RESET = 'reset';
16
+
17
+	/**
18
+	 * indicates that the HTML input type is 'submit'
19
+	 */
20
+	public const TYPE_BUTTON_SUBMIT = 'submit';
21
+
22
+
23
+	/**
24
+	 * @var array
25
+	 */
26
+	private $valid_type_options;
27
+
28
+
29
+	public function __construct()
30
+	{
31
+		$this->valid_type_options = apply_filters(
32
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Button__valid_type_options',
33
+			[
34
+				Button::TYPE_BUTTON        => esc_html__('Button', 'event_espresso'),
35
+				Button::TYPE_BUTTON_RESET  => esc_html__('Reset Button', 'event_espresso'),
36
+				Button::TYPE_BUTTON_SUBMIT => esc_html__('Submit Button', 'event_espresso'),
37
+			]
38
+		);
39
+	}
40
+
41
+
42
+	/**
43
+	 * @param bool $constants_only
44
+	 * @return array
45
+	 */
46
+	public function validTypeOptions(bool $constants_only = false): array
47
+	{
48
+		return $constants_only
49
+			? array_keys($this->valid_type_options)
50
+			: $this->valid_type_options;
51
+	}
52 52
 }
Please login to merge, or discard this patch.
core/services/form/meta/inputs/DateTime.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -5,81 +5,81 @@
 block discarded – undo
5 5
 class DateTime
6 6
 {
7 7
 
8
-    /**
9
-     * indicates that the HTML input type is 'date'
10
-     */
11
-    public const TYPE_DATE = 'date';
12
-
13
-    /**
14
-     * indicates that the HTML input type is 'datetime-local'
15
-     */
16
-    public const TYPE_DATETIME_LOCAL = 'datetime-local';
17
-
18
-    /**
19
-     * indicates that the HTML input type is 'month'
20
-     */
21
-    public const TYPE_MONTH = 'month';
22
-
23
-    /**
24
-     * indicates that the HTML input type is 'time'
25
-     */
26
-    public const TYPE_TIME = 'time';
27
-
28
-    /**
29
-     * indicates that the HTML input type is 'week'
30
-     */
31
-    public const TYPE_WEEK = 'week';
32
-
33
-    // CUSTOM EE DATE TYPES
34
-
35
-    /**
36
-     * indicates that the input is an HTML dropdown used for selecting the day for a date
37
-     */
38
-    public const TYPE_SELECT_DAY = 'day-select';
39
-
40
-    /**
41
-     * indicates that the input is an HTML dropdown used for selecting the month for a date
42
-     */
43
-    public const TYPE_SELECT_MONTH = 'month-select';
44
-
45
-    /**
46
-     * indicates that the input is an HTML dropdown used for selecting the year for a date
47
-     */
48
-    public const TYPE_SELECT_YEAR = 'year-select';
49
-
50
-
51
-    /**
52
-     * @var array
53
-     */
54
-    private $valid_type_options;
55
-
56
-
57
-    public function __construct()
58
-    {
59
-        $this->valid_type_options = apply_filters(
60
-            'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options',
61
-            [
62
-                DateTime::TYPE_DATE           => esc_html__('Date Picker', 'event_espresso'),
63
-                DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'),
64
-                DateTime::TYPE_MONTH          => esc_html__('Month Picker', 'event_espresso'),
65
-                DateTime::TYPE_TIME           => esc_html__('Time Picker', 'event_espresso'),
66
-                DateTime::TYPE_WEEK           => esc_html__('Week Picker', 'event_espresso'),
67
-                DateTime::TYPE_SELECT_DAY     => esc_html__('Day Selector', 'event_espresso'),
68
-                DateTime::TYPE_SELECT_MONTH   => esc_html__('Month Selector', 'event_espresso'),
69
-                DateTime::TYPE_SELECT_YEAR    => esc_html__('Year Selector', 'event_espresso'),
70
-            ]
71
-        );
72
-    }
73
-
74
-
75
-    /**
76
-     * @param bool $constants_only
77
-     * @return array
78
-     */
79
-    public function validTypeOptions(bool $constants_only = false): array
80
-    {
81
-        return $constants_only
82
-            ? array_keys($this->valid_type_options)
83
-            : $this->valid_type_options;
84
-    }
8
+	/**
9
+	 * indicates that the HTML input type is 'date'
10
+	 */
11
+	public const TYPE_DATE = 'date';
12
+
13
+	/**
14
+	 * indicates that the HTML input type is 'datetime-local'
15
+	 */
16
+	public const TYPE_DATETIME_LOCAL = 'datetime-local';
17
+
18
+	/**
19
+	 * indicates that the HTML input type is 'month'
20
+	 */
21
+	public const TYPE_MONTH = 'month';
22
+
23
+	/**
24
+	 * indicates that the HTML input type is 'time'
25
+	 */
26
+	public const TYPE_TIME = 'time';
27
+
28
+	/**
29
+	 * indicates that the HTML input type is 'week'
30
+	 */
31
+	public const TYPE_WEEK = 'week';
32
+
33
+	// CUSTOM EE DATE TYPES
34
+
35
+	/**
36
+	 * indicates that the input is an HTML dropdown used for selecting the day for a date
37
+	 */
38
+	public const TYPE_SELECT_DAY = 'day-select';
39
+
40
+	/**
41
+	 * indicates that the input is an HTML dropdown used for selecting the month for a date
42
+	 */
43
+	public const TYPE_SELECT_MONTH = 'month-select';
44
+
45
+	/**
46
+	 * indicates that the input is an HTML dropdown used for selecting the year for a date
47
+	 */
48
+	public const TYPE_SELECT_YEAR = 'year-select';
49
+
50
+
51
+	/**
52
+	 * @var array
53
+	 */
54
+	private $valid_type_options;
55
+
56
+
57
+	public function __construct()
58
+	{
59
+		$this->valid_type_options = apply_filters(
60
+			'FHEE__EventEspresso_core_services_form_meta_inputs_DateTime__valid_type_options',
61
+			[
62
+				DateTime::TYPE_DATE           => esc_html__('Date Picker', 'event_espresso'),
63
+				DateTime::TYPE_DATETIME_LOCAL => esc_html__('Local Date Picker', 'event_espresso'),
64
+				DateTime::TYPE_MONTH          => esc_html__('Month Picker', 'event_espresso'),
65
+				DateTime::TYPE_TIME           => esc_html__('Time Picker', 'event_espresso'),
66
+				DateTime::TYPE_WEEK           => esc_html__('Week Picker', 'event_espresso'),
67
+				DateTime::TYPE_SELECT_DAY     => esc_html__('Day Selector', 'event_espresso'),
68
+				DateTime::TYPE_SELECT_MONTH   => esc_html__('Month Selector', 'event_espresso'),
69
+				DateTime::TYPE_SELECT_YEAR    => esc_html__('Year Selector', 'event_espresso'),
70
+			]
71
+		);
72
+	}
73
+
74
+
75
+	/**
76
+	 * @param bool $constants_only
77
+	 * @return array
78
+	 */
79
+	public function validTypeOptions(bool $constants_only = false): array
80
+	{
81
+		return $constants_only
82
+			? array_keys($this->valid_type_options)
83
+			: $this->valid_type_options;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
core/services/form/meta/inputs/Number.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -5,49 +5,49 @@
 block discarded – undo
5 5
 class Number
6 6
 {
7 7
 
8
-    /**
9
-     * indicates that the HTML input type is 'number' whose value is a decimal (float)
10
-     */
11
-    public const TYPE_FLOAT = 'decimal';
12
-
13
-    /**
14
-     * indicates that the HTML input type is 'number' whose value is an integer (whole number)
15
-     */
16
-    public const TYPE_INT = 'integer';
17
-
18
-    /**
19
-     * indicates that the HTML input type is 'range'
20
-     */
21
-    public const TYPE_RANGE = 'range';
22
-
23
-
24
-    /**
25
-     * @var array
26
-     */
27
-    private $valid_type_options;
28
-
29
-
30
-    public function __construct()
31
-    {
32
-        $this->valid_type_options = apply_filters(
33
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options',
34
-            [
35
-                Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'),
36
-                Number::TYPE_INT   => esc_html__('Integer (Whole) Number', 'event_espresso'),
37
-                Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'),
38
-            ]
39
-        );
40
-    }
41
-
42
-
43
-    /**
44
-     * @param bool $constants_only
45
-     * @return array
46
-     */
47
-    public function validTypeOptions(bool $constants_only = false): array
48
-    {
49
-        return $constants_only
50
-            ? array_keys($this->valid_type_options)
51
-            : $this->valid_type_options;
52
-    }
8
+	/**
9
+	 * indicates that the HTML input type is 'number' whose value is a decimal (float)
10
+	 */
11
+	public const TYPE_FLOAT = 'decimal';
12
+
13
+	/**
14
+	 * indicates that the HTML input type is 'number' whose value is an integer (whole number)
15
+	 */
16
+	public const TYPE_INT = 'integer';
17
+
18
+	/**
19
+	 * indicates that the HTML input type is 'range'
20
+	 */
21
+	public const TYPE_RANGE = 'range';
22
+
23
+
24
+	/**
25
+	 * @var array
26
+	 */
27
+	private $valid_type_options;
28
+
29
+
30
+	public function __construct()
31
+	{
32
+		$this->valid_type_options = apply_filters(
33
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Number__valid_type_options',
34
+			[
35
+				Number::TYPE_FLOAT => esc_html__('Decimal Number', 'event_espresso'),
36
+				Number::TYPE_INT   => esc_html__('Integer (Whole) Number', 'event_espresso'),
37
+				Number::TYPE_RANGE => esc_html__('Number Range', 'event_espresso'),
38
+			]
39
+		);
40
+	}
41
+
42
+
43
+	/**
44
+	 * @param bool $constants_only
45
+	 * @return array
46
+	 */
47
+	public function validTypeOptions(bool $constants_only = false): array
48
+	{
49
+		return $constants_only
50
+			? array_keys($this->valid_type_options)
51
+			: $this->valid_type_options;
52
+	}
53 53
 }
Please login to merge, or discard this patch.
core/services/form/meta/inputs/Select.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -5,59 +5,59 @@
 block discarded – undo
5 5
 class Select
6 6
 {
7 7
 
8
-    /**
9
-     * indicates that the input is an HTML dropdown (select input) that accepts only one value
10
-     */
11
-    public const TYPE_SELECT = 'select';
12
-
13
-    /**
14
-     * indicates that the input is an HTML dropdown (select input) that accepts multiple values
15
-     */
16
-    public const TYPE_SELECT_MULTI = 'select-multi';
17
-
18
-    // CUSTOM EE SELECT TYPES
19
-
20
-    /**
21
-     * indicates that input is an HTML dropdown (select input)
22
-     * populated with names of countries that are enabled for the site
23
-     */
24
-    public const TYPE_SELECT_COUNTRY = 'select-country';
25
-
26
-    /**
27
-     * indicates that the input is an HTML dropdown (select input)
28
-     * populated with names of states for the countries that are enabled for the site
29
-     */
30
-    public const TYPE_SELECT_STATE = 'select-state';
31
-
32
-
33
-    /**
34
-     * @var array
35
-     */
36
-    private $valid_type_options;
37
-
38
-
39
-    public function __construct()
40
-    {
41
-        $this->valid_type_options = apply_filters(
42
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Select__valid_type_options',
43
-            [
44
-                Select::TYPE_SELECT         => esc_html__('Dropdown', 'event_espresso'),
45
-                Select::TYPE_SELECT_MULTI   => esc_html__('Multi-Select Dropdown', 'event_espresso'),
46
-                Select::TYPE_SELECT_COUNTRY => esc_html__('Country Selector', 'event_espresso'),
47
-                Select::TYPE_SELECT_STATE   => esc_html__('State Selector', 'event_espresso'),
48
-            ]
49
-        );
50
-    }
51
-
52
-
53
-    /**
54
-     * @param bool $constants_only
55
-     * @return array
56
-     */
57
-    public function validTypeOptions(bool $constants_only = false): array
58
-    {
59
-        return $constants_only
60
-            ? array_keys($this->valid_type_options)
61
-            : $this->valid_type_options;
62
-    }
8
+	/**
9
+	 * indicates that the input is an HTML dropdown (select input) that accepts only one value
10
+	 */
11
+	public const TYPE_SELECT = 'select';
12
+
13
+	/**
14
+	 * indicates that the input is an HTML dropdown (select input) that accepts multiple values
15
+	 */
16
+	public const TYPE_SELECT_MULTI = 'select-multi';
17
+
18
+	// CUSTOM EE SELECT TYPES
19
+
20
+	/**
21
+	 * indicates that input is an HTML dropdown (select input)
22
+	 * populated with names of countries that are enabled for the site
23
+	 */
24
+	public const TYPE_SELECT_COUNTRY = 'select-country';
25
+
26
+	/**
27
+	 * indicates that the input is an HTML dropdown (select input)
28
+	 * populated with names of states for the countries that are enabled for the site
29
+	 */
30
+	public const TYPE_SELECT_STATE = 'select-state';
31
+
32
+
33
+	/**
34
+	 * @var array
35
+	 */
36
+	private $valid_type_options;
37
+
38
+
39
+	public function __construct()
40
+	{
41
+		$this->valid_type_options = apply_filters(
42
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Select__valid_type_options',
43
+			[
44
+				Select::TYPE_SELECT         => esc_html__('Dropdown', 'event_espresso'),
45
+				Select::TYPE_SELECT_MULTI   => esc_html__('Multi-Select Dropdown', 'event_espresso'),
46
+				Select::TYPE_SELECT_COUNTRY => esc_html__('Country Selector', 'event_espresso'),
47
+				Select::TYPE_SELECT_STATE   => esc_html__('State Selector', 'event_espresso'),
48
+			]
49
+		);
50
+	}
51
+
52
+
53
+	/**
54
+	 * @param bool $constants_only
55
+	 * @return array
56
+	 */
57
+	public function validTypeOptions(bool $constants_only = false): array
58
+	{
59
+		return $constants_only
60
+			? array_keys($this->valid_type_options)
61
+			: $this->valid_type_options;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
core/services/form/meta/inputs/Phone.php 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -5,109 +5,109 @@
 block discarded – undo
5 5
 class Phone
6 6
 {
7 7
 
8
-    /**
9
-     * indicates that the HTML input type is 'tel'
10
-     */
11
-    public const INPUT_TYPE = 'tel';
8
+	/**
9
+	 * indicates that the HTML input type is 'tel'
10
+	 */
11
+	public const INPUT_TYPE = 'tel';
12 12
 
13
-    /**
14
-     * indicates that the 'tel' input regex pattern is for a US formatted phone number, examples:
15
-     *      ##########
16
-     *      ###-###-####
17
-     *      ### ### ####
18
-     *      (###)-###-####
19
-     *      (###) ###-####
20
-     *
21
-     * captures the intl code to the first group (+1) and the rest of the number to group 2
22
-     *      +1 (###) ###-####
23
-     */
24
-    public const PATTERN_US = '(\+?\d{1,3})?[\ \-]?(\(?\d{3}\)?[\ \-]?\d{3}[\ \-]?\d{4})';
13
+	/**
14
+	 * indicates that the 'tel' input regex pattern is for a US formatted phone number, examples:
15
+	 *      ##########
16
+	 *      ###-###-####
17
+	 *      ### ### ####
18
+	 *      (###)-###-####
19
+	 *      (###) ###-####
20
+	 *
21
+	 * captures the intl code to the first group (+1) and the rest of the number to group 2
22
+	 *      +1 (###) ###-####
23
+	 */
24
+	public const PATTERN_US = '(\+?\d{1,3})?[\ \-]?(\(?\d{3}\)?[\ \-]?\d{3}[\ \-]?\d{4})';
25 25
 
26
-    /**
27
-     * indicates that the 'tel' input regex pattern is for a UK formatted phone number, examples:
28
-     *      (###) #### ####
29
-     *      (####) ### ####
30
-     *      (#####) ## ####
31
-     *
32
-     * captures the intl code to the first group (+44) and the rest of the number to group 2
33
-     *      +44 (###) #### ####
34
-     */
35
-    public const PATTERN_UK = '(\+?44)?[\ ]?(\(?(?:(?:\d{3,5})|(?:\d{4} \d{2}))\)?[\-\ ]?\d{2,4}[\-\ ]?\d{2,4})';
26
+	/**
27
+	 * indicates that the 'tel' input regex pattern is for a UK formatted phone number, examples:
28
+	 *      (###) #### ####
29
+	 *      (####) ### ####
30
+	 *      (#####) ## ####
31
+	 *
32
+	 * captures the intl code to the first group (+44) and the rest of the number to group 2
33
+	 *      +44 (###) #### ####
34
+	 */
35
+	public const PATTERN_UK = '(\+?44)?[\ ]?(\(?(?:(?:\d{3,5})|(?:\d{4} \d{2}))\)?[\-\ ]?\d{2,4}[\-\ ]?\d{2,4})';
36 36
 
37
-    /**
38
-     * indicates that the 'tel' input regex pattern is for a France formatted phone number, examples:
39
-     *      0# ## ## ## ##
40
-     *      0### ## ## ##
41
-     *
42
-     * captures the intl code to the first group (+33) and the rest of the number to group 2
43
-     *      +33 # ## ## ## ##
44
-     *      0033 # ## ## ## ##
45
-     */
46
-    public const PATTERN_FR = '((?:\+|00)33)?[\ \.\-]*((?:(?:\(0\)[\ \.\-]{0,3})?|0)[1-9](?:(?:[\ \.\-]?\d{2}){4}|\d{2}(?:[\ \.\-]?\d{3}){2}))';
37
+	/**
38
+	 * indicates that the 'tel' input regex pattern is for a France formatted phone number, examples:
39
+	 *      0# ## ## ## ##
40
+	 *      0### ## ## ##
41
+	 *
42
+	 * captures the intl code to the first group (+33) and the rest of the number to group 2
43
+	 *      +33 # ## ## ## ##
44
+	 *      0033 # ## ## ## ##
45
+	 */
46
+	public const PATTERN_FR = '((?:\+|00)33)?[\ \.\-]*((?:(?:\(0\)[\ \.\-]{0,3})?|0)[1-9](?:(?:[\ \.\-]?\d{2}){4}|\d{2}(?:[\ \.\-]?\d{3}){2}))';
47 47
 
48
-    /**
49
-     * indicates that the 'tel' input regex pattern is for a German formatted phone number, examples:
50
-     *      (0##) ####-####
51
-     *      (0###) ####-####
52
-     *      (0####) ###-####
53
-     *      (03####) ##-####
54
-     *
55
-     * captures the intl code to the first group (+49) and the rest of the number to group 2
56
-     *      +49 (0##) ####-####
57
-     */
58
-    public const PATTERN_DE = '(\+?49)?[\ \.\-]?(\(?(?:[\d \-\)\–\/\(]+){6,}\)?(?:[\ \.\-–\/]?)(?:[\d]+))';
48
+	/**
49
+	 * indicates that the 'tel' input regex pattern is for a German formatted phone number, examples:
50
+	 *      (0##) ####-####
51
+	 *      (0###) ####-####
52
+	 *      (0####) ###-####
53
+	 *      (03####) ##-####
54
+	 *
55
+	 * captures the intl code to the first group (+49) and the rest of the number to group 2
56
+	 *      +49 (0##) ####-####
57
+	 */
58
+	public const PATTERN_DE = '(\+?49)?[\ \.\-]?(\(?(?:[\d \-\)\–\/\(]+){6,}\)?(?:[\ \.\-–\/]?)(?:[\d]+))';
59 59
 
60
-    /**
61
-     * @var array
62
-     */
63
-    private $regex_patterns;
60
+	/**
61
+	 * @var array
62
+	 */
63
+	private $regex_patterns;
64 64
 
65
-    /**
66
-     * @var array
67
-     */
68
-    private $valid_type_options;
65
+	/**
66
+	 * @var array
67
+	 */
68
+	private $valid_type_options;
69 69
 
70 70
 
71
-    /**
72
-     * Phone constructor.
73
-     */
74
-    public function __construct()
75
-    {
76
-        $this->regex_patterns     = (array) apply_filters(
77
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Phone__regex_patterns',
78
-            [
79
-                'de_DE' => Phone::PATTERN_DE,
80
-                'fr_FR' => Phone::PATTERN_FR,
81
-                'en_UK' => Phone::PATTERN_UK,
82
-                'en_US' => Phone::PATTERN_US,
83
-            ]
84
-        );
85
-        $this->valid_type_options = apply_filters(
86
-            'FHEE__EventEspresso_core_services_form_meta_inputs_Phone__valid_type_options',
87
-            [
88
-                Phone::INPUT_TYPE => esc_html__('Phone Number', 'event_espresso'),
89
-            ]
90
-        );
91
-    }
71
+	/**
72
+	 * Phone constructor.
73
+	 */
74
+	public function __construct()
75
+	{
76
+		$this->regex_patterns     = (array) apply_filters(
77
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Phone__regex_patterns',
78
+			[
79
+				'de_DE' => Phone::PATTERN_DE,
80
+				'fr_FR' => Phone::PATTERN_FR,
81
+				'en_UK' => Phone::PATTERN_UK,
82
+				'en_US' => Phone::PATTERN_US,
83
+			]
84
+		);
85
+		$this->valid_type_options = apply_filters(
86
+			'FHEE__EventEspresso_core_services_form_meta_inputs_Phone__valid_type_options',
87
+			[
88
+				Phone::INPUT_TYPE => esc_html__('Phone Number', 'event_espresso'),
89
+			]
90
+		);
91
+	}
92 92
 
93 93
 
94
-    /**
95
-     * @return array
96
-     */
97
-    public function regexPatterns(): array
98
-    {
99
-        return $this->regex_patterns;
100
-    }
94
+	/**
95
+	 * @return array
96
+	 */
97
+	public function regexPatterns(): array
98
+	{
99
+		return $this->regex_patterns;
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * @param bool $constants_only
105
-     * @return array
106
-     */
107
-    public function validTypeOptions(bool $constants_only = false): array
108
-    {
109
-        return $constants_only
110
-            ? array_keys($this->valid_type_options)
111
-            : $this->valid_type_options;
112
-    }
103
+	/**
104
+	 * @param bool $constants_only
105
+	 * @return array
106
+	 */
107
+	public function validTypeOptions(bool $constants_only = false): array
108
+	{
109
+		return $constants_only
110
+			? array_keys($this->valid_type_options)
111
+			: $this->valid_type_options;
112
+	}
113 113
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     public function __construct()
75 75
     {
76
-        $this->regex_patterns     = (array) apply_filters(
76
+        $this->regex_patterns = (array) apply_filters(
77 77
             'FHEE__EventEspresso_core_services_form_meta_inputs_Phone__regex_patterns',
78 78
             [
79 79
                 'de_DE' => Phone::PATTERN_DE,
Please login to merge, or discard this patch.
core/services/orm/ModelFieldFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
         bool $nullable = false,
140 140
         string $default_value = EE_Datetime_Field::now
141 141
     ): EE_Datetime_Field {
142
-        return $this->loader->getNew('EE_Datetime_Field', [$table_column, $nice_name, $nullable, $default_value,]);
142
+        return $this->loader->getNew('EE_Datetime_Field', [$table_column, $nice_name, $nullable, $default_value, ]);
143 143
     }
144 144
 
145 145
 
Please login to merge, or discard this patch.
Indentation   +614 added lines, -614 removed lines patch added patch discarded remove patch
@@ -46,618 +46,618 @@
 block discarded – undo
46 46
  */
47 47
 class ModelFieldFactory
48 48
 {
49
-    /**
50
-     * @var LoaderInterface $loader
51
-     */
52
-    private $loader;
53
-
54
-
55
-    /**
56
-     * ModelFieldFactory constructor.
57
-     *
58
-     * @param LoaderInterface $loader
59
-     */
60
-    public function __construct(LoaderInterface $loader)
61
-    {
62
-        $this->loader = $loader;
63
-    }
64
-
65
-
66
-    /**
67
-     * @param string $table_column
68
-     * @param string $nice_name
69
-     * @param bool   $nullable
70
-     * @param null   $default_value
71
-     * @return EE_All_Caps_Text_Field
72
-     */
73
-    public function createAllCapsTextField(
74
-        string $table_column,
75
-        string $nice_name,
76
-        bool $nullable,
77
-        $default_value = null
78
-    ): EE_All_Caps_Text_Field {
79
-        return $this->loader->getNew(
80
-            'EE_All_Caps_Text_Field',
81
-            [$table_column, $nice_name, $nullable, $default_value]
82
-        );
83
-    }
84
-
85
-
86
-    /**
87
-     * @param string $table_column
88
-     * @param string $nice_name
89
-     * @param bool   $nullable
90
-     * @param null   $default_value
91
-     * @param string $model_name
92
-     * @return EE_Any_Foreign_Model_Name_Field
93
-     */
94
-    public function createAnyForeignModelNameField(
95
-        string $table_column,
96
-        string $nice_name,
97
-        bool $nullable,
98
-        $default_value = null,
99
-        string $model_name = ''
100
-    ): EE_Any_Foreign_Model_Name_Field {
101
-        return $this->loader->getNew(
102
-            'EE_Any_Foreign_Model_Name_Field',
103
-            [$table_column, $nice_name, $nullable, $default_value, $model_name]
104
-        );
105
-    }
106
-
107
-
108
-    /**
109
-     * @param string $table_column
110
-     * @param string $nice_name
111
-     * @param bool   $nullable
112
-     * @param null   $default_value
113
-     * @return EE_Boolean_Field
114
-     */
115
-    public function createBooleanField(
116
-        string $table_column,
117
-        string $nice_name,
118
-        bool $nullable,
119
-        $default_value = null
120
-    ): EE_Boolean_Field {
121
-        return $this->loader->getNew(
122
-            'EE_Boolean_Field',
123
-            [$table_column, $nice_name, $nullable, $default_value]
124
-        );
125
-    }
126
-
127
-
128
-    /**
129
-     * @param string $table_column
130
-     * @param string $nice_name
131
-     * @param bool   $nullable
132
-     * @param string $default_value
133
-     * @return EE_Datetime_Field
134
-     */
135
-    public function createDatetimeField(
136
-        string $table_column,
137
-        string $nice_name,
138
-        bool $nullable = false,
139
-        string $default_value = EE_Datetime_Field::now
140
-    ): EE_Datetime_Field {
141
-        return $this->loader->getNew('EE_Datetime_Field', [$table_column, $nice_name, $nullable, $default_value,]);
142
-    }
143
-
144
-
145
-    /**
146
-     * @param string $table_column
147
-     * @param string $nice_name
148
-     * @param bool   $nullable
149
-     * @param null   $default_value
150
-     * @return EE_DB_Only_Float_Field
151
-     */
152
-    public function createDbOnlyFloatField(
153
-        string $table_column,
154
-        string $nice_name,
155
-        bool $nullable,
156
-        $default_value = null
157
-    ): EE_DB_Only_Float_Field {
158
-        return $this->loader->getNew(
159
-            'EE_DB_Only_Float_Field',
160
-            [$table_column, $nice_name, $nullable, $default_value]
161
-        );
162
-    }
163
-
164
-
165
-    /**
166
-     * @param string $table_column
167
-     * @param string $nice_name
168
-     * @param bool   $nullable
169
-     * @param null   $default_value
170
-     * @return EE_DB_Only_Int_Field
171
-     */
172
-    public function createDbOnlyIntField(
173
-        string $table_column,
174
-        string $nice_name,
175
-        bool $nullable,
176
-        $default_value = null
177
-    ): EE_DB_Only_Int_Field {
178
-        return $this->loader->getNew(
179
-            'EE_DB_Only_Int_Field',
180
-            [$table_column, $nice_name, $nullable, $default_value]
181
-        );
182
-    }
183
-
184
-
185
-    /**
186
-     * @param string $table_column
187
-     * @param string $nice_name
188
-     * @param bool   $nullable
189
-     * @param null   $default_value
190
-     * @return EE_DB_Only_Text_Field
191
-     */
192
-    public function createDbOnlyTextField(
193
-        string $table_column,
194
-        string $nice_name,
195
-        bool $nullable,
196
-        $default_value = null
197
-    ): EE_DB_Only_Text_Field {
198
-        return $this->loader->getNew(
199
-            'EE_DB_Only_Text_Field',
200
-            [$table_column, $nice_name, $nullable, $default_value]
201
-        );
202
-    }
203
-
204
-
205
-    /**
206
-     * @param string      $table_column
207
-     * @param string      $nice_name
208
-     * @param bool        $nullable
209
-     * @param string|null $default_value
210
-     * @return EE_Email_Field
211
-     */
212
-    public function createEmailField(
213
-        string $table_column,
214
-        string $nice_name,
215
-        bool $nullable = true,
216
-        string $default_value = ''
217
-    ): EE_Email_Field {
218
-        return $this->loader->getNew(
219
-            'EE_Email_Field',
220
-            [$table_column, $nice_name, $nullable, $default_value]
221
-        );
222
-    }
223
-
224
-
225
-    /**
226
-     * @param string $table_column
227
-     * @param string $nice_name
228
-     * @param bool   $nullable
229
-     * @param null   $default_value
230
-     * @param array  $allowed_enum_values keys are values to be used in the DB,
231
-     *                                    values are how they should be displayed
232
-     * @return EE_Enum_Integer_Field
233
-     */
234
-    public function createEnumIntegerField(
235
-        string $table_column,
236
-        string $nice_name,
237
-        bool $nullable,
238
-        $default_value = null,
239
-        array $allowed_enum_values = []
240
-    ): EE_Enum_Integer_Field {
241
-        return $this->loader->getNew(
242
-            'EE_Enum_Integer_Field',
243
-            [$table_column, $nice_name, $nullable, $default_value, $allowed_enum_values]
244
-        );
245
-    }
246
-
247
-
248
-    /**
249
-     * @param string $table_column
250
-     * @param string $nice_name
251
-     * @param bool   $nullable
252
-     * @param null   $default_value
253
-     * @param array  $allowed_enum_values keys are values to be used in the DB,
254
-     *                                    values are how they should be displayed
255
-     * @return EE_Enum_Text_Field
256
-     */
257
-    public function createEnumTextField(
258
-        string $table_column,
259
-        string $nice_name,
260
-        bool $nullable,
261
-        $default_value,
262
-        array $allowed_enum_values
263
-    ): EE_Enum_Text_Field {
264
-        return $this->loader->getNew(
265
-            'EE_Enum_Text_Field',
266
-            [$table_column, $nice_name, $nullable, $default_value, $allowed_enum_values]
267
-        );
268
-    }
269
-
270
-
271
-    /**
272
-     * @param string $table_column
273
-     * @param string $nice_name
274
-     * @param bool   $nullable
275
-     * @param null   $default_value
276
-     * @return EE_Float_Field
277
-     */
278
-    public function createFloatField(
279
-        string $table_column,
280
-        string $nice_name,
281
-        bool $nullable,
282
-        $default_value = null
283
-    ): EE_Float_Field {
284
-        return $this->loader->getNew(
285
-            'EE_Float_Field',
286
-            [$table_column, $nice_name, $nullable, $default_value]
287
-        );
288
-    }
289
-
290
-
291
-    /**
292
-     * @param string $table_column
293
-     * @param string $nice_name
294
-     * @param bool   $nullable
295
-     * @param null   $default_value
296
-     * @param string $model_name
297
-     * @return EE_Foreign_Key_Int_Field
298
-     */
299
-    public function createForeignKeyIntField(
300
-        string $table_column,
301
-        string $nice_name,
302
-        bool $nullable,
303
-        $default_value,
304
-        string $model_name
305
-    ): EE_Foreign_Key_Int_Field {
306
-        return $this->loader->getNew(
307
-            'EE_Foreign_Key_Int_Field',
308
-            [$table_column, $nice_name, $nullable, $default_value, $model_name]
309
-        );
310
-    }
311
-
312
-
313
-    /**
314
-     * @param string $table_column
315
-     * @param string $nice_name
316
-     * @param bool   $nullable
317
-     * @param null   $default_value
318
-     * @param string $model_name
319
-     * @return EE_Foreign_Key_String_Field
320
-     */
321
-    public function createForeignKeyStringField(
322
-        string $table_column,
323
-        string $nice_name,
324
-        bool $nullable,
325
-        $default_value,
326
-        string $model_name
327
-    ): EE_Foreign_Key_String_Field {
328
-        return $this->loader->getNew(
329
-            'EE_Foreign_Key_String_Field',
330
-            [$table_column, $nice_name, $nullable, $default_value, $model_name]
331
-        );
332
-    }
333
-
334
-
335
-    /**
336
-     * @param string $table_column
337
-     * @param string $nice_name
338
-     * @param bool   $nullable
339
-     * @param null   $default_value
340
-     * @return EE_Full_HTML_Field
341
-     */
342
-    public function createFullHtmlField(
343
-        string $table_column,
344
-        string $nice_name,
345
-        bool $nullable,
346
-        $default_value = null
347
-    ): EE_Full_HTML_Field {
348
-        return $this->loader->getNew(
349
-            'EE_Full_HTML_Field',
350
-            [$table_column, $nice_name, $nullable, $default_value]
351
-        );
352
-    }
353
-
354
-
355
-    /**
356
-     * @param string $table_column
357
-     * @param string $nice_name
358
-     * @param bool   $nullable
359
-     * @param null   $default_value
360
-     * @return EE_Infinite_Integer_Field
361
-     */
362
-    public function createInfiniteIntegerField(
363
-        string $table_column,
364
-        string $nice_name,
365
-        bool $nullable,
366
-        $default_value = null
367
-    ): EE_Infinite_Integer_Field {
368
-        return $this->loader->getNew(
369
-            'EE_Infinite_Integer_Field',
370
-            [$table_column, $nice_name, $nullable, $default_value]
371
-        );
372
-    }
373
-
374
-
375
-    /**
376
-     * @param string  $table_column
377
-     * @param string  $nice_name
378
-     * @param bool    $nullable
379
-     * @param integer $default_value
380
-     * @return EE_Integer_Field
381
-     */
382
-    public function createIntegerField(
383
-        string $table_column,
384
-        string $nice_name,
385
-        bool $nullable = false,
386
-        int $default_value = 0
387
-    ): EE_Integer_Field {
388
-        return $this->loader->getNew(
389
-            'EE_Integer_Field',
390
-            [$table_column, $nice_name, $nullable, $default_value]
391
-        );
392
-    }
393
-
394
-
395
-    /**
396
-     * @param string $table_column
397
-     * @param string $nice_name
398
-     * @param bool   $nullable
399
-     * @param null   $default_value
400
-     * @return EE_Maybe_Serialized_Simple_HTML_Field
401
-     */
402
-    public function createMaybeSerializedSimpleHtmlField(
403
-        string $table_column,
404
-        string $nice_name,
405
-        bool $nullable,
406
-        $default_value = null
407
-    ): EE_Maybe_Serialized_Simple_HTML_Field {
408
-        return $this->loader->getNew(
409
-            'EE_Maybe_Serialized_Simple_HTML_Field',
410
-            [$table_column, $nice_name, $nullable, $default_value]
411
-        );
412
-    }
413
-
414
-
415
-    /**
416
-     * @param string $table_column
417
-     * @param string $nice_name
418
-     * @param bool   $nullable
419
-     * @param null   $default_value
420
-     * @return EE_Maybe_Serialized_Text_Field
421
-     */
422
-    public function createMaybeSerializedTextField(
423
-        string $table_column,
424
-        string $nice_name,
425
-        bool $nullable,
426
-        $default_value = null
427
-    ): EE_Maybe_Serialized_Text_Field {
428
-        return $this->loader->getNew(
429
-            'EE_Maybe_Serialized_Text_Field',
430
-            [$table_column, $nice_name, $nullable, $default_value]
431
-        );
432
-    }
433
-
434
-
435
-    /**
436
-     * @param string $table_column
437
-     * @param string $nice_name
438
-     * @param bool   $nullable
439
-     * @param null   $default_value
440
-     * @return EE_Money_Field
441
-     */
442
-    public function createMoneyField(
443
-        string $table_column,
444
-        string $nice_name,
445
-        bool $nullable,
446
-        $default_value = null
447
-    ): EE_Money_Field {
448
-        return $this->loader->getNew(
449
-            'EE_Money_Field',
450
-            [$table_column, $nice_name, $nullable, $default_value]
451
-        );
452
-    }
453
-
454
-
455
-    /**
456
-     * @param string $table_column
457
-     * @param string $nice_name
458
-     * @param bool   $nullable
459
-     * @param string $default_value
460
-     * @return EE_Plain_Text_Field
461
-     */
462
-    public function createPlainTextField(
463
-        string $table_column,
464
-        string $nice_name,
465
-        bool $nullable = true,
466
-        string $default_value = ''
467
-    ): EE_Plain_Text_Field {
468
-        return $this->loader->getNew(
469
-            'EE_Plain_Text_Field',
470
-            [$table_column, $nice_name, $nullable, $default_value]
471
-        );
472
-    }
473
-
474
-
475
-    /**
476
-     * @param string $table_column
477
-     * @param string $nice_name
478
-     * @param bool   $nullable
479
-     * @param null   $default_value
480
-     * @return EE_Post_Content_Field
481
-     */
482
-    public function createPostContentField(
483
-        string $table_column,
484
-        string $nice_name,
485
-        bool $nullable,
486
-        $default_value = null
487
-    ): EE_Post_Content_Field {
488
-        return $this->loader->getNew(
489
-            'EE_Post_Content_Field',
490
-            [$table_column, $nice_name, $nullable, $default_value]
491
-        );
492
-    }
493
-
494
-
495
-    /**
496
-     * @param string $table_column
497
-     * @param string $nice_name
498
-     * @return EE_Primary_Key_Int_Field
499
-     */
500
-    public function createPrimaryKeyIntField(string $table_column, string $nice_name): EE_Primary_Key_Int_Field
501
-    {
502
-        return $this->loader->getNew('EE_Primary_Key_Int_Field', [$table_column, $nice_name]);
503
-    }
504
-
505
-
506
-    /**
507
-     * @param string $table_column
508
-     * @param string $nice_name
509
-     * @return EE_Primary_Key_String_Field
510
-     */
511
-    public function createPrimaryKeyStringField(string $table_column, string $nice_name): EE_Primary_Key_String_Field
512
-    {
513
-        return $this->loader->getNew('EE_Primary_Key_String_Field', [$table_column, $nice_name]);
514
-    }
515
-
516
-
517
-    /**
518
-     * @param string $table_column
519
-     * @param string $nice_name
520
-     * @param bool   $nullable
521
-     * @param null   $default_value
522
-     * @return EE_Serialized_Text_Field
523
-     */
524
-    public function createSerializedTextField(
525
-        string $table_column,
526
-        string $nice_name,
527
-        bool $nullable,
528
-        $default_value = null
529
-    ): EE_Serialized_Text_Field {
530
-        return $this->loader->getNew(
531
-            'EE_Serialized_Text_Field',
532
-            [$table_column, $nice_name, $nullable, $default_value]
533
-        );
534
-    }
535
-
536
-
537
-    /**
538
-     * @param string $table_column
539
-     * @param string $nice_name
540
-     * @param bool   $nullable
541
-     * @param null   $default_value
542
-     * @return EE_Simple_HTML_Field
543
-     */
544
-    public function createSimpleHtmlField(
545
-        string $table_column,
546
-        string $nice_name,
547
-        bool $nullable,
548
-        $default_value = null
549
-    ): EE_Simple_HTML_Field {
550
-        return $this->loader->getNew(
551
-            'EE_Simple_HTML_Field',
552
-            [$table_column, $nice_name, $nullable, $default_value]
553
-        );
554
-    }
555
-
556
-
557
-    /**
558
-     * @param string $table_column
559
-     * @param string $nice_name
560
-     * @param bool   $nullable
561
-     * @param null   $default_value
562
-     * @return EE_Slug_Field
563
-     */
564
-    public function createSlugField(
565
-        string $table_column,
566
-        string $nice_name,
567
-        bool $nullable = false,
568
-        $default_value = null
569
-    ): EE_Slug_Field {
570
-        return $this->loader->getNew(
571
-            'EE_Slug_Field',
572
-            [$table_column, $nice_name, $nullable, $default_value]
573
-        );
574
-    }
575
-
576
-
577
-    /**
578
-     * @param string $table_column
579
-     * @param string $nice_name
580
-     * @param bool   $nullable
581
-     * @param null   $default_value
582
-     * @return EE_Trashed_Flag_Field
583
-     */
584
-    public function createTrashedFlagField(
585
-        string $table_column,
586
-        string $nice_name,
587
-        bool $nullable,
588
-        $default_value = null
589
-    ): EE_Trashed_Flag_Field {
590
-        return $this->loader->getNew(
591
-            'EE_Trashed_Flag_Field',
592
-            [$table_column, $nice_name, $nullable, $default_value]
593
-        );
594
-    }
595
-
596
-
597
-    /**
598
-     * @param string $table_column
599
-     * @param string $nice_name
600
-     * @param bool   $nullable
601
-     * @param mixed  $default_value
602
-     * @param array $values     If additional statuses are to be used other than the default WP statuses,
603
-     *                          then they can be registered via this property.
604
-     *                          The format of the array should be as follows:
605
-     *                          [
606
-     *                              'status_reference' => [
607
-     *                                  'label' => __('Status Reference Label', 'event_espresso'),
608
-     *                                  // whether status is shown on the frontend of the site
609
-     *                                  'public' => true,
610
-     *                                  // whether status is excluded from wp searches
611
-     *                                  'exclude_from_search' => false,
612
-     *                                  // whether status is included in queries
613
-     *                                  for the admin 'all' view in list table views.
614
-     *                                  'show_in_admin_all_list' => true,
615
-     *                                  // show in the list of statuses with post counts
616
-     *                                  // at the top of the admin list tables (i.e. Status Reference(2) )
617
-     *                                  'show_in_admin_status_list' => true,
618
-     *                                  // the text to display on the admin screen
619
-     *                                  // ( or you won't see your status count )
620
-     *                                  'label_count' => _n_noop(
621
-     *                                      'Status Reference <span class="count">(%s)</span>',
622
-     *                                      'Status References <span class="count">(%s)</span>'
623
-     *                                  ),
624
-     *                              ]
625
-     *                          ]
626
-     * @return EE_WP_Post_Status_Field
627
-     * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
628
-     */
629
-    public function createWpPostStatusField(
630
-        string $table_column,
631
-        string $nice_name,
632
-        bool $nullable,
633
-        $default_value = null,
634
-        array $values = []
635
-    ): EE_WP_Post_Status_Field {
636
-        return $this->loader->getNew(
637
-            'EE_WP_Post_Status_Field',
638
-            [$table_column, $nice_name, $nullable, $default_value, $values]
639
-        );
640
-    }
641
-
642
-
643
-    /**
644
-     * @param string $post_type
645
-     * @return EE_WP_Post_Type_Field
646
-     */
647
-    public function createWpPostTypeField(string $post_type): EE_WP_Post_Type_Field
648
-    {
649
-        return $this->loader->getNew('EE_WP_Post_Type_Field', [$post_type]);
650
-    }
651
-
652
-
653
-    /**
654
-     * @param string $table_column
655
-     * @param string $nice_name
656
-     * @param bool   $nullable
657
-     * @return EE_WP_User_Field
658
-     */
659
-    public function createWpUserField(string $table_column, string $nice_name, bool $nullable): EE_WP_User_Field
660
-    {
661
-        return $this->loader->getNew('EE_WP_User_Field', [$table_column, $nice_name, $nullable]);
662
-    }
49
+	/**
50
+	 * @var LoaderInterface $loader
51
+	 */
52
+	private $loader;
53
+
54
+
55
+	/**
56
+	 * ModelFieldFactory constructor.
57
+	 *
58
+	 * @param LoaderInterface $loader
59
+	 */
60
+	public function __construct(LoaderInterface $loader)
61
+	{
62
+		$this->loader = $loader;
63
+	}
64
+
65
+
66
+	/**
67
+	 * @param string $table_column
68
+	 * @param string $nice_name
69
+	 * @param bool   $nullable
70
+	 * @param null   $default_value
71
+	 * @return EE_All_Caps_Text_Field
72
+	 */
73
+	public function createAllCapsTextField(
74
+		string $table_column,
75
+		string $nice_name,
76
+		bool $nullable,
77
+		$default_value = null
78
+	): EE_All_Caps_Text_Field {
79
+		return $this->loader->getNew(
80
+			'EE_All_Caps_Text_Field',
81
+			[$table_column, $nice_name, $nullable, $default_value]
82
+		);
83
+	}
84
+
85
+
86
+	/**
87
+	 * @param string $table_column
88
+	 * @param string $nice_name
89
+	 * @param bool   $nullable
90
+	 * @param null   $default_value
91
+	 * @param string $model_name
92
+	 * @return EE_Any_Foreign_Model_Name_Field
93
+	 */
94
+	public function createAnyForeignModelNameField(
95
+		string $table_column,
96
+		string $nice_name,
97
+		bool $nullable,
98
+		$default_value = null,
99
+		string $model_name = ''
100
+	): EE_Any_Foreign_Model_Name_Field {
101
+		return $this->loader->getNew(
102
+			'EE_Any_Foreign_Model_Name_Field',
103
+			[$table_column, $nice_name, $nullable, $default_value, $model_name]
104
+		);
105
+	}
106
+
107
+
108
+	/**
109
+	 * @param string $table_column
110
+	 * @param string $nice_name
111
+	 * @param bool   $nullable
112
+	 * @param null   $default_value
113
+	 * @return EE_Boolean_Field
114
+	 */
115
+	public function createBooleanField(
116
+		string $table_column,
117
+		string $nice_name,
118
+		bool $nullable,
119
+		$default_value = null
120
+	): EE_Boolean_Field {
121
+		return $this->loader->getNew(
122
+			'EE_Boolean_Field',
123
+			[$table_column, $nice_name, $nullable, $default_value]
124
+		);
125
+	}
126
+
127
+
128
+	/**
129
+	 * @param string $table_column
130
+	 * @param string $nice_name
131
+	 * @param bool   $nullable
132
+	 * @param string $default_value
133
+	 * @return EE_Datetime_Field
134
+	 */
135
+	public function createDatetimeField(
136
+		string $table_column,
137
+		string $nice_name,
138
+		bool $nullable = false,
139
+		string $default_value = EE_Datetime_Field::now
140
+	): EE_Datetime_Field {
141
+		return $this->loader->getNew('EE_Datetime_Field', [$table_column, $nice_name, $nullable, $default_value,]);
142
+	}
143
+
144
+
145
+	/**
146
+	 * @param string $table_column
147
+	 * @param string $nice_name
148
+	 * @param bool   $nullable
149
+	 * @param null   $default_value
150
+	 * @return EE_DB_Only_Float_Field
151
+	 */
152
+	public function createDbOnlyFloatField(
153
+		string $table_column,
154
+		string $nice_name,
155
+		bool $nullable,
156
+		$default_value = null
157
+	): EE_DB_Only_Float_Field {
158
+		return $this->loader->getNew(
159
+			'EE_DB_Only_Float_Field',
160
+			[$table_column, $nice_name, $nullable, $default_value]
161
+		);
162
+	}
163
+
164
+
165
+	/**
166
+	 * @param string $table_column
167
+	 * @param string $nice_name
168
+	 * @param bool   $nullable
169
+	 * @param null   $default_value
170
+	 * @return EE_DB_Only_Int_Field
171
+	 */
172
+	public function createDbOnlyIntField(
173
+		string $table_column,
174
+		string $nice_name,
175
+		bool $nullable,
176
+		$default_value = null
177
+	): EE_DB_Only_Int_Field {
178
+		return $this->loader->getNew(
179
+			'EE_DB_Only_Int_Field',
180
+			[$table_column, $nice_name, $nullable, $default_value]
181
+		);
182
+	}
183
+
184
+
185
+	/**
186
+	 * @param string $table_column
187
+	 * @param string $nice_name
188
+	 * @param bool   $nullable
189
+	 * @param null   $default_value
190
+	 * @return EE_DB_Only_Text_Field
191
+	 */
192
+	public function createDbOnlyTextField(
193
+		string $table_column,
194
+		string $nice_name,
195
+		bool $nullable,
196
+		$default_value = null
197
+	): EE_DB_Only_Text_Field {
198
+		return $this->loader->getNew(
199
+			'EE_DB_Only_Text_Field',
200
+			[$table_column, $nice_name, $nullable, $default_value]
201
+		);
202
+	}
203
+
204
+
205
+	/**
206
+	 * @param string      $table_column
207
+	 * @param string      $nice_name
208
+	 * @param bool        $nullable
209
+	 * @param string|null $default_value
210
+	 * @return EE_Email_Field
211
+	 */
212
+	public function createEmailField(
213
+		string $table_column,
214
+		string $nice_name,
215
+		bool $nullable = true,
216
+		string $default_value = ''
217
+	): EE_Email_Field {
218
+		return $this->loader->getNew(
219
+			'EE_Email_Field',
220
+			[$table_column, $nice_name, $nullable, $default_value]
221
+		);
222
+	}
223
+
224
+
225
+	/**
226
+	 * @param string $table_column
227
+	 * @param string $nice_name
228
+	 * @param bool   $nullable
229
+	 * @param null   $default_value
230
+	 * @param array  $allowed_enum_values keys are values to be used in the DB,
231
+	 *                                    values are how they should be displayed
232
+	 * @return EE_Enum_Integer_Field
233
+	 */
234
+	public function createEnumIntegerField(
235
+		string $table_column,
236
+		string $nice_name,
237
+		bool $nullable,
238
+		$default_value = null,
239
+		array $allowed_enum_values = []
240
+	): EE_Enum_Integer_Field {
241
+		return $this->loader->getNew(
242
+			'EE_Enum_Integer_Field',
243
+			[$table_column, $nice_name, $nullable, $default_value, $allowed_enum_values]
244
+		);
245
+	}
246
+
247
+
248
+	/**
249
+	 * @param string $table_column
250
+	 * @param string $nice_name
251
+	 * @param bool   $nullable
252
+	 * @param null   $default_value
253
+	 * @param array  $allowed_enum_values keys are values to be used in the DB,
254
+	 *                                    values are how they should be displayed
255
+	 * @return EE_Enum_Text_Field
256
+	 */
257
+	public function createEnumTextField(
258
+		string $table_column,
259
+		string $nice_name,
260
+		bool $nullable,
261
+		$default_value,
262
+		array $allowed_enum_values
263
+	): EE_Enum_Text_Field {
264
+		return $this->loader->getNew(
265
+			'EE_Enum_Text_Field',
266
+			[$table_column, $nice_name, $nullable, $default_value, $allowed_enum_values]
267
+		);
268
+	}
269
+
270
+
271
+	/**
272
+	 * @param string $table_column
273
+	 * @param string $nice_name
274
+	 * @param bool   $nullable
275
+	 * @param null   $default_value
276
+	 * @return EE_Float_Field
277
+	 */
278
+	public function createFloatField(
279
+		string $table_column,
280
+		string $nice_name,
281
+		bool $nullable,
282
+		$default_value = null
283
+	): EE_Float_Field {
284
+		return $this->loader->getNew(
285
+			'EE_Float_Field',
286
+			[$table_column, $nice_name, $nullable, $default_value]
287
+		);
288
+	}
289
+
290
+
291
+	/**
292
+	 * @param string $table_column
293
+	 * @param string $nice_name
294
+	 * @param bool   $nullable
295
+	 * @param null   $default_value
296
+	 * @param string $model_name
297
+	 * @return EE_Foreign_Key_Int_Field
298
+	 */
299
+	public function createForeignKeyIntField(
300
+		string $table_column,
301
+		string $nice_name,
302
+		bool $nullable,
303
+		$default_value,
304
+		string $model_name
305
+	): EE_Foreign_Key_Int_Field {
306
+		return $this->loader->getNew(
307
+			'EE_Foreign_Key_Int_Field',
308
+			[$table_column, $nice_name, $nullable, $default_value, $model_name]
309
+		);
310
+	}
311
+
312
+
313
+	/**
314
+	 * @param string $table_column
315
+	 * @param string $nice_name
316
+	 * @param bool   $nullable
317
+	 * @param null   $default_value
318
+	 * @param string $model_name
319
+	 * @return EE_Foreign_Key_String_Field
320
+	 */
321
+	public function createForeignKeyStringField(
322
+		string $table_column,
323
+		string $nice_name,
324
+		bool $nullable,
325
+		$default_value,
326
+		string $model_name
327
+	): EE_Foreign_Key_String_Field {
328
+		return $this->loader->getNew(
329
+			'EE_Foreign_Key_String_Field',
330
+			[$table_column, $nice_name, $nullable, $default_value, $model_name]
331
+		);
332
+	}
333
+
334
+
335
+	/**
336
+	 * @param string $table_column
337
+	 * @param string $nice_name
338
+	 * @param bool   $nullable
339
+	 * @param null   $default_value
340
+	 * @return EE_Full_HTML_Field
341
+	 */
342
+	public function createFullHtmlField(
343
+		string $table_column,
344
+		string $nice_name,
345
+		bool $nullable,
346
+		$default_value = null
347
+	): EE_Full_HTML_Field {
348
+		return $this->loader->getNew(
349
+			'EE_Full_HTML_Field',
350
+			[$table_column, $nice_name, $nullable, $default_value]
351
+		);
352
+	}
353
+
354
+
355
+	/**
356
+	 * @param string $table_column
357
+	 * @param string $nice_name
358
+	 * @param bool   $nullable
359
+	 * @param null   $default_value
360
+	 * @return EE_Infinite_Integer_Field
361
+	 */
362
+	public function createInfiniteIntegerField(
363
+		string $table_column,
364
+		string $nice_name,
365
+		bool $nullable,
366
+		$default_value = null
367
+	): EE_Infinite_Integer_Field {
368
+		return $this->loader->getNew(
369
+			'EE_Infinite_Integer_Field',
370
+			[$table_column, $nice_name, $nullable, $default_value]
371
+		);
372
+	}
373
+
374
+
375
+	/**
376
+	 * @param string  $table_column
377
+	 * @param string  $nice_name
378
+	 * @param bool    $nullable
379
+	 * @param integer $default_value
380
+	 * @return EE_Integer_Field
381
+	 */
382
+	public function createIntegerField(
383
+		string $table_column,
384
+		string $nice_name,
385
+		bool $nullable = false,
386
+		int $default_value = 0
387
+	): EE_Integer_Field {
388
+		return $this->loader->getNew(
389
+			'EE_Integer_Field',
390
+			[$table_column, $nice_name, $nullable, $default_value]
391
+		);
392
+	}
393
+
394
+
395
+	/**
396
+	 * @param string $table_column
397
+	 * @param string $nice_name
398
+	 * @param bool   $nullable
399
+	 * @param null   $default_value
400
+	 * @return EE_Maybe_Serialized_Simple_HTML_Field
401
+	 */
402
+	public function createMaybeSerializedSimpleHtmlField(
403
+		string $table_column,
404
+		string $nice_name,
405
+		bool $nullable,
406
+		$default_value = null
407
+	): EE_Maybe_Serialized_Simple_HTML_Field {
408
+		return $this->loader->getNew(
409
+			'EE_Maybe_Serialized_Simple_HTML_Field',
410
+			[$table_column, $nice_name, $nullable, $default_value]
411
+		);
412
+	}
413
+
414
+
415
+	/**
416
+	 * @param string $table_column
417
+	 * @param string $nice_name
418
+	 * @param bool   $nullable
419
+	 * @param null   $default_value
420
+	 * @return EE_Maybe_Serialized_Text_Field
421
+	 */
422
+	public function createMaybeSerializedTextField(
423
+		string $table_column,
424
+		string $nice_name,
425
+		bool $nullable,
426
+		$default_value = null
427
+	): EE_Maybe_Serialized_Text_Field {
428
+		return $this->loader->getNew(
429
+			'EE_Maybe_Serialized_Text_Field',
430
+			[$table_column, $nice_name, $nullable, $default_value]
431
+		);
432
+	}
433
+
434
+
435
+	/**
436
+	 * @param string $table_column
437
+	 * @param string $nice_name
438
+	 * @param bool   $nullable
439
+	 * @param null   $default_value
440
+	 * @return EE_Money_Field
441
+	 */
442
+	public function createMoneyField(
443
+		string $table_column,
444
+		string $nice_name,
445
+		bool $nullable,
446
+		$default_value = null
447
+	): EE_Money_Field {
448
+		return $this->loader->getNew(
449
+			'EE_Money_Field',
450
+			[$table_column, $nice_name, $nullable, $default_value]
451
+		);
452
+	}
453
+
454
+
455
+	/**
456
+	 * @param string $table_column
457
+	 * @param string $nice_name
458
+	 * @param bool   $nullable
459
+	 * @param string $default_value
460
+	 * @return EE_Plain_Text_Field
461
+	 */
462
+	public function createPlainTextField(
463
+		string $table_column,
464
+		string $nice_name,
465
+		bool $nullable = true,
466
+		string $default_value = ''
467
+	): EE_Plain_Text_Field {
468
+		return $this->loader->getNew(
469
+			'EE_Plain_Text_Field',
470
+			[$table_column, $nice_name, $nullable, $default_value]
471
+		);
472
+	}
473
+
474
+
475
+	/**
476
+	 * @param string $table_column
477
+	 * @param string $nice_name
478
+	 * @param bool   $nullable
479
+	 * @param null   $default_value
480
+	 * @return EE_Post_Content_Field
481
+	 */
482
+	public function createPostContentField(
483
+		string $table_column,
484
+		string $nice_name,
485
+		bool $nullable,
486
+		$default_value = null
487
+	): EE_Post_Content_Field {
488
+		return $this->loader->getNew(
489
+			'EE_Post_Content_Field',
490
+			[$table_column, $nice_name, $nullable, $default_value]
491
+		);
492
+	}
493
+
494
+
495
+	/**
496
+	 * @param string $table_column
497
+	 * @param string $nice_name
498
+	 * @return EE_Primary_Key_Int_Field
499
+	 */
500
+	public function createPrimaryKeyIntField(string $table_column, string $nice_name): EE_Primary_Key_Int_Field
501
+	{
502
+		return $this->loader->getNew('EE_Primary_Key_Int_Field', [$table_column, $nice_name]);
503
+	}
504
+
505
+
506
+	/**
507
+	 * @param string $table_column
508
+	 * @param string $nice_name
509
+	 * @return EE_Primary_Key_String_Field
510
+	 */
511
+	public function createPrimaryKeyStringField(string $table_column, string $nice_name): EE_Primary_Key_String_Field
512
+	{
513
+		return $this->loader->getNew('EE_Primary_Key_String_Field', [$table_column, $nice_name]);
514
+	}
515
+
516
+
517
+	/**
518
+	 * @param string $table_column
519
+	 * @param string $nice_name
520
+	 * @param bool   $nullable
521
+	 * @param null   $default_value
522
+	 * @return EE_Serialized_Text_Field
523
+	 */
524
+	public function createSerializedTextField(
525
+		string $table_column,
526
+		string $nice_name,
527
+		bool $nullable,
528
+		$default_value = null
529
+	): EE_Serialized_Text_Field {
530
+		return $this->loader->getNew(
531
+			'EE_Serialized_Text_Field',
532
+			[$table_column, $nice_name, $nullable, $default_value]
533
+		);
534
+	}
535
+
536
+
537
+	/**
538
+	 * @param string $table_column
539
+	 * @param string $nice_name
540
+	 * @param bool   $nullable
541
+	 * @param null   $default_value
542
+	 * @return EE_Simple_HTML_Field
543
+	 */
544
+	public function createSimpleHtmlField(
545
+		string $table_column,
546
+		string $nice_name,
547
+		bool $nullable,
548
+		$default_value = null
549
+	): EE_Simple_HTML_Field {
550
+		return $this->loader->getNew(
551
+			'EE_Simple_HTML_Field',
552
+			[$table_column, $nice_name, $nullable, $default_value]
553
+		);
554
+	}
555
+
556
+
557
+	/**
558
+	 * @param string $table_column
559
+	 * @param string $nice_name
560
+	 * @param bool   $nullable
561
+	 * @param null   $default_value
562
+	 * @return EE_Slug_Field
563
+	 */
564
+	public function createSlugField(
565
+		string $table_column,
566
+		string $nice_name,
567
+		bool $nullable = false,
568
+		$default_value = null
569
+	): EE_Slug_Field {
570
+		return $this->loader->getNew(
571
+			'EE_Slug_Field',
572
+			[$table_column, $nice_name, $nullable, $default_value]
573
+		);
574
+	}
575
+
576
+
577
+	/**
578
+	 * @param string $table_column
579
+	 * @param string $nice_name
580
+	 * @param bool   $nullable
581
+	 * @param null   $default_value
582
+	 * @return EE_Trashed_Flag_Field
583
+	 */
584
+	public function createTrashedFlagField(
585
+		string $table_column,
586
+		string $nice_name,
587
+		bool $nullable,
588
+		$default_value = null
589
+	): EE_Trashed_Flag_Field {
590
+		return $this->loader->getNew(
591
+			'EE_Trashed_Flag_Field',
592
+			[$table_column, $nice_name, $nullable, $default_value]
593
+		);
594
+	}
595
+
596
+
597
+	/**
598
+	 * @param string $table_column
599
+	 * @param string $nice_name
600
+	 * @param bool   $nullable
601
+	 * @param mixed  $default_value
602
+	 * @param array $values     If additional statuses are to be used other than the default WP statuses,
603
+	 *                          then they can be registered via this property.
604
+	 *                          The format of the array should be as follows:
605
+	 *                          [
606
+	 *                              'status_reference' => [
607
+	 *                                  'label' => __('Status Reference Label', 'event_espresso'),
608
+	 *                                  // whether status is shown on the frontend of the site
609
+	 *                                  'public' => true,
610
+	 *                                  // whether status is excluded from wp searches
611
+	 *                                  'exclude_from_search' => false,
612
+	 *                                  // whether status is included in queries
613
+	 *                                  for the admin 'all' view in list table views.
614
+	 *                                  'show_in_admin_all_list' => true,
615
+	 *                                  // show in the list of statuses with post counts
616
+	 *                                  // at the top of the admin list tables (i.e. Status Reference(2) )
617
+	 *                                  'show_in_admin_status_list' => true,
618
+	 *                                  // the text to display on the admin screen
619
+	 *                                  // ( or you won't see your status count )
620
+	 *                                  'label_count' => _n_noop(
621
+	 *                                      'Status Reference <span class="count">(%s)</span>',
622
+	 *                                      'Status References <span class="count">(%s)</span>'
623
+	 *                                  ),
624
+	 *                              ]
625
+	 *                          ]
626
+	 * @return EE_WP_Post_Status_Field
627
+	 * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info
628
+	 */
629
+	public function createWpPostStatusField(
630
+		string $table_column,
631
+		string $nice_name,
632
+		bool $nullable,
633
+		$default_value = null,
634
+		array $values = []
635
+	): EE_WP_Post_Status_Field {
636
+		return $this->loader->getNew(
637
+			'EE_WP_Post_Status_Field',
638
+			[$table_column, $nice_name, $nullable, $default_value, $values]
639
+		);
640
+	}
641
+
642
+
643
+	/**
644
+	 * @param string $post_type
645
+	 * @return EE_WP_Post_Type_Field
646
+	 */
647
+	public function createWpPostTypeField(string $post_type): EE_WP_Post_Type_Field
648
+	{
649
+		return $this->loader->getNew('EE_WP_Post_Type_Field', [$post_type]);
650
+	}
651
+
652
+
653
+	/**
654
+	 * @param string $table_column
655
+	 * @param string $nice_name
656
+	 * @param bool   $nullable
657
+	 * @return EE_WP_User_Field
658
+	 */
659
+	public function createWpUserField(string $table_column, string $nice_name, bool $nullable): EE_WP_User_Field
660
+	{
661
+		return $this->loader->getNew('EE_WP_User_Field', [$table_column, $nice_name, $nullable]);
662
+	}
663 663
 }
Please login to merge, or discard this patch.
core/domain/services/registration/form/v1/RegFormAttendeeFactory.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -16,113 +16,113 @@
 block discarded – undo
16 16
 class RegFormAttendeeFactory
17 17
 {
18 18
 
19
-    /**
20
-     * @var CommandBusInterface
21
-     */
22
-    public $command_bus;
19
+	/**
20
+	 * @var CommandBusInterface
21
+	 */
22
+	public $command_bus;
23 23
 
24
-    /**
25
-     * @var RegistrantData
26
-     */
27
-    private $registrant_data;
24
+	/**
25
+	 * @var RegistrantData
26
+	 */
27
+	private $registrant_data;
28 28
 
29 29
 
30
-    /**
31
-     * RegFormAttendeeFactory constructor.
32
-     *
33
-     * @param CommandBusInterface $command_bus
34
-     * @param RegistrantData      $registrant_data
35
-     */
36
-    public function __construct(CommandBusInterface $command_bus, RegistrantData $registrant_data)
37
-    {
38
-        $this->command_bus     = $command_bus;
39
-        $this->registrant_data = $registrant_data;
40
-    }
30
+	/**
31
+	 * RegFormAttendeeFactory constructor.
32
+	 *
33
+	 * @param CommandBusInterface $command_bus
34
+	 * @param RegistrantData      $registrant_data
35
+	 */
36
+	public function __construct(CommandBusInterface $command_bus, RegistrantData $registrant_data)
37
+	{
38
+		$this->command_bus     = $command_bus;
39
+		$this->registrant_data = $registrant_data;
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @param EE_Registration $registration
45
-     * @param string          $reg_url_link
46
-     * @return bool
47
-     * @throws EE_Error
48
-     * @throws ReflectionException
49
-     */
50
-    public function create(EE_Registration $registration, string $reg_url_link): bool
51
-    {
52
-        // this registration does not require additional attendee information ?
53
-        if (
54
-            $this->registrant_data->copyPrimary()
55
-            && $this->registrant_data->attendeeCount() > 1
56
-            && $this->registrant_data->primaryRegistrantIsValid()
57
-        ) {
58
-            // just copy the primary registrant
59
-            $attendee = $this->registrant_data->primaryRegistrant();
60
-        } else {
61
-            // ensure critical details are set for additional attendees
62
-            // raw form data was already set during call to processRegFormData()
63
-            $this->registrant_data->ensureCriticalRegistrantDataIsSet($reg_url_link);
64
-            // execute create attendee command (which may return an existing attendee)
65
-            $attendee = $this->command_bus->execute(
66
-                new CreateAttendeeCommand(
67
-                    $this->registrant_data->getRegistrantData($reg_url_link),
68
-                    $registration
69
-                )
70
-            );
71
-            // who's #1 ?
72
-            if ($this->registrant_data->currentRegistrantIsPrimary()) {
73
-                $this->registrant_data->setPrimaryRegistrant($attendee);
74
-            }
75
-        }
76
-        // add relation to registration, set attendee ID, and cache attendee
77
-        $this->associateAttendeeWithRegistration($registration, $attendee);
78
-        return $this->isValidAttendee($registration, $reg_url_link);
79
-    }
43
+	/**
44
+	 * @param EE_Registration $registration
45
+	 * @param string          $reg_url_link
46
+	 * @return bool
47
+	 * @throws EE_Error
48
+	 * @throws ReflectionException
49
+	 */
50
+	public function create(EE_Registration $registration, string $reg_url_link): bool
51
+	{
52
+		// this registration does not require additional attendee information ?
53
+		if (
54
+			$this->registrant_data->copyPrimary()
55
+			&& $this->registrant_data->attendeeCount() > 1
56
+			&& $this->registrant_data->primaryRegistrantIsValid()
57
+		) {
58
+			// just copy the primary registrant
59
+			$attendee = $this->registrant_data->primaryRegistrant();
60
+		} else {
61
+			// ensure critical details are set for additional attendees
62
+			// raw form data was already set during call to processRegFormData()
63
+			$this->registrant_data->ensureCriticalRegistrantDataIsSet($reg_url_link);
64
+			// execute create attendee command (which may return an existing attendee)
65
+			$attendee = $this->command_bus->execute(
66
+				new CreateAttendeeCommand(
67
+					$this->registrant_data->getRegistrantData($reg_url_link),
68
+					$registration
69
+				)
70
+			);
71
+			// who's #1 ?
72
+			if ($this->registrant_data->currentRegistrantIsPrimary()) {
73
+				$this->registrant_data->setPrimaryRegistrant($attendee);
74
+			}
75
+		}
76
+		// add relation to registration, set attendee ID, and cache attendee
77
+		$this->associateAttendeeWithRegistration($registration, $attendee);
78
+		return $this->isValidAttendee($registration, $reg_url_link);
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * @param EE_Registration $registration
84
-     * @param string          $reg_url_link
85
-     * @return bool
86
-     * @throws EE_Error
87
-     */
88
-    private function isValidAttendee(EE_Registration $registration, string $reg_url_link): bool
89
-    {
90
-        if ($registration->attendee() instanceof EE_Attendee) {
91
-            return true;
92
-        }
93
-        EE_Error::add_error(
94
-            sprintf(
95
-                esc_html_x(
96
-                    'Registration %s has an invalid or missing Attendee object.',
97
-                    'Registration 123-456-789 has an invalid or missing Attendee object.',
98
-                    'event_espresso'
99
-                ),
100
-                $reg_url_link
101
-            ),
102
-            __FILE__,
103
-            __FUNCTION__,
104
-            __LINE__
105
-        );
106
-        return false;
107
-    }
82
+	/**
83
+	 * @param EE_Registration $registration
84
+	 * @param string          $reg_url_link
85
+	 * @return bool
86
+	 * @throws EE_Error
87
+	 */
88
+	private function isValidAttendee(EE_Registration $registration, string $reg_url_link): bool
89
+	{
90
+		if ($registration->attendee() instanceof EE_Attendee) {
91
+			return true;
92
+		}
93
+		EE_Error::add_error(
94
+			sprintf(
95
+				esc_html_x(
96
+					'Registration %s has an invalid or missing Attendee object.',
97
+					'Registration 123-456-789 has an invalid or missing Attendee object.',
98
+					'event_espresso'
99
+				),
100
+				$reg_url_link
101
+			),
102
+			__FILE__,
103
+			__FUNCTION__,
104
+			__LINE__
105
+		);
106
+		return false;
107
+	}
108 108
 
109 109
 
110
-    /**
111
-     * @param EE_Registration $registration
112
-     * @param EE_Attendee     $attendee
113
-     * @return void
114
-     * @throws EE_Error
115
-     * @throws InvalidArgumentException
116
-     * @throws ReflectionException
117
-     * @throws RuntimeException
118
-     * @throws InvalidDataTypeException
119
-     * @throws InvalidInterfaceException
120
-     */
121
-    private function associateAttendeeWithRegistration(EE_Registration $registration, EE_Attendee $attendee)
122
-    {
123
-        // add relation to attendee
124
-        $registration->_add_relation_to($attendee, 'Attendee');
125
-        $registration->set_attendee_id($attendee->ID());
126
-        $registration->update_cache_after_object_save('Attendee', $attendee);
127
-    }
110
+	/**
111
+	 * @param EE_Registration $registration
112
+	 * @param EE_Attendee     $attendee
113
+	 * @return void
114
+	 * @throws EE_Error
115
+	 * @throws InvalidArgumentException
116
+	 * @throws ReflectionException
117
+	 * @throws RuntimeException
118
+	 * @throws InvalidDataTypeException
119
+	 * @throws InvalidInterfaceException
120
+	 */
121
+	private function associateAttendeeWithRegistration(EE_Registration $registration, EE_Attendee $attendee)
122
+	{
123
+		// add relation to attendee
124
+		$registration->_add_relation_to($attendee, 'Attendee');
125
+		$registration->set_attendee_id($attendee->ID());
126
+		$registration->update_cache_after_object_save('Attendee', $attendee);
127
+	}
128 128
 }
Please login to merge, or discard this patch.
core/domain/services/registration/form/v1/RegFormQuestionFactory.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $registration,
57 57
             $question->system_ID()
58 58
         );
59
-        $answer       = $answer_value === null
59
+        $answer = $answer_value === null
60 60
             ? $this->answer_model->get_one(
61 61
                 [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
62 62
             )
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
         }
76 76
         // verify instance
77 77
         if ($answer instanceof EE_Answer) {
78
-            if (! empty($answer_value)) {
78
+            if ( ! empty($answer_value)) {
79 79
                 $answer->set('ANS_value', $answer_value);
80 80
             }
81 81
             $answer->cache('Question', $question);
82 82
             // remember system ID had a bug where sometimes it could be null
83 83
             $answer_cache_id = $question->is_system_question()
84
-                ? $question->system_ID() . '-' . $registration->reg_url_link()
85
-                : $question->ID() . '-' . $registration->reg_url_link();
84
+                ? $question->system_ID().'-'.$registration->reg_url_link()
85
+                : $question->ID().'-'.$registration->reg_url_link();
86 86
             $registration->cache('Answer', $answer, $answer_cache_id);
87 87
         }
88 88
         return $this->generateQuestionInput($registration, $question, $answer);
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
         EE_Question $question,
106 106
         $answer
107 107
     ): EE_Form_Input_Base {
108
-        $identifier                              = $question->is_system_question()
108
+        $identifier = $question->is_system_question()
109 109
             ? $question->system_ID()
110 110
             : $question->ID();
111 111
         $callback = $this->addRequiredQuestion;
112 112
         $callback($identifier, $question->required());
113
-        $input_constructor_args                  = [
114
-            'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
115
-            'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
116
-            'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
117
-            'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
113
+        $input_constructor_args = [
114
+            'html_name'        => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
115
+            'html_id'          => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
116
+            'html_class'       => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
117
+            'html_label_id'    => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
118 118
             'html_label_class' => 'ee-reg-qstn',
119 119
         ];
120 120
         $input_constructor_args['html_label_id'] .= '-lbl';
121 121
         if ($answer instanceof EE_Answer && $answer->ID()) {
122
-            $input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
123
-            $input_constructor_args['html_id']       .= '-' . $answer->ID();
124
-            $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
122
+            $input_constructor_args['html_name']     .= '['.$answer->ID().']';
123
+            $input_constructor_args['html_id']       .= '-'.$answer->ID();
124
+            $input_constructor_args['html_label_id'] .= '-'.$answer->ID();
125 125
         }
126 126
         return $question->generate_form_input(
127 127
             $registration,
Please login to merge, or discard this patch.
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -16,118 +16,118 @@
 block discarded – undo
16 16
 class RegFormQuestionFactory
17 17
 {
18 18
 
19
-    /**
20
-     * @var callable
21
-     */
22
-    protected $addRequiredQuestion;
19
+	/**
20
+	 * @var callable
21
+	 */
22
+	protected $addRequiredQuestion;
23 23
 
24
-    /**
25
-     * @var EEM_Answer
26
-     */
27
-    public $answer_model;
24
+	/**
25
+	 * @var EEM_Answer
26
+	 */
27
+	public $answer_model;
28 28
 
29 29
 
30
-    /**
31
-     * @param callable   $addRequiredQuestion
32
-     * @param EEM_Answer $answer_model
33
-     */
34
-    public function __construct(callable $addRequiredQuestion, EEM_Answer $answer_model)
35
-    {
36
-        $this->addRequiredQuestion = $addRequiredQuestion;
37
-        $this->answer_model = $answer_model;
38
-    }
30
+	/**
31
+	 * @param callable   $addRequiredQuestion
32
+	 * @param EEM_Answer $answer_model
33
+	 */
34
+	public function __construct(callable $addRequiredQuestion, EEM_Answer $answer_model)
35
+	{
36
+		$this->addRequiredQuestion = $addRequiredQuestion;
37
+		$this->answer_model = $answer_model;
38
+	}
39 39
 
40 40
 
41
-    /**
42
-     * @param EE_Registration $registration
43
-     * @param EE_Question     $question
44
-     * @return EE_Form_Input_Base
45
-     * @throws EE_Error
46
-     * @throws InvalidArgumentException
47
-     * @throws InvalidDataTypeException
48
-     * @throws InvalidInterfaceException
49
-     * @throws ReflectionException
50
-     */
51
-    public function create(
52
-        EE_Registration $registration,
53
-        EE_Question $question
54
-    ): EE_Form_Input_Base {
55
-        // if this question was for an attendee detail, then check for that answer
56
-        $answer_value = $this->answer_model->get_attendee_property_answer_value(
57
-            $registration,
58
-            $question->system_ID()
59
-        );
60
-        $answer       = $answer_value === null
61
-            ? $this->answer_model->get_one(
62
-                [['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
63
-            )
64
-            : null;
65
-        // if NOT returning to edit an existing registration
66
-        // OR if this question is for an attendee property
67
-        // OR we still don't have an EE_Answer object
68
-        if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
69
-            // create an EE_Answer object for storing everything in
70
-            $answer = EE_Answer::new_instance(
71
-                [
72
-                    'QST_ID' => $question->ID(),
73
-                    'REG_ID' => $registration->ID(),
74
-                ]
75
-            );
76
-        }
77
-        // verify instance
78
-        if ($answer instanceof EE_Answer) {
79
-            if (! empty($answer_value)) {
80
-                $answer->set('ANS_value', $answer_value);
81
-            }
82
-            $answer->cache('Question', $question);
83
-            // remember system ID had a bug where sometimes it could be null
84
-            $answer_cache_id = $question->is_system_question()
85
-                ? $question->system_ID() . '-' . $registration->reg_url_link()
86
-                : $question->ID() . '-' . $registration->reg_url_link();
87
-            $registration->cache('Answer', $answer, $answer_cache_id);
88
-        }
89
-        return $this->generateQuestionInput($registration, $question, $answer);
90
-    }
41
+	/**
42
+	 * @param EE_Registration $registration
43
+	 * @param EE_Question     $question
44
+	 * @return EE_Form_Input_Base
45
+	 * @throws EE_Error
46
+	 * @throws InvalidArgumentException
47
+	 * @throws InvalidDataTypeException
48
+	 * @throws InvalidInterfaceException
49
+	 * @throws ReflectionException
50
+	 */
51
+	public function create(
52
+		EE_Registration $registration,
53
+		EE_Question $question
54
+	): EE_Form_Input_Base {
55
+		// if this question was for an attendee detail, then check for that answer
56
+		$answer_value = $this->answer_model->get_attendee_property_answer_value(
57
+			$registration,
58
+			$question->system_ID()
59
+		);
60
+		$answer       = $answer_value === null
61
+			? $this->answer_model->get_one(
62
+				[['QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()]]
63
+			)
64
+			: null;
65
+		// if NOT returning to edit an existing registration
66
+		// OR if this question is for an attendee property
67
+		// OR we still don't have an EE_Answer object
68
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
69
+			// create an EE_Answer object for storing everything in
70
+			$answer = EE_Answer::new_instance(
71
+				[
72
+					'QST_ID' => $question->ID(),
73
+					'REG_ID' => $registration->ID(),
74
+				]
75
+			);
76
+		}
77
+		// verify instance
78
+		if ($answer instanceof EE_Answer) {
79
+			if (! empty($answer_value)) {
80
+				$answer->set('ANS_value', $answer_value);
81
+			}
82
+			$answer->cache('Question', $question);
83
+			// remember system ID had a bug where sometimes it could be null
84
+			$answer_cache_id = $question->is_system_question()
85
+				? $question->system_ID() . '-' . $registration->reg_url_link()
86
+				: $question->ID() . '-' . $registration->reg_url_link();
87
+			$registration->cache('Answer', $answer, $answer_cache_id);
88
+		}
89
+		return $this->generateQuestionInput($registration, $question, $answer);
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * @param EE_Registration $registration
95
-     * @param EE_Question     $question
96
-     * @param                 $answer
97
-     * @return EE_Form_Input_Base
98
-     * @throws EE_Error
99
-     * @throws InvalidArgumentException
100
-     * @throws ReflectionException
101
-     * @throws InvalidDataTypeException
102
-     * @throws InvalidInterfaceException
103
-     */
104
-    private function generateQuestionInput(
105
-        EE_Registration $registration,
106
-        EE_Question $question,
107
-        $answer
108
-    ): EE_Form_Input_Base {
109
-        $identifier                              = $question->is_system_question()
110
-            ? $question->system_ID()
111
-            : $question->ID();
112
-        $callback = $this->addRequiredQuestion;
113
-        $callback($identifier, $question->required());
114
-        $input_constructor_args                  = [
115
-            'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
116
-            'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
117
-            'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
118
-            'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
119
-            'html_label_class' => 'ee-reg-qstn',
120
-        ];
121
-        $input_constructor_args['html_label_id'] .= '-lbl';
122
-        if ($answer instanceof EE_Answer && $answer->ID()) {
123
-            $input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
124
-            $input_constructor_args['html_id']       .= '-' . $answer->ID();
125
-            $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
126
-        }
127
-        return $question->generate_form_input(
128
-            $registration,
129
-            $answer,
130
-            $input_constructor_args
131
-        );
132
-    }
93
+	/**
94
+	 * @param EE_Registration $registration
95
+	 * @param EE_Question     $question
96
+	 * @param                 $answer
97
+	 * @return EE_Form_Input_Base
98
+	 * @throws EE_Error
99
+	 * @throws InvalidArgumentException
100
+	 * @throws ReflectionException
101
+	 * @throws InvalidDataTypeException
102
+	 * @throws InvalidInterfaceException
103
+	 */
104
+	private function generateQuestionInput(
105
+		EE_Registration $registration,
106
+		EE_Question $question,
107
+		$answer
108
+	): EE_Form_Input_Base {
109
+		$identifier                              = $question->is_system_question()
110
+			? $question->system_ID()
111
+			: $question->ID();
112
+		$callback = $this->addRequiredQuestion;
113
+		$callback($identifier, $question->required());
114
+		$input_constructor_args                  = [
115
+			'html_name'        => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
116
+			'html_id'          => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
117
+			'html_class'       => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
118
+			'html_label_id'    => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
119
+			'html_label_class' => 'ee-reg-qstn',
120
+		];
121
+		$input_constructor_args['html_label_id'] .= '-lbl';
122
+		if ($answer instanceof EE_Answer && $answer->ID()) {
123
+			$input_constructor_args['html_name']     .= '[' . $answer->ID() . ']';
124
+			$input_constructor_args['html_id']       .= '-' . $answer->ID();
125
+			$input_constructor_args['html_label_id'] .= '-' . $answer->ID();
126
+		}
127
+		return $question->generate_form_input(
128
+			$registration,
129
+			$answer,
130
+			$input_constructor_args
131
+		);
132
+	}
133 133
 }
Please login to merge, or discard this patch.