@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | public function __construct($instance=NULL){ |
15 | 15 | $this->values=[]; |
16 | 16 | $this->afterCompile=[]; |
17 | - if(isset($instance)) |
|
18 | - $this->setInstance($instance); |
|
17 | + if(isset($instance)) { |
|
18 | + $this->setInstance($instance); |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public function getValues(){ |
@@ -30,8 +31,9 @@ discard block |
||
30 | 31 | |
31 | 32 | public function getIdentifier(){ |
32 | 33 | $value=self::$index; |
33 | - if(isset($this->values["identifier"])) |
|
34 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
34 | + if(isset($this->values["identifier"])) { |
|
35 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
36 | + } |
|
35 | 37 | return $value; |
36 | 38 | } |
37 | 39 | |
@@ -47,14 +49,15 @@ discard block |
||
47 | 49 | if(isset($this->values[$index])){ |
48 | 50 | $value= $this->values[$index]($value); |
49 | 51 | } |
50 | - }else{ |
|
51 | - if(\is_callable($property)) |
|
52 | - $value=$property($this->instance); |
|
53 | - elseif(\is_array($property)){ |
|
52 | + } else{ |
|
53 | + if(\is_callable($property)) { |
|
54 | + $value=$property($this->instance); |
|
55 | + } elseif(\is_array($property)){ |
|
54 | 56 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
55 | 57 | $value=\implode("", $values); |
56 | - }else |
|
57 | - $value=$property; |
|
58 | + } else { |
|
59 | + $value=$property; |
|
60 | + } |
|
58 | 61 | } |
59 | 62 | if(isset($this->afterCompile[$index])){ |
60 | 63 | if(\is_callable($this->afterCompile[$index])){ |
@@ -74,10 +77,10 @@ discard block |
||
74 | 77 | if(isset($vb[$index])){ |
75 | 78 | if(\is_array($vb[$index])){ |
76 | 79 | $this->visibleProperties[$index][]=$field; |
77 | - }else{ |
|
80 | + } else{ |
|
78 | 81 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
79 | 82 | } |
80 | - }else{ |
|
83 | + } else{ |
|
81 | 84 | return $this->insertField($index, $field); |
82 | 85 | } |
83 | 86 | return $this; |
@@ -109,24 +112,25 @@ discard block |
||
109 | 112 | $this->reflect=new \ReflectionClass($instance); |
110 | 113 | if(\sizeof($this->visibleProperties)===0){ |
111 | 114 | $this->properties=$this->getDefaultProperties(); |
112 | - }else{ |
|
115 | + } else{ |
|
113 | 116 | foreach ($this->visibleProperties as $property){ |
114 | 117 | if(\is_callable($property)){ |
115 | 118 | $this->properties[]=$property; |
116 | - }elseif(\is_string($property)){ |
|
119 | + } elseif(\is_string($property)){ |
|
117 | 120 | try{ |
118 | 121 | $rProperty=$this->reflect->getProperty($property); |
119 | 122 | $this->properties[]=$rProperty; |
120 | - }catch(\Exception $e){ |
|
123 | + } catch(\Exception $e){ |
|
121 | 124 | $this->properties[]=$property; |
122 | 125 | } |
123 | - }elseif(\is_int($property)){ |
|
126 | + } elseif(\is_int($property)){ |
|
124 | 127 | $props=$this->getDefaultProperties(); |
125 | - if(isset($props[$property])) |
|
126 | - $this->properties[]=$props[$property]; |
|
127 | - else |
|
128 | - $this->properties[]=$property; |
|
129 | - }else{ |
|
128 | + if(isset($props[$property])) { |
|
129 | + $this->properties[]=$props[$property]; |
|
130 | + } else { |
|
131 | + $this->properties[]=$property; |
|
132 | + } |
|
133 | + } else{ |
|
130 | 134 | $this->properties[]=$property; |
131 | 135 | } |
132 | 136 | } |
@@ -11,12 +11,13 @@ |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | public function getCaption($index){ |
14 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
15 | - return $this->properties[$index]->getName(); |
|
16 | - elseif(\is_callable($this->properties[$index])) |
|
17 | - return ""; |
|
18 | - else |
|
19 | - return $this->properties[$index]; |
|
14 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
15 | + return $this->properties[$index]->getName(); |
|
16 | + } elseif(\is_callable($this->properties[$index])) { |
|
17 | + return ""; |
|
18 | + } else { |
|
19 | + return $this->properties[$index]; |
|
20 | + } |
|
20 | 21 | } |
21 | 22 | |
22 | 23 | public function getCaptions(){ |