@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @return FunctionWrapper|mixed |
182 | 182 | */ |
183 | 183 | public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) { |
184 | - Helper::warn( 'function_wrapper is deprecated and will be removed in 1.4. Use {{ function( \'function_to_call\' ) }} instead or use FunctionWrapper directly. For more information refer to https://timber.github.io/docs/guides/functions/' ); |
|
184 | + Helper::warn('function_wrapper is deprecated and will be removed in 1.4. Use {{ function( \'function_to_call\' ) }} instead or use FunctionWrapper directly. For more information refer to https://timber.github.io/docs/guides/functions/'); |
|
185 | 185 | |
186 | - return new FunctionWrapper( $function_name, $defaults, $return_output_buffer ); |
|
186 | + return new FunctionWrapper($function_name, $defaults, $return_output_buffer); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -436,17 +436,17 @@ discard block |
||
436 | 436 | * @return array |
437 | 437 | */ |
438 | 438 | public static function filter_array( $list, $arrow, $operator = 'AND' ) { |
439 | - if ( ! is_callable( $arrow ) ) { |
|
440 | - self::warn( 'This filter is using Twig\'s filter by default. If you want to use wp_list_filter use {{ my_array|wp_list_filter }}.' ); |
|
441 | - return self::wp_list_filter( $list, $arrow, $operator ); |
|
439 | + if ( !is_callable($arrow) ) { |
|
440 | + self::warn('This filter is using Twig\'s filter by default. If you want to use wp_list_filter use {{ my_array|wp_list_filter }}.'); |
|
441 | + return self::wp_list_filter($list, $arrow, $operator); |
|
442 | 442 | } |
443 | 443 | |
444 | - if ( is_array( $list ) ) { |
|
445 | - return array_filter( $list, $arrow, \ARRAY_FILTER_USE_BOTH ); |
|
444 | + if ( is_array($list) ) { |
|
445 | + return array_filter($list, $arrow, \ARRAY_FILTER_USE_BOTH); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | // the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator |
449 | - return new \CallbackFilterIterator( new \IteratorIterator( $list ), $arrow ); |
|
449 | + return new \CallbackFilterIterator(new \IteratorIterator($list), $arrow); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -461,16 +461,16 @@ discard block |
||
461 | 461 | * @return array |
462 | 462 | */ |
463 | 463 | public static function wp_list_filter( $list, $args, $operator = 'AND' ) { |
464 | - if ( ! is_array( $args ) ) { |
|
465 | - $args = array( 'slug' => $args ); |
|
464 | + if ( !is_array($args) ) { |
|
465 | + $args = array('slug' => $args); |
|
466 | 466 | } |
467 | 467 | |
468 | - if ( ! is_array( $list ) && ! is_a( $list, 'Traversable' ) ) { |
|
468 | + if ( !is_array($list) && !is_a($list, 'Traversable') ) { |
|
469 | 469 | return array(); |
470 | 470 | } |
471 | 471 | |
472 | - $util = new \WP_List_Util( $list ); |
|
473 | - return $util->filter( $args, $operator ); |
|
472 | + $util = new \WP_List_Util($list); |
|
473 | + return $util->filter($args, $operator); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /* Links, Forms, Etc. Utilities |