@@ -88,14 +88,14 @@ |
||
88 | 88 | */ |
89 | 89 | public function load(): Config |
90 | 90 | { |
91 | - $this->encryption = (bool)config($this->configName . '.encryption', $this->encryption); |
|
92 | - $this->autoClear = (bool)config($this->configName . '.auto_clear', $this->autoClear); |
|
91 | + $this->encryption = (bool) config($this->configName . '.encryption', $this->encryption); |
|
92 | + $this->autoClear = (bool) config($this->configName . '.auto_clear', $this->autoClear); |
|
93 | 93 | $this->autoClearPause = intval(config($this->configName . '.auto_clear_pause', $this->autoClearPause)); |
94 | - $this->repository_global = (string)config($this->configName . '.repository_global', $this->repository_global); |
|
95 | - $this->repository_access = (string)config($this->configName . '.repository_global', $this->repository_access); |
|
96 | - $this->lastUse = (bool)config($this->configName . '.last_use', $this->lastUse); |
|
97 | - $this->jwt = (bool)config($this->configName . '.jwt', $this->jwt); |
|
98 | - $this->salt = (string)config($this->configName . '.salt', $this->salt); |
|
94 | + $this->repository_global = (string) config($this->configName . '.repository_global', $this->repository_global); |
|
95 | + $this->repository_access = (string) config($this->configName . '.repository_global', $this->repository_access); |
|
96 | + $this->lastUse = (bool) config($this->configName . '.last_use', $this->lastUse); |
|
97 | + $this->jwt = (bool) config($this->configName . '.jwt', $this->jwt); |
|
98 | + $this->salt = (string) config($this->configName . '.salt', $this->salt); |
|
99 | 99 | $this->salt = file_exists($this->salt) ? file_get_contents($this->salt) : $this->salt; |
100 | 100 | return $this; |
101 | 101 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function register() |
61 | 61 | { |
62 | - $this->app->singleton(Config::class, function () { |
|
62 | + $this->app->singleton(Config::class, function() { |
|
63 | 63 | return new Config; |
64 | 64 | }); |
65 | 65 | $this->app->bind( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | GlobalTokenRepositoryInterface::class, |
71 | 71 | app(Config::class)->getRepositoryGlobalToken() |
72 | 72 | ); |
73 | - $this->app->singleton(TokenManager::class, function () { |
|
73 | + $this->app->singleton(TokenManager::class, function() { |
|
74 | 74 | return new TokenManager( |
75 | 75 | app(Config::class), |
76 | 76 | app(AccessTokenRepositoryInterface::class), |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function deleteGlobalTokenById(int $token_id): bool |
44 | 44 | { |
45 | - return (bool)GlobalToken::where('id', $token_id)->delete(); |
|
45 | + return (bool) GlobalToken::where('id', $token_id)->delete(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function deleteGlobalToken(string $token): bool |
56 | 56 | { |
57 | - return (bool)GlobalToken::where('token', $token)->delete(); |
|
57 | + return (bool) GlobalToken::where('token', $token)->delete(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function deactivationGlobalTokenById(int $token_id): bool |
79 | 79 | { |
80 | - return (bool)GlobalToken::where('id', $token_id)->update([ |
|
80 | + return (bool) GlobalToken::where('id', $token_id)->update([ |
|
81 | 81 | 'expiration' => Carbon::now()->subMinutes(), |
82 | 82 | ]); |
83 | 83 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function deactivationGlobalToken(string $token): bool |
93 | 93 | { |
94 | - return (bool)GlobalToken::where('token', $token)->update([ |
|
94 | + return (bool) GlobalToken::where('token', $token)->update([ |
|
95 | 95 | 'expiration' => Carbon::now()->subMinutes(), |
96 | 96 | ]); |
97 | 97 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function prolongationGlobalTokenById(int $token_id, ?DateTime $expiration = null): bool |
108 | 108 | { |
109 | - return (bool)GlobalToken::where('id', $token_id)->update(['expiration' => $expiration]); |
|
109 | + return (bool) GlobalToken::where('id', $token_id)->update(['expiration' => $expiration]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function prolongationGlobalToken(string $token, ?DateTime $expiration = null): bool |
121 | 121 | { |
122 | - return (bool)GlobalToken::where('token', $token)->update(['expiration' => $expiration]); |
|
122 | + return (bool) GlobalToken::where('token', $token)->update(['expiration' => $expiration]); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setLastUseGlobalToken(int $token_id): bool |
157 | 157 | { |
158 | - return (bool)GlobalToken::where('id', $token_id)->update([ |
|
158 | + return (bool) GlobalToken::where('id', $token_id)->update([ |
|
159 | 159 | 'last_use' => Carbon::now()->subMinutes(), |
160 | 160 | ]); |
161 | 161 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function deleteAccessTokenById(int $token_id): bool |
52 | 52 | { |
53 | - return (bool)AccessToken::where('id', $token_id)->delete(); |
|
53 | + return (bool) AccessToken::where('id', $token_id)->delete(); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function deleteAccessToken(string $token): bool |
64 | 64 | { |
65 | - return (bool)AccessToken::where('token', $token)->delete(); |
|
65 | + return (bool) AccessToken::where('token', $token)->delete(); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function deleteAccessTokenByUser(int $user_id, string $user_type): bool |
77 | 77 | { |
78 | - return (bool)AccessToken::where('user_id', $user_id)->where('user_type', $user_type)->delete(); |
|
78 | + return (bool) AccessToken::where('user_id', $user_id)->where('user_type', $user_type)->delete(); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function deactivationAccessTokenById(int $token_id): bool |
100 | 100 | { |
101 | - return (bool)AccessToken::where('id', $token_id)->update([ |
|
101 | + return (bool) AccessToken::where('id', $token_id)->update([ |
|
102 | 102 | 'expiration' => Carbon::now()->subMinutes(), |
103 | 103 | ]); |
104 | 104 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function deactivationAccessToken(string $token): bool |
114 | 114 | { |
115 | - return (bool)AccessToken::where('token', $token)->update([ |
|
115 | + return (bool) AccessToken::where('token', $token)->update([ |
|
116 | 116 | 'expiration' => Carbon::now()->subMinutes(), |
117 | 117 | ]); |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function deactivationAccessTokenByUser(int $user_id, string $user_type): bool |
129 | 129 | { |
130 | - return (bool)AccessToken::where('user_id', $user_id) |
|
130 | + return (bool) AccessToken::where('user_id', $user_id) |
|
131 | 131 | ->where('user_type', $user_type) |
132 | 132 | ->update([ |
133 | 133 | 'expiration' => Carbon::now()->subMinutes(), |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function prolongationAccessTokenById(int $token_id, ?DateTime $expiration = null): bool |
146 | 146 | { |
147 | - return (bool)AccessToken::where('id', $token_id)->update(['expiration' => $expiration]); |
|
147 | + return (bool) AccessToken::where('id', $token_id)->update(['expiration' => $expiration]); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function prolongationAccessToken(string $token, ?DateTime $expiration = null): bool |
159 | 159 | { |
160 | - return (bool)AccessToken::where('token', $token)->update(['expiration' => $expiration]); |
|
160 | + return (bool) AccessToken::where('token', $token)->update(['expiration' => $expiration]); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function prolongationAccessTokenByUser(int $user_id, string $user_type, ?DateTime $expiration = null): bool |
173 | 173 | { |
174 | - return (bool)AccessToken::where('user_id', $user_id) |
|
174 | + return (bool) AccessToken::where('user_id', $user_id) |
|
175 | 175 | ->where('user_type', $user_type) |
176 | 176 | ->update(['expiration' => $expiration]); |
177 | 177 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function setLastUseAccessToken(int $token_id): bool |
226 | 226 | { |
227 | - return (bool)AccessToken::where('id', $token_id)->update([ |
|
227 | + return (bool) AccessToken::where('id', $token_id)->update([ |
|
228 | 228 | 'last_use' => Carbon::now()->subMinutes(), |
229 | 229 | ]); |
230 | 230 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | return 1; |
74 | 74 | } |
75 | 75 | $date = is_null($expiration) ? 'навсегда' : 'до ' . $expiration->format('Y-m-d H:i:s'); |
76 | - $this->line('Персональный токен ' . $token->token . ' создан '. $date . '.'); |
|
76 | + $this->line('Персональный токен ' . $token->token . ' создан ' . $date . '.'); |
|
77 | 77 | return 1; |
78 | 78 | } |
79 | 79 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * manually detect large ints in the JSON string and quote them (thus converting |
79 | 79 | *them to strings) before decoding, hence the preg_replace() call. |
80 | 80 | */ |
81 | - $maxLength = \strlen((string)PHP_INT_MAX) - 1; |
|
81 | + $maxLength = \strlen((string) PHP_INT_MAX) - 1; |
|
82 | 82 | $withoutBigints = \preg_replace('/:\s*(-?\d{' . $maxLength . ',})/', ': "$1"', $input); |
83 | 83 | $obj = \json_decode($withoutBigints, true); |
84 | 84 | } |