@@ -187,10 +187,14 @@ |
||
187 | 187 | protected function _validatesTypes() |
188 | 188 | { |
189 | 189 | // Verifica que sea un archivo de imagen |
190 | - if (!$this->_imgInfo) return FALSE; |
|
190 | + if (!$this->_imgInfo) { |
|
191 | + return FALSE; |
|
192 | + } |
|
191 | 193 | |
192 | 194 | foreach ($this->_types as $type) { |
193 | - if ($this->_imgInfo['mime'] == "image/$type") return TRUE; |
|
195 | + if ($this->_imgInfo['mime'] == "image/$type") { |
|
196 | + return TRUE; |
|
197 | + } |
|
194 | 198 | } |
195 | 199 | |
196 | 200 | return FALSE; |
@@ -86,8 +86,9 @@ |
||
86 | 86 | $vars = $url; |
87 | 87 | } |
88 | 88 | |
89 | - if (++$cyclic > 1000) |
|
90 | - throw new KumbiaException('Se ha detectado un enrutamiento cíclico. Esto puede causar problemas de estabilidad'); |
|
89 | + if (++$cyclic > 1000) { |
|
90 | + throw new KumbiaException('Se ha detectado un enrutamiento cíclico. Esto puede causar problemas de estabilidad'); |
|
91 | + } |
|
91 | 92 | |
92 | 93 | Router::to($vars, TRUE); |
93 | 94 | } |
@@ -49,17 +49,17 @@ |
||
49 | 49 | * @var array |
50 | 50 | */ |
51 | 51 | protected $_fields = array('id'); |
52 | - /** |
|
53 | - * |
|
54 | - * |
|
55 | - * @var string |
|
56 | - */ |
|
52 | + /** |
|
53 | + * |
|
54 | + * |
|
55 | + * @var string |
|
56 | + */ |
|
57 | 57 | protected $_algos ; |
58 | - /** |
|
59 | - * |
|
60 | - * |
|
61 | - * @var string |
|
62 | - */ |
|
58 | + /** |
|
59 | + * |
|
60 | + * |
|
61 | + * @var string |
|
62 | + */ |
|
63 | 63 | protected $_key; |
64 | 64 | /** |
65 | 65 | * Asigna el modelo a utilizar |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | if(!$obj->$ruleName($field, $param)){ |
117 | - $this->addError($param, $field, $ruleName); |
|
117 | + $this->addError($param, $field, $ruleName); |
|
118 | 118 | } |
119 | 119 | return true; |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $rule Nombre de la regla |
127 | 127 | */ |
128 | 128 | protected function addError(Array $param, $field, $rule){ |
129 | - $this->messages[$field][] = isset($param['error']) ? |
|
129 | + $this->messages[$field][] = isset($param['error']) ? |
|
130 | 130 | $param['error']: Validations::getMessage($rule); |
131 | 131 | } |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return string |
138 | 138 | */ |
139 | 139 | protected static function getRuleName($ruleName, $param){ |
140 | - /*Evita tener que colocar un null cuando no se pasan parametros*/ |
|
140 | + /*Evita tener que colocar un null cuando no se pasan parametros*/ |
|
141 | 141 | return is_integer($ruleName) && is_string($param)?$param:$ruleName; |
142 | 142 | } |
143 | 143 |
@@ -82,11 +82,13 @@ discard block |
||
82 | 82 | $ruleName = self::getRuleName($ruleName, $param); |
83 | 83 | $param = self::getParams($param); |
84 | 84 | /*Ignore the rule is starts with "#"*/ |
85 | - if($ruleName[0] == '#') continue; |
|
85 | + if($ruleName[0] == '#') { |
|
86 | + continue; |
|
87 | + } |
|
86 | 88 | /*Es una validación de modelo*/ |
87 | 89 | if($ruleName[0] == '@'){ |
88 | 90 | $this->modelRule($ruleName, $param, $field); |
89 | - }elseif(!Validations::$ruleName($value, $param, $this->obj)){ |
|
91 | + } elseif(!Validations::$ruleName($value, $param, $this->obj)){ |
|
90 | 92 | $this->addError($param, $field, $ruleName); |
91 | 93 | } |
92 | 94 | } |
@@ -185,7 +187,8 @@ discard block |
||
185 | 187 | * @param Array $error |
186 | 188 | */ |
187 | 189 | public static function errorToFlash(Array $error){ |
188 | - foreach ($error as $value) |
|
189 | - Flash::error($value); |
|
190 | + foreach ($error as $value) { |
|
191 | + Flash::error($value); |
|
192 | + } |
|
190 | 193 | } |
191 | 194 | } |
@@ -168,7 +168,9 @@ |
||
168 | 168 | self::$_events[$event][] = $handler2; |
169 | 169 | return; |
170 | 170 | } |
171 | - if ($after) ++$i; |
|
171 | + if ($after) { |
|
172 | + ++$i; |
|
173 | + } |
|
172 | 174 | |
173 | 175 | array_splice(self::$_events[$event], $i, 0, $handler2); |
174 | 176 | } |
@@ -140,17 +140,17 @@ |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * Permite Obtener el Agente de Usuario (User Agent) |
|
144 | - * @return String |
|
145 | - */ |
|
143 | + * Permite Obtener el Agente de Usuario (User Agent) |
|
144 | + * @return String |
|
145 | + */ |
|
146 | 146 | public static function userAgent(){ |
147 | 147 | return $_SERVER['HTTP_USER_AGENT']; |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * Permite obtene la IP del cliente, aún cuando usa proxy |
|
152 | - * @return String |
|
153 | - */ |
|
151 | + * Permite obtene la IP del cliente, aún cuando usa proxy |
|
152 | + * @return String |
|
153 | + */ |
|
154 | 154 | public static function ip(){ |
155 | 155 | if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
156 | 156 | return $_SERVER['HTTP_CLIENT_IP']; |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | public static function ip(){ |
155 | 155 | if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
156 | 156 | return $_SERVER['HTTP_CLIENT_IP']; |
157 | - }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
|
157 | + } elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
|
158 | 158 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
159 | - }else{ |
|
159 | + } else{ |
|
160 | 160 | return $_SERVER['REMOTE_ADDR']; |
161 | 161 | } |
162 | 162 | } |
@@ -181,8 +181,9 @@ discard block |
||
181 | 181 | * @return mixed |
182 | 182 | */ |
183 | 183 | protected static function getFilter(Array $var, $str){ |
184 | - if(empty($str)) |
|
185 | - return filter_var_array($var); |
|
184 | + if(empty($str)) { |
|
185 | + return filter_var_array($var); |
|
186 | + } |
|
186 | 187 | $arr = explode('.', $str); |
187 | 188 | $value = $var; |
188 | 189 | foreach ($arr as $key) { |
@@ -34,8 +34,9 @@ |
||
34 | 34 | */ |
35 | 35 | public static function mkdir($path) |
36 | 36 | { |
37 | - if (file_exists($path) || @mkdir($path)) |
|
38 | - return TRUE; |
|
37 | + if (file_exists($path) || @mkdir($path)) { |
|
38 | + return TRUE; |
|
39 | + } |
|
39 | 40 | return (self::mkdir(dirname($path)) && mkdir($path)); |
40 | 41 | } |
41 | 42 |
@@ -136,8 +136,9 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public static function getPath() |
138 | 138 | { |
139 | - if (self::$_response) |
|
140 | - return self::$_path . self::$_view . '.' . self::$_response . '.phtml'; |
|
139 | + if (self::$_response) { |
|
140 | + return self::$_path . self::$_view . '.' . self::$_response . '.phtml'; |
|
141 | + } |
|
141 | 142 | |
142 | 143 | return self::$_path . self::$_view . '.phtml'; |
143 | 144 | } |
@@ -224,8 +225,9 @@ discard block |
||
224 | 225 | */ |
225 | 226 | public static function render(Controller $controller) |
226 | 227 | { |
227 | - if (!self::$_view && !self::$_template) |
|
228 | - return ob_end_flush(); |
|
228 | + if (!self::$_view && !self::$_template) { |
|
229 | + return ob_end_flush(); |
|
230 | + } |
|
229 | 231 | |
230 | 232 | // Guarda el controlador |
231 | 233 | self::$_controller = $controller; |
@@ -253,8 +255,9 @@ discard block |
||
253 | 255 | ob_start(); |
254 | 256 | |
255 | 257 | // carga la vista |
256 | - if (!include self::getView()) |
|
257 | - throw new KumbiaException('Vista "' . self::getPath() . '" no encontrada', 'no_view'); |
|
258 | + if (!include self::getView()) { |
|
259 | + throw new KumbiaException('Vista "' . self::getPath() . '" no encontrada', 'no_view'); |
|
260 | + } |
|
258 | 261 | |
259 | 262 | // si esta en produccion y se cachea la vista |
260 | 263 | self::saveCache('view'); |
@@ -274,8 +277,9 @@ discard block |
||
274 | 277 | ob_start(); |
275 | 278 | |
276 | 279 | // carga el template |
277 | - if (!include APP_PATH . "views/_shared/templates/$__template.phtml") |
|
278 | - throw new KumbiaException("Template $__template no encontrado"); |
|
280 | + if (!include APP_PATH . "views/_shared/templates/$__template.phtml") { |
|
281 | + throw new KumbiaException("Template $__template no encontrado"); |
|
282 | + } |
|
279 | 283 | |
280 | 284 | // si esta en produccion y se cachea template |
281 | 285 | self::saveCache('template'); |
@@ -351,7 +355,9 @@ discard block |
||
351 | 355 | */ |
352 | 356 | public static function getVar($var = '') |
353 | 357 | { |
354 | - if(!$var) return get_object_vars(self::$_controller); |
|
358 | + if(!$var) { |
|
359 | + return get_object_vars(self::$_controller); |
|
360 | + } |
|
355 | 361 | |
356 | 362 | return isset(self::$_controller->$var) ? self::$_controller->$var : NULL; |
357 | 363 | } |
@@ -94,7 +94,9 @@ |
||
94 | 94 | foreach ($args as $model) { |
95 | 95 | $Model = Util::camelcase(basename($model)); |
96 | 96 | //Si esta cargada continua con la siguiente clase |
97 | - if (class_exists($Model, FALSE)) continue; |
|
97 | + if (class_exists($Model, FALSE)) { |
|
98 | + continue; |
|
99 | + } |
|
98 | 100 | if (!include APP_PATH . "models/$model.php") { |
99 | 101 | throw new KumbiaException($model,'no_model'); |
100 | 102 | } |