Completed
Pull Request — master (#141)
by Stephanie
02:24
created
classes/models/FrmFormMigrator.php 2 patches
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$form['fields'][]         = $new_field;
274 274
 		$this->current_section    = null;
275 275
 
276
-		++$field_order;
276
+		++ $field_order;
277 277
 	}
278 278
 
279 279
 	protected function before_add_field( $field, &$new_field, &$form, &$field_order ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 		foreach ( $form['fields'] as $key => $new_field ) {
301 301
 			$new_field['form_id']         = $form_id;
302
-			$form['fields'][ $key ]['id'] = FrmField::create( $new_field );
302
+			$form['fields'][$key]['id'] = FrmField::create( $new_field );
303 303
 		}
304 304
 
305 305
 		// create emails
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 				if ( $key === 'post_title' ) {
312 312
 					$new_action->post_title = $value;
313 313
 				} else {
314
-					$new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] );
314
+					$new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] );
315 315
 				}
316 316
 			}
317 317
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 		$imported = $this->get_tracked_import();
365 365
 
366
-		$imported[ $this->slug ][ $new_form_id ] = $source_id;
366
+		$imported[$this->slug][$new_form_id] = $source_id;
367 367
 
368 368
 		update_option( $this->tracking, $imported, false );
369 369
 	}
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	private function is_imported( $source_id ) {
384 384
 		$imported    = $this->get_tracked_import();
385 385
 		$new_form_id = 0;
386
-		if ( isset( $imported[ $this->slug ] ) && in_array( $source_id, $imported[ $this->slug ] ) ) {
387
-			$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );
386
+		if ( isset( $imported[$this->slug] ) && in_array( $source_id, $imported[$this->slug] ) ) {
387
+			$new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) );
388 388
 		}
389 389
 
390 390
 		return $new_form_id;
@@ -478,8 +478,7 @@  discard block
 block discarded – undo
478 478
 	 * @return string
479 479
 	 */
480 480
 	protected function get_field_label( $field ) {
481
-		$label = is_array( $field ) ? ( isset( $field['label'] ) ? $field['label'] : '' ) :
482
-									  ( isset( $field->label )   ? $field->label   : '' );
481
+		$label = is_array( $field ) ? ( isset( $field['label'] ) ? $field['label'] : '' ) : ( isset( $field->label ) ? $field->label : '' );
483 482
 		if ( ! empty( $label ) ) {
484 483
 			return sanitize_text_field( $label );
485 484
 		}
Please login to merge, or discard this patch.
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -167,6 +167,9 @@  discard block
 block discarded – undo
167 167
 		return $response;
168 168
 	}
169 169
 
170
+	/**
171
+	 * @param string $source_form_name
172
+	 */
170 173
 	protected function prepare_new_form( $source_id, $source_form_name ) {
171 174
 		return array(
172 175
 			'import_form_id' => $source_id,
@@ -261,6 +264,7 @@  discard block
 block discarded – undo
261 264
 	 *                            particularly the overrides in child classes, as
262 265
 	 *                            there will be no need to rebuild the converter
263 266
 	 *                            array at usage locations.
267
+	 * @return string
264 268
 	 */
265 269
 	protected function convert_field_type( $field, $use = '' ) {
266 270
 		return $use ? $use : ( is_array( $field ) ? $field['type'] : $field->type );
@@ -404,6 +408,9 @@  discard block
 block discarded – undo
404 408
 		return array();
405 409
 	}
406 410
 
411
+	/**
412
+	 * @param string $type
413
+	 */
407 414
 	private function is_unsupported_field( $type ) {
408 415
 		$fields = $this->unsupported_field_types();
409 416
 
@@ -419,6 +426,9 @@  discard block
 block discarded – undo
419 426
 		return array();
420 427
 	}
421 428
 
429
+	/**
430
+	 * @param string $type
431
+	 */
422 432
 	protected function should_skip_field( $type ) {
423 433
 		$skip_pro_fields = $this->skip_pro_fields();
424 434
 
Please login to merge, or discard this patch.