Completed
Push — master ( d77527...b74ec4 )
by Aleksandar
19:52
created
src/Newsletter/src/Web/Action/HandlePostActionFactory.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 Newsletter\Web\Action;
6 6
 
Please login to merge, or discard this patch.
src/Newsletter/src/Web/Action/HandlePostAction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
     {
21 21
         try {
22 22
             $data  = $request->getParsedBody();
23
-            $email = isset($data['email']) ? $data['email'] : null;
23
+            $email = isset($data[ 'email' ]) ? $data[ 'email' ] : null;
24 24
 
25 25
             $this->newsletterService->registerNew($email);
26 26
 
27
-            return new JsonResponse(['message' => 'Uspešno ste se prijavili.']);
27
+            return new JsonResponse([ 'message' => 'Uspešno ste se prijavili.' ]);
28 28
         }
29
-        catch(\Exception $e) {
30
-            return new JsonResponse(['message' => $e->getMessage()], $e->getCode());
29
+        catch (\Exception $e) {
30
+            return new JsonResponse([ 'message' => $e->getMessage() ], $e->getCode());
31 31
         }
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
src/Newsletter/src/Service/NewsletterServiceFactory.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 Newsletter\Service;
6 6
 
Please login to merge, or discard this patch.
src/Newsletter/src/Service/NewsletterService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
 
16 16
     public function registerNew($email)
17 17
     {
18
-        if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
18
+        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
19 19
             throw new \Exception('Email is not valid!', 400);
20 20
         }
21 21
 
22
-        $current = $this->newsletterMapper->select(['email' => $email])->current();
22
+        $current = $this->newsletterMapper->select([ 'email' => $email ])->current();
23 23
 
24
-        if(!$current) {
25
-            return $this->newsletterMapper->insert(['email' => $email]);
24
+        if (!$current) {
25
+            return $this->newsletterMapper->insert([ 'email' => $email ]);
26 26
         }
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Newsletter/src/ConfigProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
         return [
10 10
             'templates' => [
11 11
                 'paths' => [
12
-                    'newsletter' => [__DIR__ . '/../templates/newsletter'],
12
+                    'newsletter' => [ __DIR__ . '/../templates/newsletter' ],
13 13
                 ],
14 14
             ],
15 15
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                     'name'            => 'newsletter-post',
27 27
                     'path'            => '/newsletter',
28 28
                     'middleware'      => Web\Action\HandlePostAction::class,
29
-                    'allowed_methods' => ['POST'],
29
+                    'allowed_methods' => [ 'POST' ],
30 30
                 ],
31 31
             ],
32 32
         ];
Please login to merge, or discard this patch.
data/phinx/migrations/20170523131220_newsletter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
     public function change()
9 9
     {
10
-        $this->table('newsletter', ['id' => false])
10
+        $this->table('newsletter', [ 'id' => false ])
11 11
             ->addColumn('email', 'text')
12
-            ->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP'])
12
+            ->addColumn('created_at', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP' ])
13 13
             ->create();
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
src/Article/src/Service/VideoService.php 1 patch
Spacing   +19 added lines, -19 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\Service;
6 6
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
107 107
         $videosFilter  = $this->videosFilter->getInputFilter()->setData($data);
108 108
 
109
-        if(!$articleFilter->isValid() || !$videosFilter->isValid()) {
109
+        if (!$articleFilter->isValid() || !$videosFilter->isValid()) {
110 110
             throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages());
111 111
         }
112 112
 
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 
116 116
         $article = $articleFilter->getValues();
117 117
         $article += [
118
-            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']),
118
+            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]),
119 119
             'type'            => ArticleType::VIDEO,
120 120
             'article_id'      => $id,
121 121
             'article_uuid'    => $uuId
122 122
         ];
123 123
 
124
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
125
-        unset($article['category_id'], $article['admin_user_id']);
124
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
125
+        unset($article[ 'category_id' ], $article[ 'admin_user_id' ]);
126 126
 
127 127
         $videos = $videosFilter->getValues() + [
128 128
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
         $articleFilter = $this->articleFilter->getInputFilter()->setData($data);
141 141
         $videosFilter  = $this->videosFilter->getInputFilter()->setData($data);
142 142
 
143
-        if(!$articleFilter->isValid() || !$videosFilter->isValid()) {
143
+        if (!$articleFilter->isValid() || !$videosFilter->isValid()) {
144 144
             throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages());
145 145
         }
146 146
 
147
-        $article                    = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid];
148
-        $article['category_uuid']   = $this->categoryMapper->get($article['category_id'])->category_uuid;
149
-        $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']);
150
-        unset($article['category_id']);
151
-        unset($article['admin_user_id']);
147
+        $article                    = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ];
148
+        $article[ 'category_uuid' ]   = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
149
+        $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]);
150
+        unset($article[ 'category_id' ]);
151
+        unset($article[ 'admin_user_id' ]);
152 152
 
153 153
         $videos = $videosFilter->getValues() + [
154 154
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
@@ -156,27 +156,27 @@  discard block
 block discarded – undo
156 156
             ];
157 157
 
158 158
         // We dont want to force user to re-upload image on edit
159
-        if(!$videos['featured_img']) {
160
-            unset($videos['featured_img']);
159
+        if (!$videos[ 'featured_img' ]) {
160
+            unset($videos[ 'featured_img' ]);
161 161
         }
162 162
 
163
-        if(!$videos['main_img']) {
164
-            unset($videos['main_img']);
163
+        if (!$videos[ 'main_img' ]) {
164
+            unset($videos[ 'main_img' ]);
165 165
         }
166 166
 
167
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
168
-        $this->articleVideosMapper->update($videos, ['article_uuid' => $article['article_uuid']]);
167
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
168
+        $this->articleVideosMapper->update($videos, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
169 169
     }
170 170
 
171 171
     public function deleteArticle($id)
172 172
     {
173 173
         $video = $this->articleVideosMapper->get($id);
174 174
 
175
-        if(!$video) {
175
+        if (!$video) {
176 176
             throw new \Exception('Article not found!');
177 177
         }
178 178
 
179
-        $this->articleVideosMapper->delete(['article_uuid' => $video->article_uuid]);
179
+        $this->articleVideosMapper->delete([ 'article_uuid' => $video->article_uuid ]);
180 180
         $this->delete($video->article_uuid);
181 181
     }
182 182
 
Please login to merge, or discard this patch.
src/Article/src/Mapper/ArticleVideosMapper.php 1 patch
Spacing   +15 added lines, -15 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,13 +34,13 @@  discard block
 block discarded – undo
34 34
     public function getPaginationSelect($isActive = null)
35 35
     {
36 36
         $select = $this->getSql()->select()
37
-            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['slug', 'published_at', 'status', 'article_id'])
38
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name'])
39
-            ->where(['articles.type' => ArticleType::VIDEO])
40
-            ->order(['articles.created_at' => 'desc']);
37
+            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'slug', 'published_at', 'status', 'article_id' ])
38
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ])
39
+            ->where([ 'articles.type' => ArticleType::VIDEO ])
40
+            ->order([ 'articles.created_at' => 'desc' ]);
41 41
 
42
-        if($isActive !== null) {
43
-            $select->where(['articles.status' => (int)$isActive]);
42
+        if ($isActive !== null) {
43
+            $select->where([ 'articles.status' => (int) $isActive ]);
44 44
         }
45 45
 
46 46
         return $select;
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
     public function get($id)
50 50
     {
51 51
         $select = $this->getSql()->select()
52
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title'])
52
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ])
53 53
             ->join('articles', 'article_videos.article_uuid = articles.article_uuid')
54 54
             ->join('category', 'category.category_uuid = articles.category_uuid',
55
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
56
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left')
57
-            ->where(['articles.article_id' => $id]);
55
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
56
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left')
57
+            ->where([ 'articles.article_id' => $id ]);
58 58
 
59 59
         return $this->selectWith($select)->current();
60 60
     }
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     public function getLatest($limit = 50)
63 63
     {
64 64
         $select = $this->getSql()->select()
65
-            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at'])
66
-            ->where(['articles.status' => 1])
67
-            ->order(['published_at' => 'desc'])
65
+            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ])
66
+            ->where([ 'articles.status' => 1 ])
67
+            ->order([ 'published_at' => 'desc' ])
68 68
             ->limit($limit);
69 69
 
70 70
         return $this->selectWith($select);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $select = $this->getSql()->select()
76 76
             ->join('articles', 'article_videos.article_uuid = articles.article_uuid')
77
-            ->where(['articles.slug' => $slug]);
77
+            ->where([ 'articles.slug' => $slug ]);
78 78
 
79 79
         return $this->selectWith($select)->current();
80 80
     }
Please login to merge, or discard this patch.
src/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.