Completed
Pull Request — master (#97)
by Aleksandar
46:22 queued 13:15
created
packages/Article/src/Controller/VideoController.php 1 patch
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 Article\Controller;
6 6
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     public function index(): HtmlResponse
69 69
     {
70 70
         $params = $this->request->getQueryParams();
71
-        $page   = isset($params['page']) ? $params['page'] : 1;
72
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
71
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
72
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
73 73
         $videos = $this->videoService->fetchAllArticles($page, $limit);
74 74
 
75
-        return new HtmlResponse($this->template->render('article::video/index', ['list' => $videos, 'layout' => 'layout/admin']));
75
+        return new HtmlResponse($this->template->render('article::video/index', [ 'list' => $videos, 'layout' => 'layout/admin' ]));
76 76
     }
77 77
 
78 78
     /**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return \Psr\Http\Message\ResponseInterface
82 82
      */
83
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
83
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
84 84
     {
85 85
         $id         = $this->request->getAttribute('id');
86 86
         $video      = $this->videoService->fetchSingleArticle($id);
87 87
         $categories = $this->categoryService->getAll();
88 88
 
89
-        if($this->request->getParsedBody()) {
90
-            $video             = (object)($this->request->getParsedBody() + (array)$video);
89
+        if ($this->request->getParsedBody()) {
90
+            $video             = (object) ($this->request->getParsedBody() + (array) $video);
91 91
             $video->article_id = $id;
92 92
         }
93 93
 
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
             $data = $this->request->getParsedBody();
115 115
             $data += (new Request())->getFiles()->toArray();
116 116
 
117
-            if($id) {
117
+            if ($id) {
118 118
                 $this->videoService->updateArticle($data, $id);
119 119
             } else {
120 120
                 $this->videoService->createArticle($user, $data);
121 121
             }
122 122
         }
123
-        catch(FilterException $fe) {
123
+        catch (FilterException $fe) {
124 124
             return $this->edit($fe->getArrayMessages());
125 125
         }
126
-        catch(\Exception $e) {
126
+        catch (\Exception $e) {
127 127
             throw $e;
128 128
         }
129 129
 
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         try {
142 142
             $this->videoService->deleteArticle($this->request->getAttribute('id'));
143 143
         }
144
-        catch(\Exception $e) {
144
+        catch (\Exception $e) {
145 145
             throw $e;
146 146
         }
147 147
 
148 148
         return $this->response->withStatus(302)->withHeader(
149
-            'Location', $this->router->generateUri('admin.videos', ['action' => 'index'])
149
+            'Location', $this->router->generateUri('admin.videos', [ 'action' => 'index' ])
150 150
         );
151 151
     }
152 152
 }
Please login to merge, or discard this patch.
packages/Article/src/Filter/DiscussionFilter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@
 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'       => 'body',
30 30
                 'required'   => true,
31
-                'filters'    => [['name' => 'StringTrim']],
31
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
32 32
                 'validators' => [
33
-                    ['name' => 'NotEmpty'],
34
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1500]],
33
+                    [ 'name' => 'NotEmpty' ],
34
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1500 ] ],
35 35
                 ],
36 36
             ]);
37 37
 
Please login to merge, or discard this patch.
packages/Article/src/Filter/PostFilter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,49 +12,49 @@
 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'       => 'body',
30 30
                 'required'   => true,
31
-                'filters'    => [['name' => 'StringTrim']],
31
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
32 32
                 'validators' => [
33
-                    ['name' => 'NotEmpty'],
34
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]],
33
+                    [ 'name' => 'NotEmpty' ],
34
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100000 ] ],
35 35
                 ],
36 36
             ]);
37 37
 
38 38
             $inputFilter->add([
39 39
                 'name'       => 'lead',
40 40
                 'required'   => true,
41
-                'filters'    => [['name' => 'StringTrim']],
41
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
42 42
                 'validators' => [
43
-                    ['name' => 'NotEmpty'],
44
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]],
43
+                    [ 'name' => 'NotEmpty' ],
44
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 50000 ] ],
45 45
                 ],
46 46
             ]);
47 47
 
48 48
             $inputFilter->add([
49 49
                 'name'     => 'has_layout',
50 50
                 'required' => false,
51
-                'filters'  => [['name' => 'Boolean']],
51
+                'filters'  => [ [ 'name' => 'Boolean' ] ],
52 52
             ]);
53 53
 
54 54
             $inputFilter->add([
55 55
                 'name'     => 'is_homepage',
56 56
                 'required' => false,
57
-                'filters'  => [['name' => 'Boolean']],
57
+                'filters'  => [ [ 'name' => 'Boolean' ] ],
58 58
             ]);
59 59
 
60 60
             $this->inputFilter = $inputFilter;
Please login to merge, or discard this patch.
packages/Article/src/Filter/ArticleFilter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 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'       => 'slug',
20 20
                 'required'   => true,
21
-                'filters'    => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]],
21
+                'filters'    => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ],
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'       => 'published_at',
30 30
                 'required'   => true,
31
-                'filters'    => [['name' => 'StringTrim']],
32
-                'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]]
31
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
32
+                'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ]
33 33
             ]);
34 34
 
35 35
             $inputFilter->add([
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
             $inputFilter->add([
41 41
                 'name'     => 'status',
42 42
                 'required' => false,
43
-                'filters'  => [['name' => 'Boolean']],
43
+                'filters'  => [ [ 'name' => 'Boolean' ] ],
44 44
             ]);
45 45
 
46 46
             $inputFilter->add([
47 47
                 'name'     => 'is_wysiwyg_editor',
48 48
                 'required' => false,
49
-                'filters'  => [['name' => 'Boolean']],
49
+                'filters'  => [ [ 'name' => 'Boolean' ] ],
50 50
             ]);
51 51
 
52 52
             $this->inputFilter = $inputFilter;
Please login to merge, or discard this patch.
packages/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.
packages/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.
packages/Article/src/Mapper/ArticleEventsMapper.php 1 patch
Spacing   +20 added lines, -20 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 Article\Mapper;
6 6
 
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
     public function getPaginationSelect($status = null)
37 37
     {
38 38
         $select = $this->getSql()->select()
39
-            ->columns(['title', 'body', 'longitude', 'latitude'])
39
+            ->columns([ 'title', 'body', 'longitude', 'latitude' ])
40 40
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
41
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name'])
42
-            ->where(['articles.type' => ArticleType::EVENT])
43
-            ->order(['created_at' => 'desc']);
41
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ])
42
+            ->where([ 'articles.type' => ArticleType::EVENT ])
43
+            ->order([ 'created_at' => 'desc' ]);
44 44
 
45
-        if($status) {
46
-            $select->where(['articles.status' => (int)$status]);
45
+        if ($status) {
46
+            $select->where([ 'articles.status' => (int) $status ]);
47 47
         }
48 48
 
49 49
         return $select;
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
         $select = $this->getSql()->select()
55 55
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
56 56
             ->join('category', 'category.category_uuid = articles.category_uuid',
57
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
58
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left')
59
-            ->where(['articles.article_id' => $id]);
57
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
58
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left')
59
+            ->where([ 'articles.article_id' => $id ]);
60 60
 
61 61
         return $this->selectWith($select)->current();
62 62
     }
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
         $select = $this->getSql()->select()
67 67
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
68 68
             ->join('category', 'category.category_uuid = articles.category_uuid',
69
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
70
-            ->where(['articles.slug' => $slug]);
69
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
70
+            ->where([ 'articles.slug' => $slug ]);
71 71
 
72 72
         return $this->selectWith($select)->current();
73 73
     }
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
     public function getLatest($limit = 50)
76 76
     {
77 77
         $select = $this->getSql()->select()
78
-            ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at'])
79
-            ->where(['articles.status' => 1])
80
-            ->order(['published_at' => 'desc'])
78
+            ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ])
79
+            ->where([ 'articles.status' => 1 ])
80
+            ->order([ 'published_at' => 'desc' ])
81 81
             ->limit($limit);
82 82
 
83 83
         return $this->selectWith($select);
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     public function getFuture()
87 87
     {
88 88
         $select = $this->getSql()->select()
89
-            ->where(['articles.status' => 1])
90
-            ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at'])
89
+            ->where([ 'articles.status' => 1 ])
90
+            ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ])
91 91
             ->order(new Expression('rand()'));
92 92
 
93 93
         $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s'));
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
     public function getPastSelect()
99 99
     {
100 100
         $select = $this->getSql()->select()
101
-            ->where(['articles.status' => 1])
102
-            ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at'])
103
-            ->order(['start_at' => 'desc']);
101
+            ->where([ 'articles.status' => 1 ])
102
+            ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ])
103
+            ->order([ 'start_at' => 'desc' ]);
104 104
 
105 105
         $select->where->lessThan('end_at', date('Y-m-d H:i:s'));
106 106
 
Please login to merge, or discard this patch.
packages/Article/src/Mapper/ArticleDiscussionsMapper.php 1 patch
Spacing   +8 added lines, -8 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 Article\Mapper;
6 6
 
@@ -21,21 +21,21 @@  discard block
 block discarded – undo
21 21
     public function getPaginationSelect()
22 22
     {
23 23
         return $this->getSql()->select()
24
-            ->columns(['title', 'body'])
24
+            ->columns([ 'title', 'body' ])
25 25
             ->join('articles', 'article_discussions.article_uuid = articles.article_uuid')
26
-            ->where(['articles.type' => ArticleType::DISCUSSION])
27
-            ->order(['created_at' => 'desc']);
26
+            ->where([ 'articles.type' => ArticleType::DISCUSSION ])
27
+            ->order([ 'created_at' => 'desc' ]);
28 28
     }
29 29
 
30 30
     public function get($id)
31 31
     {
32 32
         $select = $this->getSql()->select()
33
-            ->columns(['title', 'body'])
33
+            ->columns([ 'title', 'body' ])
34 34
             ->join('articles', 'article_discussions.article_uuid = articles.article_uuid')
35 35
             ->join('category', 'category.category_uuid = articles.category_uuid',
36
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
37
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left')
38
-            ->where(['articles.article_id' => $id]);
36
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
37
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left')
38
+            ->where([ 'articles.article_id' => $id ]);
39 39
 
40 40
         return $this->selectWith($select)->current();
41 41
     }
Please login to merge, or discard this patch.
packages/Article/src/Mapper/ArticlePostsMapper.php 1 patch
Spacing   +25 added lines, -25 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 Article\Mapper;
5 5
 
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
     public function getPaginationSelect()
35 35
     {
36 36
         return $this->getSql()->select()
37
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage'])
37
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage' ])
38 38
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
39
-            ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left')
40
-            ->where(['articles.type' => ArticleType::POST])
41
-            ->order(['created_at' => 'desc']);
39
+            ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left')
40
+            ->where([ 'articles.type' => ArticleType::POST ])
41
+            ->order([ 'created_at' => 'desc' ]);
42 42
     }
43 43
 
44 44
     public function get($id)
45 45
     {
46 46
         $select = $this->getSql()->select()
47
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage'])
47
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ])
48 48
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
49 49
             ->join('category', 'category.category_uuid = articles.category_uuid',
50
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
51
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left')
52
-            ->where(['articles.article_id' => $id]);
50
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
51
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left')
52
+            ->where([ 'articles.article_id' => $id ]);
53 53
 
54 54
         return $this->selectWith($select)->current();
55 55
     }
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $select = $this->getSql()->select()
60 60
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
61
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug'])
62
-            ->where(['articles.status' => 1])
61
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ])
62
+            ->where([ 'articles.status' => 1 ])
63 63
             ->limit(1);
64 64
 
65
-        if($direction > 0) {
65
+        if ($direction > 0) {
66 66
             $select->where->greaterThan('published_at', $publishedAt);
67
-            $select->order(['published_at' => 'asc']);
68
-        } elseif($direction < 0) {
67
+            $select->order([ 'published_at' => 'asc' ]);
68
+        } elseif ($direction < 0) {
69 69
             $select->where->lessThan('published_at', $publishedAt);
70
-            $select->order(['published_at' => 'desc']);
70
+            $select->order([ 'published_at' => 'desc' ]);
71 71
         }
72 72
 
73 73
         return $this->selectWith($select)->current();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $select = $this->getSql()->select()
79 79
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
80
-            ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]);
80
+            ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]);
81 81
 
82 82
         return $this->selectWith($select)->current();
83 83
     }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     public function getBySlug($slug)
86 86
     {
87 87
         $select = $this->getSql()->select()
88
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img'])
88
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ])
89 89
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
90
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug'])
91
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
92
-            ->where(['articles.slug' => $slug, 'articles.status' => 1]);
90
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ])
91
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
92
+            ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]);
93 93
 
94 94
         return $this->selectWith($select)->current();
95 95
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     public function getAll()
98 98
     {
99 99
         $select = $this->getSql()->select()
100
-            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']);
100
+            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]);
101 101
 
102 102
         return $this->selectWith($select);
103 103
     }
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $select = $this->getSql()->select()
108 108
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
109
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
109
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
110 110
             ->join('category', 'category.category_uuid = articles.category_uuid',
111
-                ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'])
112
-            ->where(['articles.status' => 1])
113
-            ->order(['articles.published_at' => 'desc'])
111
+                [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ])
112
+            ->where([ 'articles.status' => 1 ])
113
+            ->order([ 'articles.published_at' => 'desc' ])
114 114
             ->limit($limit);
115 115
 
116 116
         return $this->selectWith($select);
Please login to merge, or discard this patch.