Completed
Push — dev ( ff0a8e...21175d )
by Pavel
08:20
created
app/src/Common/Helper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
         $i = 1;
52 52
         $token = '';
53 53
 
54
-        while ($i <= $length)
55
-        {
54
+        while ($i <= $length) {
56 55
             $num = rand() % $charsCount;
57 56
             $tmp = substr($chars, $num, 1);
58 57
             $token .= $tmp;
Please login to merge, or discard this patch.
app/src/Common/Auth.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     public static function getUserId()
51 51
     {
52
-        if(self::checkUser()){
52
+        if (self::checkUser()) {
53 53
             return self::$user->id;
54 54
         } else {
55 55
             return null;
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,16 @@  discard block
 block discarded – undo
8 8
     /**
9 9
      * Forbidden to create new instances
10 10
      */
11
-    private function __construct() {}
11
+    private function __construct()
12
+    {
13
+}
12 14
 
13 15
     /**
14 16
      * Forbidden to cloned instances
15 17
      */
16
-    private function __clone() {}
18
+    private function __clone()
19
+    {
20
+}
17 21
 
18 22
     /**
19 23
      * @var User
@@ -49,7 +53,7 @@  discard block
 block discarded – undo
49 53
      */
50 54
     public static function getUserId()
51 55
     {
52
-        if(self::checkUser()){
56
+        if(self::checkUser()) {
53 57
             return self::$user->id;
54 58
         } else {
55 59
             return null;
Please login to merge, or discard this patch.
app/src/Common/MailRenderer.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,10 +50,12 @@
 block discarded – undo
50 50
             ob_start();
51 51
             $this->protectedIncludeScope($this->templatePath . $template, $data);
52 52
             $output = ob_get_clean();
53
-        } catch(\Throwable $e) { // PHP 7+
53
+        } catch(\Throwable $e) {
54
+// PHP 7+
54 55
             ob_end_clean();
55 56
             throw $e;
56
-        } catch(\Exception $e) { // PHP < 7
57
+        } catch(\Exception $e) {
58
+// PHP < 7
57 59
             ob_end_clean();
58 60
             throw $e;
59 61
         }
Please login to merge, or discard this patch.
app/src/Model/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
app/src/Schema/RoleSchema.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -196,25 +196,25 @@
 block discarded – undo
196 196
  */
197 197
 
198 198
 /**
199
-     * @api {delete} /role/:id Удаление роли
200
-     * @apiName DeleteRole
201
-     * @apiGroup Role
202
-     *
203
-     * @apiDescription Метод для удаления роли.
204
-     *
205
-     * @apiPermission admin
206
-     *
207
-     * @apiParam {Number} id Id роли
208
-     *
209
-     * @apiHeader {String} Authorization Токен.
210
-     *
211
-     * @apiSuccessExample {json} Успешно (204)
212
-     *     HTTP/1.1 204 OK
213
-     *
214
-     * @apiUse UnauthorizedError
215
-     * @apiUse StandardErrors
216
-     * @apiUse NotFoundError
217
-     */
199
+ * @api {delete} /role/:id Удаление роли
200
+ * @apiName DeleteRole
201
+ * @apiGroup Role
202
+ *
203
+ * @apiDescription Метод для удаления роли.
204
+ *
205
+ * @apiPermission admin
206
+ *
207
+ * @apiParam {Number} id Id роли
208
+ *
209
+ * @apiHeader {String} Authorization Токен.
210
+ *
211
+ * @apiSuccessExample {json} Успешно (204)
212
+ *     HTTP/1.1 204 OK
213
+ *
214
+ * @apiUse UnauthorizedError
215
+ * @apiUse StandardErrors
216
+ * @apiUse NotFoundError
217
+ */
218 218
 final class RoleSchema extends BaseSchema
219 219
 {
220 220
     protected $resourceType = 'role';
Please login to merge, or discard this patch.
app/src/Schema/UserSchema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -312,7 +312,7 @@
 block discarded – undo
312 312
         return [
313 313
             'full_name'  => $user->full_name,
314 314
             'email'      => $user->email,
315
-            'role_id'    => (int) $user->role_id,
315
+            'role_id'    => (int)$user->role_id,
316 316
             'created_at' => Carbon::parse($user->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
317 317
             'updated_at' => Carbon::parse($user->updated_at)->setTimezone('UTC')->format(Carbon::ISO8601),
318 318
             'created_by' => $user->created_by,
Please login to merge, or discard this patch.
app/src/Schema/LogSchema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
     {
102 102
         return [
103 103
             'action'      => $log->action,
104
-            'entity_id'   => (int) $log->entity_id,
104
+            'entity_id'   => (int)$log->entity_id,
105 105
             'entity_type' => $log->entity_type,
106 106
             'state'       => $log->state,
107 107
             'created_at'  => Carbon::parse($log->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
Please login to merge, or discard this patch.
app/src/Schema/UserSchemaExtended.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         return [
18 18
             'full_name'   => $user->full_name,
19 19
             'email'       => $user->email,
20
-            'role_id'     => (int) $user->role_id,
20
+            'role_id'     => (int)$user->role_id,
21 21
             'created_at'  => Carbon::parse($user->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
22 22
             'updated_at'  => Carbon::parse($user->updated_at)->setTimezone('UTC')->format(Carbon::ISO8601),
23 23
             'created_by'  => $user->created_by,
Please login to merge, or discard this patch.
app/src/Observers/CreatedByAndUpdatedByObserver.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function creating(BaseModel $model)
16 16
     {
17 17
         $user = Auth::getUser();
18
-        if(!is_null($user)){
18
+        if (!is_null($user)) {
19 19
             $model->created_by = $user->id;
20 20
         }
21 21
     }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function updating(BaseModel $model)
31 31
     {
32 32
         $user = Auth::getUser();
33
-        if(!is_null($user)){
33
+        if (!is_null($user)) {
34 34
             $model->updated_by = $user->id;
35 35
         }
36 36
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function creating(BaseModel $model)
16 16
     {
17 17
         $user = Auth::getUser();
18
-        if(!is_null($user)){
18
+        if(!is_null($user)) {
19 19
             $model->created_by = $user->id;
20 20
         }
21 21
     }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function updating(BaseModel $model)
31 31
     {
32 32
         $user = Auth::getUser();
33
-        if(!is_null($user)){
33
+        if(!is_null($user)) {
34 34
             $model->updated_by = $user->id;
35 35
         }
36 36
     }
Please login to merge, or discard this patch.