@@ -111,45 +111,45 @@ |
||
111 | 111 | |
112 | 112 | public static function nicetime($date, array $translate = ["second", "minute", "hour", "day", "week", "month", "year", "decade"]) |
113 | 113 | { |
114 | - if(empty($date)) { |
|
114 | + if (empty($date)) { |
|
115 | 115 | return "No date provided"; |
116 | 116 | } |
117 | - if(!is_array($translate)) { |
|
117 | + if (!is_array($translate)) { |
|
118 | 118 | return "the expected value is not an array"; |
119 | 119 | } |
120 | - if( 5 > count($translate)){ |
|
120 | + if (5 > count($translate)) { |
|
121 | 121 | return "the matrix needs 5 to 8 values (second, minute, hour, day, week,month, year, decade)"; |
122 | 122 | } |
123 | 123 | |
124 | 124 | $periods = $translate; |
125 | - $lengths = array("60","60","24","7","4.35","12","10"); |
|
125 | + $lengths = array("60", "60", "24", "7", "4.35", "12", "10"); |
|
126 | 126 | |
127 | 127 | $now = time(); |
128 | - $unix_date = strtotime($date); |
|
128 | + $unix_date = strtotime($date); |
|
129 | 129 | |
130 | 130 | // check validity of date |
131 | - if(empty($unix_date)) { |
|
131 | + if (empty($unix_date)) { |
|
132 | 132 | return "Bad date"; |
133 | 133 | } |
134 | 134 | |
135 | 135 | // is it future date or past date |
136 | - if($now > $unix_date) { |
|
137 | - $difference = $now - $unix_date; |
|
138 | - $tense = "ago"; |
|
136 | + if ($now > $unix_date) { |
|
137 | + $difference = $now - $unix_date; |
|
138 | + $tense = "ago"; |
|
139 | 139 | |
140 | 140 | } else { |
141 | - $difference = $unix_date - $now; |
|
142 | - $tense = "from now"; |
|
141 | + $difference = $unix_date - $now; |
|
142 | + $tense = "from now"; |
|
143 | 143 | } |
144 | 144 | |
145 | - for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { |
|
145 | + for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) { |
|
146 | 146 | $difference /= $lengths[$j]; |
147 | 147 | } |
148 | 148 | |
149 | 149 | $difference = round($difference); |
150 | 150 | |
151 | - if($difference != 1) { |
|
152 | - $periods[$j].= "s"; |
|
151 | + if ($difference != 1) { |
|
152 | + $periods[$j] .= "s"; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return "$difference $periods[$j] {$tense}"; |
@@ -256,8 +256,8 @@ |
||
256 | 256 | return $this->data['value']; |
257 | 257 | } |
258 | 258 | |
259 | - public function setValue($value){ |
|
260 | - $this->data['value']= $value; |
|
259 | + public function setValue($value) { |
|
260 | + $this->data['value'] = $value; |
|
261 | 261 | |
262 | 262 | } |
263 | 263 |
@@ -211,7 +211,7 @@ |
||
211 | 211 | public function has($keys) |
212 | 212 | { |
213 | 213 | $keys = (array)$keys; |
214 | - if ( empty($this->elements) || $keys === []) { |
|
214 | + if (empty($this->elements) || $keys === []) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | foreach ($keys as $key) { |
@@ -382,7 +382,7 @@ |
||
382 | 382 | if (!is_array($params)) { |
383 | 383 | throw new \InvalidArgumentException("Arguments is not a Array" . print_r($params, true)); |
384 | 384 | } |
385 | - $o =''; |
|
385 | + $o = ''; |
|
386 | 386 | $o .= (isset($params['id'])) ? " id='{$params['id']}'" : ''; |
387 | 387 | $o .= (isset($params['name'])) ? " name='{$params['name']}'" : ''; |
388 | 388 | $o .= (isset($params['class'])) ? " class='form-input textbox {$params['class']}'" : ''; |