@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function getTests() { |
| 21 | 21 | return [ |
| 22 | - new \Twig_SimpleTest('numeric', function( $value ) { |
|
| 22 | + new \Twig_SimpleTest('numeric', function($value) { |
|
| 23 | 23 | return is_numeric($value); |
| 24 | 24 | }), |
| 25 | - new \Twig_SimpleTest('integer', function( $value ) { |
|
| 25 | + new \Twig_SimpleTest('integer', function($value) { |
|
| 26 | 26 | return is_numeric($value) && ($value == (int) $value); |
| 27 | 27 | }), |
| 28 | - new \Twig_SimpleTest('string', function( $value ) { |
|
| 28 | + new \Twig_SimpleTest('string', function($value) { |
|
| 29 | 29 | return is_string($value); |
| 30 | 30 | }), |
| 31 | - new \Twig_SimpleTest('array', function( $value ) { |
|
| 31 | + new \Twig_SimpleTest('array', function($value) { |
|
| 32 | 32 | return is_array($value); |
| 33 | 33 | }), |
| 34 | - new \Twig_SimpleTest('object', function( $value, $class = '' ) { |
|
| 34 | + new \Twig_SimpleTest('object', function($value, $class = '') { |
|
| 35 | 35 | $result = is_object($value); |
| 36 | - if( $class ) |
|
| 36 | + if ($class) |
|
| 37 | 37 | $result = $result && ($value instanceof $class); |
| 38 | 38 | return $result; |
| 39 | 39 | }), |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $filters = [ |
| 46 | 46 | new \Twig_SimpleFilter('md5', 'md5'), |
| 47 | 47 | new \Twig_SimpleFilter('sha1', 'sha1'), |
| 48 | - new \Twig_SimpleFilter('truncate', function( $str, $length, $replace = '...' ) { |
|
| 49 | - if( isset($str) ) |
|
| 50 | - return strlen($str) <= $length ? $str : substr($str, 0, $length - strip_tags($replace)) . $replace; |
|
| 48 | + new \Twig_SimpleFilter('truncate', function($str, $length, $replace = '...') { |
|
| 49 | + if (isset($str)) |
|
| 50 | + return strlen($str) <= $length ? $str : substr($str, 0, $length - strip_tags($replace)).$replace; |
|
| 51 | 51 | return null; |
| 52 | 52 | }), |
| 53 | 53 | new \Twig_SimpleFilter('sum', 'array_sum'), |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | ]; |
| 56 | 56 | |
| 57 | 57 | // include some helpful shit from yolk-core/StringHelper if we have it available |
| 58 | - if( class_exists ('\\yolk\\helpers\\StringHelper') ) { |
|
| 58 | + if (class_exists('\\yolk\\helpers\\StringHelper')) { |
|
| 59 | 59 | $filters = array_merge( |
| 60 | 60 | $filters, |
| 61 | 61 | [ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // more helpful shit from yolk-core/Inflector if we have it available |
| 74 | - if( class_exists ('\\yolk\\helpers\\Inflector') ) { |
|
| 74 | + if (class_exists('\\yolk\\helpers\\Inflector')) { |
|
| 75 | 75 | $filters = array_merge( |
| 76 | 76 | $filters, |
| 77 | 77 | [ |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | 95 | // include some helpful shit from yolk-core/StringHelper if we have it available |
| 96 | - if( class_exists ('\\yolk\\helpers\\StringHelper') ) { |
|
| 96 | + if (class_exists('\\yolk\\helpers\\StringHelper')) { |
|
| 97 | 97 | $functions = array_merge( |
| 98 | 98 | $functions, |
| 99 | 99 | [ |