@@ -138,7 +138,7 @@ |
||
138 | 138 | * Efectua operaciones SQL sobre la base de datos |
139 | 139 | * |
140 | 140 | * @param string $sql_query |
141 | - * @return resource or false |
|
141 | + * @return resource|null or false |
|
142 | 142 | */ |
143 | 143 | public function query($sql_query) |
144 | 144 | { |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * @param string $table |
581 | 581 | * @param array $values |
582 | 582 | * @param array $fields |
583 | - * @return boolean |
|
583 | + * @return resource|null |
|
584 | 584 | */ |
585 | 585 | public function insert($table, $values, $fields=null) |
586 | 586 | { |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * @param array $fields |
596 | 596 | * @param array $values |
597 | 597 | * @param string $where_condition |
598 | - * @return boolean |
|
598 | + * @return resource|null |
|
599 | 599 | */ |
600 | 600 | public function update($table, $fields, $values, $where_condition=null) |
601 | 601 | { |
@@ -152,7 +152,7 @@ |
||
152 | 152 | /** |
153 | 153 | * Cierra la Conexión al Motor de Base de datos |
154 | 154 | * |
155 | - * @return boolean |
|
155 | + * @return boolean|null |
|
156 | 156 | */ |
157 | 157 | public function close() |
158 | 158 | { |
@@ -117,13 +117,19 @@ |
||
117 | 117 | */ |
118 | 118 | public function connect($config) |
119 | 119 | { |
120 | - if (!extension_loaded('mysqli')) throw new KumbiaException('Debe cargar la extensión de PHP llamada php_mysqli'); |
|
120 | + if (!extension_loaded('mysqli')) { |
|
121 | + throw new KumbiaException('Debe cargar la extensión de PHP llamada php_mysqli'); |
|
122 | + } |
|
121 | 123 | |
122 | 124 | $this->id_connection = new mysqli($config['host'], $config['username'], $config['password'], $config['name'], $config['port']); |
123 | 125 | //no se usa $object->error() ya que solo funciona a partir de 5.2.9 y 5.3 |
124 | - if (mysqli_connect_error ()) throw new KumbiaException(mysqli_connect_error()); |
|
126 | + if (mysqli_connect_error ()) { |
|
127 | + throw new KumbiaException(mysqli_connect_error()); |
|
128 | + } |
|
125 | 129 | //Selecciona charset |
126 | - if (isset($config['charset'])) $this->id_connection->set_charset($config['charset']); |
|
130 | + if (isset($config['charset'])) { |
|
131 | + $this->id_connection->set_charset($config['charset']); |
|
132 | + } |
|
127 | 133 | return TRUE; |
128 | 134 | } |
129 | 135 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | /** |
93 | 93 | * Devuelve el ultimo id autonumerico generado en la BD |
94 | 94 | * |
95 | - * @return integer |
|
95 | + * @return string |
|
96 | 96 | */ |
97 | 97 | public function last_insert_id($table='', $primary_key='') |
98 | 98 | { |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * |
146 | 146 | * @param string $table |
147 | 147 | * @param array $definition |
148 | - * @return boolean |
|
148 | + * @return integer |
|
149 | 149 | */ |
150 | 150 | public function create_table($table, $definition, $index=array()) |
151 | 151 | { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $table |
171 | 171 | * @param array $values |
172 | 172 | * @param array $fields |
173 | - * @return boolean |
|
173 | + * @return resource|null |
|
174 | 174 | */ |
175 | 175 | public function insert($table, $values, $fields=null) |
176 | 176 | { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param array $fields |
198 | 198 | * @param array $values |
199 | 199 | * @param string $where_condition |
200 | - * @return boolean |
|
200 | + * @return resource|null |
|
201 | 201 | */ |
202 | 202 | public function update($table, $fields, $values, $where_condition=null) |
203 | 203 | { |
@@ -298,7 +298,6 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * Efectua operaciones SQL sobre la base de datos |
300 | 300 | * Este método lo extienden los adapters |
301 | - * @param string $sql_query |
|
302 | 301 | * @return resource or false |
303 | 302 | */ |
304 | 303 | public function query($sql) |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | /** |
662 | 662 | * Commit a Transaction |
663 | 663 | * |
664 | - * @return success |
|
664 | + * @return resource|null |
|
665 | 665 | */ |
666 | 666 | public function commit() |
667 | 667 | { |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | /** |
672 | 672 | * Rollback a Transaction |
673 | 673 | * |
674 | - * @return success |
|
674 | + * @return resource|null |
|
675 | 675 | */ |
676 | 676 | public function rollback() |
677 | 677 | { |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | /** |
682 | 682 | * Start a transaction in RDBM |
683 | 683 | * |
684 | - * @return success |
|
684 | + * @return resource|null |
|
685 | 685 | */ |
686 | 686 | public function begin() |
687 | 687 | { |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | * Execute a SQL Statement directly |
726 | 726 | * |
727 | 727 | * @param string $sqlQuery |
728 | - * @return int affected |
|
728 | + * @return resource|null affected |
|
729 | 729 | */ |
730 | 730 | public function sql($sqlQuery) |
731 | 731 | { |
@@ -1217,7 +1217,6 @@ discard block |
||
1217 | 1217 | /** |
1218 | 1218 | * Creates a new Row in map table |
1219 | 1219 | * |
1220 | - * @param mixed $values |
|
1221 | 1220 | * @return boolean success |
1222 | 1221 | */ |
1223 | 1222 | public function create() |
@@ -1785,7 +1784,6 @@ discard block |
||
1785 | 1784 | /** |
1786 | 1785 | * Updates Data in the Relational Table |
1787 | 1786 | * |
1788 | - * @param mixed $values |
|
1789 | 1787 | * @return boolean|null sucess |
1790 | 1788 | */ |
1791 | 1789 | function update() |
@@ -1943,7 +1941,7 @@ discard block |
||
1943 | 1941 | * Delete All data from Relational Map Table |
1944 | 1942 | * |
1945 | 1943 | * @param string $conditions |
1946 | - * @return boolean |
|
1944 | + * @return resource|null |
|
1947 | 1945 | */ |
1948 | 1946 | public function delete_all($conditions = '') |
1949 | 1947 | { |
@@ -277,7 +277,9 @@ discard block |
||
277 | 277 | $this->_connect(); |
278 | 278 | |
279 | 279 | if ($data) { |
280 | - if (!is_array($data)) $data = Util::getParams(func_get_args()); |
|
280 | + if (!is_array($data)) { |
|
281 | + $data = Util::getParams(func_get_args()); |
|
282 | + } |
|
281 | 283 | foreach($this->fields as $field) { |
282 | 284 | if (isset($data[$field])) { |
283 | 285 | $this->$field = $data[$field]; |
@@ -394,7 +396,7 @@ discard block |
||
394 | 396 | } else { |
395 | 397 | $relation->through = "{$relation_source}_{$this->source}"; |
396 | 398 | } |
397 | - }else{ |
|
399 | + } else{ |
|
398 | 400 | $through = explode('/', $relation->through); |
399 | 401 | $relation->through = end($through); |
400 | 402 | } |
@@ -593,8 +595,9 @@ discard block |
||
593 | 595 | if ($field['Key'] == 'PRI') { |
594 | 596 | $this->primary_key[] = $field['Field']; |
595 | 597 | $this->alias[$field['Field']] = 'Código'; |
596 | - } else |
|
597 | - $this->non_primary[] = $field['Field']; |
|
598 | + } else { |
|
599 | + $this->non_primary[] = $field['Field']; |
|
600 | + } |
|
598 | 601 | /** |
599 | 602 | * Si se indica que no puede ser nulo, pero se indica un |
600 | 603 | * valor por defecto, entonces no se incluye en la lista, ya que |
@@ -1282,8 +1285,9 @@ discard block |
||
1282 | 1285 | public function save($values=null) |
1283 | 1286 | { |
1284 | 1287 | if ($values) { |
1285 | - if (!is_array($values)) |
|
1286 | - $values = Util::getParams(func_get_args()); |
|
1288 | + if (!is_array($values)) { |
|
1289 | + $values = Util::getParams(func_get_args()); |
|
1290 | + } |
|
1287 | 1291 | foreach ($this->fields as $field) { |
1288 | 1292 | if (isset($values[$field])) { |
1289 | 1293 | $this->$field = $values[$field]; |
@@ -1345,8 +1349,9 @@ discard block |
||
1345 | 1349 | if (isset($this->_validates['presence_of'])) { |
1346 | 1350 | foreach ($this->_validates['presence_of'] as $f => $opt) { |
1347 | 1351 | if (isset($this->$f) && (is_null($this->$f) || $this->$f == '')) { |
1348 | - if (!$ex && $f == $this->primary_key[0]) |
|
1349 | - continue; |
|
1352 | + if (!$ex && $f == $this->primary_key[0]) { |
|
1353 | + continue; |
|
1354 | + } |
|
1350 | 1355 | if (isset($opt['message'])) { |
1351 | 1356 | Flash::error($opt['message']); |
1352 | 1357 | return false; |
@@ -1396,18 +1401,20 @@ discard block |
||
1396 | 1401 | $field = isset($opt['field']) ? $opt['field'] : $f; |
1397 | 1402 | |
1398 | 1403 | if (strlen($this->$f) < $opt['min']) { |
1399 | - if (isset($opt['too_short'])) |
|
1400 | - Flash::error($opt['too_short']); |
|
1401 | - else |
|
1402 | - Flash::error("Error: El campo $field debe tener como mínimo $opt[min] caracteres"); |
|
1404 | + if (isset($opt['too_short'])) { |
|
1405 | + Flash::error($opt['too_short']); |
|
1406 | + } else { |
|
1407 | + Flash::error("Error: El campo $field debe tener como mínimo $opt[min] caracteres"); |
|
1408 | + } |
|
1403 | 1409 | return false; |
1404 | 1410 | } |
1405 | 1411 | |
1406 | 1412 | if (strlen($this->$f) > $opt['max']) { |
1407 | - if (isset($opt['too_long'])) |
|
1408 | - Flash::error($opt['too_long']); |
|
1409 | - else |
|
1410 | - Flash::error("Error: El campo $field debe tener como máximo $opt[max] caracteres"); |
|
1413 | + if (isset($opt['too_long'])) { |
|
1414 | + Flash::error($opt['too_long']); |
|
1415 | + } else { |
|
1416 | + Flash::error("Error: El campo $field debe tener como máximo $opt[max] caracteres"); |
|
1417 | + } |
|
1411 | 1418 | return false; |
1412 | 1419 | } |
1413 | 1420 | } |
@@ -1569,8 +1576,9 @@ discard block |
||
1569 | 1576 | } else { |
1570 | 1577 | if (isset($this->after_validation_on_update)) { |
1571 | 1578 | $method = $this->after_validation_on_update; |
1572 | - if ($this->$method() == 'cancel') |
|
1573 | - return false; |
|
1579 | + if ($this->$method() == 'cancel') { |
|
1580 | + return false; |
|
1581 | + } |
|
1574 | 1582 | } |
1575 | 1583 | } |
1576 | 1584 | } |
@@ -2008,8 +2016,9 @@ discard block |
||
2008 | 2016 | */ |
2009 | 2017 | protected function validates_presence_of($field, $params=array()) |
2010 | 2018 | { |
2011 | - if (is_string($params)) |
|
2012 | - $params = Util::getParams(func_get_args()); |
|
2019 | + if (is_string($params)) { |
|
2020 | + $params = Util::getParams(func_get_args()); |
|
2021 | + } |
|
2013 | 2022 | |
2014 | 2023 | $this->_validates['presence_of'][$field] = $params; |
2015 | 2024 | } |
@@ -2029,8 +2038,9 @@ discard block |
||
2029 | 2038 | */ |
2030 | 2039 | protected function validates_length_of($field, $max, $min=0, $params=array()) |
2031 | 2040 | { |
2032 | - if (is_string($params)) |
|
2033 | - $params = Util::getParams(func_get_args()); |
|
2041 | + if (is_string($params)) { |
|
2042 | + $params = Util::getParams(func_get_args()); |
|
2043 | + } |
|
2034 | 2044 | |
2035 | 2045 | $this->_validates['length_of'][$field] = $params; |
2036 | 2046 | $this->_validates['length_of'][$field]['min'] = $min; |
@@ -2049,8 +2059,9 @@ discard block |
||
2049 | 2059 | */ |
2050 | 2060 | protected function validates_inclusion_in($field, $list, $params=array()) |
2051 | 2061 | { |
2052 | - if (is_string($params)) |
|
2053 | - $params = Util::getParams(func_get_args()); |
|
2062 | + if (is_string($params)) { |
|
2063 | + $params = Util::getParams(func_get_args()); |
|
2064 | + } |
|
2054 | 2065 | |
2055 | 2066 | $this->_validates['inclusion_in'][$field] = $params; |
2056 | 2067 | $this->_validates['inclusion_in'][$field]['list'] = $list; |
@@ -2068,8 +2079,9 @@ discard block |
||
2068 | 2079 | */ |
2069 | 2080 | protected function validates_exclusion_of($field, $list, $params=array()) |
2070 | 2081 | { |
2071 | - if (is_string($params)) |
|
2072 | - $params = Util::getParams(func_get_args()); |
|
2082 | + if (is_string($params)) { |
|
2083 | + $params = Util::getParams(func_get_args()); |
|
2084 | + } |
|
2073 | 2085 | |
2074 | 2086 | $this->_validates['exclusion_of'][$field] = $params; |
2075 | 2087 | $this->_validates['exclusion_of'][$field]['list'] = $list; |
@@ -2087,8 +2099,9 @@ discard block |
||
2087 | 2099 | */ |
2088 | 2100 | protected function validates_format_of($field, $pattern, $params=array()) |
2089 | 2101 | { |
2090 | - if (is_string($params)) |
|
2091 | - $params = Util::getParams(func_get_args()); |
|
2102 | + if (is_string($params)) { |
|
2103 | + $params = Util::getParams(func_get_args()); |
|
2104 | + } |
|
2092 | 2105 | |
2093 | 2106 | $this->_validates['format_of'][$field] = $params; |
2094 | 2107 | $this->_validates['format_of'][$field]['pattern'] = $pattern; |
@@ -2105,8 +2118,9 @@ discard block |
||
2105 | 2118 | */ |
2106 | 2119 | protected function validates_numericality_of($field, $params=array()) |
2107 | 2120 | { |
2108 | - if (is_string($params)) |
|
2109 | - $params = Util::getParams(func_get_args()); |
|
2121 | + if (is_string($params)) { |
|
2122 | + $params = Util::getParams(func_get_args()); |
|
2123 | + } |
|
2110 | 2124 | |
2111 | 2125 | $this->_validates['numericality_of'][$field] = $params; |
2112 | 2126 | } |
@@ -2122,8 +2136,9 @@ discard block |
||
2122 | 2136 | */ |
2123 | 2137 | protected function validates_email_in($field, $params=array()) |
2124 | 2138 | { |
2125 | - if (is_string($params)) |
|
2126 | - $params = Util::getParams(func_get_args()); |
|
2139 | + if (is_string($params)) { |
|
2140 | + $params = Util::getParams(func_get_args()); |
|
2141 | + } |
|
2127 | 2142 | |
2128 | 2143 | $this->_validates['email_in'][$field] = $params; |
2129 | 2144 | } |
@@ -2139,8 +2154,9 @@ discard block |
||
2139 | 2154 | */ |
2140 | 2155 | protected function validates_uniqueness_of($field, $params=array()) |
2141 | 2156 | { |
2142 | - if (is_string($params)) |
|
2143 | - $params = Util::getParams(func_get_args()); |
|
2157 | + if (is_string($params)) { |
|
2158 | + $params = Util::getParams(func_get_args()); |
|
2159 | + } |
|
2144 | 2160 | |
2145 | 2161 | $this->_validates['uniqueness_of'][$field] = $params; |
2146 | 2162 | } |
@@ -2156,8 +2172,9 @@ discard block |
||
2156 | 2172 | */ |
2157 | 2173 | protected function validates_date_in($field, $params=array()) |
2158 | 2174 | { |
2159 | - if (is_string($params)) |
|
2160 | - $params = Util::getParams(func_get_args()); |
|
2175 | + if (is_string($params)) { |
|
2176 | + $params = Util::getParams(func_get_args()); |
|
2177 | + } |
|
2161 | 2178 | |
2162 | 2179 | $this->_validates['date_in'][$field] = $params; |
2163 | 2180 | } |
@@ -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)) { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | /** |
40 | 40 | * Sube y actualiza la foto del usuario. |
41 | 41 | * |
42 | - * @return boolean | null |
|
42 | + * @return boolean|null | null |
|
43 | 43 | */ |
44 | 44 | public function updatePhoto() { |
45 | 45 | if ($photo = $this->uploadPhoto('photo')) { |