GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 699b70...879176 )
by Chris
13:23
created
vendor/cmb2/includes/CMB2_Base.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
 	 * Get object property and optionally set a fallback
160 160
 	 * @since  2.0.0
161 161
 	 * @param  string $property Metabox config property to retrieve
162
-	 * @param  mixed  $fallback Fallback value to set if no value found
162
+	 * @param  boolean|null  $fallback Fallback value to set if no value found
163 163
 	 * @return mixed            Metabox config property value or false
164 164
 	 */
165 165
 	public function prop( $property, $fallback = null ) {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -315,10 +315,10 @@
 block discarded – undo
315 315
 	 * which is callable. If so, it registers the callback, and if not,
316 316
 	 * converts the maybe-modified $val to a boolean for return.
317 317
 	 *
318
- 	 * The registered handlers will have a parameter name which matches the filter, except:
319
- 	 * - The 'cmb2_api' prefix will be removed
320
- 	 * - A '_cb' suffix will be added (to stay inline with other '*_cb' parameters).
321
- 	 *
318
+	 * The registered handlers will have a parameter name which matches the filter, except:
319
+	 * - The 'cmb2_api' prefix will be removed
320
+	 * - A '_cb' suffix will be added (to stay inline with other '*_cb' parameters).
321
+	 *
322 322
 	 * @since  2.2.3
323 323
 	 *
324 324
 	 * @param  string $hook_name     The hook name.
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		}
359 359
 
360 360
 		// Cast to bool.
361
-		return !! $val;
361
+		return ! ! $val;
362 362
 	}
363 363
 
364 364
 	/**
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 			switch ( $message ) {
387 387
 
388 388
 				case self::DEPRECATED_PARAM:
389
-					$message = sprintf( __( 'The "%s" field parameter has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[3], $args[4] );
389
+					$message = sprintf( __( 'The "%s" field parameter has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] );
390 390
 					break;
391 391
 
392 392
 				case self::DEPRECATED_CB_PARAM:
393
-					$message = sprintf( __( 'Using the "%s" field parameter as a callback has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[3], $args[4] );
393
+					$message = sprintf( __( 'Using the "%s" field parameter as a callback has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] );
394 394
 					break;
395 395
 
396 396
 				default:
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	public function __call( $method, $args ) {
470 470
 		$object_class = strtolower( get_class( $this ) );
471 471
 
472
-		if ( ! has_filter(  "{$object_class}_inherit_{$method}" ) ) {
472
+		if ( ! has_filter( "{$object_class}_inherit_{$method}" ) ) {
473 473
 			throw new Exception( sprintf( esc_html__( 'Invalid %1$s method: %2$s', 'give' ), get_class( $this ), $method ) );
474 474
 		}
475 475
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -421,15 +421,13 @@
 block discarded – undo
421 421
 			if ( function_exists( '__' ) ) {
422 422
 				if ( ! is_null( $message ) ) {
423 423
 					trigger_error( sprintf( __( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s! %3$s', 'cmb2' ), $function, $version, $message ) );
424
-				}
425
-				else {
424
+				} else {
426 425
 					trigger_error( sprintf( __( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s with no alternative available.', 'cmb2' ), $function, $version ) );
427 426
 				}
428 427
 			} else {
429 428
 				if ( ! is_null( $message ) ) {
430 429
 					trigger_error( sprintf( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
431
-				}
432
-				else {
430
+				} else {
433 431
 					trigger_error( sprintf( '%1$s was called with a parameter that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
434 432
 				}
435 433
 			}
Please login to merge, or discard this patch.
vendor/cmb2/includes/CMB2_Field.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	 * Return a formatted timestamp for a field
724 724
 	 * @since  2.0.0
725 725
 	 * @param  string $format     Either date_format or time_format
726
-	 * @param  string $meta_value Optional meta value to check
726
+	 * @param  integer $meta_value Optional meta value to check
727 727
 	 * @return string             Formatted date
728 728
 	 */
729 729
 	public function get_timestamp_format( $format = 'date_format', $meta_value = 0 ) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 * Retrieve options args. Calls options_cb if it exists.
997 997
 	 * @since  2.0.0
998 998
 	 * @param  string  $key Specific option to retrieve
999
-	 * @return array        Array of options
999
+	 * @return string        Array of options
1000 1000
 	 */
1001 1001
 	public function options( $key = '' ) {
1002 1002
 		if ( ! empty( $this->field_options ) ) {
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function __construct( $args ) {
114 114
 
115
-		if ( ! empty( $args['group_field'] ) ) {
116
-			$this->group       = $args['group_field'];
115
+		if ( ! empty( $args[ 'group_field' ] ) ) {
116
+			$this->group       = $args[ 'group_field' ];
117 117
 			$this->object_id   = $this->group->object_id;
118 118
 			$this->object_type = $this->group->object_type;
119 119
 			$this->cmb_id      = $this->group->cmb_id;
120 120
 		} else {
121
-			$this->object_id   = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
122
-			$this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post';
121
+			$this->object_id   = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0;
122
+			$this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post';
123 123
 
124
-			if ( isset( $args['cmb_id'] ) ) {
125
-				$this->cmb_id = $args['cmb_id'];
124
+			if ( isset( $args[ 'cmb_id' ] ) ) {
125
+				$this->cmb_id = $args[ 'cmb_id' ];
126 126
 			}
127 127
 		}
128 128
 
129
-		$this->args = $this->_set_field_defaults( $args['field_args'], $args );
129
+		$this->args = $this->_set_field_defaults( $args[ 'field_args' ], $args );
130 130
 
131 131
 		if ( $this->object_id ) {
132 132
 			$this->value = $this->get_data();
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			return call_user_func_array( array( $this, 'get_string' ), $arguments );
146 146
 		}
147 147
 
148
-		$key = isset( $arguments[0] ) ? $arguments[0] : false;
148
+		$key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false;
149 149
 		return $this->args( $name, $key );
150 150
 	}
151 151
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function get_data( $field_id = '', $args = array() ) {
218 218
 		if ( $field_id ) {
219
-			$args['field_id'] = $field_id;
219
+			$args[ 'field_id' ] = $field_id;
220 220
 		} else if ( $this->group ) {
221
-			$args['field_id'] = $this->group->id();
221
+			$args[ 'field_id' ] = $this->group->id();
222 222
 		}
223 223
 
224 224
 		$a = $this->data_args( $args );
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		 *
260 260
 		 * @since 2.0.0
261 261
 		 */
262
-		$data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this );
262
+		$data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this );
263 263
 
264 264
 		// If no override, get value normally
265 265
 		if ( 'cmb2_field_no_override_val' === $data ) {
266
-			$data = 'options-page' === $a['type']
267
-				? cmb2_options( $a['id'] )->get( $a['field_id'] )
268
-				: get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) );
266
+			$data = 'options-page' === $a[ 'type' ]
267
+				? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] )
268
+				: get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) );
269 269
 		}
270 270
 
271 271
 		if ( $this->group ) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	public function update_data( $new_value, $single = true ) {
288 288
 		$a = $this->data_args( array( 'single' => $single ) );
289 289
 
290
-		$a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value;
290
+		$a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value;
291 291
 
292 292
 		/**
293 293
 		 * Filter whether to override saving of meta value.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @since 2.0.0
325 325
 		 */
326
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this );
326
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this );
327 327
 
328 328
 		// If override, return that
329 329
 		if ( null !== $override ) {
@@ -331,22 +331,22 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 
333 333
 		// Options page handling (or temp data store)
334
-		if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
335
-			return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] );
334
+		if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
335
+			return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] );
336 336
 		}
337 337
 
338 338
 		// Add metadata if not single
339
-		if ( ! $a['single'] ) {
340
-			return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false );
339
+		if ( ! $a[ 'single' ] ) {
340
+			return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false );
341 341
 		}
342 342
 
343 343
 		// Delete meta if we have an empty array
344
-		if ( is_array( $a['value'] ) && empty( $a['value'] ) ) {
345
-			return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value );
344
+		if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) {
345
+			return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value );
346 346
 		}
347 347
 
348 348
 		// Update metadata
349
-		return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] );
349
+		return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] );
350 350
 	}
351 351
 
352 352
 	/**
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 		 * @param array $field_args All field arguments
397 397
 		 * @param CMB2_Field object $field This field object
398 398
 		 */
399
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );
399
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this );
400 400
 
401 401
 		// If no override, remove as usual
402 402
 		if ( null !== $override ) {
403 403
 			return $override;
404 404
 		}
405 405
 		// Option page handling
406
-		elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
407
-			return cmb2_options( $a['id'] )->remove( $a['field_id'] );
406
+		elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
407
+			return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] );
408 408
 		}
409 409
 
410 410
 		// Remove metadata
411
-		return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old );
411
+		return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old );
412 412
 	}
413 413
 
414 414
 	/**
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 		foreach ( $conditional_classes as $class => $condition ) {
861 861
 			if ( $condition ) {
862
-				$classes[] = $class;
862
+				$classes[ ] = $class;
863 863
 			}
864 864
 		}
865 865
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 
872 872
 		if ( $added_classes ) {
873
-			$classes[] = esc_attr( $added_classes );
873
+			$classes[ ] = esc_attr( $added_classes );
874 874
 		}
875 875
 
876 876
 		/**
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
 	public function get_string( $text_key, $fallback ) {
971 971
 		// If null, populate with our field strings values.
972 972
 		if ( null === $this->strings ) {
973
-			$this->strings = (array) $this->args['text'];
973
+			$this->strings = (array) $this->args[ 'text' ];
974 974
 
975
-			if ( is_callable( $this->args['text_cb'] ) ) {
976
-				$strings = call_user_func( $this->args['text_cb'], $this );
975
+			if ( is_callable( $this->args[ 'text_cb' ] ) ) {
976
+				$strings = call_user_func( $this->args[ 'text_cb' ], $this );
977 977
 
978 978
 				if ( $strings && is_array( $strings ) ) {
979 979
 					$this->strings += $strings;
@@ -1007,10 +1007,10 @@  discard block
 block discarded – undo
1007 1007
 			return $this->field_options;
1008 1008
 		}
1009 1009
 
1010
-		$this->field_options = (array) $this->args['options'];
1010
+		$this->field_options = (array) $this->args[ 'options' ];
1011 1011
 
1012
-		if ( is_callable( $this->args['options_cb'] ) ) {
1013
-			$options = call_user_func( $this->args['options_cb'], $this );
1012
+		if ( is_callable( $this->args[ 'options_cb' ] ) ) {
1013
+			$options = call_user_func( $this->args[ 'options_cb' ], $this );
1014 1014
 
1015 1015
 			if ( $options && is_array( $options ) ) {
1016 1016
 				$this->field_options = $options + $this->field_options;
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	public function add_js_dependencies( $dependencies = array() ) {
1033 1033
 		foreach ( (array) $dependencies as $dependency ) {
1034
-			$this->args['js_dependencies'][ $dependency ] = $dependency;
1034
+			$this->args[ 'js_dependencies' ][ $dependency ] = $dependency;
1035 1035
 		}
1036 1036
 
1037 1037
 		CMB2_JS::add_dependencies( $dependencies );
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 	 * @return mixed  Default field value
1046 1046
 	 */
1047 1047
 	public function get_default() {
1048
-		if ( null !== $this->args['default'] ) {
1049
-			return $this->args['default'];
1048
+		if ( null !== $this->args[ 'default' ] ) {
1049
+			return $this->args[ 'default' ];
1050 1050
 		}
1051 1051
 
1052
-		$param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default';
1052
+		$param = is_callable( $this->args[ 'default_cb' ] ) ? 'default_cb' : 'default';
1053 1053
 		$default = $this->get_param_callback_result( $param );
1054 1054
 
1055 1055
 		// Allow a filter override of the default value
1056
-		$this->args['default'] = apply_filters( 'cmb2_default_filter', $default, $this );
1056
+		$this->args[ 'default' ] = apply_filters( 'cmb2_default_filter', $default, $this );
1057 1057
 
1058
-		return $this->args['default'];
1058
+		return $this->args[ 'default' ];
1059 1059
 	}
1060 1060
 
1061 1061
 	/**
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
 			'classes_cb'        => '',
1086 1086
 			'select_all_button' => true,
1087 1087
 			'multiple'          => false,
1088
-			'repeatable'        => isset( $args['type'] ) && 'group' == $args['type'],
1088
+			'repeatable'        => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ],
1089 1089
 			'inline'            => false,
1090 1090
 			'on_front'          => true,
1091 1091
 			'show_names'        => true,
1092 1092
 			'save_field'        => true, // Will not save if false
1093 1093
 			'date_format'       => 'm\/d\/Y',
1094 1094
 			'time_format'       => 'h:i A',
1095
-			'description'       => isset( $args['desc'] ) ? $args['desc'] : '',
1096
-			'preview_size'      => 'file' == $args['type'] ? array( 350, 350 ) : array( 50, 50 ),
1095
+			'description'       => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '',
1096
+			'preview_size'      => 'file' == $args[ 'type' ] ? array( 350, 350 ) : array( 50, 50 ),
1097 1097
 			'render_row_cb'     => array( $this, 'render_field_callback' ),
1098 1098
 			'display_cb'        => array( $this, 'display_value_callback' ),
1099
-			'label_cb'          => 'title' != $args['type'] ? array( $this, 'label' ) : '',
1099
+			'label_cb'          => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '',
1100 1100
 			'column'            => false,
1101 1101
 			'js_dependencies'   => array(),
1102 1102
 			'show_in_rest'      => null,
@@ -1111,44 +1111,44 @@  discard block
 block discarded – undo
1111 1111
 		 */
1112 1112
 		$args = $this->convert_deprecated_params( $args );
1113 1113
 
1114
-		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] );
1115
-		$args['inline']     = $args['inline'] || false !== stripos( $args['type'], '_inline' );
1114
+		$args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] );
1115
+		$args[ 'inline' ]     = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' );
1116 1116
 
1117
-		$args['options']    = 'group' == $args['type'] ? wp_parse_args( $args['options'], array(
1117
+		$args[ 'options' ]    = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array(
1118 1118
 			'add_button'    => esc_html__( 'Add Group', 'cmb2' ),
1119 1119
 			'remove_button' => esc_html__( 'Remove Group', 'cmb2' ),
1120
-		) ) : $args['options'];
1120
+		) ) : $args[ 'options' ];
1121 1121
 
1122
-		$args['_id']        = $args['id'];
1123
-		$args['_name']      = $args['id'];
1122
+		$args[ '_id' ]        = $args[ 'id' ];
1123
+		$args[ '_name' ]      = $args[ 'id' ];
1124 1124
 
1125 1125
 		if ( $this->group ) {
1126 1126
 
1127
-			$args['id']    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id'];
1128
-			$args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']';
1127
+			$args[ 'id' ]    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ];
1128
+			$args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']';
1129 1129
 		}
1130 1130
 
1131
-		if ( 'wysiwyg' == $args['type'] ) {
1132
-			$args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) );
1133
-			$args['options']['textarea_name'] = $args['_name'];
1131
+		if ( 'wysiwyg' == $args[ 'type' ] ) {
1132
+			$args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) );
1133
+			$args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ];
1134 1134
 		}
1135 1135
 
1136 1136
 		$option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this );
1137 1137
 
1138
-		if ( in_array( $args['type'], $option_types, true ) ) {
1138
+		if ( in_array( $args[ 'type' ], $option_types, true ) ) {
1139 1139
 
1140
-			$args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null;
1141
-			$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none'];
1140
+			$args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null;
1141
+			$args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? esc_html__( 'None', 'cmb2' ) : $args[ 'show_option_none' ];
1142 1142
 
1143
-			if ( null === $args['show_option_none'] ) {
1144
-				$off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true );
1145
-				$args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1143
+			if ( null === $args[ 'show_option_none' ] ) {
1144
+				$off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true );
1145
+				$args[ 'show_option_none' ] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1146 1146
 			}
1147 1147
 
1148 1148
 		}
1149 1149
 
1150
-		$args['has_supporting_data'] = in_array(
1151
-			$args['type'],
1150
+		$args[ 'has_supporting_data' ] = in_array(
1151
+			$args[ 'type' ],
1152 1152
 			array(
1153 1153
 				// CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array()
1154 1154
 				'file',
@@ -1171,10 +1171,10 @@  discard block
 block discarded – undo
1171 1171
 	protected function get_default_args( $field_args, $field_group = null ) {
1172 1172
 		$args = parent::get_default_args( array(), $this->group );
1173 1173
 
1174
-		if ( isset( $field_args['field_args'] ) ) {
1174
+		if ( isset( $field_args[ 'field_args' ] ) ) {
1175 1175
 			$args = wp_parse_args( $field_args, $args );
1176 1176
 		} else {
1177
-			$args['field_args'] = wp_parse_args( $field_args, $this->args );
1177
+			$args[ 'field_args' ] = wp_parse_args( $field_args, $this->args );
1178 1178
 		}
1179 1179
 
1180 1180
 		return $args;
@@ -1217,43 +1217,43 @@  discard block
 block discarded – undo
1217 1217
 	 */
1218 1218
 	protected function convert_deprecated_params( $args ) {
1219 1219
 
1220
-		if ( isset( $args['row_classes'] ) ) {
1220
+		if ( isset( $args[ 'row_classes' ] ) ) {
1221 1221
 
1222 1222
 			// We'll let this one be.
1223 1223
 			// $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' );
1224 1224
 
1225 1225
 			// row_classes param could be a callback. This is definitely deprecated.
1226
-			if ( is_callable( $args['row_classes'] ) ) {
1226
+			if ( is_callable( $args[ 'row_classes' ] ) ) {
1227 1227
 
1228 1228
 				$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' );
1229 1229
 
1230
-				$args['classes_cb'] = $args['row_classes'];
1231
-				$args['classes'] = null;
1230
+				$args[ 'classes_cb' ] = $args[ 'row_classes' ];
1231
+				$args[ 'classes' ] = null;
1232 1232
 			} else {
1233 1233
 
1234
-				$args['classes'] = $args['row_classes'];
1234
+				$args[ 'classes' ] = $args[ 'row_classes' ];
1235 1235
 			}
1236 1236
 
1237
-			unset( $args['row_classes'] );
1237
+			unset( $args[ 'row_classes' ] );
1238 1238
 		}
1239 1239
 
1240 1240
 
1241 1241
 		// default param can be passed a callback as well
1242
-		if ( is_callable( $args['default'] ) ) {
1242
+		if ( is_callable( $args[ 'default' ] ) ) {
1243 1243
 
1244 1244
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' );
1245 1245
 
1246
-			$args['default_cb'] = $args['default'];
1247
-			$args['default'] = null;
1246
+			$args[ 'default_cb' ] = $args[ 'default' ];
1247
+			$args[ 'default' ] = null;
1248 1248
 		}
1249 1249
 
1250 1250
 		// options param can be passed a callback as well
1251
-		if ( is_callable( $args['options'] ) ) {
1251
+		if ( is_callable( $args[ 'options' ] ) ) {
1252 1252
 
1253 1253
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' );
1254 1254
 
1255
-			$args['options_cb'] = $args['options'];
1256
-			$args['options'] = array();
1255
+			$args[ 'options_cb' ] = $args[ 'options' ];
1256
+			$args[ 'options' ] = array();
1257 1257
 		}
1258 1258
 
1259 1259
 		return $args;
Please login to merge, or discard this patch.
vendor/cmb2/includes/CMB2_Sanitize.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -366,6 +366,7 @@  discard block
 block discarded – undo
366 366
 	/**
367 367
 	 * Gets the values for the `file` field type from the data being saved.
368 368
 	 * @since  2.2.0
369
+	 * @param string $id_key
369 370
 	 */
370 371
 	public function _get_group_file_value_array( $id_key ) {
371 372
 		$alldata = $this->field->group->data_to_save;
@@ -387,6 +388,7 @@  discard block
 block discarded – undo
387 388
 	/**
388 389
 	 * Peforms saving of `file` attachement's ID
389 390
 	 * @since  1.1.0
391
+	 * @param string $file_id_key
390 392
 	 */
391 393
 	public function _save_file_id_value( $file_id_key ) {
392 394
 		$id_field = $this->_new_supporting_field( $file_id_key );
@@ -407,6 +409,7 @@  discard block
 block discarded – undo
407 409
 	/**
408 410
 	 * Peforms saving of `text_datetime_timestamp_timezone` utc timestamp
409 411
 	 * @since  2.2.0
412
+	 * @param string $utc_key
410 413
 	 */
411 414
 	public function _save_utc_value( $utc_key, $utc_stamp ) {
412 415
 		return $this->_new_supporting_field( $utc_key )->save_field( $utc_stamp );
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 		global $wp_locale;
181 181
 
182
-		$search = array( $wp_locale->number_format['thousands_sep'], $wp_locale->number_format['decimal_point'] );
182
+		$search = array( $wp_locale->number_format[ 'thousands_sep' ], $wp_locale->number_format[ 'decimal_point' ] );
183 183
 		$replace = array( '', '.' );
184 184
 
185 185
 		// for repeatable
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 			return $repeat_value;
225 225
 		}
226 226
 
227
-		if ( isset( $this->value['date'], $this->value['time'] ) ) {
228
-			$this->value = $this->field->get_timestamp_from_value( $this->value['date'] . ' ' . $this->value['time'] );
227
+		if ( isset( $this->value[ 'date' ], $this->value[ 'time' ] ) ) {
228
+			$this->value = $this->field->get_timestamp_from_value( $this->value[ 'date' ] . ' ' . $this->value[ 'time' ] );
229 229
 		}
230 230
 
231 231
 		if ( $tz_offset = $this->field->field_timezone_offset() ) {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		$tzstring = null;
264 264
 
265 265
 		if ( is_array( $this->value ) && array_key_exists( 'timezone', $this->value ) ) {
266
-			$tzstring = $this->value['timezone'];
266
+			$tzstring = $this->value[ 'timezone' ];
267 267
 		}
268 268
 
269 269
 		if ( empty( $tzstring ) ) {
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 			$tzstring = false !== $tzstring ? $tzstring : timezone_name_from_abbr( '', 0, 0 );
284 284
 		}
285 285
 
286
-		$full_format = $this->field->args['date_format'] . ' ' . $this->field->args['time_format'];
287
-		$full_date   = $this->value['date'] . ' ' . $this->value['time'];
286
+		$full_format = $this->field->args[ 'date_format' ] . ' ' . $this->field->args[ 'time_format' ];
287
+		$full_date   = $this->value[ 'date' ] . ' ' . $this->value[ 'time' ];
288 288
 
289 289
 		try {
290 290
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			} else {
308 308
 				// Save the utc timestamp supporting field
309 309
 				if ( $repeat ) {
310
-					$utc_values[ $utc_key ][] = $utc_stamp;
310
+					$utc_values[ $utc_key ][ ] = $utc_stamp;
311 311
 				} else {
312 312
 					$this->_save_utc_value( $utc_key, $utc_stamp );
313 313
 				}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 			if ( $this->value ) {
443 443
 				$val = $this->$method( true );
444 444
 				if ( ! empty( $val ) ) {
445
-					$new_value[] = $val;
445
+					$new_value[ ] = $val;
446 446
 				}
447 447
 			}
448 448
 		}
Please login to merge, or discard this patch.
vendor/cmb2/includes/rest-api/CMB2_REST.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,6 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @param string|array $object_types Object(s) the field is being registered
203 203
 	 *                                   to, "post"|"term"|"comment" etc.
204 204
 	 * @param string $object_types       Canonical object type for callbacks.
205
+	 * @param string $object_type
205 206
 	 *
206 207
 	 * @return void
207 208
 	 */
@@ -701,7 +702,7 @@  discard block
 block discarded – undo
701 702
 	 * Retrieve all CMB2_REST instances from the registry.
702 703
 	 *
703 704
 	 * @since  2.2.3
704
-	 * @return CMB2[] Array of all registered CMB2_REST instances.
705
+	 * @return CMB2_REST[] Array of all registered CMB2_REST instances.
705 706
 	 */
706 707
 	public static function get_all() {
707 708
 		return self::$boxes;
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -148,30 +148,30 @@  discard block
 block discarded – undo
148 148
 		foreach ( self::$boxes as $cmb_id => $rest_box ) {
149 149
 			$types = array_flip( $rest_box->cmb->box_types() );
150 150
 
151
-			if ( isset( $types['user'] ) ) {
152
-				unset( $types['user'] );
153
-				self::$type_boxes['user'][ $cmb_id ] = $cmb_id;
151
+			if ( isset( $types[ 'user' ] ) ) {
152
+				unset( $types[ 'user' ] );
153
+				self::$type_boxes[ 'user' ][ $cmb_id ] = $cmb_id;
154 154
 			}
155 155
 
156
-			if ( isset( $types['comment'] ) ) {
157
-				unset( $types['comment'] );
158
-				self::$type_boxes['comment'][ $cmb_id ] = $cmb_id;
156
+			if ( isset( $types[ 'comment' ] ) ) {
157
+				unset( $types[ 'comment' ] );
158
+				self::$type_boxes[ 'comment' ][ $cmb_id ] = $cmb_id;
159 159
 			}
160 160
 
161
-			if ( isset( $types['term'] ) ) {
162
-				unset( $types['term'] );
161
+			if ( isset( $types[ 'term' ] ) ) {
162
+				unset( $types[ 'term' ] );
163 163
 
164 164
 				$taxonomies = array_merge(
165 165
 					$taxonomies,
166 166
 					CMB2_Utils::ensure_array( $rest_box->cmb->prop( 'taxonomies' ) )
167 167
 				);
168 168
 
169
-				self::$type_boxes['term'][ $cmb_id ] = $cmb_id;
169
+				self::$type_boxes[ 'term' ][ $cmb_id ] = $cmb_id;
170 170
 			}
171 171
 
172 172
 			if ( ! empty( $types ) ) {
173 173
 				$alltypes = array_merge( $alltypes, array_flip( $types ) );
174
-				self::$type_boxes['post'][ $cmb_id ] = $cmb_id;
174
+				self::$type_boxes[ 'post' ][ $cmb_id ] = $cmb_id;
175 175
 			}
176 176
 		}
177 177
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 			self::register_rest_field( $alltypes, 'post' );
182 182
 		}
183 183
 
184
-		if ( ! empty( self::$type_boxes['user'] ) ) {
184
+		if ( ! empty( self::$type_boxes[ 'user' ] ) ) {
185 185
 			self::register_rest_field( 'user', 'user' );
186 186
 		}
187 187
 
188
-		if ( ! empty( self::$type_boxes['comment'] ) ) {
188
+		if ( ! empty( self::$type_boxes[ 'comment' ] ) ) {
189 189
 			self::register_rest_field( 'comment', 'comment' );
190 190
 		}
191 191
 
192
-		if ( ! empty( self::$type_boxes['term'] ) ) {
192
+		if ( ! empty( self::$type_boxes[ 'term' ] ) ) {
193 193
 			self::register_rest_field( $taxonomies, 'term' );
194 194
 		}
195 195
 	}
@@ -222,18 +222,18 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function declare_read_edit_fields() {
224 224
 		foreach ( $this->cmb->prop( 'fields' ) as $field ) {
225
-			$show_in_rest = isset( $field['show_in_rest'] ) ? $field['show_in_rest'] : null;
225
+			$show_in_rest = isset( $field[ 'show_in_rest' ] ) ? $field[ 'show_in_rest' ] : null;
226 226
 
227 227
 			if ( false === $show_in_rest ) {
228 228
 				continue;
229 229
 			}
230 230
 
231 231
 			if ( $this->can_read( $show_in_rest ) ) {
232
-				$this->read_fields[] = $field['id'];
232
+				$this->read_fields[ ] = $field[ 'id' ];
233 233
 			}
234 234
 
235 235
 			if ( $this->can_edit( $show_in_rest ) ) {
236
-				$this->edit_fields[] = $field['id'];
236
+				$this->edit_fields[ ] = $field[ 'id' ];
237 237
 			}
238 238
 
239 239
 		}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @return mixed
365 365
 	 */
366 366
 	protected static function get_rest_values( $object, $request, $object_type, $main_object_type = 'post' ) {
367
-		if ( ! isset( $object['id'] ) ) {
367
+		if ( ! isset( $object[ 'id' ] ) ) {
368 368
 			return;
369 369
 		}
370 370
 
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 				$rest_box = self::$boxes[ $cmb_id ];
376 376
 
377 377
 				foreach ( $rest_box->read_fields as $field_id ) {
378
-					$rest_box->cmb->object_id( $object['id'] );
378
+					$rest_box->cmb->object_id( $object[ 'id' ] );
379 379
 					$rest_box->cmb->object_type( $main_object_type );
380 380
 
381 381
 					$field = $rest_box->cmb->get_field( $field_id );
382 382
 
383
-					$field->object_id( $object['id'] );
383
+					$field->object_id( $object[ 'id' ] );
384 384
 					$field->object_type( $main_object_type );
385 385
 
386 386
 					$values[ $cmb_id ][ $field->id( true ) ] = $field->get_data();
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 					return intval( $object->comment_ID );
615 615
 				}
616 616
 			case 'term':
617
-				if ( is_array( $object ) && isset( $object['term_id'] ) ) {
618
-					return intval( $object['term_id'] );
617
+				if ( is_array( $object ) && isset( $object[ 'term_id' ] ) ) {
618
+					return intval( $object[ 'term_id' ] );
619 619
 				} elseif ( isset( $object->term_id ) ) {
620 620
 					return intval( $object->term_id );
621 621
 				}
Please login to merge, or discard this patch.
vendor/cmb2/includes/rest-api/CMB2_REST_Controller.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @since  2.2.3
199 199
 	 *
200 200
 	 * @param  mixed $cb Callable function/method.
201
-	 * @return mixed     Results of output buffer after calling function/method.
201
+	 * @return string     Results of output buffer after calling function/method.
202 202
 	 */
203 203
 	public function get_cb_results( $cb ) {
204 204
 		$args = func_get_args();
@@ -214,7 +214,6 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @since 2.2.3
216 216
 	 *
217
-	 * @param  mixed            $item     WordPress representation of the item.
218 217
 	 * @param  WP_REST_Request  $request  Request object.
219 218
 	 * @return WP_REST_Response $response
220 219
 	 */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 * @return WP_REST_Response $response
220 220
 	 */
221 221
 	public function prepare_item_for_response( $data, $request = null ) {
222
-		$data = $this->filter_response_by_context( $data, $this->request['context'] );
222
+		$data = $this->filter_response_by_context( $data, $this->request[ 'context' ] );
223 223
 
224 224
 		/**
225 225
 		 * Filter the prepared CMB2 item response.
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
 
291 291
 		} else {
292 292
 
293
-			if ( isset( $this->request['object_id'] ) ) {
294
-				$this->rest_box->cmb->object_id( sanitize_text_field( $this->request['object_id'] ) );
293
+			if ( isset( $this->request[ 'object_id' ] ) ) {
294
+				$this->rest_box->cmb->object_id( sanitize_text_field( $this->request[ 'object_id' ] ) );
295 295
 			}
296 296
 
297
-			if ( isset( $this->request['object_type'] ) ) {
298
-				$this->rest_box->cmb->object_type( sanitize_text_field( $this->request['object_type'] ) );
297
+			if ( isset( $this->request[ 'object_type' ] ) ) {
298
+				$this->rest_box->cmb->object_type( sanitize_text_field( $this->request[ 'object_type' ] ) );
299 299
 			}
300 300
 		}
301 301
 	}
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	public function initiate_request( $request, $request_type ) {
314 314
 		$this->request = $request;
315 315
 
316
-		if ( ! isset( $this->request['context'] ) || empty( $this->request['context'] ) ) {
317
-			$this->request['context'] = 'view';
316
+		if ( ! isset( $this->request[ 'context' ] ) || empty( $this->request[ 'context' ] ) ) {
317
+			$this->request[ 'context' ] = 'view';
318 318
 		}
319 319
 
320 320
 		if ( ! self::$request_type ) {
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Base.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,6 @@  discard block
 block discarded – undo
107 107
 
108 108
 	/**
109 109
 	 * Fall back to CMB2_Types methods
110
-	 * @param string $field
111 110
 	 * @throws Exception Throws an exception if the field is invalid.
112 111
 	 * @return mixed
113 112
 	 */
@@ -128,7 +127,7 @@  discard block
 block discarded – undo
128 127
 	 * Magic getter for our object.
129 128
 	 * @param string $field
130 129
 	 * @throws Exception Throws an exception if the field is invalid.
131
-	 * @return mixed
130
+	 * @return CMB2_Field
132 131
 	 */
133 132
 	public function __get( $field ) {
134 133
 		switch ( $field ) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function __construct( CMB2_Types $types, $args = array() ) {
40 40
 		$this->types = $types;
41
-		$args['rendered'] = isset( $args['rendered'] ) ? (bool) $args['rendered'] : true;
41
+		$args[ 'rendered' ] = isset( $args[ 'rendered' ] ) ? (bool) $args[ 'rendered' ] : true;
42 42
 		$this->args = $args;
43 43
 	}
44 44
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
57 57
 	 */
58 58
 	public function rendered( $rendered ) {
59
-		if ( $this->args['rendered'] ) {
59
+		if ( $this->args[ 'rendered' ] ) {
60 60
 			return is_a( $rendered, __CLASS__ ) ? $rendered->rendered : $rendered;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -39,6 +39,9 @@  discard block
 block discarded – undo
39 39
 		return $this->rendered( $date_input . "\n" . $time_input );
40 40
 	}
41 41
 
42
+	/**
43
+	 * @param boolean $has_good_value
44
+	 */
42 45
 	public function date_args( $args, $has_good_value ) {
43 46
 		$date_args = wp_parse_args( $args['datepicker'], array(
44 47
 			'class' => 'cmb2-text-small cmb2-datepicker',
@@ -54,6 +57,9 @@  discard block
 block discarded – undo
54 57
 		return $this->parse_picker_options( 'date', $date_args );
55 58
 	}
56 59
 
60
+	/**
61
+	 * @param boolean $has_good_value
62
+	 */
57 63
 	public function time_args( $args, $has_good_value ) {
58 64
 		$time_args = wp_parse_args( $args['timepicker'], array(
59 65
 			'class' => 'cmb2-timepicker text-time',
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 			'timepicker' => array(),
23 23
 		) );
24 24
 
25
-		if ( empty( $args['value'] ) ) {
26
-			$args['value'] = $field->escaped_value();
25
+		if ( empty( $args[ 'value' ] ) ) {
26
+			$args[ 'value' ] = $field->escaped_value();
27 27
 			// This will be used if there is a select_timezone set for this field
28 28
 			$tz_offset = $field->field_timezone_offset();
29 29
 			if ( ! empty( $tz_offset ) ) {
30
-				$args['value'] -= $tz_offset;
30
+				$args[ 'value' ] -= $tz_offset;
31 31
 			}
32 32
 		}
33 33
 
34
-		$has_good_value = ! empty( $args['value'] ) && ! is_array( $args['value'] );
34
+		$has_good_value = ! empty( $args[ 'value' ] ) && ! is_array( $args[ 'value' ] );
35 35
 
36 36
 		$date_input = parent::render( $this->date_args( $args, $has_good_value ) );
37 37
 		$time_input = parent::render( $this->time_args( $args, $has_good_value ) );
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	public function date_args( $args, $has_good_value ) {
43
-		$date_args = wp_parse_args( $args['datepicker'], array(
43
+		$date_args = wp_parse_args( $args[ 'datepicker' ], array(
44 44
 			'class' => 'cmb2-text-small cmb2-datepicker',
45 45
 			'name'  => $this->_name( '[date]' ),
46 46
 			'id'    => $this->_id( '_date' ),
47
-			'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args['value'] ) : '',
47
+			'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args[ 'value' ] ) : '',
48 48
 			'desc'  => '',
49 49
 		) );
50 50
 
51
-		$date_args['rendered'] = true;
51
+		$date_args[ 'rendered' ] = true;
52 52
 
53 53
 		// Let's get the date-format, and set it up as a data attr for the field.
54 54
 		return $this->parse_picker_options( 'date', $date_args );
55 55
 	}
56 56
 
57 57
 	public function time_args( $args, $has_good_value ) {
58
-		$time_args = wp_parse_args( $args['timepicker'], array(
58
+		$time_args = wp_parse_args( $args[ 'timepicker' ], array(
59 59
 			'class' => 'cmb2-timepicker text-time',
60 60
 			'name'  => $this->_name( '[time]' ),
61 61
 			'id'    => $this->_id( '_time' ),
62
-			'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args['value'] ) : '',
63
-			'desc'  => $args['desc'],
62
+			'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args[ 'value' ] ) : '',
63
+			'desc'  => $args[ 'desc' ],
64 64
 			'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-datetimepicker' ),
65 65
 		) );
66 66
 
67
-		$time_args['rendered'] = true;
67
+		$time_args[ 'rendered' ] = true;
68 68
 
69 69
 		// Let's get the time-format, and set it up as a data attr for the field.
70 70
 		return $this->parse_picker_options( 'time', $time_args );
Please login to merge, or discard this patch.
vendor/cmb2/includes/types/CMB2_Type_Textarea_Code.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 	/**
16 16
 	 * Handles outputting an 'textarea' element
17 17
 	 * @since  1.1.0
18
-	 * @param  array  $args Override arguments
19 18
 	 * @return string       Form textarea element
20 19
 	 */
21 20
 	public function render() {
Please login to merge, or discard this patch.
vendor/composer/ClassLoader.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -367,6 +367,10 @@
 block discarded – undo
367 367
         return $file;
368 368
     }
369 369
 
370
+    /**
371
+     * @param string $class
372
+     * @param string $ext
373
+     */
370 374
     private function findFileWithExtension($class, $ext)
371 375
     {
372 376
         // PSR-4 lookup
Please login to merge, or discard this patch.
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -42,392 +42,392 @@  discard block
 block discarded – undo
42 42
  */
43 43
 class ClassLoader
44 44
 {
45
-    // PSR-4
46
-    private $prefixLengthsPsr4 = array();
47
-    private $prefixDirsPsr4 = array();
48
-    private $fallbackDirsPsr4 = array();
49
-
50
-    // PSR-0
51
-    private $prefixesPsr0 = array();
52
-    private $fallbackDirsPsr0 = array();
53
-
54
-    private $useIncludePath = false;
55
-    private $classMap = array();
56
-    private $classMapAuthoritative = false;
57
-    private $missingClasses = array();
58
-    private $apcuPrefix;
59
-
60
-    public function getPrefixes()
61
-    {
62
-        if (!empty($this->prefixesPsr0)) {
63
-            return call_user_func_array('array_merge', $this->prefixesPsr0);
64
-        }
65
-
66
-        return array();
67
-    }
68
-
69
-    public function getPrefixesPsr4()
70
-    {
71
-        return $this->prefixDirsPsr4;
72
-    }
73
-
74
-    public function getFallbackDirs()
75
-    {
76
-        return $this->fallbackDirsPsr0;
77
-    }
78
-
79
-    public function getFallbackDirsPsr4()
80
-    {
81
-        return $this->fallbackDirsPsr4;
82
-    }
83
-
84
-    public function getClassMap()
85
-    {
86
-        return $this->classMap;
87
-    }
88
-
89
-    /**
90
-     * @param array $classMap Class to filename map
91
-     */
92
-    public function addClassMap(array $classMap)
93
-    {
94
-        if ($this->classMap) {
95
-            $this->classMap = array_merge($this->classMap, $classMap);
96
-        } else {
97
-            $this->classMap = $classMap;
98
-        }
99
-    }
100
-
101
-    /**
102
-     * Registers a set of PSR-0 directories for a given prefix, either
103
-     * appending or prepending to the ones previously set for this prefix.
104
-     *
105
-     * @param string       $prefix  The prefix
106
-     * @param array|string $paths   The PSR-0 root directories
107
-     * @param bool         $prepend Whether to prepend the directories
108
-     */
109
-    public function add($prefix, $paths, $prepend = false)
110
-    {
111
-        if (!$prefix) {
112
-            if ($prepend) {
113
-                $this->fallbackDirsPsr0 = array_merge(
114
-                    (array) $paths,
115
-                    $this->fallbackDirsPsr0
116
-                );
117
-            } else {
118
-                $this->fallbackDirsPsr0 = array_merge(
119
-                    $this->fallbackDirsPsr0,
120
-                    (array) $paths
121
-                );
122
-            }
123
-
124
-            return;
125
-        }
126
-
127
-        $first = $prefix[0];
128
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
-
131
-            return;
132
-        }
133
-        if ($prepend) {
134
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
135
-                (array) $paths,
136
-                $this->prefixesPsr0[$first][$prefix]
137
-            );
138
-        } else {
139
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
140
-                $this->prefixesPsr0[$first][$prefix],
141
-                (array) $paths
142
-            );
143
-        }
144
-    }
145
-
146
-    /**
147
-     * Registers a set of PSR-4 directories for a given namespace, either
148
-     * appending or prepending to the ones previously set for this namespace.
149
-     *
150
-     * @param string       $prefix  The prefix/namespace, with trailing '\\'
151
-     * @param array|string $paths   The PSR-4 base directories
152
-     * @param bool         $prepend Whether to prepend the directories
153
-     *
154
-     * @throws \InvalidArgumentException
155
-     */
156
-    public function addPsr4($prefix, $paths, $prepend = false)
157
-    {
158
-        if (!$prefix) {
159
-            // Register directories for the root namespace.
160
-            if ($prepend) {
161
-                $this->fallbackDirsPsr4 = array_merge(
162
-                    (array) $paths,
163
-                    $this->fallbackDirsPsr4
164
-                );
165
-            } else {
166
-                $this->fallbackDirsPsr4 = array_merge(
167
-                    $this->fallbackDirsPsr4,
168
-                    (array) $paths
169
-                );
170
-            }
171
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
-            // Register directories for a new namespace.
173
-            $length = strlen($prefix);
174
-            if ('\\' !== $prefix[$length - 1]) {
175
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
-            }
177
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
-        } elseif ($prepend) {
180
-            // Prepend directories for an already registered namespace.
181
-            $this->prefixDirsPsr4[$prefix] = array_merge(
182
-                (array) $paths,
183
-                $this->prefixDirsPsr4[$prefix]
184
-            );
185
-        } else {
186
-            // Append directories for an already registered namespace.
187
-            $this->prefixDirsPsr4[$prefix] = array_merge(
188
-                $this->prefixDirsPsr4[$prefix],
189
-                (array) $paths
190
-            );
191
-        }
192
-    }
193
-
194
-    /**
195
-     * Registers a set of PSR-0 directories for a given prefix,
196
-     * replacing any others previously set for this prefix.
197
-     *
198
-     * @param string       $prefix The prefix
199
-     * @param array|string $paths  The PSR-0 base directories
200
-     */
201
-    public function set($prefix, $paths)
202
-    {
203
-        if (!$prefix) {
204
-            $this->fallbackDirsPsr0 = (array) $paths;
205
-        } else {
206
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
-        }
208
-    }
209
-
210
-    /**
211
-     * Registers a set of PSR-4 directories for a given namespace,
212
-     * replacing any others previously set for this namespace.
213
-     *
214
-     * @param string       $prefix The prefix/namespace, with trailing '\\'
215
-     * @param array|string $paths  The PSR-4 base directories
216
-     *
217
-     * @throws \InvalidArgumentException
218
-     */
219
-    public function setPsr4($prefix, $paths)
220
-    {
221
-        if (!$prefix) {
222
-            $this->fallbackDirsPsr4 = (array) $paths;
223
-        } else {
224
-            $length = strlen($prefix);
225
-            if ('\\' !== $prefix[$length - 1]) {
226
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
-            }
228
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
-        }
231
-    }
232
-
233
-    /**
234
-     * Turns on searching the include path for class files.
235
-     *
236
-     * @param bool $useIncludePath
237
-     */
238
-    public function setUseIncludePath($useIncludePath)
239
-    {
240
-        $this->useIncludePath = $useIncludePath;
241
-    }
242
-
243
-    /**
244
-     * Can be used to check if the autoloader uses the include path to check
245
-     * for classes.
246
-     *
247
-     * @return bool
248
-     */
249
-    public function getUseIncludePath()
250
-    {
251
-        return $this->useIncludePath;
252
-    }
253
-
254
-    /**
255
-     * Turns off searching the prefix and fallback directories for classes
256
-     * that have not been registered with the class map.
257
-     *
258
-     * @param bool $classMapAuthoritative
259
-     */
260
-    public function setClassMapAuthoritative($classMapAuthoritative)
261
-    {
262
-        $this->classMapAuthoritative = $classMapAuthoritative;
263
-    }
264
-
265
-    /**
266
-     * Should class lookup fail if not found in the current class map?
267
-     *
268
-     * @return bool
269
-     */
270
-    public function isClassMapAuthoritative()
271
-    {
272
-        return $this->classMapAuthoritative;
273
-    }
274
-
275
-    /**
276
-     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
-     *
278
-     * @param string|null $apcuPrefix
279
-     */
280
-    public function setApcuPrefix($apcuPrefix)
281
-    {
282
-        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
-    }
284
-
285
-    /**
286
-     * The APCu prefix in use, or null if APCu caching is not enabled.
287
-     *
288
-     * @return string|null
289
-     */
290
-    public function getApcuPrefix()
291
-    {
292
-        return $this->apcuPrefix;
293
-    }
294
-
295
-    /**
296
-     * Registers this instance as an autoloader.
297
-     *
298
-     * @param bool $prepend Whether to prepend the autoloader or not
299
-     */
300
-    public function register($prepend = false)
301
-    {
302
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
-    }
304
-
305
-    /**
306
-     * Unregisters this instance as an autoloader.
307
-     */
308
-    public function unregister()
309
-    {
310
-        spl_autoload_unregister(array($this, 'loadClass'));
311
-    }
312
-
313
-    /**
314
-     * Loads the given class or interface.
315
-     *
316
-     * @param  string    $class The name of the class
317
-     * @return bool|null True if loaded, null otherwise
318
-     */
319
-    public function loadClass($class)
320
-    {
321
-        if ($file = $this->findFile($class)) {
322
-            includeFile($file);
323
-
324
-            return true;
325
-        }
326
-    }
327
-
328
-    /**
329
-     * Finds the path to the file where the class is defined.
330
-     *
331
-     * @param string $class The name of the class
332
-     *
333
-     * @return string|false The path if found, false otherwise
334
-     */
335
-    public function findFile($class)
336
-    {
337
-        // class map lookup
338
-        if (isset($this->classMap[$class])) {
339
-            return $this->classMap[$class];
340
-        }
341
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
-            return false;
343
-        }
344
-        if (null !== $this->apcuPrefix) {
345
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
-            if ($hit) {
347
-                return $file;
348
-            }
349
-        }
350
-
351
-        $file = $this->findFileWithExtension($class, '.php');
352
-
353
-        // Search for Hack files if we are running on HHVM
354
-        if (false === $file && defined('HHVM_VERSION')) {
355
-            $file = $this->findFileWithExtension($class, '.hh');
356
-        }
357
-
358
-        if (null !== $this->apcuPrefix) {
359
-            apcu_add($this->apcuPrefix.$class, $file);
360
-        }
361
-
362
-        if (false === $file) {
363
-            // Remember that this class does not exist.
364
-            $this->missingClasses[$class] = true;
365
-        }
366
-
367
-        return $file;
368
-    }
369
-
370
-    private function findFileWithExtension($class, $ext)
371
-    {
372
-        // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
-
375
-        $first = $class[0];
376
-        if (isset($this->prefixLengthsPsr4[$first])) {
377
-            foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
378
-                if (0 === strpos($class, $prefix)) {
379
-                    foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
380
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
381
-                            return $file;
382
-                        }
383
-                    }
384
-                }
385
-            }
386
-        }
387
-
388
-        // PSR-4 fallback dirs
389
-        foreach ($this->fallbackDirsPsr4 as $dir) {
390
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
391
-                return $file;
392
-            }
393
-        }
394
-
395
-        // PSR-0 lookup
396
-        if (false !== $pos = strrpos($class, '\\')) {
397
-            // namespaced class name
398
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
399
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
400
-        } else {
401
-            // PEAR-like class name
402
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
403
-        }
404
-
405
-        if (isset($this->prefixesPsr0[$first])) {
406
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
407
-                if (0 === strpos($class, $prefix)) {
408
-                    foreach ($dirs as $dir) {
409
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
410
-                            return $file;
411
-                        }
412
-                    }
413
-                }
414
-            }
415
-        }
416
-
417
-        // PSR-0 fallback dirs
418
-        foreach ($this->fallbackDirsPsr0 as $dir) {
419
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
420
-                return $file;
421
-            }
422
-        }
423
-
424
-        // PSR-0 include paths.
425
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
426
-            return $file;
427
-        }
428
-
429
-        return false;
430
-    }
45
+	 // PSR-4
46
+	 private $prefixLengthsPsr4 = array();
47
+	 private $prefixDirsPsr4 = array();
48
+	 private $fallbackDirsPsr4 = array();
49
+
50
+	 // PSR-0
51
+	 private $prefixesPsr0 = array();
52
+	 private $fallbackDirsPsr0 = array();
53
+
54
+	 private $useIncludePath = false;
55
+	 private $classMap = array();
56
+	 private $classMapAuthoritative = false;
57
+	 private $missingClasses = array();
58
+	 private $apcuPrefix;
59
+
60
+	 public function getPrefixes()
61
+	 {
62
+		  if (!empty($this->prefixesPsr0)) {
63
+				return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+		  }
65
+
66
+		  return array();
67
+	 }
68
+
69
+	 public function getPrefixesPsr4()
70
+	 {
71
+		  return $this->prefixDirsPsr4;
72
+	 }
73
+
74
+	 public function getFallbackDirs()
75
+	 {
76
+		  return $this->fallbackDirsPsr0;
77
+	 }
78
+
79
+	 public function getFallbackDirsPsr4()
80
+	 {
81
+		  return $this->fallbackDirsPsr4;
82
+	 }
83
+
84
+	 public function getClassMap()
85
+	 {
86
+		  return $this->classMap;
87
+	 }
88
+
89
+	 /**
90
+	  * @param array $classMap Class to filename map
91
+	  */
92
+	 public function addClassMap(array $classMap)
93
+	 {
94
+		  if ($this->classMap) {
95
+				$this->classMap = array_merge($this->classMap, $classMap);
96
+		  } else {
97
+				$this->classMap = $classMap;
98
+		  }
99
+	 }
100
+
101
+	 /**
102
+	  * Registers a set of PSR-0 directories for a given prefix, either
103
+	  * appending or prepending to the ones previously set for this prefix.
104
+	  *
105
+	  * @param string       $prefix  The prefix
106
+	  * @param array|string $paths   The PSR-0 root directories
107
+	  * @param bool         $prepend Whether to prepend the directories
108
+	  */
109
+	 public function add($prefix, $paths, $prepend = false)
110
+	 {
111
+		  if (!$prefix) {
112
+				if ($prepend) {
113
+					 $this->fallbackDirsPsr0 = array_merge(
114
+						  (array) $paths,
115
+						  $this->fallbackDirsPsr0
116
+					 );
117
+				} else {
118
+					 $this->fallbackDirsPsr0 = array_merge(
119
+						  $this->fallbackDirsPsr0,
120
+						  (array) $paths
121
+					 );
122
+				}
123
+
124
+				return;
125
+		  }
126
+
127
+		  $first = $prefix[0];
128
+		  if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+				$this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+				return;
132
+		  }
133
+		  if ($prepend) {
134
+				$this->prefixesPsr0[$first][$prefix] = array_merge(
135
+					 (array) $paths,
136
+					 $this->prefixesPsr0[$first][$prefix]
137
+				);
138
+		  } else {
139
+				$this->prefixesPsr0[$first][$prefix] = array_merge(
140
+					 $this->prefixesPsr0[$first][$prefix],
141
+					 (array) $paths
142
+				);
143
+		  }
144
+	 }
145
+
146
+	 /**
147
+	  * Registers a set of PSR-4 directories for a given namespace, either
148
+	  * appending or prepending to the ones previously set for this namespace.
149
+	  *
150
+	  * @param string       $prefix  The prefix/namespace, with trailing '\\'
151
+	  * @param array|string $paths   The PSR-4 base directories
152
+	  * @param bool         $prepend Whether to prepend the directories
153
+	  *
154
+	  * @throws \InvalidArgumentException
155
+	  */
156
+	 public function addPsr4($prefix, $paths, $prepend = false)
157
+	 {
158
+		  if (!$prefix) {
159
+				// Register directories for the root namespace.
160
+				if ($prepend) {
161
+					 $this->fallbackDirsPsr4 = array_merge(
162
+						  (array) $paths,
163
+						  $this->fallbackDirsPsr4
164
+					 );
165
+				} else {
166
+					 $this->fallbackDirsPsr4 = array_merge(
167
+						  $this->fallbackDirsPsr4,
168
+						  (array) $paths
169
+					 );
170
+				}
171
+		  } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+				// Register directories for a new namespace.
173
+				$length = strlen($prefix);
174
+				if ('\\' !== $prefix[$length - 1]) {
175
+					 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+				}
177
+				$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+				$this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+		  } elseif ($prepend) {
180
+				// Prepend directories for an already registered namespace.
181
+				$this->prefixDirsPsr4[$prefix] = array_merge(
182
+					 (array) $paths,
183
+					 $this->prefixDirsPsr4[$prefix]
184
+				);
185
+		  } else {
186
+				// Append directories for an already registered namespace.
187
+				$this->prefixDirsPsr4[$prefix] = array_merge(
188
+					 $this->prefixDirsPsr4[$prefix],
189
+					 (array) $paths
190
+				);
191
+		  }
192
+	 }
193
+
194
+	 /**
195
+	  * Registers a set of PSR-0 directories for a given prefix,
196
+	  * replacing any others previously set for this prefix.
197
+	  *
198
+	  * @param string       $prefix The prefix
199
+	  * @param array|string $paths  The PSR-0 base directories
200
+	  */
201
+	 public function set($prefix, $paths)
202
+	 {
203
+		  if (!$prefix) {
204
+				$this->fallbackDirsPsr0 = (array) $paths;
205
+		  } else {
206
+				$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+		  }
208
+	 }
209
+
210
+	 /**
211
+	  * Registers a set of PSR-4 directories for a given namespace,
212
+	  * replacing any others previously set for this namespace.
213
+	  *
214
+	  * @param string       $prefix The prefix/namespace, with trailing '\\'
215
+	  * @param array|string $paths  The PSR-4 base directories
216
+	  *
217
+	  * @throws \InvalidArgumentException
218
+	  */
219
+	 public function setPsr4($prefix, $paths)
220
+	 {
221
+		  if (!$prefix) {
222
+				$this->fallbackDirsPsr4 = (array) $paths;
223
+		  } else {
224
+				$length = strlen($prefix);
225
+				if ('\\' !== $prefix[$length - 1]) {
226
+					 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+				}
228
+				$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+				$this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+		  }
231
+	 }
232
+
233
+	 /**
234
+	  * Turns on searching the include path for class files.
235
+	  *
236
+	  * @param bool $useIncludePath
237
+	  */
238
+	 public function setUseIncludePath($useIncludePath)
239
+	 {
240
+		  $this->useIncludePath = $useIncludePath;
241
+	 }
242
+
243
+	 /**
244
+	  * Can be used to check if the autoloader uses the include path to check
245
+	  * for classes.
246
+	  *
247
+	  * @return bool
248
+	  */
249
+	 public function getUseIncludePath()
250
+	 {
251
+		  return $this->useIncludePath;
252
+	 }
253
+
254
+	 /**
255
+	  * Turns off searching the prefix and fallback directories for classes
256
+	  * that have not been registered with the class map.
257
+	  *
258
+	  * @param bool $classMapAuthoritative
259
+	  */
260
+	 public function setClassMapAuthoritative($classMapAuthoritative)
261
+	 {
262
+		  $this->classMapAuthoritative = $classMapAuthoritative;
263
+	 }
264
+
265
+	 /**
266
+	  * Should class lookup fail if not found in the current class map?
267
+	  *
268
+	  * @return bool
269
+	  */
270
+	 public function isClassMapAuthoritative()
271
+	 {
272
+		  return $this->classMapAuthoritative;
273
+	 }
274
+
275
+	 /**
276
+	  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+	  *
278
+	  * @param string|null $apcuPrefix
279
+	  */
280
+	 public function setApcuPrefix($apcuPrefix)
281
+	 {
282
+		  $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
+	 }
284
+
285
+	 /**
286
+	  * The APCu prefix in use, or null if APCu caching is not enabled.
287
+	  *
288
+	  * @return string|null
289
+	  */
290
+	 public function getApcuPrefix()
291
+	 {
292
+		  return $this->apcuPrefix;
293
+	 }
294
+
295
+	 /**
296
+	  * Registers this instance as an autoloader.
297
+	  *
298
+	  * @param bool $prepend Whether to prepend the autoloader or not
299
+	  */
300
+	 public function register($prepend = false)
301
+	 {
302
+		  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+	 }
304
+
305
+	 /**
306
+	  * Unregisters this instance as an autoloader.
307
+	  */
308
+	 public function unregister()
309
+	 {
310
+		  spl_autoload_unregister(array($this, 'loadClass'));
311
+	 }
312
+
313
+	 /**
314
+	  * Loads the given class or interface.
315
+	  *
316
+	  * @param  string    $class The name of the class
317
+	  * @return bool|null True if loaded, null otherwise
318
+	  */
319
+	 public function loadClass($class)
320
+	 {
321
+		  if ($file = $this->findFile($class)) {
322
+				includeFile($file);
323
+
324
+				return true;
325
+		  }
326
+	 }
327
+
328
+	 /**
329
+	  * Finds the path to the file where the class is defined.
330
+	  *
331
+	  * @param string $class The name of the class
332
+	  *
333
+	  * @return string|false The path if found, false otherwise
334
+	  */
335
+	 public function findFile($class)
336
+	 {
337
+		  // class map lookup
338
+		  if (isset($this->classMap[$class])) {
339
+				return $this->classMap[$class];
340
+		  }
341
+		  if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+				return false;
343
+		  }
344
+		  if (null !== $this->apcuPrefix) {
345
+				$file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+				if ($hit) {
347
+					 return $file;
348
+				}
349
+		  }
350
+
351
+		  $file = $this->findFileWithExtension($class, '.php');
352
+
353
+		  // Search for Hack files if we are running on HHVM
354
+		  if (false === $file && defined('HHVM_VERSION')) {
355
+				$file = $this->findFileWithExtension($class, '.hh');
356
+		  }
357
+
358
+		  if (null !== $this->apcuPrefix) {
359
+				apcu_add($this->apcuPrefix.$class, $file);
360
+		  }
361
+
362
+		  if (false === $file) {
363
+				// Remember that this class does not exist.
364
+				$this->missingClasses[$class] = true;
365
+		  }
366
+
367
+		  return $file;
368
+	 }
369
+
370
+	 private function findFileWithExtension($class, $ext)
371
+	 {
372
+		  // PSR-4 lookup
373
+		  $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+		  $first = $class[0];
376
+		  if (isset($this->prefixLengthsPsr4[$first])) {
377
+				foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
378
+					 if (0 === strpos($class, $prefix)) {
379
+						  foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
380
+								if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
381
+									 return $file;
382
+								}
383
+						  }
384
+					 }
385
+				}
386
+		  }
387
+
388
+		  // PSR-4 fallback dirs
389
+		  foreach ($this->fallbackDirsPsr4 as $dir) {
390
+				if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
391
+					 return $file;
392
+				}
393
+		  }
394
+
395
+		  // PSR-0 lookup
396
+		  if (false !== $pos = strrpos($class, '\\')) {
397
+				// namespaced class name
398
+				$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
399
+					 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
400
+		  } else {
401
+				// PEAR-like class name
402
+				$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
403
+		  }
404
+
405
+		  if (isset($this->prefixesPsr0[$first])) {
406
+				foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
407
+					 if (0 === strpos($class, $prefix)) {
408
+						  foreach ($dirs as $dir) {
409
+								if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
410
+									 return $file;
411
+								}
412
+						  }
413
+					 }
414
+				}
415
+		  }
416
+
417
+		  // PSR-0 fallback dirs
418
+		  foreach ($this->fallbackDirsPsr0 as $dir) {
419
+				if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
420
+					 return $file;
421
+				}
422
+		  }
423
+
424
+		  // PSR-0 include paths.
425
+		  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
426
+				return $file;
427
+		  }
428
+
429
+		  return false;
430
+	 }
431 431
 }
432 432
 
433 433
 /**
@@ -437,5 +437,5 @@  discard block
 block discarded – undo
437 437
  */
438 438
 function includeFile($file)
439 439
 {
440
-    include $file;
440
+	 include $file;
441 441
 }
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function getPrefixes()
61 61
     {
62
-        if (!empty($this->prefixesPsr0)) {
63
-            return call_user_func_array('array_merge', $this->prefixesPsr0);
62
+        if ( ! empty( $this->prefixesPsr0 ) ) {
63
+            return call_user_func_array( 'array_merge', $this->prefixesPsr0 );
64 64
         }
65 65
 
66 66
         return array();
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * @param array $classMap Class to filename map
91 91
      */
92
-    public function addClassMap(array $classMap)
92
+    public function addClassMap( array $classMap )
93 93
     {
94
-        if ($this->classMap) {
95
-            $this->classMap = array_merge($this->classMap, $classMap);
94
+        if ( $this->classMap ) {
95
+            $this->classMap = array_merge( $this->classMap, $classMap );
96 96
         } else {
97 97
             $this->classMap = $classMap;
98 98
         }
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
      * @param array|string $paths   The PSR-0 root directories
107 107
      * @param bool         $prepend Whether to prepend the directories
108 108
      */
109
-    public function add($prefix, $paths, $prepend = false)
109
+    public function add( $prefix, $paths, $prepend = false )
110 110
     {
111
-        if (!$prefix) {
112
-            if ($prepend) {
111
+        if ( ! $prefix ) {
112
+            if ( $prepend ) {
113 113
                 $this->fallbackDirsPsr0 = array_merge(
114 114
                     (array) $paths,
115 115
                     $this->fallbackDirsPsr0
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
             return;
125 125
         }
126 126
 
127
-        $first = $prefix[0];
128
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
127
+        $first = $prefix[ 0 ];
128
+        if ( ! isset( $this->prefixesPsr0[ $first ][ $prefix ] ) ) {
129
+            $this->prefixesPsr0[ $first ][ $prefix ] = (array) $paths;
130 130
 
131 131
             return;
132 132
         }
133
-        if ($prepend) {
134
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
133
+        if ( $prepend ) {
134
+            $this->prefixesPsr0[ $first ][ $prefix ] = array_merge(
135 135
                 (array) $paths,
136
-                $this->prefixesPsr0[$first][$prefix]
136
+                $this->prefixesPsr0[ $first ][ $prefix ]
137 137
             );
138 138
         } else {
139
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
140
-                $this->prefixesPsr0[$first][$prefix],
139
+            $this->prefixesPsr0[ $first ][ $prefix ] = array_merge(
140
+                $this->prefixesPsr0[ $first ][ $prefix ],
141 141
                 (array) $paths
142 142
             );
143 143
         }
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @throws \InvalidArgumentException
155 155
      */
156
-    public function addPsr4($prefix, $paths, $prepend = false)
156
+    public function addPsr4( $prefix, $paths, $prepend = false )
157 157
     {
158
-        if (!$prefix) {
158
+        if ( ! $prefix ) {
159 159
             // Register directories for the root namespace.
160
-            if ($prepend) {
160
+            if ( $prepend ) {
161 161
                 $this->fallbackDirsPsr4 = array_merge(
162 162
                     (array) $paths,
163 163
                     $this->fallbackDirsPsr4
@@ -168,24 +168,24 @@  discard block
 block discarded – undo
168 168
                     (array) $paths
169 169
                 );
170 170
             }
171
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+        } elseif ( ! isset( $this->prefixDirsPsr4[ $prefix ] ) ) {
172 172
             // Register directories for a new namespace.
173
-            $length = strlen($prefix);
174
-            if ('\\' !== $prefix[$length - 1]) {
175
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
173
+            $length = strlen( $prefix );
174
+            if ( '\\' !== $prefix[ $length - 1 ] ) {
175
+                throw new \InvalidArgumentException( "A non-empty PSR-4 prefix must end with a namespace separator." );
176 176
             }
177
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
-        } elseif ($prepend) {
177
+            $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length;
178
+            $this->prefixDirsPsr4[ $prefix ] = (array) $paths;
179
+        } elseif ( $prepend ) {
180 180
             // Prepend directories for an already registered namespace.
181
-            $this->prefixDirsPsr4[$prefix] = array_merge(
181
+            $this->prefixDirsPsr4[ $prefix ] = array_merge(
182 182
                 (array) $paths,
183
-                $this->prefixDirsPsr4[$prefix]
183
+                $this->prefixDirsPsr4[ $prefix ]
184 184
             );
185 185
         } else {
186 186
             // Append directories for an already registered namespace.
187
-            $this->prefixDirsPsr4[$prefix] = array_merge(
188
-                $this->prefixDirsPsr4[$prefix],
187
+            $this->prefixDirsPsr4[ $prefix ] = array_merge(
188
+                $this->prefixDirsPsr4[ $prefix ],
189 189
                 (array) $paths
190 190
             );
191 191
         }
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
      * @param string       $prefix The prefix
199 199
      * @param array|string $paths  The PSR-0 base directories
200 200
      */
201
-    public function set($prefix, $paths)
201
+    public function set( $prefix, $paths )
202 202
     {
203
-        if (!$prefix) {
203
+        if ( ! $prefix ) {
204 204
             $this->fallbackDirsPsr0 = (array) $paths;
205 205
         } else {
206
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+            $this->prefixesPsr0[ $prefix[ 0 ] ][ $prefix ] = (array) $paths;
207 207
         }
208 208
     }
209 209
 
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
      *
217 217
      * @throws \InvalidArgumentException
218 218
      */
219
-    public function setPsr4($prefix, $paths)
219
+    public function setPsr4( $prefix, $paths )
220 220
     {
221
-        if (!$prefix) {
221
+        if ( ! $prefix ) {
222 222
             $this->fallbackDirsPsr4 = (array) $paths;
223 223
         } else {
224
-            $length = strlen($prefix);
225
-            if ('\\' !== $prefix[$length - 1]) {
226
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
224
+            $length = strlen( $prefix );
225
+            if ( '\\' !== $prefix[ $length - 1 ] ) {
226
+                throw new \InvalidArgumentException( "A non-empty PSR-4 prefix must end with a namespace separator." );
227 227
             }
228
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
228
+            $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length;
229
+            $this->prefixDirsPsr4[ $prefix ] = (array) $paths;
230 230
         }
231 231
     }
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @param bool $useIncludePath
237 237
      */
238
-    public function setUseIncludePath($useIncludePath)
238
+    public function setUseIncludePath( $useIncludePath )
239 239
     {
240 240
         $this->useIncludePath = $useIncludePath;
241 241
     }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      *
258 258
      * @param bool $classMapAuthoritative
259 259
      */
260
-    public function setClassMapAuthoritative($classMapAuthoritative)
260
+    public function setClassMapAuthoritative( $classMapAuthoritative )
261 261
     {
262 262
         $this->classMapAuthoritative = $classMapAuthoritative;
263 263
     }
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @param string|null $apcuPrefix
279 279
      */
280
-    public function setApcuPrefix($apcuPrefix)
280
+    public function setApcuPrefix( $apcuPrefix )
281 281
     {
282
-        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
282
+        $this->apcuPrefix = function_exists( 'apcu_fetch' ) && ini_get( 'apc.enabled' ) ? $apcuPrefix : null;
283 283
     }
284 284
 
285 285
     /**
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @param bool $prepend Whether to prepend the autoloader or not
299 299
      */
300
-    public function register($prepend = false)
300
+    public function register( $prepend = false )
301 301
     {
302
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
302
+        spl_autoload_register( array( $this, 'loadClass' ), true, $prepend );
303 303
     }
304 304
 
305 305
     /**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public function unregister()
309 309
     {
310
-        spl_autoload_unregister(array($this, 'loadClass'));
310
+        spl_autoload_unregister( array( $this, 'loadClass' ) );
311 311
     }
312 312
 
313 313
     /**
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
      * @param  string    $class The name of the class
317 317
      * @return bool|null True if loaded, null otherwise
318 318
      */
319
-    public function loadClass($class)
319
+    public function loadClass( $class )
320 320
     {
321
-        if ($file = $this->findFile($class)) {
322
-            includeFile($file);
321
+        if ( $file = $this->findFile( $class ) ) {
322
+            includeFile( $file );
323 323
 
324 324
             return true;
325 325
         }
@@ -332,52 +332,52 @@  discard block
 block discarded – undo
332 332
      *
333 333
      * @return string|false The path if found, false otherwise
334 334
      */
335
-    public function findFile($class)
335
+    public function findFile( $class )
336 336
     {
337 337
         // class map lookup
338
-        if (isset($this->classMap[$class])) {
339
-            return $this->classMap[$class];
338
+        if ( isset( $this->classMap[ $class ] ) ) {
339
+            return $this->classMap[ $class ];
340 340
         }
341
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
341
+        if ( $this->classMapAuthoritative || isset( $this->missingClasses[ $class ] ) ) {
342 342
             return false;
343 343
         }
344
-        if (null !== $this->apcuPrefix) {
345
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
-            if ($hit) {
344
+        if ( null !== $this->apcuPrefix ) {
345
+            $file = apcu_fetch( $this->apcuPrefix . $class, $hit );
346
+            if ( $hit ) {
347 347
                 return $file;
348 348
             }
349 349
         }
350 350
 
351
-        $file = $this->findFileWithExtension($class, '.php');
351
+        $file = $this->findFileWithExtension( $class, '.php' );
352 352
 
353 353
         // Search for Hack files if we are running on HHVM
354
-        if (false === $file && defined('HHVM_VERSION')) {
355
-            $file = $this->findFileWithExtension($class, '.hh');
354
+        if ( false === $file && defined( 'HHVM_VERSION' ) ) {
355
+            $file = $this->findFileWithExtension( $class, '.hh' );
356 356
         }
357 357
 
358
-        if (null !== $this->apcuPrefix) {
359
-            apcu_add($this->apcuPrefix.$class, $file);
358
+        if ( null !== $this->apcuPrefix ) {
359
+            apcu_add( $this->apcuPrefix . $class, $file );
360 360
         }
361 361
 
362
-        if (false === $file) {
362
+        if ( false === $file ) {
363 363
             // Remember that this class does not exist.
364
-            $this->missingClasses[$class] = true;
364
+            $this->missingClasses[ $class ] = true;
365 365
         }
366 366
 
367 367
         return $file;
368 368
     }
369 369
 
370
-    private function findFileWithExtension($class, $ext)
370
+    private function findFileWithExtension( $class, $ext )
371 371
     {
372 372
         // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
-
375
-        $first = $class[0];
376
-        if (isset($this->prefixLengthsPsr4[$first])) {
377
-            foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
378
-                if (0 === strpos($class, $prefix)) {
379
-                    foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
380
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
373
+        $logicalPathPsr4 = strtr( $class, '\\', DIRECTORY_SEPARATOR ) . $ext;
374
+
375
+        $first = $class[ 0 ];
376
+        if ( isset( $this->prefixLengthsPsr4[ $first ] ) ) {
377
+            foreach ( $this->prefixLengthsPsr4[ $first ] as $prefix => $length ) {
378
+                if ( 0 === strpos( $class, $prefix ) ) {
379
+                    foreach ( $this->prefixDirsPsr4[ $prefix ] as $dir ) {
380
+                        if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . substr( $logicalPathPsr4, $length ) ) ) {
381 381
                             return $file;
382 382
                         }
383 383
                     }
@@ -386,27 +386,27 @@  discard block
 block discarded – undo
386 386
         }
387 387
 
388 388
         // PSR-4 fallback dirs
389
-        foreach ($this->fallbackDirsPsr4 as $dir) {
390
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
389
+        foreach ( $this->fallbackDirsPsr4 as $dir ) {
390
+            if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4 ) ) {
391 391
                 return $file;
392 392
             }
393 393
         }
394 394
 
395 395
         // PSR-0 lookup
396
-        if (false !== $pos = strrpos($class, '\\')) {
396
+        if ( false !== $pos = strrpos( $class, '\\' ) ) {
397 397
             // namespaced class name
398
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
399
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
398
+            $logicalPathPsr0 = substr( $logicalPathPsr4, 0, $pos + 1 )
399
+                . strtr( substr( $logicalPathPsr4, $pos + 1 ), '_', DIRECTORY_SEPARATOR );
400 400
         } else {
401 401
             // PEAR-like class name
402
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
402
+            $logicalPathPsr0 = strtr( $class, '_', DIRECTORY_SEPARATOR ) . $ext;
403 403
         }
404 404
 
405
-        if (isset($this->prefixesPsr0[$first])) {
406
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
407
-                if (0 === strpos($class, $prefix)) {
408
-                    foreach ($dirs as $dir) {
409
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
405
+        if ( isset( $this->prefixesPsr0[ $first ] ) ) {
406
+            foreach ( $this->prefixesPsr0[ $first ] as $prefix => $dirs ) {
407
+                if ( 0 === strpos( $class, $prefix ) ) {
408
+                    foreach ( $dirs as $dir ) {
409
+                        if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0 ) ) {
410 410
                             return $file;
411 411
                         }
412 412
                     }
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
         }
416 416
 
417 417
         // PSR-0 fallback dirs
418
-        foreach ($this->fallbackDirsPsr0 as $dir) {
419
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
418
+        foreach ( $this->fallbackDirsPsr0 as $dir ) {
419
+            if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0 ) ) {
420 420
                 return $file;
421 421
             }
422 422
         }
423 423
 
424 424
         // PSR-0 include paths.
425
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
425
+        if ( $this->useIncludePath && $file = stream_resolve_include_path( $logicalPathPsr0 ) ) {
426 426
             return $file;
427 427
         }
428 428
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
  *
436 436
  * Prevents access to $this/self from included files.
437 437
  */
438
-function includeFile($file)
438
+function includeFile( $file )
439 439
 {
440 440
     include $file;
441 441
 }
Please login to merge, or discard this patch.
Braces   +23 added lines, -46 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
  * @see    http://www.php-fig.org/psr/psr-0/
41 41
  * @see    http://www.php-fig.org/psr/psr-4/
42 42
  */
43
-class ClassLoader
44
-{
43
+class ClassLoader {
45 44
     // PSR-4
46 45
     private $prefixLengthsPsr4 = array();
47 46
     private $prefixDirsPsr4 = array();
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
     private $missingClasses = array();
58 57
     private $apcuPrefix;
59 58
 
60
-    public function getPrefixes()
61
-    {
59
+    public function getPrefixes() {
62 60
         if (!empty($this->prefixesPsr0)) {
63 61
             return call_user_func_array('array_merge', $this->prefixesPsr0);
64 62
         }
@@ -66,31 +64,26 @@  discard block
 block discarded – undo
66 64
         return array();
67 65
     }
68 66
 
69
-    public function getPrefixesPsr4()
70
-    {
67
+    public function getPrefixesPsr4() {
71 68
         return $this->prefixDirsPsr4;
72 69
     }
73 70
 
74
-    public function getFallbackDirs()
75
-    {
71
+    public function getFallbackDirs() {
76 72
         return $this->fallbackDirsPsr0;
77 73
     }
78 74
 
79
-    public function getFallbackDirsPsr4()
80
-    {
75
+    public function getFallbackDirsPsr4() {
81 76
         return $this->fallbackDirsPsr4;
82 77
     }
83 78
 
84
-    public function getClassMap()
85
-    {
79
+    public function getClassMap() {
86 80
         return $this->classMap;
87 81
     }
88 82
 
89 83
     /**
90 84
      * @param array $classMap Class to filename map
91 85
      */
92
-    public function addClassMap(array $classMap)
93
-    {
86
+    public function addClassMap(array $classMap) {
94 87
         if ($this->classMap) {
95 88
             $this->classMap = array_merge($this->classMap, $classMap);
96 89
         } else {
@@ -106,8 +99,7 @@  discard block
 block discarded – undo
106 99
      * @param array|string $paths   The PSR-0 root directories
107 100
      * @param bool         $prepend Whether to prepend the directories
108 101
      */
109
-    public function add($prefix, $paths, $prepend = false)
110
-    {
102
+    public function add($prefix, $paths, $prepend = false) {
111 103
         if (!$prefix) {
112 104
             if ($prepend) {
113 105
                 $this->fallbackDirsPsr0 = array_merge(
@@ -153,8 +145,7 @@  discard block
 block discarded – undo
153 145
      *
154 146
      * @throws \InvalidArgumentException
155 147
      */
156
-    public function addPsr4($prefix, $paths, $prepend = false)
157
-    {
148
+    public function addPsr4($prefix, $paths, $prepend = false) {
158 149
         if (!$prefix) {
159 150
             // Register directories for the root namespace.
160 151
             if ($prepend) {
@@ -198,8 +189,7 @@  discard block
 block discarded – undo
198 189
      * @param string       $prefix The prefix
199 190
      * @param array|string $paths  The PSR-0 base directories
200 191
      */
201
-    public function set($prefix, $paths)
202
-    {
192
+    public function set($prefix, $paths) {
203 193
         if (!$prefix) {
204 194
             $this->fallbackDirsPsr0 = (array) $paths;
205 195
         } else {
@@ -216,8 +206,7 @@  discard block
 block discarded – undo
216 206
      *
217 207
      * @throws \InvalidArgumentException
218 208
      */
219
-    public function setPsr4($prefix, $paths)
220
-    {
209
+    public function setPsr4($prefix, $paths) {
221 210
         if (!$prefix) {
222 211
             $this->fallbackDirsPsr4 = (array) $paths;
223 212
         } else {
@@ -235,8 +224,7 @@  discard block
 block discarded – undo
235 224
      *
236 225
      * @param bool $useIncludePath
237 226
      */
238
-    public function setUseIncludePath($useIncludePath)
239
-    {
227
+    public function setUseIncludePath($useIncludePath) {
240 228
         $this->useIncludePath = $useIncludePath;
241 229
     }
242 230
 
@@ -246,8 +234,7 @@  discard block
 block discarded – undo
246 234
      *
247 235
      * @return bool
248 236
      */
249
-    public function getUseIncludePath()
250
-    {
237
+    public function getUseIncludePath() {
251 238
         return $this->useIncludePath;
252 239
     }
253 240
 
@@ -257,8 +244,7 @@  discard block
 block discarded – undo
257 244
      *
258 245
      * @param bool $classMapAuthoritative
259 246
      */
260
-    public function setClassMapAuthoritative($classMapAuthoritative)
261
-    {
247
+    public function setClassMapAuthoritative($classMapAuthoritative) {
262 248
         $this->classMapAuthoritative = $classMapAuthoritative;
263 249
     }
264 250
 
@@ -267,8 +253,7 @@  discard block
 block discarded – undo
267 253
      *
268 254
      * @return bool
269 255
      */
270
-    public function isClassMapAuthoritative()
271
-    {
256
+    public function isClassMapAuthoritative() {
272 257
         return $this->classMapAuthoritative;
273 258
     }
274 259
 
@@ -277,8 +262,7 @@  discard block
 block discarded – undo
277 262
      *
278 263
      * @param string|null $apcuPrefix
279 264
      */
280
-    public function setApcuPrefix($apcuPrefix)
281
-    {
265
+    public function setApcuPrefix($apcuPrefix) {
282 266
         $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283 267
     }
284 268
 
@@ -287,8 +271,7 @@  discard block
 block discarded – undo
287 271
      *
288 272
      * @return string|null
289 273
      */
290
-    public function getApcuPrefix()
291
-    {
274
+    public function getApcuPrefix() {
292 275
         return $this->apcuPrefix;
293 276
     }
294 277
 
@@ -297,16 +280,14 @@  discard block
 block discarded – undo
297 280
      *
298 281
      * @param bool $prepend Whether to prepend the autoloader or not
299 282
      */
300
-    public function register($prepend = false)
301
-    {
283
+    public function register($prepend = false) {
302 284
         spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303 285
     }
304 286
 
305 287
     /**
306 288
      * Unregisters this instance as an autoloader.
307 289
      */
308
-    public function unregister()
309
-    {
290
+    public function unregister() {
310 291
         spl_autoload_unregister(array($this, 'loadClass'));
311 292
     }
312 293
 
@@ -316,8 +297,7 @@  discard block
 block discarded – undo
316 297
      * @param  string    $class The name of the class
317 298
      * @return bool|null True if loaded, null otherwise
318 299
      */
319
-    public function loadClass($class)
320
-    {
300
+    public function loadClass($class) {
321 301
         if ($file = $this->findFile($class)) {
322 302
             includeFile($file);
323 303
 
@@ -332,8 +312,7 @@  discard block
 block discarded – undo
332 312
      *
333 313
      * @return string|false The path if found, false otherwise
334 314
      */
335
-    public function findFile($class)
336
-    {
315
+    public function findFile($class) {
337 316
         // class map lookup
338 317
         if (isset($this->classMap[$class])) {
339 318
             return $this->classMap[$class];
@@ -367,8 +346,7 @@  discard block
 block discarded – undo
367 346
         return $file;
368 347
     }
369 348
 
370
-    private function findFileWithExtension($class, $ext)
371
-    {
349
+    private function findFileWithExtension($class, $ext) {
372 350
         // PSR-4 lookup
373 351
         $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374 352
 
@@ -435,7 +413,6 @@  discard block
 block discarded – undo
435 413
  *
436 414
  * Prevents access to $this/self from included files.
437 415
  */
438
-function includeFile($file)
439
-{
416
+function includeFile($file) {
440 417
     include $file;
441 418
 }
Please login to merge, or discard this patch.