@@ -53,8 +53,9 @@ |
||
53 | 53 | */ |
54 | 54 | public static function getCiudad($comuna) |
55 | 55 | { |
56 | - if (!$comuna) |
|
57 | - return false; |
|
56 | + if (!$comuna) { |
|
57 | + return false; |
|
58 | + } |
|
58 | 59 | $comuna = mb_strtoupper($comuna, 'UTF-8'); |
59 | 60 | return isset(self::$ciudades[$comuna]) ? self::$ciudades[$comuna] : false; |
60 | 61 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | public static function mergeRecursiveDistinct(array $array1, array $array2) |
43 | 43 | { |
44 | 44 | $merged = $array1; |
45 | - foreach ( $array2 as $key => &$value ) { |
|
45 | + foreach ($array2 as $key => &$value) { |
|
46 | 46 | if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { |
47 | 47 | $merged [$key] = self::mergeRecursiveDistinct( |
48 | 48 | $merged [$key], |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function read($archivo, $separador = ';', $delimitadortexto = '"') |
48 | 48 | { |
49 | - if (($handle = fopen($archivo, 'r')) !== FALSE) { |
|
49 | + if (($handle = fopen($archivo, 'r'))!==FALSE) { |
|
50 | 50 | $data = array(); |
51 | 51 | $i = 0; |
52 | - while (($row = fgetcsv($handle, 0, $separador, $delimitadortexto)) !== FALSE) { |
|
52 | + while (($row = fgetcsv($handle, 0, $separador, $delimitadortexto))!==FALSE) { |
|
53 | 53 | $j = 0; |
54 | 54 | foreach ($row as &$col) { |
55 | 55 | $data[$i][$j++] = $col; |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | header('Content-Disposition: attachment; filename='.$archivo.'.csv'); |
78 | 78 | header('Pragma: no-cache'); |
79 | 79 | header('Expires: 0'); |
80 | - foreach($data as &$row) { |
|
81 | - foreach($row as &$col) { |
|
80 | + foreach ($data as &$row) { |
|
81 | + foreach ($row as &$col) { |
|
82 | 82 | $col = $delimitadortexto.rtrim(str_replace('<br />', ', ', strip_tags($col, '<br>')), " \t\n\r\0\x0B,").$delimitadortexto; |
83 | 83 | } |
84 | - echo implode($separador, $row),"\r\n"; |
|
84 | + echo implode($separador, $row), "\r\n"; |
|
85 | 85 | unset($row); |
86 | 86 | } |
87 | 87 | unset($data); |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | public static function save(array $data, $archivo, $separador = ';', $delimitadortexto = '"') |
101 | 101 | { |
102 | 102 | $fd = fopen($archivo, 'w'); |
103 | - foreach($data as &$row) { |
|
104 | - foreach($row as &$col) { |
|
103 | + foreach ($data as &$row) { |
|
104 | + foreach ($row as &$col) { |
|
105 | 105 | $col = $delimitadortexto.rtrim(str_replace('<br />', ', ', strip_tags($col, '<br>')), " \t\n\r\0\x0B,").$delimitadortexto; |
106 | 106 | } |
107 | 107 | fwrite($fd, implode($separador, $row)."\r\n"); |
@@ -174,12 +174,14 @@ |
||
174 | 174 | public static function get($codigo, $args = null) |
175 | 175 | { |
176 | 176 | // si no hay glosa asociada al código se entrega el mismo código |
177 | - if (!isset(self::$glosas[(int)$codigo])) |
|
178 | - return (int)$codigo; |
|
177 | + if (!isset(self::$glosas[(int)$codigo])) { |
|
178 | + return (int)$codigo; |
|
179 | + } |
|
179 | 180 | // si los argumentos no son un arreglo se obtiene arreglo a partir |
180 | 181 | // de los argumentos pasados a la función |
181 | - if (!is_array($args)) |
|
182 | - $args = array_slice(func_get_args(), 1); |
|
182 | + if (!is_array($args)) { |
|
183 | + $args = array_slice(func_get_args(), 1); |
|
184 | + } |
|
183 | 185 | // entregar glosa |
184 | 186 | return vsprintf(I18n::translate(self::$glosas[(int)$codigo], 'estados'), $args); |
185 | 187 | } |