@@ -141,7 +141,7 @@ |
||
141 | 141 | $user->setPassword($params['data']['attributes']['password']); |
142 | 142 | $user->removePasswordResetToken(); |
143 | 143 | |
144 | - if($user->save()){ |
|
144 | + if ($user->save()) { |
|
145 | 145 | return $this->renderer->jsonApiRender($response, 204); |
146 | 146 | }; |
147 | 147 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * Register model observers |
165 | 165 | */ |
166 | - private function registerModelObservers(){ |
|
166 | + private function registerModelObservers() { |
|
167 | 167 | $observers = [ |
168 | 168 | Observers\CreatedByAndUpdatedByObserver::class => [ |
169 | 169 | Model\Right::class, |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | ] |
179 | 179 | ]; |
180 | 180 | |
181 | - foreach($observers as $observer => $models){ |
|
182 | - foreach($models as $model){ |
|
183 | - call_user_func($model. '::observe', $observer); |
|
181 | + foreach ($observers as $observer => $models) { |
|
182 | + foreach ($models as $model) { |
|
183 | + call_user_func($model.'::observe', $observer); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | return false; |
46 | 46 | } |
47 | 47 | return true; |
48 | - } catch (\Exception $e){ |
|
48 | + } catch (\Exception $e) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | } |
@@ -42,12 +42,12 @@ |
||
42 | 42 | * |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - public static function generateRandomString($length=32) |
|
45 | + public static function generateRandomString($length = 32) |
|
46 | 46 | { |
47 | 47 | $chars = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ023456789"; |
48 | 48 | $charsCount = strlen($chars); |
49 | 49 | |
50 | - srand((double)microtime()*1000000); |
|
50 | + srand((double)microtime() * 1000000); |
|
51 | 51 | $i = 1; |
52 | 52 | $token = ''; |
53 | 53 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct($templatePath = "", $attributes = []) |
23 | 23 | { |
24 | - $this->templatePath = rtrim($templatePath, '/\\') . '/'; |
|
24 | + $this->templatePath = rtrim($templatePath, '/\\').'/'; |
|
25 | 25 | $this->attributes = $attributes; |
26 | 26 | } |
27 | 27 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | throw new \InvalidArgumentException("Duplicate template key found"); |
41 | 41 | } |
42 | 42 | |
43 | - if (!is_file($this->templatePath . $template)) { |
|
43 | + if (!is_file($this->templatePath.$template)) { |
|
44 | 44 | throw new \RuntimeException("View cannot render `$template` because the template does not exist"); |
45 | 45 | } |
46 | 46 | |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | |
49 | 49 | try { |
50 | 50 | ob_start(); |
51 | - $this->protectedIncludeScope($this->templatePath . $template, $data); |
|
51 | + $this->protectedIncludeScope($this->templatePath.$template, $data); |
|
52 | 52 | $output = ob_get_clean(); |
53 | - } catch(\Throwable $e) { // PHP 7+ |
|
53 | + } catch (\Throwable $e) { // PHP 7+ |
|
54 | 54 | ob_end_clean(); |
55 | 55 | throw $e; |
56 | - } catch(\Exception $e) { // PHP < 7 |
|
56 | + } catch (\Exception $e) { // PHP < 7 |
|
57 | 57 | ob_end_clean(); |
58 | 58 | throw $e; |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string $template |
66 | 66 | * @param array $data |
67 | 67 | */ |
68 | - protected function protectedIncludeScope ($template, array $data) |
|
68 | + protected function protectedIncludeScope($template, array $data) |
|
69 | 69 | { |
70 | 70 | extract($data); |
71 | 71 | include $template; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | |
123 | - $timestamp = (int) substr($token, strrpos($token, '_') + 1); |
|
123 | + $timestamp = (int)substr($token, strrpos($token, '_') + 1); |
|
124 | 124 | // TODO Вынести expire в конфиг |
125 | 125 | $expire = 3600; |
126 | 126 | return $timestamp + $expire >= time(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function generatePasswordResetToken() |
133 | 133 | { |
134 | - $this->password_reset_token = Helper::generateRandomString() . '_' . time(); |
|
134 | + $this->password_reset_token = Helper::generateRandomString().'_'.time(); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -96,5 +96,5 @@ |
||
96 | 96 | | of "email". This simply helps us make messages a little cleaner. |
97 | 97 | | |
98 | 98 | */ |
99 | - 'attributes' => [ ], |
|
99 | + 'attributes' => [], |
|
100 | 100 | ]; |
101 | 101 | \ No newline at end of file |
@@ -12,8 +12,8 @@ |
||
12 | 12 | |
13 | 13 | public function actionIndex() |
14 | 14 | { |
15 | - echo 'This is sample console command.' . PHP_EOL; |
|
16 | - echo 'Actions: ' . PHP_EOL; |
|
17 | - echo 'partisan sample index' . PHP_EOL; |
|
15 | + echo 'This is sample console command.'.PHP_EOL; |
|
16 | + echo 'Actions: '.PHP_EOL; |
|
17 | + echo 'partisan sample index'.PHP_EOL; |
|
18 | 18 | } |
19 | 19 | } |
@@ -96,5 +96,5 @@ |
||
96 | 96 | | of "email". This simply helps us make messages a little cleaner. |
97 | 97 | | |
98 | 98 | */ |
99 | - 'attributes' => [ ], |
|
99 | + 'attributes' => [], |
|
100 | 100 | ]; |
101 | 101 | \ No newline at end of file |