@@ -140,17 +140,17 @@ |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Permite Obtener el Agente de Usuario (User Agent) |
|
| 144 | - * @return String |
|
| 145 | - */ |
|
| 143 | + * Permite Obtener el Agente de Usuario (User Agent) |
|
| 144 | + * @return String |
|
| 145 | + */ |
|
| 146 | 146 | public static function userAgent(){ |
| 147 | 147 | return $_SERVER['HTTP_USER_AGENT']; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | - * Permite obtene la IP del cliente, aún cuando usa proxy |
|
| 152 | - * @return String |
|
| 153 | - */ |
|
| 151 | + * Permite obtene la IP del cliente, aún cuando usa proxy |
|
| 152 | + * @return String |
|
| 153 | + */ |
|
| 154 | 154 | public static function ip(){ |
| 155 | 155 | if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
| 156 | 156 | return $_SERVER['HTTP_CLIENT_IP']; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function is($method = '') |
| 31 | 31 | { |
| 32 | - if($method){ |
|
| 32 | + if ($method) { |
|
| 33 | 33 | return $method == $_SERVER['REQUEST_METHOD']; |
| 34 | 34 | } |
| 35 | 35 | return $_SERVER['REQUEST_METHOD']; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public static function hasPost($var) |
| 101 | 101 | { |
| 102 | - return (bool)self::post($var); |
|
| 102 | + return (bool) self::post($var); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public static function hasGet($var) |
| 112 | 112 | { |
| 113 | - return (bool)self::get($var); |
|
| 113 | + return (bool) self::get($var); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public static function hasRequest($var) |
| 123 | 123 | { |
| 124 | - return (bool)self::request($var); |
|
| 124 | + return (bool) self::request($var); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public static function delete($var = '') |
| 134 | 134 | { |
| 135 | - if($var){ |
|
| 135 | + if ($var) { |
|
| 136 | 136 | $_POST[$var] = array(); |
| 137 | 137 | } else { |
| 138 | 138 | $_POST = array(); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * Permite Obtener el Agente de Usuario (User Agent) |
| 144 | 144 | * @return String |
| 145 | 145 | */ |
| 146 | - public static function userAgent(){ |
|
| 146 | + public static function userAgent() { |
|
| 147 | 147 | return $_SERVER['HTTP_USER_AGENT']; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | * Permite obtene la IP del cliente, aún cuando usa proxy |
| 152 | 152 | * @return String |
| 153 | 153 | */ |
| 154 | - public static function ip(){ |
|
| 155 | - if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
|
| 154 | + public static function ip() { |
|
| 155 | + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 156 | 156 | return $_SERVER['HTTP_CLIENT_IP']; |
| 157 | - }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
|
| 157 | + }elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 158 | 158 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 159 | - }else{ |
|
| 159 | + } else { |
|
| 160 | 160 | return $_SERVER['REMOTE_ADDR']; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -180,20 +180,20 @@ discard block |
||
| 180 | 180 | * @param string $str clave a usar |
| 181 | 181 | * @return mixed |
| 182 | 182 | */ |
| 183 | - protected static function getFilter(Array $var, $str){ |
|
| 184 | - if(empty($str)) |
|
| 183 | + protected static function getFilter(Array $var, $str) { |
|
| 184 | + if (empty($str)) |
|
| 185 | 185 | return filter_var_array($var); |
| 186 | 186 | $arr = explode('.', $str); |
| 187 | 187 | $value = $var; |
| 188 | 188 | foreach ($arr as $key) { |
| 189 | - if(isset($value[$key])){ |
|
| 189 | + if (isset($value[$key])) { |
|
| 190 | 190 | $value = $value[$key]; |
| 191 | - } else{ |
|
| 191 | + } else { |
|
| 192 | 192 | $value = NULL; |
| 193 | 193 | break; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - return is_array($value)?filter_var_array($value): filter_var($value); |
|
| 196 | + return is_array($value) ? filter_var_array($value) : filter_var($value); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | } |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | public static function ip(){ |
| 155 | 155 | if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
| 156 | 156 | return $_SERVER['HTTP_CLIENT_IP']; |
| 157 | - }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
|
| 157 | + } elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
|
| 158 | 158 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 159 | - }else{ |
|
| 159 | + } else{ |
|
| 160 | 160 | return $_SERVER['REMOTE_ADDR']; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -181,8 +181,9 @@ discard block |
||
| 181 | 181 | * @return mixed |
| 182 | 182 | */ |
| 183 | 183 | protected static function getFilter(Array $var, $str){ |
| 184 | - if(empty($str)) |
|
| 185 | - return filter_var_array($var); |
|
| 184 | + if(empty($str)) { |
|
| 185 | + return filter_var_array($var); |
|
| 186 | + } |
|
| 186 | 187 | $arr = explode('.', $str); |
| 187 | 188 | $value = $var; |
| 188 | 189 | foreach ($arr as $key) { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param string $group |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function get($id, $group='default') |
|
| 65 | + public function get($id, $group = 'default') |
|
| 66 | 66 | { |
| 67 | 67 | $this->_id = $id; |
| 68 | 68 | $this->_group = $group; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param int $lifetime tiempo de vida en forma timestamp de unix |
| 88 | 88 | * @return boolean |
| 89 | 89 | */ |
| 90 | - public function save($value, $lifetime='', $id='', $group='default') |
|
| 90 | + public function save($value, $lifetime = '', $id = '', $group = 'default') |
|
| 91 | 91 | { |
| 92 | 92 | if (!$id) { |
| 93 | 93 | $id = $this->_id; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string $group |
| 123 | 123 | * @return boolean |
| 124 | 124 | */ |
| 125 | - public function clean($group='') |
|
| 125 | + public function clean($group = '') |
|
| 126 | 126 | { |
| 127 | 127 | if ($group) { |
| 128 | 128 | $group = addslashes($group); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $group |
| 139 | 139 | * @return boolean |
| 140 | 140 | */ |
| 141 | - public function remove($id, $group='default') |
|
| 141 | + public function remove($id, $group = 'default') |
|
| 142 | 142 | { |
| 143 | 143 | $id = addslashes($id); |
| 144 | 144 | $group = addslashes($group); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $group |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - public function get($id, $group='default') |
|
| 51 | + public function get($id, $group = 'default') |
|
| 52 | 52 | { |
| 53 | 53 | $this->_id = $id; |
| 54 | 54 | $this->_group = $group; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param int $lifetime tiempo de vida en forma timestamp de unix |
| 79 | 79 | * @return bool |
| 80 | 80 | */ |
| 81 | - public function save($value, $lifetime='', $id='', $group='default') |
|
| 81 | + public function save($value, $lifetime = '', $id = '', $group = 'default') |
|
| 82 | 82 | { |
| 83 | 83 | if (!$id) { |
| 84 | 84 | $id = $this->_id; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $group |
| 101 | 101 | * @return boolean |
| 102 | 102 | */ |
| 103 | - public function clean($group='') |
|
| 103 | + public function clean($group = '') |
|
| 104 | 104 | { |
| 105 | 105 | $pattern = $group ? APP_PATH . 'temp/cache/' . '*.' . md5($group) : APP_PATH . 'temp/cache/*'; |
| 106 | 106 | foreach (glob($pattern) as $filename) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $group |
| 119 | 119 | * @return bool |
| 120 | 120 | */ |
| 121 | - public function remove($id, $group='default') |
|
| 121 | + public function remove($id, $group = 'default') |
|
| 122 | 122 | { |
| 123 | 123 | return unlink(APP_PATH . 'temp/cache/' . $this->_getFilename($id, $group)); |
| 124 | 124 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param string $group |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - public function get($id, $group='default') |
|
| 39 | + public function get($id, $group = 'default') |
|
| 40 | 40 | { |
| 41 | 41 | $this->_id = $id; |
| 42 | 42 | $this->_group = $group; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param string $group No se usa con APC |
| 79 | 79 | * @return boolean |
| 80 | 80 | */ |
| 81 | - public function clean($group=false) |
|
| 81 | + public function clean($group = false) |
|
| 82 | 82 | { |
| 83 | 83 | return apc_clear_cache('user'); |
| 84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string $group |
| 91 | 91 | * @return boolean |
| 92 | 92 | */ |
| 93 | - public function remove($id, $group='default') |
|
| 93 | + public function remove($id, $group = 'default') |
|
| 94 | 94 | { |
| 95 | 95 | return apc_delete("$id.$group"); |
| 96 | 96 | } |
@@ -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); |