Completed
Push — dev ( ff0a8e...21175d )
by Pavel
08:20
created
app/routes.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Routes
3
-$app->group('/api', function () {
4
-    $this->options('[/{params:.*}]', function ($request, $response, $args) {
3
+$app->group('/api', function() {
4
+    $this->options('[/{params:.*}]', function($request, $response, $args) {
5 5
         return $response->withHeader('Access-Control-Allow-Origin', '*')
6 6
             ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, PATCH, POST, DELETE, OPTIONS')
7 7
             ->withHeader('Access-Control-Allow-Credentials', 'true')
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
     $this->post('/token', 'App\Controller\TokenController:auth');
13 13
 
14
-    $this->group('/{entity:user}', function () {
14
+    $this->group('/{entity:user}', function() {
15 15
         $this->get('', 'App\Controller\UserController:actionIndex');
16 16
         $this->post('', 'App\Controller\UserController:actionCreate');
17 17
         $this->get('/{id:[0-9]+}', 'App\Controller\UserController:actionGet');
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->post('/reset-password', 'App\Controller\UserController:actionResetPassword');
23 23
     });
24 24
 
25
-    $this->group('/{entity:role|right}', function () {
25
+    $this->group('/{entity:role|right}', function() {
26 26
         $this->get('', 'App\Controller\CrudController:actionIndex');
27 27
         $this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet');
28 28
         $this->post('', 'App\Controller\CrudController:actionCreate');
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->delete('/{id:[0-9]+}', 'App\Controller\CrudController:actionDelete');
31 31
     });
32 32
 
33
-    $this->group('/{entity:log}', function () {
33
+    $this->group('/{entity:log}', function() {
34 34
         $this->get('', 'App\Controller\CrudController:actionIndex');
35 35
         $this->get('/{id:[0-9]+}', 'App\Controller\CrudController:actionGet');
36 36
     });
Please login to merge, or discard this patch.
app/dependencies.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
 $container = $app->getContainer();
23 23
 
24 24
 // render
25
-$container['renderer'] = function($c){
25
+$container['renderer'] = function($c) {
26 26
     $renderer = new Renderer();
27 27
 
28 28
     return $renderer;
29 29
 };
30 30
 
31
-$container['mailRenderer'] = function($c){
31
+$container['mailRenderer'] = function($c) {
32 32
     $settings = $c->get('settings');
33 33
     $renderer = new MailRenderer($settings['mailTemplate']);
34 34
     return $renderer;
35 35
 };
36 36
 
37 37
 // monolog
38
-$container['logger'] = function ($c) {
38
+$container['logger'] = function($c) {
39 39
     $settings = $c->get('settings');
40 40
     $logger   = new Logger($settings['logger']['name']);
41 41
     $logger->pushProcessor(new UidProcessor());
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 };
46 46
 
47 47
 // error handlers
48
-$container['errorHandler'] = function ($c) {
49
-    return function ($request, $response, $exception) use ($c) {
48
+$container['errorHandler'] = function($c) {
49
+    return function($request, $response, $exception) use ($c) {
50 50
         $details = (defined('DEBUG_MODE') && DEBUG_MODE == 1) ? $exception->getMessage() : 'Internal server error';
51 51
         $e = new JsonException(null, 500, 'Internal server error', $details);
52 52
 
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
     };
55 55
 };
56 56
 
57
-$container['notAllowedHandler'] = function ($c) {
58
-    return function ($request, $response, $methods) use ($c) {
59
-        throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: ' . implode(', ', $methods));
57
+$container['notAllowedHandler'] = function($c) {
58
+    return function($request, $response, $methods) use ($c) {
59
+        throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: '.implode(', ', $methods));
60 60
     };
61 61
 };
62 62
 
63
-$container['notFoundHandler'] = function ($c) {
64
-    return function ($request, $response) use ($c) {
63
+$container['notFoundHandler'] = function($c) {
64
+    return function($request, $response) use ($c) {
65 65
         throw new JsonException(null, 404, 'Not found', 'Entity not found');
66 66
     };
67 67
 };
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 // database
70 70
 $setting = $container->get('settings');
71 71
 $capsule = new Capsule;
72
-foreach ($setting['database']['connections'] as $name => $connection){
72
+foreach ($setting['database']['connections'] as $name => $connection) {
73 73
     $capsule->addConnection($connection, $name);
74 74
 }
75 75
 $capsule->setEventDispatcher(new Dispatcher(new Container));
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 $container['databaseManager'] = $capsule->getDatabaseManager();
80 80
 
81 81
 // ACL
82
-$container['acl'] = function ($c) {
82
+$container['acl'] = function($c) {
83 83
     $settings = $c->get('settings');
84 84
     $acl      = new Acl($settings['acl']);
85 85
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 };
88 88
 
89 89
 // translation
90
-$container['translator'] = function($c){
90
+$container['translator'] = function($c) {
91 91
     $settings                = $c->get('settings');
92 92
     $translation_file_loader = new FileLoader(new Filesystem, $settings['translate']['path']);
93 93
     $translator              = new Translator($translation_file_loader, $settings['translate']['locale']);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 };
97 97
 
98 98
 // validation
99
-$container['validation'] = function($c){
99
+$container['validation'] = function($c) {
100 100
     $translator = $c->get('translator');
101 101
     $validation = new Factory($translator);
102 102
     $presence   = new DatabasePresenceVerifier($c->get('databaseManager'));
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 };
107 107
 
108 108
 // mailer
109
-$container['mailer'] = function($c){
109
+$container['mailer'] = function($c) {
110 110
     $transport = \Swift_MailTransport::newInstance();
111 111
     $mailer    = \Swift_Mailer::newInstance($transport);
112 112
 
Please login to merge, or discard this patch.
app/src/Controller/UserController.php 1 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.
app/src/Controller/BaseController.php 1 patch
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.
app/src/Controller/TokenController.php 1 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.
app/src/Controller/CrudController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
                         $query = $query->whereNotIn($filter['attribute'], $filter['value']);
45 45
                         break;
46 46
                     case 'like':
47
-                        $query = $query->where($filter['attribute'], 'like', '%' . $filter['value'] . '%');
47
+                        $query = $query->where($filter['attribute'], 'like', '%'.$filter['value'].'%');
48 48
                         break;
49 49
                     case '=':
50 50
                     case '!=':
Please login to merge, or discard this patch.
app/src/Common/Helper.php 1 patch
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.
app/src/Common/Auth.php 1 patch
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.
app/src/Common/MailRenderer.php 1 patch
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.