@@ -24,14 +24,14 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getConstantValues($postFix="",$prefixBefore=false) { |
27 | - if ($postFix == "") |
|
28 | - return \array_values(self::getConstants()); |
|
29 | - else { |
|
27 | + if ($postFix == "") { |
|
28 | + return \array_values(self::getConstants()); |
|
29 | + } else { |
|
30 | 30 | if($prefixBefore===false){ |
31 | 31 | return \array_map(function ($elem) use($postFix) { |
32 | 32 | return $elem . " " . $postFix; |
33 | 33 | }, \array_values(self::getConstants())); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | return \array_map(function ($elem) use($postFix) { |
36 | 36 | return $postFix." ".$elem; |
37 | 37 | }, \array_values(self::getConstants())); |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
20 | - $this->setProperty("value", $value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setProperty("value", $value); |
|
21 | + } |
|
21 | 22 | return $this; |
22 | 23 | } |
23 | 24 | |
@@ -27,11 +28,13 @@ discard block |
||
27 | 28 | |
28 | 29 | public function setPlaceholder($value){ |
29 | 30 | if(JString::isNull($value)){ |
30 | - if(JString::isNotNull($this->identifier)) |
|
31 | - $value=\ucfirst($this->identifier); |
|
31 | + if(JString::isNotNull($this->identifier)) { |
|
32 | + $value=\ucfirst($this->identifier); |
|
33 | + } |
|
34 | + } |
|
35 | + if(JString::isNotNull($value)) { |
|
36 | + $this->setProperty("placeholder", $value); |
|
32 | 37 | } |
33 | - if(JString::isNotNull($value)) |
|
34 | - $this->setProperty("placeholder", $value); |
|
35 | 38 | return $this; |
36 | 39 | } |
37 | 40 | } |
38 | 41 | \ No newline at end of file |
@@ -11,18 +11,21 @@ |
||
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
15 | - $this->setRows($rows); |
|
14 | + if(isset($rows)) { |
|
15 | + $this->setRows($rows); |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | public function setValue($value) { |
18 | - if(isset($value)) |
|
19 | - $this->setContent($value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setContent($value); |
|
21 | + } |
|
20 | 22 | return $this; |
21 | 23 | } |
22 | 24 | |
23 | 25 | public function setPlaceholder($value){ |
24 | - if(JString::isNotNull($value)) |
|
25 | - $this->setProperty("placeholder", $value); |
|
26 | + if(JString::isNotNull($value)) { |
|
27 | + $this->setProperty("placeholder", $value); |
|
28 | + } |
|
26 | 29 | return $this; |
27 | 30 | } |
28 | 31 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function addOption($element,$value="",$selected=false){ |
26 | 26 | if($element instanceof HtmlOption){ |
27 | 27 | $option=$element; |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
30 | 30 | } |
31 | 31 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach ($array as $k=>$v){ |
65 | 65 | $this->addOption($v, $k); |
66 | 66 | } |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | foreach ($array as $v){ |
69 | 69 | $this->addOption($v, $v); |
70 | 70 | } |
@@ -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) === true || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) === true || \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 (is_object($v)) |
|
48 | - return $v->compile($js); |
|
49 | - elseif (\is_array($v)) { |
|
48 | + if (is_object($v)) { |
|
49 | + return $v->compile($js); |
|
50 | + } elseif (\is_array($v)) { |
|
50 | 51 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
52 | - return $v; |
|
52 | + } else { |
|
53 | + return $v; |
|
54 | + } |
|
53 | 55 | }, $input)); |
54 | 56 | } |
55 | 57 | } |
56 | 58 | \ No newline at end of file |
@@ -29,15 +29,17 @@ |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (is_array($this->content)===false) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 |
@@ -14,21 +14,24 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
18 | - return $values[$pos]; |
|
17 | + if ($pos < sizeof($values)) { |
|
18 | + return $values[$pos]; |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
22 | 23 | $result=NULL; |
23 | 24 | if (array_key_exists($key, $array)) { |
24 | 25 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
26 | - return $result; |
|
26 | + if ($condition($result) === true) { |
|
27 | + return $result; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | $values=array_values($array); |
29 | 31 | foreach ( $values as $val ) { |
30 | - if ($condition($val) === true) |
|
31 | - return $val; |
|
32 | + if ($condition($val) === true) { |
|
33 | + return $val; |
|
34 | + } |
|
32 | 35 | } |
33 | 36 | return $result; |
34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 40 | if (array_key_exists($key, $array)) { |
38 | 41 | return $array[$key]; |
39 | - } else |
|
40 | - return $default; |
|
42 | + } else { |
|
43 | + return $default; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | public static function implode($glue, $pieces) { |
@@ -14,8 +14,9 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function compile(JsUtils $js=null) { |
17 | - if ($js==null) |
|
18 | - return; |
|
17 | + if ($js==null) { |
|
18 | + return; |
|
19 | + } |
|
19 | 20 | $result=""; |
20 | 21 | $params="{}"; |
21 | 22 | $callback=NULL; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if(isset($router)===true){ |
14 | 14 | try { |
15 | 15 | $url=$router->generate($url); |
16 | - }catch (\Exception $e){ |
|
16 | + } catch (\Exception $e){ |
|
17 | 17 | return $router->getContext()->getBaseUrl(); |
18 | 18 | } |
19 | 19 | } |