Completed
Push — master ( e9a84e...21be5c )
by Aleksandar
26:24
created
packages/Admin/src/Controller/UserController.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Admin\Controller;
6 6
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $user   = $this->session->getStorage()->user;
66 66
         $params = $this->request->getQueryParams();
67
-        $page   = isset($params['page']) ? $params['page'] : 1;
68
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
67
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
68
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
69 69
 
70 70
         $adminUsers = $this->adminUserService->getPagination($page, $limit, $user->admin_user_id);
71 71
 
72
-        return new HtmlResponse($this->template->render('admin::user/index', ['list' => $adminUsers, 'layout' => 'layout/admin']));
72
+        return new HtmlResponse($this->template->render('admin::user/index', [ 'list' => $adminUsers, 'layout' => 'layout/admin' ]));
73 73
     }
74 74
 
75 75
     /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @return \Psr\Http\Message\ResponseInterface
79 79
      */
80
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
80
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
81 81
     {
82 82
         $id   = $this->request->getAttribute('id');
83 83
         $user = $this->adminUserService->getUser($id);
84 84
 
85
-        if($this->request->getParsedBody()) {
86
-            $user                = (object)($this->request->getParsedBody() + (array)$user);
85
+        if ($this->request->getParsedBody()) {
86
+            $user                = (object) ($this->request->getParsedBody() + (array) $user);
87 87
             $user->admin_user_id = $id;
88 88
         }
89 89
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         try {
100 100
             $userId = $this->request->getAttribute('id');
101 101
             $data   = $this->request->getParsedBody();
102
-            $data   += (new Request())->getFiles()->toArray();
102
+            $data += (new Request())->getFiles()->toArray();
103 103
 
104
-            if($userId) {
104
+            if ($userId) {
105 105
                 $this->adminUserService->updateUser($data, $userId);
106 106
             }
107 107
             else {
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
112 112
         }
113
-        catch(FilterException $fe) {
113
+        catch (FilterException $fe) {
114 114
             return $this->edit($fe->getArrayMessages());
115 115
         }
116
-        catch(\Exception $e) {
116
+        catch (\Exception $e) {
117 117
             throw $e;
118 118
         }
119 119
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
128 128
         }
129
-        catch(\Exception $e) {
129
+        catch (\Exception $e) {
130 130
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
131 131
         }
132 132
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,17 +103,14 @@  discard block
 block discarded – undo
103 103
 
104 104
             if($userId) {
105 105
                 $this->adminUserService->updateUser($data, $userId);
106
-            }
107
-            else {
106
+            } else {
108 107
                 $this->adminUserService->registerNewUser($data);
109 108
             }
110 109
 
111 110
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
112
-        }
113
-        catch(FilterException $fe) {
111
+        } catch(FilterException $fe) {
114 112
             return $this->edit($fe->getArrayMessages());
115
-        }
116
-        catch(\Exception $e) {
113
+        } catch(\Exception $e) {
117 114
             throw $e;
118 115
         }
119 116
     }
@@ -125,8 +122,7 @@  discard block
 block discarded – undo
125 122
             $this->adminUserService->delete($userId);
126 123
 
127 124
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
128
-        }
129
-        catch(\Exception $e) {
125
+        } catch(\Exception $e) {
130 126
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
131 127
         }
132 128
     }
Please login to merge, or discard this patch.
packages/Admin/src/Action/IndexAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function __invoke(Request $request, Response $response, callable $next = null)
41 41
     {
42
-        return new HtmlResponse($this->template->render('admin::index', ['layout' => 'layout/admin']));
42
+        return new HtmlResponse($this->template->render('admin::index', [ 'layout' => 'layout/admin' ]));
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
data/phinx/seeds/ArticlePosts.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
         $allUsers    = array_column($articlePosts->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid');
19 19
         $allCategory = array_column($articlePosts->getAdapter()->fetchAll('select category_uuid from category'), 'category_uuid');
20 20
 
21
-        for($i = 0; $i < $count; $i++) {
21
+        for ($i = 0; $i < $count; $i++) {
22 22
             // Insert Article
23 23
             $id           = $faker->uuid;
24 24
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
25 25
             $title        = $faker->sentence();
26
-            $userUuid     = $allUsers[rand(0, (count($allUsers) - 1))];
27
-            $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))];
26
+            $userUuid     = $allUsers[ rand(0, (count($allUsers) - 1)) ];
27
+            $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ];
28 28
             $data         = [
29 29
                 'article_uuid'      => $mysqlUuid,
30 30
                 'article_id'        => $id,
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
                 'title'        => $title,
47 47
                 'body'         => $faker->paragraph(15),
48 48
                 'lead'         => $faker->paragraph(5),
49
-                'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))],
50
-                'main_img'     => $mainImages[rand(0, (count($mainImages) - 1))],
49
+                'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ],
50
+                'main_img'     => $mainImages[ rand(0, (count($mainImages) - 1)) ],
51 51
                 'has_layout'   => true,
52 52
             ];
53 53
 
Please login to merge, or discard this patch.
data/phinx/migrations/20161229132328_article_posts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 {
7 7
     public function up()
8 8
     {
9
-        $this->table('article_posts', ['id' => false])
10
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
9
+        $this->table('article_posts', [ 'id' => false ])
10
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
11 11
             ->addColumn('title', 'text')
12 12
             ->addColumn('body', 'text')
13 13
             ->addColumn('lead', 'text')
14
-            ->addColumn('featured_img', 'text', ['null' => true])
15
-            ->addColumn('main_img', 'text', ['null' => true])
16
-            ->addColumn('has_layout', 'boolean', ['default' => true])
17
-            ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
14
+            ->addColumn('featured_img', 'text', [ 'null' => true ])
15
+            ->addColumn('main_img', 'text', [ 'null' => true ])
16
+            ->addColumn('has_layout', 'boolean', [ 'default' => true ])
17
+            ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
18 18
             ->create();
19 19
     }
20 20
 
Please login to merge, or discard this patch.
packages/Web/Action/PageAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Web\Action;
6 6
 
Please login to merge, or discard this patch.
packages/Web/Factory/Action/PageActionFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Web\Factory\Action;
6 6
 
Please login to merge, or discard this patch.
packages/Admin/src/View/Helper/AdminUserHelper.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -22,6 +22,9 @@
 block discarded – undo
22 22
         return $this;
23 23
     }
24 24
 
25
+    /**
26
+     * @return boolean
27
+     */
25 28
     public function current()
26 29
     {
27 30
         return $this->session->getStorage()->user;
Please login to merge, or discard this patch.
packages/Article/tests/Factory/Controller/DiscussionFactoryTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
             ->getMockForAbstractClass();
19 19
         $session = new \Zend\Session\SessionManager();
20 20
         $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class)
21
-            ->setMethods(['get'])
21
+            ->setMethods([ 'get' ])
22 22
             ->getMockForAbstractClass();
23 23
         $container->expects(static::at(0))
24 24
             ->method('get')
Please login to merge, or discard this patch.
packages/Article/tests/Factory/Service/PostServiceFactoryTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
20 20
             ->getMockForAbstractClass();
21 21
 
22 22
         $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class)
23
-            ->setMethods(['get'])
23
+            ->setMethods([ 'get' ])
24 24
             ->getMockForAbstractClass();
25 25
         $container->expects(static::at(0))
26 26
             ->method('get')
27
-            ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']]));
27
+            ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ]));
28 28
         $container->expects(static::at(1))
29 29
             ->method('get')
30 30
             ->will(static::returnValue($articleMapper));
Please login to merge, or discard this patch.