@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | $output=$input; |
13 | 13 | } |
14 | 14 | if (\is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $separator=' ', $valueQuote='"'); |
18 | 18 | } else { |
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
27 | + foreach ($input as $v) { |
|
28 | 28 | if (\is_object($v) || \is_array($v)) |
29 | 29 | return true; |
30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | 39 | } else { |
40 | 40 | $result=implode($separator, array_values($input)); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
47 | 47 | if ($v instanceof BaseHtml) |
48 | 48 | return $v->compile($js); |
49 | 49 | elseif (\is_array($v)) { |
50 | 50 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } elseif(!\is_callable($v)) |
|
51 | + } elseif (!\is_callable($v)) |
|
52 | 52 | return $v; |
53 | 53 | }, $input)); |
54 | 54 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | 27 | foreach ( $input as $v ) { |
28 | - if (\is_object($v) || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) || \is_array($v)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | return false; |
32 | 33 | } |
@@ -44,12 +45,13 @@ discard block |
||
44 | 45 | |
45 | 46 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | 47 | return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
47 | - if ($v instanceof BaseHtml) |
|
48 | - return $v->compile($js); |
|
49 | - elseif (\is_array($v)) { |
|
48 | + if ($v instanceof BaseHtml) { |
|
49 | + return $v->compile($js); |
|
50 | + } elseif (\is_array($v)) { |
|
50 | 51 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } elseif(!\is_callable($v)) |
|
52 | - return $v; |
|
52 | + } elseif(!\is_callable($v)) { |
|
53 | + return $v; |
|
54 | + } |
|
53 | 55 | }, $input)); |
54 | 56 | } |
55 | 57 | } |