Completed
Push — master ( 286755...1c9c5d )
by Aleksandar
40:24 queued 16:52
created
src/Admin/src/ConfigProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
                     'admin/pagination' => __DIR__ . '/../templates/admin/partial/pagination.phtml',
14 14
                 ],
15 15
                 'paths' => [
16
-                    'admin' => [__DIR__ . '/../templates/admin'],
16
+                    'admin' => [ __DIR__ . '/../templates/admin' ],
17 17
                 ],
18 18
             ],
19 19
 
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
                     'name'            => 'auth',
31 31
                     'path'            => '/auth/:action',
32 32
                     'middleware'      => Controller\AuthController::class,
33
-                    'allowed_methods' => ['GET', 'POST'],
33
+                    'allowed_methods' => [ 'GET', 'POST' ],
34 34
                 ],
35 35
                 [
36 36
                     'name'            => 'admin',
37 37
                     'path'            => '/admin',
38 38
                     'middleware'      => Action\IndexAction::class,
39
-                    'allowed_methods' => ['GET'],
39
+                    'allowed_methods' => [ 'GET' ],
40 40
                 ],
41 41
                 [
42 42
                     'name'            => 'admin.users',
43 43
                     'path'            => '/admin/users',
44 44
                     'middleware'      => Controller\UserController::class,
45
-                    'allowed_methods' => ['GET']
45
+                    'allowed_methods' => [ 'GET' ]
46 46
                 ],
47 47
                 [
48 48
                     'name'            => 'admin.users.action',
49 49
                     'path'            => '/admin/users/:action/:id',
50 50
                     'middleware'      => Controller\UserController::class,
51
-                    'allowed_methods' => ['GET', 'POST']
51
+                    'allowed_methods' => [ 'GET', 'POST' ]
52 52
                 ],
53 53
             ],
54 54
 
Please login to merge, or discard this patch.
src/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.
src/Category/src/View/Helper/CategoryHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     public function forWeb()
35 35
     {
36
-        if(!$this->categoriesWithPosts) {
36
+        if (!$this->categoriesWithPosts) {
37 37
             $this->categoriesWithPosts = $this->categoryService->getWebCategories();
38 38
         }
39 39
 
Please login to merge, or discard this patch.
src/Category/src/Service/CategoryService.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Category\Service;
5 5
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function getCategoryBySlug($urlSlug)
71 71
     {
72
-        return $this->categoryMapper->select(['slug' => $urlSlug])->current();
72
+        return $this->categoryMapper->select([ 'slug' => $urlSlug ])->current();
73 73
     }
74 74
 
75 75
     /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $filter = $this->categoryFilter->getInputFilter()->setData($data);
84 84
 
85
-        if(!$filter->isValid()) {
85
+        if (!$filter->isValid()) {
86 86
             throw new FilterException($filter->getMessages());
87 87
         }
88 88
 
89 89
         $data                  = $filter->getValues();
90
-        $data['category_id']   = Uuid::uuid1()->toString();
91
-        $data['category_uuid'] = (new MysqlUuid($data['category_id']))->toFormat(new Binary);
90
+        $data[ 'category_id' ]   = Uuid::uuid1()->toString();
91
+        $data[ 'category_uuid' ] = (new MysqlUuid($data[ 'category_id' ]))->toFormat(new Binary);
92 92
 
93 93
         $this->categoryMapper->insert($data);
94 94
     }
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function updateCategory($data, $categoryId)
105 105
     {
106
-        if(!$this->getCategory($categoryId)) {
106
+        if (!$this->getCategory($categoryId)) {
107 107
             throw new \Exception('CategoryId dos not exist.');
108 108
         }
109 109
 
110 110
         $filter = $this->categoryFilter->getInputFilter()->setData($data);
111 111
 
112
-        if(!$filter->isValid()) {
112
+        if (!$filter->isValid()) {
113 113
             throw new FilterException($filter->getMessages());
114 114
         }
115 115
 
116 116
         $data = $filter->getValues();
117
-        $this->categoryMapper->update($data, ['category_id' => $categoryId]);
117
+        $this->categoryMapper->update($data, [ 'category_id' => $categoryId ]);
118 118
     }
119 119
 
120 120
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function delete($categoryId)
127 127
     {
128
-        return (bool)$this->categoryMapper->delete(['category_id' => $categoryId]);
128
+        return (bool) $this->categoryMapper->delete([ 'category_id' => $categoryId ]);
129 129
     }
130 130
 
131 131
     /**
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $categories = $this->categoryMapper->getWeb()->toArray();
147 147
 
148
-        foreach($categories as $ctn => $category) {
149
-            $select                    = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4);
148
+        foreach ($categories as $ctn => $category) {
149
+            $select                    = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4);
150 150
             $posts                     = $this->categoryMapper->selectWith($select)->toArray();
151
-            $categories[$ctn]['posts'] = $posts;
151
+            $categories[ $ctn ][ 'posts' ] = $posts;
152 152
         }
153 153
 
154 154
         return $categories;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function allWeb()
161 161
     {
162
-        return $this->categoryMapper->getWeb(null, ['name' => 'asc']);
162
+        return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ]);
163 163
     }
164 164
 
165 165
     /**
Please login to merge, or discard this patch.
src/Core/Factory/Service/AdminUserServiceFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Core\Factory\Service;
5 5
 
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __invoke(ContainerInterface $container): AdminUserService
22 22
     {
23
-        $config = $container->get('config')['upload'];
24
-        $upload = new Upload($config['public_path'], $config['non_public_path']);
23
+        $config = $container->get('config')[ 'upload' ];
24
+        $upload = new Upload($config[ 'public_path' ], $config[ 'non_public_path' ]);
25 25
 
26 26
         return new AdminUserService(
27 27
             new Bcrypt(),
Please login to merge, or discard this patch.
data/phinx/migrations/20161003183350_category.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     public function up()
11 11
     {
12
-        $this->table('category', ['id' => false, 'primary_key' => 'category_uuid'])
13
-            ->addColumn('category_uuid', 'binary', ['limit' => 16])
12
+        $this->table('category', [ 'id' => false, 'primary_key' => 'category_uuid' ])
13
+            ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ])
14 14
             ->addColumn('category_id', 'text')
15 15
             ->addColumn('name', 'text')
16 16
             ->addColumn('slug', 'text')
Please login to merge, or discard this patch.
src/Article/src/Filter/VideoFilter.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,56 +12,56 @@
 block discarded – undo
12 12
 
13 13
     public function getInputFilter()
14 14
     {
15
-        if(!$this->inputFilter) {
15
+        if (!$this->inputFilter) {
16 16
             $inputFilter = new InputFilter();
17 17
 
18 18
             $inputFilter->add([
19 19
                 'name'       => 'title',
20 20
                 'required'   => true,
21
-                'filters'    => [['name' => 'StringTrim']],
21
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
22 22
                 'validators' => [
23
-                    ['name' => 'NotEmpty'],
24
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
23
+                    [ 'name' => 'NotEmpty' ],
24
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
25 25
                 ],
26 26
             ]);
27 27
 
28 28
             $inputFilter->add([
29 29
                 'name'       => 'sub_title',
30 30
                 'required'   => false,
31
-                'filters'    => [['name' => 'StringTrim']],
31
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
32 32
                 'validators' => [
33
-                    ['name' => 'NotEmpty'],
34
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]],
33
+                    [ 'name' => 'NotEmpty' ],
34
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ],
35 35
                 ],
36 36
             ]);
37 37
 
38 38
             $inputFilter->add([
39 39
                 'name'       => 'body',
40 40
                 'required'   => true,
41
-                'filters'    => [['name' => 'StringTrim']],
41
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
42 42
                 'validators' => [
43
-                    ['name' => 'NotEmpty'],
44
-                    ['name' => 'StringLength', 'options' => ['min' => 2]],
43
+                    [ 'name' => 'NotEmpty' ],
44
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ],
45 45
                 ],
46 46
             ]);
47 47
 
48 48
             $inputFilter->add([
49 49
                 'name'       => 'lead',
50 50
                 'required'   => true,
51
-                'filters'    => [['name' => 'StringTrim']],
51
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
52 52
                 'validators' => [
53
-                    ['name' => 'NotEmpty'],
54
-                    ['name' => 'StringLength', 'options' => ['min' => 2]],
53
+                    [ 'name' => 'NotEmpty' ],
54
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ],
55 55
                 ],
56 56
             ]);
57 57
 
58 58
             $inputFilter->add([
59 59
                 'name'       => 'video_url',
60 60
                 'required'   => true,
61
-                'filters'    => [['name' => 'StringTrim']],
61
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
62 62
                 'validators' => [
63
-                    ['name' => 'NotEmpty'],
64
-                    ['name' => 'StringLength'],
63
+                    [ 'name' => 'NotEmpty' ],
64
+                    [ 'name' => 'StringLength' ],
65 65
                 ],
66 66
             ]);
67 67
 
Please login to merge, or discard this patch.
src/Article/src/Filter/EventFilter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,73 +12,73 @@
 block discarded – undo
12 12
 
13 13
     public function getInputFilter()
14 14
     {
15
-        if(!$this->inputFilter) {
15
+        if (!$this->inputFilter) {
16 16
             $inputFilter = new InputFilter();
17 17
 
18 18
             $inputFilter->add([
19 19
                 'name'       => 'title',
20 20
                 'required'   => true,
21
-                'filters'    => [['name' => 'StringTrim']],
21
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
22 22
                 'validators' => [
23
-                    ['name' => 'NotEmpty'],
24
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
23
+                    [ 'name' => 'NotEmpty' ],
24
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ],
25 25
                 ],
26 26
             ]);
27 27
 
28 28
             $inputFilter->add([
29 29
                 'name'     => 'sub_title',
30 30
                 'required' => false,
31
-                'filters'  => [['name' => 'StringTrim']]
31
+                'filters'  => [ [ 'name' => 'StringTrim' ] ]
32 32
             ]);
33 33
 
34 34
             $inputFilter->add([
35 35
                 'name'     => 'place_name',
36 36
                 'required' => true,
37
-                'filters'  => [['name' => 'StringTrim']]
37
+                'filters'  => [ [ 'name' => 'StringTrim' ] ]
38 38
             ]);
39 39
 
40 40
             $inputFilter->add([
41 41
                 'name'     => 'event_url',
42 42
                 'required' => false,
43
-                'filters'  => [['name' => 'StringTrim']]
43
+                'filters'  => [ [ 'name' => 'StringTrim' ] ]
44 44
             ]);
45 45
 
46 46
             $inputFilter->add([
47 47
                 'name'       => 'body',
48 48
                 'required'   => true,
49
-                'filters'    => [['name' => 'StringTrim']],
49
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
50 50
                 'validators' => [
51
-                    ['name' => 'NotEmpty'],
52
-                    ['name' => 'StringLength', 'options' => ['min' => 2]],
51
+                    [ 'name' => 'NotEmpty' ],
52
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ],
53 53
                 ],
54 54
             ]);
55 55
 
56 56
             $inputFilter->add([
57 57
                 'name'       => 'start_at',
58 58
                 'required'   => true,
59
-                'filters'    => [['name' => 'StringTrim']],
60
-                'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]]
59
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
60
+                'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ]
61 61
             ]);
62 62
 
63 63
             $inputFilter->add([
64 64
                 'name'       => 'end_at',
65 65
                 'required'   => true,
66
-                'filters'    => [['name' => 'StringTrim']],
67
-                'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]]
66
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
67
+                'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ]
68 68
             ]);
69 69
 
70 70
             $inputFilter->add([
71 71
                 'name'       => 'longitude',
72 72
                 'required'   => true,
73
-                'filters'    => [['name' => 'StringTrim']],
74
-                'validators' => [['name' => 'NotEmpty']],
73
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
74
+                'validators' => [ [ 'name' => 'NotEmpty' ] ],
75 75
             ]);
76 76
 
77 77
             $inputFilter->add([
78 78
                 'name'       => 'latitude',
79 79
                 'required'   => true,
80
-                'filters'    => [['name' => 'StringTrim']],
81
-                'validators' => [['name' => 'NotEmpty']],
80
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
81
+                'validators' => [ [ 'name' => 'NotEmpty' ] ],
82 82
             ]);
83 83
 
84 84
             $this->inputFilter = $inputFilter;
Please login to merge, or discard this patch.
data/phinx/migrations/20161229132343_article_discussions.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 use MysqlUuid\Formats\Binary;
5 5
 use MysqlUuid\Uuid;
6 6
 use Core\Entity\ArticleType;
7
-use MysqlUuid\Formats\PlainString;
8 7
 
9 8
 class ArticleDiscussions extends AbstractMigration
10 9
 {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function up()
12 12
     {
13
-        $this->table('article_discussions', ['id' => false])
14
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
13
+        $this->table('article_discussions', [ 'id' => false ])
14
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
15 15
             ->addColumn('title', 'text')
16 16
             ->addColumn('body', 'text')
17
-            ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
17
+            ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
18 18
             ->create();
19 19
 
20 20
 //        $this->insertDummyData();
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 
28 28
     private function insertDummyData()
29 29
     {
30
-        $ids  = [];
30
+        $ids  = [ ];
31 31
         $rows = $this->fetchAll('select admin_user_uuid from admin_users;');
32
-        foreach($rows as $r){
33
-            $ids[] = $r['admin_user_uuid'];
32
+        foreach ($rows as $r) {
33
+            $ids[ ] = $r[ 'admin_user_uuid' ];
34 34
         }
35 35
 
36 36
         $faker = Faker\Factory::create();
37 37
         $count = rand(250, 300);
38
-        for($i = 0; $i < $count; $i++){
38
+        for ($i = 0; $i < $count; $i++) {
39 39
             $id        = $faker->uuid;
40 40
             $mysqluuid = (new Uuid($id))->toFormat(new Binary());
41 41
             $title     = $faker->sentence(5, 15);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 'article_id'      => $id,
46 46
                 'slug'            => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')),
47 47
                 'status'          => 1,
48
-                'admin_user_uuid' => $ids[array_rand($ids)],
48
+                'admin_user_uuid' => $ids[ array_rand($ids) ],
49 49
                 'type'            => ArticleType::DISCUSSION
50 50
             ];
51 51
 
Please login to merge, or discard this patch.