Passed
Branch master (49f250)
by Brayan
01:58
created
app/models/Users.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * Hace un set() a la sesión login_user_recentAttempts con el valor actualizado.
51 51
      *
52 52
      * @return void
53
-    */
53
+     */
54 54
     private function updateSessionAttempts() {
55 55
         global $session;
56 56
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
         throw new \RuntimeException('El usuario no está logeado.');
271 271
     }
272 272
 
273
-     /**
274
-     * Realiza la acción de login dentro del sistema
275
-     *
276
-     * @return array : Con información de éxito/falla al inicio de sesión.
277
-     */
273
+      /**
274
+       * Realiza la acción de login dentro del sistema
275
+       *
276
+       * @return array : Con información de éxito/falla al inicio de sesión.
277
+       */
278 278
     public function login() : array {
279 279
         try {
280 280
             global $http;
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
     }
355 355
     
356 356
     /**
357
-      * Envía un correo electrónico al usuario que quiere recuperar la contraseña, con un token y una nueva contraseña.
358
-      * Si el usuario no visita el enlace, el sistema no cambiará la contraseña.
359
-      *
360
-      * @return array<string,integer|string>
361
-    */  
357
+     * Envía un correo electrónico al usuario que quiere recuperar la contraseña, con un token y una nueva contraseña.
358
+     * Si el usuario no visita el enlace, el sistema no cambiará la contraseña.
359
+     *
360
+     * @return array<string,integer|string>
361
+     */  
362 362
     public function lostpass() : array {
363 363
         try {
364 364
             global $http, $config;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
             # Enviar el correo electrónico
397 397
             $dest = array();
398
-			$dest[$email] = $user_data[0]['name'];
398
+      $dest[$email] = $user_data[0]['name'];
399 399
             $email_send = Helper\Emails::send($dest,array(
400 400
                 # Título del mensaje
401 401
                 '{{title}}' => 'Recuperar contraseña de ' . $config['build']['name'],
@@ -483,6 +483,6 @@  discard block
 block discarded – undo
483 483
      */
484 484
     public function __construct(IRouter $router = null) {
485 485
         parent::__construct($router);
486
-		$this->startDBConexion();
486
+    $this->startDBConexion();
487 487
     }
488 488
 }
489 489
\ No newline at end of file
Please login to merge, or discard this patch.
Ocrend/Kernel/Database/Drivers/Sqlite/Sqlite.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
      *
94 94
      * @throws \RuntimeException si el arreglo está vacío
95 95
      * @return int con la cantidad de tablas afectadas
96
-    */
96
+     */
97 97
     public function update(string $table, array $e, $where = null, $limit = null) : int {
98 98
         if (sizeof($e) == 0) {
99 99
             throw new \RuntimeException('El arreglo pasado por $this->db->update(\'' . $table . '\'...) está vacío.');
Please login to merge, or discard this patch.
Ocrend/Kernel/Models/Models.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 abstract class Models {
23 23
 
24 24
     /**
25
-      * Tiene siempre el id pasado por la ruta, en caso de no haber ninguno, será cero.
26
-      *
27
-      * @var int 
28
-    */
25
+     * Tiene siempre el id pasado por la ruta, en caso de no haber ninguno, será cero.
26
+     *
27
+     * @var int 
28
+     */
29 29
     protected $id = 0;
30 30
 
31 31
     /**
32
-      * Contiene el id del usuario que tiene su sesión iniciada.
33
-      *
34
-      * @var int|null con id del usuario
35
-    */
32
+     * Contiene el id del usuario que tiene su sesión iniciada.
33
+     *
34
+     * @var int|null con id del usuario
35
+     */
36 36
     protected $id_user = null;
37 37
 
38 38
     /**
39
-      * Inicia la configuración inicial de cualquier modelo
40
-      *
41
-      * @param IRouter $router: Instancia de un Router 
42
-      *                                    
43
-    */
39
+     * Inicia la configuración inicial de cualquier modelo
40
+     *
41
+     * @param IRouter $router: Instancia de un Router 
42
+     *                                    
43
+     */
44 44
     protected function __construct(IRouter $router = null) {
45 45
         global $session, $cookie;
46 46
         
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         # Verificar sesión del usuario
54 54
         $session_name = $cookie->get('session_hash') . '__user_id';
55 55
         if(null !== $session->get($session_name)) {
56
-           $this->id_user = $session->get($session_name);
56
+            $this->id_user = $session->get($session_name);
57 57
         }
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
Ocrend/Kernel/Router/Rules.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * @param mixed $ruta : Ruta a aplicar la regla
25 25
      *
26 26
      * @return mixed
27
-    */
27
+     */
28 28
     final public function none($ruta) {
29 29
         return $ruta;
30 30
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param mixed $ruta : Ruta a aplicar la regla
36 36
      *
37 37
      * @return mixed
38
-    */    
38
+     */    
39 39
     final public function letters($ruta) {
40 40
         return preg_match("/^[a-zA-Z ]*$/", $ruta) ? $ruta : null;
41 41
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $ruta : Ruta a aplicar la regla
47 47
      *
48 48
      * @return mixed
49
-    */   
49
+     */   
50 50
     final public function alphanumeric($ruta) {
51 51
         return preg_match('/^[a-zA-Z0-9 ]*$/', $ruta) ? $ruta : null;
52 52
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param mixed $ruta : Ruta a aplicar la regla
58 58
      *
59 59
      * @return mixed
60
-    */
60
+     */
61 61
     final public function url($ruta) {
62 62
         return preg_match('/^[a-zA-Z0-9- ]*$/', $ruta) ? $ruta : null;
63 63
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param mixed $ruta : Ruta a aplicar la regla
69 69
      *
70 70
      * @return int|null
71
-    */
71
+     */
72 72
     final public function integer($ruta) {
73 73
         return is_numeric($ruta) ? (int) $ruta : null;
74 74
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param mixed $ruta : Ruta a aplicar la regla
80 80
      *
81 81
      * @return int|null
82
-    */    
82
+     */    
83 83
     final public function integer_positive($ruta) {
84 84
         return is_numeric($ruta) && $ruta >= 0 ? (int) $ruta : null;
85 85
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param mixed $ruta : Ruta a aplicar la regla
91 91
      *
92 92
      * @return float|null
93
-    */
93
+     */
94 94
     final public function float($ruta) {
95 95
         return is_numeric($ruta) ? (float) $ruta : null;
96 96
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param mixed $ruta : Ruta a aplicar la regla
102 102
      *
103 103
      * @return float|null
104
-    */
104
+     */
105 105
     final public function float_positive($ruta) {
106 106
         return is_numeric($ruta) && $ruta >= 0 ? (float) $ruta : null;
107 107
     }
Please login to merge, or discard this patch.
Ocrend/Kernel/Router/Router.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * Reglas definidas en Rules.php 
28 28
      *
29 29
      * @var array CONSTANTE con las reglas permitidas
30
-    */
30
+     */
31 31
     const RULES = [
32 32
         'none', # Sin ninguna regla
33 33
         'letters', # Sólamente letras
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * Colección de rutas existentes
44 44
      *
45 45
      * @var array 
46
-    */
46
+     */
47 47
     private $routerCollection = array(
48 48
         '/controller' => 'home', # controlador por defecto
49 49
         '/method' => null, # método por defecto
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * Colección de reglas para cada ruta existente
55 55
      *
56 56
      * @var array 
57
-    */
57
+     */
58 58
     private $routerCollectionRules = array(
59 59
         '/controller' => 'letters',
60 60
         '/method' => 'none',
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
      * Petición real estructurada
66 66
      * 
67 67
      * @var array
68
-    */
68
+     */
69 69
     private $real_request = array();
70 70
 
71 71
     /**
72 72
      * Uri requerida por el cliente final 
73 73
      * 
74 74
      * @var string
75
-    */
75
+     */
76 76
     private $requestUri;
77 77
 
78 78
     /**
79 79
      * __construct() 
80
-    */
80
+     */
81 81
     public function __construct() {
82 82
         global $http;
83 83
         
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @throws \RuntimeException si la regla no existe
98 98
      * @return void
99
-    */
99
+     */
100 100
     final private function setCollectionRule(string $index, string $rule) {
101 101
         # Verificar si la regla existe
102 102
         if (!in_array($rule, self::RULES)) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     /**
110 110
      * Verifica las peticiones por defecto
111
-    */
111
+     */
112 112
     final private function checkRequests()  {
113 113
         # Verificar si existe peticiones
114 114
         if (null !== $this->requestUri) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param string $rule : Nombre de la regla, por defecto es ninguna "none"
129 129
      *
130 130
      * @throws \RuntimeException si no puede definirse la ruta
131
-    */
131
+     */
132 132
     final public function setRoute(string $index, string $rule = 'none')  {
133 133
         # Nombres de rutas no permitidos
134 134
         if (in_array($index, ['/controller', '/method', '/id'])) {
Please login to merge, or discard this patch.
Ocrend/Kernel/Helpers/Files.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
   }
246 246
 
247 247
   /**
248
-    * Se obtiene de Twig_Extension y sirve para que cada función esté disponible como etiqueta en twig
249
-    *
250
-    * @return array con todas las funciones con sus respectivos nombres de acceso en plantillas twig
251
-  */
248
+   * Se obtiene de Twig_Extension y sirve para que cada función esté disponible como etiqueta en twig
249
+   *
250
+   * @return array con todas las funciones con sus respectivos nombres de acceso en plantillas twig
251
+   */
252 252
   public function getFunctions() : array {
253 253
     return array(
254 254
       new \Twig_Function('images_in_dir', array($this, 'images_in_dir')),
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
   }
262 262
 
263 263
   /**
264
-    * Identificador único para la extensión de twig
265
-    *
266
-    * @return string con el nombre de la extensión
267
-  */
264
+   * Identificador único para la extensión de twig
265
+   *
266
+   * @return string con el nombre de la extensión
267
+   */
268 268
   public function getName() : string {
269 269
     return 'ocrend_framework_helper_files';
270 270
   }
Please login to merge, or discard this patch.
Ocrend/Kernel/Helpers/Arrays.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
   }
158 158
 
159 159
   /**
160
-    * Se obtiene de Twig_Extension y sirve para que cada función esté disponible como etiqueta en twig
161
-    *
162
-    * @return array con todas las funciones con sus respectivos nombres de acceso en plantillas twig
163
-  */
160
+   * Se obtiene de Twig_Extension y sirve para que cada función esté disponible como etiqueta en twig
161
+   *
162
+   * @return array con todas las funciones con sus respectivos nombres de acceso en plantillas twig
163
+   */
164 164
   public function getFunctions() : array {
165 165
     return array(
166 166
       new \Twig_Function('get_key_by_index', array($this, 'get_key_by_index')),
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
   }
174 174
 
175 175
   /**
176
-    * Identificador único para la extensión de twig
177
-    *
178
-    * @return string con el nombre de la extensión
179
-  */
176
+   * Identificador único para la extensión de twig
177
+   *
178
+   * @return string con el nombre de la extensión
179
+   */
180 180
   public function getName() : string {
181 181
     return 'ocrend_framework_helper_arrays';
182 182
   }
Please login to merge, or discard this patch.
Ocrend/Kernel/Helpers/Functions.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
    * @param int $max: Valor a comparar
28 28
    *
29 29
    * @return bool con el resultado de la comparación
30
-  */
30
+   */
31 31
   private static function check_str_to_time(int $index, array $detail, int $max) : bool {
32 32
     return !array_key_exists($index,$detail) || !is_numeric($detail[$index]) || intval($detail[$index]) < $max;
33 33
   }
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
    * @param array $detail: Arreglo
39 39
    * 
40 40
    * @return bool
41
-  */
41
+   */
42 42
   private static function check_time(array $detail) : bool {
43 43
     return self::check_str_to_time(0,$detail,1) || self::check_str_to_time(1,$detail,1) || intval($detail[1]) > 12 || self::check_str_to_time(2,$detail,1970);
44 44
   }
45 45
 
46 46
   /**
47
-  * Redirecciona a una URL
48
-  *
49
-  * @param string $url: Sitio a donde redireccionará, si no se pasa, por defecto
50
-  * se redirecciona a la URL principal del sitio
51
-  *
52
-  * @return void
53
-  */
47
+   * Redirecciona a una URL
48
+   *
49
+   * @param string $url: Sitio a donde redireccionará, si no se pasa, por defecto
50
+   * se redirecciona a la URL principal del sitio
51
+   *
52
+   * @return void
53
+   */
54 54
   public static function redir($url = null)  {
55 55
     global $config;
56 56
     
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
    * @param string  $email: El email del usuario a extraer el gravatar
92 92
    * @param int $size: El tamaño del gravatar
93 93
    * @return string con la URl
94
-  */
94
+   */
95 95
   public static function get_gravatar(string $email, int $size = 35) : string  {
96 96
     return 'http://www.gravatar.com/avatar/' . md5($email) . '?s=' . (int) abs($size) . '?d=robohash';
97 97
   }
@@ -108,30 +108,30 @@  discard block
 block discarded – undo
108 108
     return (null === $var || empty(trim(str_replace(' ','',$var))));
109 109
   }
110 110
 
111
-   //------------------------------------------------
111
+    //------------------------------------------------
112 112
 
113
-   /**
113
+    /**
114 114
      * Aanaliza que TODOS los elementos de un arreglo estén llenos, útil para analizar por ejemplo que todos los elementos de un formulario esté llenos
115 115
      * pasando como parámetro $_POST
116 116
      *
117 117
      * @param array $array, arreglo a analizar
118 118
      *
119 119
      * @return bool con true si están todos llenos, false si al menos uno está vacío
120
-   */
121
-   public static function all_full(array $array) : bool {
122
-     foreach($array as $e) {
123
-       if(self::emp($e) and $e != '0') {
124
-         return false;
125
-       }
126
-     }
127
-     return true;
128
-   }
120
+     */
121
+    public static function all_full(array $array) : bool {
122
+      foreach($array as $e) {
123
+        if(self::emp($e) and $e != '0') {
124
+          return false;
125
+        }
126
+      }
127
+      return true;
128
+    }
129 129
 
130 130
   /**
131 131
    * Alias de Empty() pero soporta más de un parámetro (infinitos)
132 132
    *
133 133
    * @return bool con true si al menos uno está vacío, false si todos están llenos
134
-  */
134
+   */
135 135
   public static function e() : bool  {
136 136
     for ($i = 0, $nargs = func_num_args(); $i < $nargs; $i++) {
137 137
       if(self::emp(func_get_arg($i)) && func_get_arg($i) != '0') {
@@ -150,40 +150,40 @@  discard block
 block discarded – undo
150 150
    * @param int $time: Tiempo, por defecto es time() (igual que en date())
151 151
    *
152 152
    * @return string con la fecha en formato humano (y en español)
153
-  */
153
+   */
154 154
   public static function fecha(string $format, int $time = 0) : string  {
155 155
     $date = date($format,$time == 0 ? time() : $time);
156 156
     $cambios = array(
157
-         'Monday'=> 'Lunes',
158
-         'Tuesday'=> 'Martes',
159
-         'Wednesday'=> 'Miércoles',
160
-         'Thursday'=> 'Jueves',
161
-         'Friday'=> 'Viernes',
162
-         'Saturday'=> 'Sábado',
163
-         'Sunday'=> 'Domingo',
164
-         'January'=> 'Enero',
165
-         'February'=> 'Febrero',
166
-         'March'=> 'Marzo',
167
-         'April'=> 'Abril',
168
-         'May'=> 'Mayo',
169
-         'June'=> 'Junio',
170
-         'July'=> 'Julio',
171
-         'August'=> 'Agosto',
172
-         'September'=> 'Septiembre',
173
-         'October'=> 'Octubre',
174
-         'November'=> 'Noviembre',
175
-         'December'=> 'Diciembre',
176
-         'Mon'=> 'Lun',
177
-         'Tue'=> 'Mar',
178
-         'Wed'=> 'Mie',
179
-         'Thu'=> 'Jue',
180
-         'Fri'=> 'Vie',
181
-         'Sat'=> 'Sab',
182
-         'Sun'=> 'Dom',
183
-         'Jan'=> 'Ene',
184
-         'Aug'=> 'Ago',
185
-         'Apr'=> 'Abr',
186
-         'Dec'=> 'Dic'
157
+          'Monday'=> 'Lunes',
158
+          'Tuesday'=> 'Martes',
159
+          'Wednesday'=> 'Miércoles',
160
+          'Thursday'=> 'Jueves',
161
+          'Friday'=> 'Viernes',
162
+          'Saturday'=> 'Sábado',
163
+          'Sunday'=> 'Domingo',
164
+          'January'=> 'Enero',
165
+          'February'=> 'Febrero',
166
+          'March'=> 'Marzo',
167
+          'April'=> 'Abril',
168
+          'May'=> 'Mayo',
169
+          'June'=> 'Junio',
170
+          'July'=> 'Julio',
171
+          'August'=> 'Agosto',
172
+          'September'=> 'Septiembre',
173
+          'October'=> 'Octubre',
174
+          'November'=> 'Noviembre',
175
+          'December'=> 'Diciembre',
176
+          'Mon'=> 'Lun',
177
+          'Tue'=> 'Mar',
178
+          'Wed'=> 'Mie',
179
+          'Thu'=> 'Jue',
180
+          'Fri'=> 'Vie',
181
+          'Sat'=> 'Sab',
182
+          'Sun'=> 'Dom',
183
+          'Jan'=> 'Ene',
184
+          'Aug'=> 'Ago',
185
+          'Apr'=> 'Abr',
186
+          'Dec'=> 'Dic'
187 187
     );
188 188
     return str_replace(array_keys($cambios), array_values($cambios), $date);
189 189
   }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
    *  Se adapta a la configuración del dominio en general.
194 194
    *
195 195
    * @return string <base href="ruta" />
196
-  */
196
+   */
197 197
   public static function base_assets() : string {
198 198
     global $config, $http;
199 199
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
    * @param int $anio: Año (1975 a 2xxx)
232 232
    *
233 233
    * @return string con el número del día
234
-  */
234
+   */
235 235
   public static function last_day_month(int $mes, int $anio) : string {
236 236
     return date('d', (mktime(0,0,0,$mes + 1, 1, $anio) - 1));
237 237
   }
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 
291 291
     # Arreglo de condiciones y subcondiciones
292 292
     $fecha = array(
293
-       1 => date('d/m/Y', time()),
294
-       2 => date('d/m/Y', time() - (60*60*24)),
295
-       3 => array(
296
-         'Mon' => $hoy[0],
297
-         'Tue' => intval($hoy[0]) - 1,
298
-         'Wed' => intval($hoy[0]) - 2,
299
-         'Thu' => intval($hoy[0]) - 3,
300
-         'Fri' => intval($hoy[0]) - 4,
301
-         'Sat' => intval($hoy[0]) - 5,
302
-         'Sun' => intval($hoy[0]) - 6
303
-       ),
304
-       4 => '01/'. self::cero_izq($hoy[1]) .'/' . $hoy[2],
305
-       5 => '01/01/' . $hoy[2]
293
+        1 => date('d/m/Y', time()),
294
+        2 => date('d/m/Y', time() - (60*60*24)),
295
+        3 => array(
296
+          'Mon' => $hoy[0],
297
+          'Tue' => intval($hoy[0]) - 1,
298
+          'Wed' => intval($hoy[0]) - 2,
299
+          'Thu' => intval($hoy[0]) - 3,
300
+          'Fri' => intval($hoy[0]) - 4,
301
+          'Sat' => intval($hoy[0]) - 5,
302
+          'Sun' => intval($hoy[0]) - 6
303
+        ),
304
+        4 => '01/'. self::cero_izq($hoy[1]) .'/' . $hoy[2],
305
+        5 => '01/01/' . $hoy[2]
306 306
     );
307 307
 
308 308
     if($desde == 3) {
@@ -347,22 +347,22 @@  discard block
 block discarded – undo
347 347
    */
348 348
   public function getFunctions() : array {
349 349
     return array(
350
-       new \Twig_Function('percent', array($this, 'percent')),
351
-       new \Twig_Function('convert', array($this, 'convert')),
352
-       new \Twig_Function('get_gravatar', array($this, 'get_gravatar')),
353
-       new \Twig_Function('emp', array($this, 'emp')),
354
-       new \Twig_Function('e_dynamic', array($this, 'e')),
355
-       new \Twig_Function('all_full', array($this, 'all_full')),
356
-       new \Twig_Function('fecha', array($this, 'fecha')),
357
-       new \Twig_Function('base_assets', array($this, 'base_assets')),
358
-       new \Twig_Function('timestamp', array($this, 'timestamp')),
359
-       new \Twig_Function('desde_date', array($this, 'desde_date')),
360
-       new \Twig_Function('cero_izq', array($this, 'cero_izq')),
361
-       new \Twig_Function('last_day_month', array($this, 'last_day_month')),
362
-       new \Twig_Function('str_to_time', array($this, 'str_to_time')),
363
-       new \Twig_Function('desde_date', array($this, 'desde_date'))
350
+        new \Twig_Function('percent', array($this, 'percent')),
351
+        new \Twig_Function('convert', array($this, 'convert')),
352
+        new \Twig_Function('get_gravatar', array($this, 'get_gravatar')),
353
+        new \Twig_Function('emp', array($this, 'emp')),
354
+        new \Twig_Function('e_dynamic', array($this, 'e')),
355
+        new \Twig_Function('all_full', array($this, 'all_full')),
356
+        new \Twig_Function('fecha', array($this, 'fecha')),
357
+        new \Twig_Function('base_assets', array($this, 'base_assets')),
358
+        new \Twig_Function('timestamp', array($this, 'timestamp')),
359
+        new \Twig_Function('desde_date', array($this, 'desde_date')),
360
+        new \Twig_Function('cero_izq', array($this, 'cero_izq')),
361
+        new \Twig_Function('last_day_month', array($this, 'last_day_month')),
362
+        new \Twig_Function('str_to_time', array($this, 'str_to_time')),
363
+        new \Twig_Function('desde_date', array($this, 'desde_date'))
364 364
     );
365
-   }
365
+    }
366 366
 
367 367
   /**
368 368
    * Identificador único para la extensión de twig
Please login to merge, or discard this patch.
Ocrend/Kernel/Helpers/Strings.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
    * @param int|null $to: Tiempo en segundo hasta donde se desea contar, si no se pasa por defecto es el tiempo actual
27 27
    *
28 28
    * @return string con la forma: hace 20 segundos, hace 1 minuto, hace 2 horas, hace 4 días, hace 1 semana, hace 3 meses, hace 1 año ...
29
-  */
29
+   */
30 30
   public static function amigable_time(int $from, $to = null) : string {   
31 31
     $intervalos = ['segundo', 'minuto', 'hora', 'día', 'semana', 'mes', 'año'];
32 32
     $duraciones = ['60','60','24','7','4.35','12'];
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
    * @example Strings::chash('$2a$10$87b2b603324793cc37f8dOPFTnHRY0lviq5filK5cN4aMCQDJcC9G','123456'); //return true
63 63
    *
64 64
    * @return bool true si $s2 contiene la misma llave que $hash, por tanto el contenido de $hash es $s2, de lo contrario false
65
-  */
65
+   */
66 66
   public static function chash(string $hash, string $s2) : bool  {
67 67
     return $hash == crypt($s2, substr($hash, 0, 29));
68 68
   }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
   }
178 178
 
179 179
   /**
180
-    * Remueve todos los espacios en blanco de un string
181
-    *
182
-    * @param string $s: Cadena de texto a convertir
183
-    *
184
-    * @return string del texto sin espacios
185
-  */
180
+   * Remueve todos los espacios en blanco de un string
181
+   *
182
+   * @param string $s: Cadena de texto a convertir
183
+   *
184
+   * @return string del texto sin espacios
185
+   */
186 186
   public static function remove_spaces(string $s) : string {
187 187
     return trim(str_replace(' ', '', $s));
188 188
   }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
    * @param string $s: Cadena de texto a verificar
194 194
    *
195 195
    * @return bool, verdadero si es alfanumerica, falso si no
196
-  */
196
+   */
197 197
   public static function alphanumeric(string $s) : bool {
198 198
     return ctype_alnum(self::remove_spaces($s));
199 199
   }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
    * @param string $s: Cadena de texto a verificar
206 206
    *
207 207
    * @return bool, verdadero si sólamente tiene letras, falso si no
208
-  */
208
+   */
209 209
   public static function only_letters(string $s) : bool {
210 210
     return ctype_alpha(self::remove_spaces($s));
211 211
   }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
    * @param string $url: Cadena de texto a convertir
230 230
    *
231 231
    * @return string Cadena de texto con formato de url amigable
232
-  */
232
+   */
233 233
   public static function url_amigable(string $url) : string {
234 234
     $url = str_replace(['á', 'é', 'í', 'ó', 'ú', 'ñ'], ['a', 'e', 'i', 'o', 'u', 'n'], $url);
235 235
     $url = str_replace([' ', '&', '\r\n', '\n', '+', '%'], '-', $url);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
    * Identificador único para la extensión de twig
370 370
    *
371 371
    * @return string Nombre de la extensión
372
-  */
372
+   */
373 373
   public function getName() : string {
374 374
     return 'ocrend_framework_helper_strings';
375 375
   }
Please login to merge, or discard this patch.