@@ -135,7 +135,7 @@ |
||
| 135 | 135 | /** |
| 136 | 136 | * Asigna las extensiones de archivos permitidas |
| 137 | 137 | * |
| 138 | - * @param array|string $value lista de extensiones para archivos, si es string separado por | |
|
| 138 | + * @param string[] $value lista de extensiones para archivos, si es string separado por | |
|
| 139 | 139 | */ |
| 140 | 140 | public function setExtensions($value) { |
| 141 | 141 | if (!is_array($value)) { |
@@ -141,7 +141,7 @@ |
||
| 141 | 141 | |
| 142 | 142 | private static function sprintf($sentence, $args, $offset) |
| 143 | 143 | { |
| 144 | - return vsprintf( $sentence, array_slice( $args, $offset)); |
|
| 144 | + return vsprintf($sentence, array_slice($args, $offset)); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @param string $name |
| 92 | 92 | */ |
| 93 | - public static function initialize($name='') |
|
| 93 | + public static function initialize($name = '') |
|
| 94 | 94 | { |
| 95 | 95 | self::$log_path = APP_PATH . 'temp/logs/'; //TODO poder cambiar el path |
| 96 | 96 | if ($name === '') { |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | * @param string $msg |
| 130 | 130 | * @param string $name_log |
| 131 | 131 | */ |
| 132 | - public static function log($type='DEBUG', $msg, $name_log) |
|
| 132 | + public static function log($type = 'DEBUG', $msg, $name_log) |
|
| 133 | 133 | { |
| 134 | 134 | if (is_array($msg)) { |
| 135 | 135 | $msg = print_r($msg, true); |
| 136 | 136 | } |
| 137 | 137 | //TODO poder añadir otros formatos de log |
| 138 | 138 | $date = date(DATE_RFC1036); |
| 139 | - $msg = "[$date][$type] " . $msg ; |
|
| 139 | + $msg = "[$date][$type] " . $msg; |
|
| 140 | 140 | if (self::$transaction) { |
| 141 | 141 | self::$queue[] = $msg; |
| 142 | 142 | return; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected static function write($msg, $name_log) |
| 153 | 153 | { |
| 154 | - self::initialize($name_log); //TODO dejarlo abierto cuando es un commit |
|
| 154 | + self::initialize($name_log); //TODO dejarlo abierto cuando es un commit |
|
| 155 | 155 | fputs(self::$fileLogger, $msg . PHP_EOL); |
| 156 | 156 | self::close(); |
| 157 | 157 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @param string $msg |
| 210 | 210 | * @param string $name_log |
| 211 | 211 | */ |
| 212 | - public static function warning($msg, $name_log='') |
|
| 212 | + public static function warning($msg, $name_log = '') |
|
| 213 | 213 | { |
| 214 | 214 | self::log('WARNING', $msg, $name_log); |
| 215 | 215 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param string $msg |
| 222 | 222 | * @param string $name_log |
| 223 | 223 | */ |
| 224 | - public static function error($msg, $name_log='') |
|
| 224 | + public static function error($msg, $name_log = '') |
|
| 225 | 225 | { |
| 226 | 226 | self::log('ERROR', $msg, $name_log); |
| 227 | 227 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $msg |
| 234 | 234 | * @param string $name_log |
| 235 | 235 | */ |
| 236 | - public static function debug($msg, $name_log='') |
|
| 236 | + public static function debug($msg, $name_log = '') |
|
| 237 | 237 | { |
| 238 | 238 | self::log('DEBUG', $msg, $name_log); |
| 239 | 239 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param string $msg |
| 246 | 246 | * @param string $name_log |
| 247 | 247 | */ |
| 248 | - public static function alert($msg, $name_log='') |
|
| 248 | + public static function alert($msg, $name_log = '') |
|
| 249 | 249 | { |
| 250 | 250 | self::log('ALERT', $msg, $name_log); |
| 251 | 251 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param string $msg |
| 258 | 258 | * @param string $name_log |
| 259 | 259 | */ |
| 260 | - public static function critical($msg, $name_log='') |
|
| 260 | + public static function critical($msg, $name_log = '') |
|
| 261 | 261 | { |
| 262 | 262 | self::log('CRITICAL', $msg, $name_log); |
| 263 | 263 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param string $msg |
| 270 | 270 | * @param string $name_log |
| 271 | 271 | */ |
| 272 | - public static function notice($msg, $name_log='') |
|
| 272 | + public static function notice($msg, $name_log = '') |
|
| 273 | 273 | { |
| 274 | 274 | self::log('NOTICE', $msg, $name_log); |
| 275 | 275 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @param string $msg |
| 282 | 282 | * @param string $name_log |
| 283 | 283 | */ |
| 284 | - public static function info($msg, $name_log='') |
|
| 284 | + public static function info($msg, $name_log = '') |
|
| 285 | 285 | { |
| 286 | 286 | self::log('INFO', $msg, $name_log); |
| 287 | 287 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @param string $msg |
| 294 | 294 | * @param string $name_log |
| 295 | 295 | */ |
| 296 | - public static function emergence($msg, $name_log='') |
|
| 296 | + public static function emergence($msg, $name_log = '') |
|
| 297 | 297 | { |
| 298 | 298 | self::log('EMERGENCE', $msg, $name_log); |
| 299 | 299 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @param string $msg |
| 306 | 306 | * @param string $name_log |
| 307 | 307 | */ |
| 308 | - public static function custom($type='CUSTOM', $msg, $name_log='') |
|
| 308 | + public static function custom($type = 'CUSTOM', $msg, $name_log = '') |
|
| 309 | 309 | { |
| 310 | 310 | self::log($type, $msg, $name_log); |
| 311 | 311 | } |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | |
| 139 | 139 | $image = $this->_imgInfo; |
| 140 | 140 | // Verifica que sea un archivo de imagen |
| 141 | - if (!$image){ |
|
| 141 | + if (!$image) { |
|
| 142 | 142 | Flash::error('Error: el archivo debe ser una imagen'); |
| 143 | 143 | return FALSE; |
| 144 | 144 | } |
@@ -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; |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | * @license http://wiki.kumbiaphp.com/Licencia New BSD License |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -class KumbiaAuth extends KumbiaFacade{ |
|
| 22 | - protected static function getAlias(){ |
|
| 21 | +class KumbiaAuth extends KumbiaFacade { |
|
| 22 | + protected static function getAlias() { |
|
| 23 | 23 | return 'auth'; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | if ($seconds) { |
| 45 | 45 | header("Refresh: $seconds; url=$route"); |
| 46 | 46 | } else { |
| 47 | - header('Location: '.$route, TRUE, $statusCode); |
|
| 47 | + header('Location: ' . $route, TRUE, $statusCode); |
|
| 48 | 48 | $_SESSION['KUMBIA.CONTENT'] = ob_get_clean(); |
| 49 | 49 | View::select(null, null); |
| 50 | 50 | } |
@@ -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 | } |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public static function createSecureRSAKey($kumbia=true) |
|
| 45 | + public static function createSecureRSAKey($kumbia = true) |
|
| 46 | 46 | { |
| 47 | 47 | $config = Config::read('config'); |
| 48 | 48 | if ($config->kumbia->secure_ajax) { |
| 49 | 49 | if ($_SESSION['rsa_key']) { |
| 50 | - if ((time() % 8) == 0) { |
|
| 50 | + if ((time()%8) == 0) { |
|
| 51 | 51 | return self::generateRSAKey($kumbia); |
| 52 | 52 | } else { |
| 53 | 53 | echo "<input type='hidden' id='rsa32_key' value=\"{$_SESSION['rsa_key']}\"/>"; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Solo letras |
| 35 | 35 | */ |
| 36 | - const IS_ALPHA = '/^(?:[^\W\d_]|([ ]))*$/mu'; |
|
| 36 | + const IS_ALPHA = '/^(?:[^\W\d_]|([ ]))*$/mu'; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Almacena la Expresion Regular |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param mixed $check Valor a ser chequeado |
| 49 | 49 | * @return bool |
| 50 | 50 | */ |
| 51 | - public static function numeric($check){ |
|
| 51 | + public static function numeric($check) { |
|
| 52 | 52 | return is_numeric($check); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public static function maxlength($value, $param) |
| 76 | 76 | { |
| 77 | - $max= isset($param['max'])?$param['max']:0; |
|
| 77 | + $max = isset($param['max']) ? $param['max'] : 0; |
|
| 78 | 78 | return !isset($value[$max]); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Valida longitud de la cadena |
| 83 | 83 | */ |
| 84 | - public static function length($value, $param){ |
|
| 84 | + public static function length($value, $param) { |
|
| 85 | 85 | $param = array_merge(array( |
| 86 | 86 | 'min' => 0, |
| 87 | 87 | 'max' => 9e100, |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public static function url($url, $param) |
| 139 | 139 | { |
| 140 | - $flag = isset($param['flag'])? $param['flag'] : 0; |
|
| 140 | + $flag = isset($param['flag']) ? $param['flag'] : 0; |
|
| 141 | 141 | return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED | $flag); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public static function date($value, $param) |
| 199 | 199 | { |
| 200 | - $format = isset($param['format'])? $param['format'] : 'Y-m-d'; |
|
| 200 | + $format = isset($param['format']) ? $param['format'] : 'Y-m-d'; |
|
| 201 | 201 | $date = DateTime::createFromFormat($format, $value); |
| 202 | 202 | return $date && $date->format($format) == $value; |
| 203 | 203 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public static function pattern($check, $param) |
| 213 | 213 | { |
| 214 | - $regex = isset($param['regexp'])? $param['regexp'] : '/.*/'; |
|
| 214 | + $regex = isset($param['regexp']) ? $param['regexp'] : '/.*/'; |
|
| 215 | 215 | return empty($check) || FALSE !== filter_var($check, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $regex))); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public static function decimal($value, $param) |
| 226 | 226 | { |
| 227 | - $decimal = isset($param['decimal'])? $param['decimal'] : ','; |
|
| 227 | + $decimal = isset($param['decimal']) ? $param['decimal'] : ','; |
|
| 228 | 228 | return filter_var($value, FILTER_VALIDATE_FLOAT, array('options' => array('decimal' => $decimal))); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public static function equal($value, $param, $obj) |
| 240 | 240 | { |
| 241 | - $equal = isset($param['to'])? $param['to'] : ''; |
|
| 241 | + $equal = isset($param['to']) ? $param['to'] : ''; |
|
| 242 | 242 | return ($obj->$equal == $value); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | * @param string $key |
| 248 | 248 | * @return string |
| 249 | 249 | */ |
| 250 | - public static function getMessage($key){ |
|
| 251 | - $arr = array( |
|
| 250 | + public static function getMessage($key) { |
|
| 251 | + $arr = array( |
|
| 252 | 252 | 'required' => 'Este campo es requerido', |
| 253 | 253 | 'alphanum' => 'Debe ser un valor alfanumérico', |
| 254 | 254 | 'alpha' => 'Solo caracteres alfabeticos', |
@@ -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 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @copyright Copyright (c) 2005 - 2017 Kumbia Team (http://www.kumbiaphp.com) |
| 20 | 20 | * @license http://wiki.kumbiaphp.com/Licencia New BSD License |
| 21 | 21 | */ |
| 22 | -require __DIR__.'/validations.php'; |
|
| 22 | +require __DIR__ . '/validations.php'; |
|
| 23 | 23 | class Validate |
| 24 | 24 | { |
| 25 | 25 | /** |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * @param mixed $obj Objecto o Array a validar |
| 64 | 64 | * @param array $rules Aray de reglas a validar |
| 65 | 65 | */ |
| 66 | - public function __construct($obj, Array $rules){ |
|
| 66 | + public function __construct($obj, Array $rules) { |
|
| 67 | 67 | $this->is_obj = is_object($obj); |
| 68 | - $this->obj = (object)$obj; |
|
| 68 | + $this->obj = (object) $obj; |
|
| 69 | 69 | $this->rules = $rules; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -73,20 +73,20 @@ discard block |
||
| 73 | 73 | * Ejecuta las validaciones |
| 74 | 74 | * @return bool Devuelve true si todo es válido |
| 75 | 75 | */ |
| 76 | - public function exec(){ |
|
| 76 | + public function exec() { |
|
| 77 | 77 | /*Recorrido por todos los campos*/ |
| 78 | - foreach ($this->rules as $field => $fRule){ |
|
| 78 | + foreach ($this->rules as $field => $fRule) { |
|
| 79 | 79 | $value = self::getValue($this->obj, $field); |
| 80 | 80 | /*Regla individual para cada campo*/ |
| 81 | 81 | foreach ($fRule as $ruleName => $param) { |
| 82 | 82 | $ruleName = self::getRuleName($ruleName, $param); |
| 83 | - $param = self::getParams($param); |
|
| 83 | + $param = self::getParams($param); |
|
| 84 | 84 | /*Ignore the rule is starts with "#"*/ |
| 85 | - if($ruleName[0] == '#') continue; |
|
| 85 | + if ($ruleName[0] == '#') continue; |
|
| 86 | 86 | /*Es una validación de modelo*/ |
| 87 | - if($ruleName[0] == '@'){ |
|
| 87 | + if ($ruleName[0] == '@') { |
|
| 88 | 88 | $this->modelRule($ruleName, $param, $field); |
| 89 | - }elseif(!Validations::$ruleName($value, $param, $this->obj)){ |
|
| 89 | + }elseif (!Validations::$ruleName($value, $param, $this->obj)) { |
|
| 90 | 90 | $this->addError($param, $field, $ruleName); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | * @param string $field Nombre del campo |
| 103 | 103 | * @return bool |
| 104 | 104 | */ |
| 105 | - protected function modelRule($rule, $param, $field){ |
|
| 106 | - if(!$this->is_obj){ |
|
| 105 | + protected function modelRule($rule, $param, $field) { |
|
| 106 | + if (!$this->is_obj) { |
|
| 107 | 107 | trigger_error('No se puede ejecutar una validacion de modelo en un array', E_USER_WARNING); |
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | 110 | $ruleName = ltrim($rule, '@'); |
| 111 | 111 | $obj = $this->obj; |
| 112 | - if(!method_exists($obj, $ruleName)){ |
|
| 112 | + if (!method_exists($obj, $ruleName)) { |
|
| 113 | 113 | trigger_error('El metodo para la validacion no existe', E_USER_WARNING); |
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | - if(!$obj->$ruleName($field, $param)){ |
|
| 116 | + if (!$obj->$ruleName($field, $param)) { |
|
| 117 | 117 | $this->addError($param, $field, $ruleName); |
| 118 | 118 | } |
| 119 | 119 | return true; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | * @param string $field Nombre del campo |
| 126 | 126 | * @param string $rule Nombre de la regla |
| 127 | 127 | */ |
| 128 | - protected function addError(Array $param, $field, $rule){ |
|
| 128 | + protected function addError(Array $param, $field, $rule) { |
|
| 129 | 129 | $this->messages[$field][] = isset($param['error']) ? |
| 130 | - $param['error']: Validations::getMessage($rule); |
|
| 130 | + $param['error'] : Validations::getMessage($rule); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * @param mixed $param |
| 137 | 137 | * @return string |
| 138 | 138 | */ |
| 139 | - protected static function getRuleName($ruleName, $param){ |
|
| 139 | + protected static function getRuleName($ruleName, $param) { |
|
| 140 | 140 | /*Evita tener que colocar un null cuando no se pasan parametros*/ |
| 141 | - return is_integer($ruleName) && is_string($param)?$param:$ruleName; |
|
| 141 | + return is_integer($ruleName) && is_string($param) ? $param : $ruleName; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | * @param mixed $param |
| 147 | 147 | * @return array |
| 148 | 148 | */ |
| 149 | - protected static function getParams($param){ |
|
| 150 | - return is_array($param)?$param:array(); |
|
| 149 | + protected static function getParams($param) { |
|
| 150 | + return is_array($param) ? $param : array(); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -156,35 +156,35 @@ discard block |
||
| 156 | 156 | * @param string $field |
| 157 | 157 | * @return mixed |
| 158 | 158 | */ |
| 159 | - protected static function getValue($obj, $field){ |
|
| 160 | - return !empty($obj->$field)?$obj->$field:null;//obtengo el valor del campo |
|
| 159 | + protected static function getValue($obj, $field) { |
|
| 160 | + return !empty($obj->$field) ? $obj->$field : null; //obtengo el valor del campo |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Devuelve los mensajes de error |
| 165 | 165 | * |
| 166 | 166 | */ |
| 167 | - public function getMessages(){ |
|
| 167 | + public function getMessages() { |
|
| 168 | 168 | return $this->messages; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Version de instancias para flush error |
| 173 | 173 | */ |
| 174 | - public function flash(){ |
|
| 174 | + public function flash() { |
|
| 175 | 175 | self::errorToFlash($this->getMessages()); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - public static function fail($obj, Array $rules){ |
|
| 178 | + public static function fail($obj, Array $rules) { |
|
| 179 | 179 | $val = new self($obj, $rules); |
| 180 | - return $val->exec() ? false:$val->getMessages(); |
|
| 180 | + return $val->exec() ? false : $val->getMessages(); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * Envia los mensajes de error via flash |
| 185 | 185 | * @param Array $error |
| 186 | 186 | */ |
| 187 | - public static function errorToFlash(Array $error){ |
|
| 187 | + public static function errorToFlash(Array $error) { |
|
| 188 | 188 | foreach ($error as $value) |
| 189 | 189 | Flash::error($value); |
| 190 | 190 | } |
@@ -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 | } |