@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | ksort($data); |
175 | 175 | |
176 | - if (true == $isId ) { |
|
176 | + if (true == $isId) { |
|
177 | 177 | ksort($data); |
178 | 178 | |
179 | 179 | $fielDetail = null; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | return $stmt->execute(); |
192 | - }else { |
|
193 | - $this->insert( $table , $data ); |
|
192 | + } else { |
|
193 | + $this->insert($table, $data); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -189,7 +189,7 @@ |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | return $stmt->execute(); |
192 | - }else { |
|
192 | + } else { |
|
193 | 193 | $this->insert( $table , $data ); |
194 | 194 | } |
195 | 195 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $foundRoute = true; |
309 | 309 | $this->runRouteMiddleware($data, 'before'); |
310 | 310 | array_shift($matched); |
311 | - $matched = array_map(function ($value) { |
|
311 | + $matched = array_map(function($value) { |
|
312 | 312 | return trim(urldecode($value)); |
313 | 313 | }, $matched); |
314 | 314 | $this->runRouteCommand($data['callback'], $matched); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | if ($foundRoute === false) { |
327 | 327 | if (!$this->errorCallback) { |
328 | - $this->errorCallback = function () { |
|
328 | + $this->errorCallback = function() { |
|
329 | 329 | $this->response() |
330 | 330 | ->setStatusCode(Response::HTTP_NOT_FOUND) |
331 | 331 | ->sendHeaders(); |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | $dirname = dirname($script); |
794 | 794 | $dirname = $dirname === '/' ? '' : $dirname; |
795 | 795 | $basename = basename($script); |
796 | - $uri = str_replace([$dirname, $basename],null, $this->request()->server->get('REQUEST_URI')); |
|
796 | + $uri = str_replace([$dirname, $basename], null, $this->request()->server->get('REQUEST_URI')); |
|
797 | 797 | return $this->clearRouteName(explode('?', $uri)[0]); |
798 | 798 | } |
799 | 799 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $id = session_id(); |
46 | - if (empty( $id )) { |
|
46 | + if (empty($id)) { |
|
47 | 47 | @session_start( |
48 | 48 | [ |
49 | - 'cookie_lifetime' => 86400 , |
|
49 | + 'cookie_lifetime' => 86400, |
|
50 | 50 | // 'read_and_close' => true, |
51 | 51 | ] |
52 | 52 | ); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function get($key) |
71 | 71 | { |
72 | - if(isset($_SESSION[$key])) { |
|
72 | + if (isset($_SESSION[$key])) { |
|
73 | 73 | return $_SESSION[$key]; |
74 | 74 | } |
75 | 75 | } |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | * @param $salt |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - public static function Create(string $algo , string $data , string $salt): string |
|
41 | + public static function Create(string $algo, string $data, string $salt): string |
|
42 | 42 | { |
43 | - $context = hash_init( $algo , HASH_HMAC , $salt ); |
|
44 | - hash_update( $context , $data ); |
|
45 | - return hash_final( $context ); |
|
43 | + $context = hash_init($algo, HASH_HMAC, $salt); |
|
44 | + hash_update($context, $data); |
|
45 | + return hash_final($context); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | - public static function simpleToken(int $length = 31 , $string = '') |
|
49 | + public static function simpleToken(int $length = 31, $string = '') |
|
50 | 50 | { |
51 | - $max = strlen( $string ) - 1; |
|
51 | + $max = strlen($string) - 1; |
|
52 | 52 | |
53 | 53 | $token = ''; |
54 | 54 | |
55 | 55 | for ($i = 0; $i < $length; $i++) { |
56 | - $token .= $string[random_int( 0 , $max )]; |
|
56 | + $token .= $string[random_int(0, $max)]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $token; |
@@ -63,35 +63,35 @@ discard block |
||
63 | 63 | * @param int $length lenght for tokon |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public static function token(int $length = 1 , $constant = SECURE_AUTH_SALT): string |
|
66 | + public static function token(int $length = 1, $constant = SECURE_AUTH_SALT): string |
|
67 | 67 | { |
68 | 68 | |
69 | 69 | $string = $constant; |
70 | 70 | |
71 | - $max = strlen( $string ) - 1; |
|
71 | + $max = strlen($string) - 1; |
|
72 | 72 | |
73 | 73 | $token = ''; |
74 | 74 | |
75 | - if (!intVal( $length )) { |
|
76 | - throw new InvalidArgumentException( 'tripleInteger function only accepts integers. Input was: ' . $length ); |
|
75 | + if (!intVal($length)) { |
|
76 | + throw new InvalidArgumentException('tripleInteger function only accepts integers. Input was: ' . $length); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | 80 | for ($i = 0; $i < $length; $i++) { |
81 | - $token .= self::Create( ALGO , uniqid( $string[random_int( 0 , $max )] ) , SECURE_AUTH_KEY ); |
|
81 | + $token .= self::Create(ALGO, uniqid($string[random_int(0, $max)]), SECURE_AUTH_KEY); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $token; |
85 | 85 | } |
86 | 86 | |
87 | - public static function hash_password($string , $const = PASSWORD_DEFAULT , $cust = null) |
|
87 | + public static function hash_password($string, $const = PASSWORD_DEFAULT, $cust = null) |
|
88 | 88 | { |
89 | 89 | |
90 | - if (!is_null( $cust )) { |
|
90 | + if (!is_null($cust)) { |
|
91 | 91 | |
92 | - return password_hash( $string , $const , ['cost' => $cust] ); |
|
92 | + return password_hash($string, $const, ['cost' => $cust]); |
|
93 | 93 | } |
94 | - return password_hash( $string , $const ); |
|
94 | + return password_hash($string, $const); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | * @param string $hash password |
102 | 102 | * @return bool |
103 | 103 | */ |
104 | - public static function verify_password(string $string , string $hash): bool |
|
104 | + public static function verify_password(string $string, string $hash): bool |
|
105 | 105 | { |
106 | 106 | |
107 | - if (password_verify( $string , $hash )) { |
|
107 | + if (password_verify($string, $hash)) { |
|
108 | 108 | return true; |
109 | 109 | |
110 | 110 | } else { |