@@ -82,7 +82,7 @@ |
||
82 | 82 | public static function memory_usage($name) |
83 | 83 | { |
84 | 84 | if (self::$_benchmark[$name]) { |
85 | - self::$_benchmark[$name]['memory_usage'] = number_format((self::$_benchmark[$name]['memory_stop'] - self::$_benchmark[$name]['memory_start']) / 1048576, 2); |
|
85 | + self::$_benchmark[$name]['memory_usage'] = number_format((self::$_benchmark[$name]['memory_stop'] - self::$_benchmark[$name]['memory_start'])/1048576, 2); |
|
86 | 86 | return self::$_benchmark[$name]['memory_usage']; |
87 | 87 | } |
88 | 88 | throw new KumbiaException("No existe el Benchmark para el nombre: '$name', especificado"); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $namespace |
53 | 53 | * @return mixed |
54 | 54 | */ |
55 | - public static function get($index, $namespace='default') |
|
55 | + public static function get($index, $namespace = 'default') |
|
56 | 56 | { |
57 | 57 | if (isset($_SESSION[SESSION][APP_PATH][$namespace][$index])) { |
58 | 58 | return $_SESSION[SESSION][APP_PATH][$namespace][$index]; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string $index |
66 | 66 | * @param string $namespace |
67 | 67 | */ |
68 | - public static function delete($index, $namespace='default') |
|
68 | + public static function delete($index, $namespace = 'default') |
|
69 | 69 | { |
70 | 70 | unset($_SESSION[SESSION][APP_PATH][$namespace][$index]); |
71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param string $namespace |
78 | 78 | * @return boolean |
79 | 79 | */ |
80 | - public static function has($index, $namespace='default') |
|
80 | + public static function has($index, $namespace = 'default') |
|
81 | 81 | { |
82 | 82 | return isset($_SESSION[SESSION][APP_PATH][$namespace][$index]); |
83 | 83 | } |
@@ -34,8 +34,9 @@ |
||
34 | 34 | */ |
35 | 35 | public static function mkdir($path) |
36 | 36 | { |
37 | - if (file_exists($path) || @mkdir($path)) |
|
38 | - return TRUE; |
|
37 | + if (file_exists($path) || @mkdir($path)) { |
|
38 | + return TRUE; |
|
39 | + } |
|
39 | 40 | return (self::mkdir(dirname($path)) && mkdir($path)); |
40 | 41 | } |
41 | 42 |
@@ -30,37 +30,37 @@ |
||
30 | 30 | |
31 | 31 | public function testShowTypeTest() |
32 | 32 | { |
33 | - $this->expectOutputString('<div class="test flash">Test Content</div>'.PHP_EOL); |
|
33 | + $this->expectOutputString('<div class="test flash">Test Content</div>' . PHP_EOL); |
|
34 | 34 | Flash::show('test', 'Test Content'); |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function testShowTypeSuccess() |
38 | 38 | { |
39 | - $this->expectOutputString('<div class="success flash">Test Content</div>'.PHP_EOL); |
|
39 | + $this->expectOutputString('<div class="success flash">Test Content</div>' . PHP_EOL); |
|
40 | 40 | Flash::show('success', 'Test Content'); |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function testValid() |
44 | 44 | { |
45 | - $this->expectOutputString('<div class="valid flash">Test content for valid</div>'.PHP_EOL); |
|
45 | + $this->expectOutputString('<div class="valid flash">Test content for valid</div>' . PHP_EOL); |
|
46 | 46 | Flash::valid('Test content for valid'); |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testError() |
50 | 50 | { |
51 | - $this->expectOutputString('<div class="error flash">Test content for error</div>'.PHP_EOL); |
|
51 | + $this->expectOutputString('<div class="error flash">Test content for error</div>' . PHP_EOL); |
|
52 | 52 | Flash::error('Test content for error'); |
53 | 53 | } |
54 | 54 | |
55 | 55 | public function testInfo() |
56 | 56 | { |
57 | - $this->expectOutputString('<div class="info flash">Test content for info</div>'.PHP_EOL); |
|
57 | + $this->expectOutputString('<div class="info flash">Test content for info</div>' . PHP_EOL); |
|
58 | 58 | Flash::info('Test content for info'); |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function testWarning() |
62 | 62 | { |
63 | - $this->expectOutputString('<div class="warning flash">Test content for warning</div>'.PHP_EOL); |
|
63 | + $this->expectOutputString('<div class="warning flash">Test content for warning</div>' . PHP_EOL); |
|
64 | 64 | Flash::warning('Test content for warning'); |
65 | 65 | } |
66 | 66 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $scriptPattern = '<script type="text/javascript" src="%sjavascript/%s"></script>'; |
41 | 41 | $response = Tag::js($file); |
42 | - $expected = sprintf($scriptPattern, PUBLIC_PATH, $file.'.js'); |
|
42 | + $expected = sprintf($scriptPattern, PUBLIC_PATH, $file . '.js'); |
|
43 | 43 | |
44 | 44 | $this->assertSame($expected, $response); |
45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $scriptPattern = '<script type="text/javascript" src="%sjavascript/%s?nocache='; |
53 | 53 | |
54 | 54 | $response = Tag::js($file, false); |
55 | - $expected = sprintf($scriptPattern, PUBLIC_PATH, $file.'.js'); |
|
55 | + $expected = sprintf($scriptPattern, PUBLIC_PATH, $file . '.js'); |
|
56 | 56 | |
57 | 57 | $this->assertStringStartsWith($expected, $response); |
58 | 58 | $this->assertStringEndsWith('"></script>', $response); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | defined('APP_PATH') || define('APP_PATH', __DIR__ . '/'); |
25 | 25 | defined('PUBLIC_PATH') || define('PUBLIC_PATH', 'http://127.0.0.1/'); |
26 | 26 | |
27 | -require_once CORE_PATH.'kumbia/autoload.php'; |
|
28 | -require_once __DIR__.'/../../vendor/autoload.php'; |
|
27 | +require_once CORE_PATH . 'kumbia/autoload.php'; |
|
28 | +require_once __DIR__ . '/../../vendor/autoload.php'; |
|
29 | 29 | |
30 | 30 | spl_autoload_register('kumbia_autoload_helper', true, true); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | try { |
128 | 128 | $reflectionMethod = new ReflectionMethod($cont, $cont->action_name); |
129 | 129 | } catch (ReflectionException $e) { |
130 | - throw new KumbiaException($cont->action_name, 'no_action');//TODO: enviar a un método del controller |
|
130 | + throw new KumbiaException($cont->action_name, 'no_action'); //TODO: enviar a un método del controller |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | //k_callback y __constructor metodo reservado |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | try { |
147 | 147 | $reflectionMethod->invokeArgs($cont, $cont->parameters); |
148 | 148 | } catch (ReflectionException $e) { |
149 | - throw new KumbiaException(null, 'no_action');//TODO: mejor no_public |
|
149 | + throw new KumbiaException(null, 'no_action'); //TODO: mejor no_public |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | //Corre los filtros after y finalize |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return boolean En producción y cache de view |
163 | 163 | */ |
164 | - public static function cache($time, $type='view', $group='kumbia.view') |
|
164 | + public static function cache($time, $type = 'view', $group = 'kumbia.view') |
|
165 | 165 | { |
166 | 166 | if ($time === FALSE) { //TODO borrar cache |
167 | 167 | self::$_cache['type'] = FALSE; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $file = APP_PATH . 'views/' . self::getPath(); |
200 | 200 | //Si no existe el view y es scaffold |
201 | 201 | if (!is_file($file) && ($scaffold = self::$_controller->scaffold)) { |
202 | - $file = APP_PATH . "views/_shared/scaffolds/$scaffold/".self::$_view.'.phtml'; |
|
202 | + $file = APP_PATH . "views/_shared/scaffolds/$scaffold/" . self::$_view . '.phtml'; |
|
203 | 203 | } |
204 | 204 | return $file; |
205 | 205 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @return string |
310 | 310 | * @throw KumbiaException |
311 | 311 | */ |
312 | - public static function partial($partial, $__time='', $params=NULL, $group ='kumbia.partials') |
|
312 | + public static function partial($partial, $__time = '', $params = NULL, $group = 'kumbia.partials') |
|
313 | 313 | { |
314 | 314 | if (PRODUCTION && $__time && !Cache::driver()->start($__time, $partial, $group)) { |
315 | 315 | return; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $__file = CORE_PATH . "views/partials/$partial.phtml"; |
324 | 324 | } |
325 | 325 | |
326 | - if($params){ |
|
326 | + if ($params) { |
|
327 | 327 | if (is_string($params)) { |
328 | 328 | $params = Util::getParams(explode(',', $params)); |
329 | 329 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public static function getVar($var = '') |
353 | 353 | { |
354 | - if(!$var) return get_object_vars(self::$_controller); |
|
354 | + if (!$var) return get_object_vars(self::$_controller); |
|
355 | 355 | |
356 | 356 | return isset(self::$_controller->$var) ? self::$_controller->$var : NULL; |
357 | 357 | } |
@@ -136,8 +136,9 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public static function getPath() |
138 | 138 | { |
139 | - if (self::$_response) |
|
140 | - return self::$_path . self::$_view . '.' . self::$_response . '.phtml'; |
|
139 | + if (self::$_response) { |
|
140 | + return self::$_path . self::$_view . '.' . self::$_response . '.phtml'; |
|
141 | + } |
|
141 | 142 | |
142 | 143 | return self::$_path . self::$_view . '.phtml'; |
143 | 144 | } |
@@ -224,8 +225,9 @@ discard block |
||
224 | 225 | */ |
225 | 226 | public static function render(Controller $controller) |
226 | 227 | { |
227 | - if (!self::$_view && !self::$_template) |
|
228 | - return ob_end_flush(); |
|
228 | + if (!self::$_view && !self::$_template) { |
|
229 | + return ob_end_flush(); |
|
230 | + } |
|
229 | 231 | |
230 | 232 | // Guarda el controlador |
231 | 233 | self::$_controller = $controller; |
@@ -253,8 +255,9 @@ discard block |
||
253 | 255 | ob_start(); |
254 | 256 | |
255 | 257 | // carga la vista |
256 | - if (!include self::getView()) |
|
257 | - throw new KumbiaException('Vista "' . self::getPath() . '" no encontrada', 'no_view'); |
|
258 | + if (!include self::getView()) { |
|
259 | + throw new KumbiaException('Vista "' . self::getPath() . '" no encontrada', 'no_view'); |
|
260 | + } |
|
258 | 261 | |
259 | 262 | // si esta en produccion y se cachea la vista |
260 | 263 | self::saveCache('view'); |
@@ -274,8 +277,9 @@ discard block |
||
274 | 277 | ob_start(); |
275 | 278 | |
276 | 279 | // carga el template |
277 | - if (!include APP_PATH . "views/_shared/templates/$__template.phtml") |
|
278 | - throw new KumbiaException("Template $__template no encontrado"); |
|
280 | + if (!include APP_PATH . "views/_shared/templates/$__template.phtml") { |
|
281 | + throw new KumbiaException("Template $__template no encontrado"); |
|
282 | + } |
|
279 | 283 | |
280 | 284 | // si esta en produccion y se cachea template |
281 | 285 | self::saveCache('template'); |
@@ -351,7 +355,9 @@ discard block |
||
351 | 355 | */ |
352 | 356 | public static function getVar($var = '') |
353 | 357 | { |
354 | - if(!$var) return get_object_vars(self::$_controller); |
|
358 | + if(!$var) { |
|
359 | + return get_object_vars(self::$_controller); |
|
360 | + } |
|
355 | 361 | |
356 | 362 | return isset(self::$_controller->$var) ? self::$_controller->$var : NULL; |
357 | 363 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if (!class_exists($Model, FALSE)) { |
77 | 77 | //Carga la clase |
78 | 78 | if (!include APP_PATH . "models/$model.php") { |
79 | - throw new KumbiaException($model,'no_model'); |
|
79 | + throw new KumbiaException($model, 'no_model'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return new $Model($params); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | //Si esta cargada continua con la siguiente clase |
97 | 97 | if (class_exists($Model, FALSE)) continue; |
98 | 98 | if (!include APP_PATH . "models/$model.php") { |
99 | - throw new KumbiaException($model,'no_model'); |
|
99 | + throw new KumbiaException($model, 'no_model'); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -94,7 +94,9 @@ |
||
94 | 94 | foreach ($args as $model) { |
95 | 95 | $Model = Util::camelcase(basename($model)); |
96 | 96 | //Si esta cargada continua con la siguiente clase |
97 | - if (class_exists($Model, FALSE)) continue; |
|
97 | + if (class_exists($Model, FALSE)) { |
|
98 | + continue; |
|
99 | + } |
|
98 | 100 | if (!include APP_PATH . "models/$model.php") { |
99 | 101 | throw new KumbiaException($model,'no_model'); |
100 | 102 | } |