@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param string $file_name: Nombre del archivo, da igual si es solo el nombre o la ruta con el nombre |
86 | 86 | * |
87 | 87 | * @return mixed string con la extensión, devuelve un string '' si no existe información alguna acerca de la extensión |
88 | - */ |
|
88 | + */ |
|
89 | 89 | public static function get_file_ext(string $file_name) { |
90 | 90 | return pathinfo($file_name, PATHINFO_EXTENSION); |
91 | 91 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param string $file_name: Nombre del archivo, da igual si es solo el nombre o la ruta con el nombre |
97 | 97 | * |
98 | 98 | * @return bool true si es una imagen, false si no lo es |
99 | - */ |
|
99 | + */ |
|
100 | 100 | public static function is_image(string $file_name) : bool { |
101 | 101 | return (bool) in_array(self::get_file_ext($file_name), ['jpg', 'png', 'jpeg', 'gif', 'JPG', 'PNG', 'JPEG', 'GIF']); |
102 | 102 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return int con el tamaño del fichero |
110 | 110 | */ |
111 | 111 | public static function file_size(string $file) : int { |
112 | - return (int) round(filesize($file)*0.0009765625, 1); |
|
112 | + return (int) round(filesize($file)*0.0009765625, 1); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @param string $file: path del fichero |
119 | 119 | * |
120 | 120 | * @return string con la fecha del fichero en el formato d-m-y h:i:s |
121 | - */ |
|
121 | + */ |
|
122 | 122 | public static function date_file(string $file) : string { |
123 | - return date('d-m-Y h:i:s', filemtime($file)); |
|
123 | + return date('d-m-Y h:i:s', filemtime($file)); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param string $types: tipos de archivos a buscar, por defecto '' significa todos, se puede pasar por ejemplo 'jpg' |
131 | 131 | * |
132 | 132 | * @return array con las rutas de todos los ficheros encontrados, un array vacío si no encontró ficheros |
133 | - */ |
|
133 | + */ |
|
134 | 134 | public static function get_files_in_dir(string $dir, string $types = '') : array { |
135 | 135 | $array = array(); |
136 | 136 | if (is_dir($dir)) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param int $permisos: Permisos del directorio a crear, por defecto es 0655 |
149 | 149 | * |
150 | 150 | * @return bool con true si fue creado con éxito, false si el directorio ya existía o hubo algún error |
151 | - */ |
|
151 | + */ |
|
152 | 152 | public static function create_dir(string $dir, int $permisos = 0655) : bool { |
153 | 153 | if(is_dir($dir)) { |
154 | 154 | return false; |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | - * Evalúa si un arreglo es de tipo asociativo o no |
|
98 | - * |
|
99 | - * @param array $a: Arreglo a evaluar |
|
100 | - * |
|
101 | - * @return bool false si no lo es, true si lo es |
|
102 | - */ |
|
97 | + * Evalúa si un arreglo es de tipo asociativo o no |
|
98 | + * |
|
99 | + * @param array $a: Arreglo a evaluar |
|
100 | + * |
|
101 | + * @return bool false si no lo es, true si lo es |
|
102 | + */ |
|
103 | 103 | public static function is_assoc(array $a) : bool { |
104 | 104 | if (sizeof($a) == 0) { |
105 | 105 | return false; |
@@ -109,36 +109,36 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * Evalúa si un arreglo es secuencial (de índices numéricos) |
|
113 | - * |
|
114 | - * @param array $a: Arreglo a evaluar |
|
115 | - * |
|
116 | - * @return bool false si no lo es, true si lo es |
|
117 | - */ |
|
112 | + * Evalúa si un arreglo es secuencial (de índices numéricos) |
|
113 | + * |
|
114 | + * @param array $a: Arreglo a evaluar |
|
115 | + * |
|
116 | + * @return bool false si no lo es, true si lo es |
|
117 | + */ |
|
118 | 118 | public static function is_numeric_array(array $a) : bool { |
119 | 119 | return !self::is_assoc($a); |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * Obtiene de forma random un elemento de un arreglo |
|
124 | - * |
|
125 | - * @param array $a: Arreglo a evaluar |
|
126 | - * |
|
127 | - * @return mixed elemento random dentro del arreglo |
|
128 | - */ |
|
123 | + * Obtiene de forma random un elemento de un arreglo |
|
124 | + * |
|
125 | + * @param array $a: Arreglo a evaluar |
|
126 | + * |
|
127 | + * @return mixed elemento random dentro del arreglo |
|
128 | + */ |
|
129 | 129 | public static function array_random_element(array $a) { |
130 | 130 | return $a[array_rand($a)]; |
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * Ordena una matriz de mayor a menor, o menor a mayor por el valor de un campo específico |
|
135 | - * |
|
136 | - * @param array $toOrderArray : Arreglo a evaluar |
|
137 | - * @param string $field: Campo por el que se va a ordenar |
|
138 | - * @param bool $inverse: Por defecto falso, cambia el orden |
|
139 | - * |
|
140 | - * @return mixed elemento random dentro del arreglo |
|
141 | - */ |
|
134 | + * Ordena una matriz de mayor a menor, o menor a mayor por el valor de un campo específico |
|
135 | + * |
|
136 | + * @param array $toOrderArray : Arreglo a evaluar |
|
137 | + * @param string $field: Campo por el que se va a ordenar |
|
138 | + * @param bool $inverse: Por defecto falso, cambia el orden |
|
139 | + * |
|
140 | + * @return mixed elemento random dentro del arreglo |
|
141 | + */ |
|
142 | 142 | public static function order_multi_dimensional(array $toOrderArray, string $field, bool $inverse = false) : array { |
143 | 143 | $position = array(); |
144 | 144 | $newRow = array(); |