Completed
Push — master ( f65d8f...4f3de5 )
by Pavel
04:14 queued 01:54
created
app/src/Controller/TokenController.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
      * @param Response $response
98 98
      * @param array    $args
99 99
      *
100
-     * @return mixed
100
+     * @return \Psr\Http\Message\ResponseInterface
101 101
      * @throws JsonException
102 102
      */
103 103
     public function auth(Request $request, Response $response, $args)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,12 +3,10 @@
 block discarded – undo
3 3
 
4 4
 use App\Model\User;
5 5
 use App\Common\JsonException;
6
-
7 6
 use App\Requests\RequestResetPasswordRequest;
8 7
 use App\Requests\ResetPasswordRequest;
9 8
 use App\Requests\UserCreateRequest;
10 9
 use App\Requests\UserUpdateRequest;
11
-
12 10
 use Slim\Http\Request;
13 11
 use Slim\Http\Response;
14 12
 
Please login to merge, or discard this patch.
app/src/Controller/UserController.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param Response $response
20 20
      * @param array    $args
21 21
      *
22
-     * @return mixed
22
+     * @return \Psr\Http\Message\ResponseInterface
23 23
      * @throws JsonException
24 24
      */
25 25
     public function actionCreate(Request $request, Response $response, $args)
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param Response $response
49 49
      * @param array    $args
50 50
      *
51
-     * @return mixed
51
+     * @return \Psr\Http\Message\ResponseInterface
52 52
      * @throws JsonException
53 53
      */
54 54
     public function actionUpdate(Request $request, Response $response, $args)
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param Response $response
81 81
      * @param array    $args
82 82
      *
83
-     * @return mixed
83
+     * @return \Psr\Http\Message\ResponseInterface
84 84
      * @throws JsonException
85 85
      */
86 86
     public function actionRequestResetPassword(Request $request, Response $response, $args)
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param Response $response
127 127
      * @param array    $args
128 128
      *
129
-     * @return mixed
129
+     * @return \Psr\Http\Message\ResponseInterface
130 130
      * @throws JsonException
131 131
      */
132 132
     public function actionResetPassword(Request $request, Response $response, $args)
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,12 +3,10 @@
 block discarded – undo
3 3
 
4 4
 use App\Model\User;
5 5
 use App\Common\JsonException;
6
-
7 6
 use App\Requests\RequestResetPasswordRequest;
8 7
 use App\Requests\ResetPasswordRequest;
9 8
 use App\Requests\UserCreateRequest;
10 9
 use App\Requests\UserUpdateRequest;
11
-
12 10
 use Slim\Http\Request;
13 11
 use Slim\Http\Response;
14 12
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
public/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
 }
6 6
 
7 7
 // Super debug func
8
-function prr($value) {
8
+function prr($value)
9
+{
9 10
     if (defined('DEBUG_MODE') && DEBUG_MODE == 1) {
10 11
         echo '<pre>';
11 12
         print_r($value);
Please login to merge, or discard this patch.
app/database/migrations/20160706232752_create_roles_table.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
      */
9 9
     public function up()
10 10
     {
11
-        Capsule::schema()->create('roles', function($table)
12
-        {
11
+        Capsule::schema()->create('roles', function($table) {
13 12
             $table->increments('id');
14 13
             $table->string('name')->unique();
15 14
             $table->string('description');
Please login to merge, or discard this patch.
app/database/migrations/20161016143152_create_roles_to_right_table.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 class CreateRolesToRightTable{
5 5
     /**
6
-    * Do the migration
7
-    */
6
+     * Do the migration
7
+     */
8 8
     public function up()
9 9
     {
10 10
         Capsule::schema()->create('roles_to_rights', function($table)
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     }
18 18
 
19 19
     /**
20
-    * Undo the migration
21
-    */
20
+     * Undo the migration
21
+     */
22 22
     public function down()
23 23
     {
24 24
         Capsule::schema()->drop('roles_to_rights');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
     */
9 9
     public function up()
10 10
     {
11
-        Capsule::schema()->create('roles_to_rights', function($table)
12
-        {
11
+        Capsule::schema()->create('roles_to_rights', function($table) {
13 12
             $table->integer('role_id')->unsigned();
14 13
             $table->integer('right_id')->unsigned();
15 14
             $table->primary(['role_id', 'right_id']);
Please login to merge, or discard this patch.
app/database/seeds/20160706233231_create_roles_rights_users.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 use App\Model\Role;
3 3
 use App\Model\User;
4 4
 
5
-class CreateRolesRightsUsers {
5
+class CreateRolesRightsUsers
6
+{
6 7
     public function run()
7 8
     {
8 9
         Role::create([
Please login to merge, or discard this patch.
app/src/Controller/BaseController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,8 @@  discard block
 block discarded – undo
163 163
     /**
164 164
      * Register model observers
165 165
      */
166
-    private function registerModelObservers(){
166
+    private function registerModelObservers()
167
+    {
167 168
         $observers = [
168 169
             Observers\CreatedByAndUpdatedByObserver::class => [
169 170
                 Model\Right::class,
@@ -178,8 +179,8 @@  discard block
 block discarded – undo
178 179
             ]
179 180
         ];
180 181
 
181
-        foreach($observers as $observer => $models){
182
-            foreach($models as $model){
182
+        foreach($observers as $observer => $models) {
183
+            foreach($models as $model) {
183 184
                 call_user_func($model. '::observe', $observer);
184 185
             }
185 186
         }
Please login to merge, or discard this patch.
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/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.