Completed
Push — dev ( ff0a8e...21175d )
by Pavel
08:20
created
app/middleware.php 3 patches
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   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 /*
12 12
  * Auth && ACL Middleware
13 13
  */
14
-$app->add(function (Request $request, Response $response, $next) {
14
+$app->add(function(Request $request, Response $response, $next) {
15 15
     // If path is "/api/token" or "/api/user/request-password-reset" or "/api/user/reset-password" no need authorization process
16 16
     $path = $request->getUri()->getPath();
17 17
     if (in_array($path, ['/api/token', '/api/user/request-password-reset', '/api/user/reset-password'])) {
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
                 $route     = $request->getAttribute('route');
37 37
 
38 38
                 if ($route) {
39
-                    if ($this->acl->hasResource('route' . $route->getPattern())) {
40
-                        $isAllowed = $isAllowed || $this->acl->isAllowed($user->role->name, 'route' . $route->getPattern(), strtolower($request->getMethod()));
39
+                    if ($this->acl->hasResource('route'.$route->getPattern())) {
40
+                        $isAllowed = $isAllowed || $this->acl->isAllowed($user->role->name, 'route'.$route->getPattern(), strtolower($request->getMethod()));
41 41
                     }
42
-                    if ($this->acl->hasResource('callable/' . $route->getCallable())) {
43
-                        $isAllowed = $isAllowed || $this->acl->isAllowed($user->role->name, 'callable/' . $route->getCallable());
42
+                    if ($this->acl->hasResource('callable/'.$route->getCallable())) {
43
+                        $isAllowed = $isAllowed || $this->acl->isAllowed($user->role->name, 'callable/'.$route->getCallable());
44 44
                     }
45 45
                     if (!$isAllowed) {
46
-                        throw new JsonException(null, 403, 'Not allowed', $user->role->name . ' is not allowed access to this location.');
46
+                        throw new JsonException(null, 403, 'Not allowed', $user->role->name.' is not allowed access to this location.');
47 47
                     }
48 48
                 }
49 49
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 /*
59 59
  * Logger
60 60
  */
61
-$app->add(function (Request $request, Response $response, $next) {
61
+$app->add(function(Request $request, Response $response, $next) {
62 62
     $logger     = $this->logger;
63 63
     $response   = $next($request, $response);
64 64
     $uri        = $request->getUri()->getPath();
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 /**
100 100
  * Custom exception
101 101
  */
102
-$app->add(function (Request $request, Response $response, $next) {
102
+$app->add(function(Request $request, Response $response, $next) {
103 103
     try {
104 104
         return $next($request, $response);
105
-    } catch (JsonException $e){
105
+    } catch (JsonException $e) {
106 106
         return $this->renderer->jsonApiRender($response, $e->statusCode, $e->encodeError());
107 107
     }
108 108
 });
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 $app->add(function (Request $request, Response $response, $next) {
103 103
     try {
104 104
         return $next($request, $response);
105
-    } catch (JsonException $e){
105
+    } catch (JsonException $e) {
106 106
         return $this->renderer->jsonApiRender($response, $e->statusCode, $e->encodeError());
107 107
     }
108 108
 });
Please login to merge, or discard this patch.
app/database/migrations/20160706232835_create_rights_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('rights', function($table)
12
-        {
11
+        Capsule::schema()->create('rights', 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/20160706231338_create_users_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('users', function($table)
12
-        {
11
+        Capsule::schema()->create('users', function($table) {
13 12
             $table->increments('id');
14 13
             $table->string('email')->unique();
15 14
             $table->string('full_name');
Please login to merge, or discard this patch.
app/database/migrations/20160706233448_create_logs_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('logs', function($table)
12
-        {
11
+        Capsule::schema()->create('logs', function($table) {
13 12
             $table->increments('id');
14 13
             $table->string('action');
15 14
             $table->morphs('entity');
Please login to merge, or discard this patch.
app/src/Commands/SampleController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lang/ru/validation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,5 +96,5 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
app/settings.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         // monolog settings
9 9
         'logger' => [
10 10
             'name' => 'app',
11
-            'path' => __DIR__ . '/../log/app.log',
11
+            'path' => __DIR__.'/../log/app.log',
12 12
         ],
13 13
 
14
-        'mailTemplate' => __DIR__ . '/../mail',
14
+        'mailTemplate' => __DIR__.'/../mail',
15 15
 
16 16
             // DB
17
-        'database' => require(__DIR__ . '/../config/db.php'),
17
+        'database' => require(__DIR__.'/../config/db.php'),
18 18
 
19 19
         // ACL
20 20
         'acl' =>
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
                  * specified here so can be used in the code if needs be
31 31
                  * Example: ['user' => null]
32 32
                  */
33
-                'resources' => [ ],
33
+                'resources' => [],
34 34
                 // where we specify the guarding!
35 35
                 'guards' => [
36 36
                     /*
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
                      * if included all resources default to deny unless specified.
40 40
                      * Example: ['user', ['admin']]
41 41
                      */
42
-                    'resources' => [ ],
42
+                    'resources' => [],
43 43
                     /*
44 44
                      * list of literal routes for guarding.
45 45
                      * optional
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
                      * ['route', ['roles'], ['methods',' methods1']]
49 49
                      */
50 50
                     'routes' => [
51
-                        ['/api/token',  ['guest'],  ['post']],
52
-                        ['/api/user',   ['user'],   ['get']],
51
+                        ['/api/token', ['guest'], ['post']],
52
+                        ['/api/user', ['user'], ['get']],
53 53
                     ],
54 54
                     /*
55 55
                      * list of callables to resolve against
@@ -59,27 +59,27 @@  discard block
 block discarded – undo
59 59
                      * ['callable', ['roles']]
60 60
                      */
61 61
                     'callables' => [
62
-                        ['App\Controller\CrudController',               ['user']],
63
-                        ['App\Controller\CrudController:actionIndex',   ['user']],
64
-                        ['App\Controller\CrudController:actionGet',     ['user']],
65
-                        ['App\Controller\CrudController:actionCreate',  ['user']],
66
-                        ['App\Controller\CrudController:actionUpdate',  ['user']],
67
-                        ['App\Controller\CrudController:actionDelete',  ['user']],
62
+                        ['App\Controller\CrudController', ['user']],
63
+                        ['App\Controller\CrudController:actionIndex', ['user']],
64
+                        ['App\Controller\CrudController:actionGet', ['user']],
65
+                        ['App\Controller\CrudController:actionCreate', ['user']],
66
+                        ['App\Controller\CrudController:actionUpdate', ['user']],
67
+                        ['App\Controller\CrudController:actionDelete', ['user']],
68 68
 
69
-                        ['App\Controller\UserController:actionIndex',  ['admin']],
70
-                        ['App\Controller\UserController:actionGet',    ['admin']],
69
+                        ['App\Controller\UserController:actionIndex', ['admin']],
70
+                        ['App\Controller\UserController:actionGet', ['admin']],
71 71
                         ['App\Controller\UserController:actionCreate', ['admin']],
72 72
                         ['App\Controller\UserController:actionUpdate', ['admin']],
73
-                        ['App\Controller\UserController:actionDelete',  ['user']],
73
+                        ['App\Controller\UserController:actionDelete', ['user']],
74 74
                     ]
75 75
                 ]
76 76
             ],
77 77
 
78 78
         'translate' => [
79
-            'path' => __DIR__ . '/../lang',
79
+            'path' => __DIR__.'/../lang',
80 80
             'locale' => 'ru',
81 81
         ],
82 82
 
83
-        'params' => require(__DIR__ . '/../config/params.php'),
83
+        'params' => require(__DIR__.'/../config/params.php'),
84 84
     ],
85 85
 ];
Please login to merge, or discard this patch.