Completed
Push — master ( 66f803...88b7e8 )
by
unknown
69:50 queued 46:16
created
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.
data/phinx/seeds/ArticleEvents.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($articleEvents->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid');
19 19
         $allCategory = array_column($articleEvents->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,
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
                 'start_at'     => $faker->dateTimeBetween('now', '+5 days')->format('Y-m-d H:i:s'),
53 53
                 'end_at'       => $faker->dateTimeBetween('+5 days', '+6 days')->format('Y-m-d H:i:s'),
54 54
                 'event_url'    => 'https://www.meetup.com/Tokyo-Hello-Kitty-Meetup/',
55
-                'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))],
56
-                'main_img'     => $mainImages[rand(0, (count($mainImages) - 1))]
55
+                'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ],
56
+                'main_img'     => $mainImages[ rand(0, (count($mainImages) - 1)) ]
57 57
             ];
58 58
 
59 59
             $articleEvents->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/seeds/AdminUsers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getImages($faker, $type = 'people', $width = 400, $height = 400)
13 13
     {
14
-        $images = [];
14
+        $images = [ ];
15 15
         $conf   = include __DIR__ . "/../../../config/autoload/local.php";
16
-        $p      = $conf['upload']['public_path'];
16
+        $p      = $conf[ 'upload' ][ 'public_path' ];
17 17
         $upload = new Upload($p, '');
18 18
 
19
-        for($i = 0; $i < 5; $i++) {
19
+        for ($i = 0; $i < 5; $i++) {
20 20
             $filename = md5(rand()) . '.jpg';
21
-            $path     = $p . $filename[0] . '/' . $filename[1] . '/' . $filename[2] . '/' . $filename;
21
+            $path     = $p . $filename[ 0 ] . '/' . $filename[ 1 ] . '/' . $filename[ 2 ] . '/' . $filename;
22 22
             $upload->getPath($filename); // create sub folders
23 23
             $img = file_get_contents($faker->imageUrl(400, 400, $type));
24 24
             file_put_contents($path, $img);
25 25
 
26
-            $images[] = $upload->getWebPath($filename);
26
+            $images[ ] = $upload->getWebPath($filename);
27 27
         }
28 28
 
29 29
         return $images;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $faceImages    = $this->getImages($faker, 'people');
38 38
         $profileImages = $this->getImages($faker, 'fashion');
39 39
 
40
-        for($i = 0; $i < $count; $i++) {
40
+        for ($i = 0; $i < $count; $i++) {
41 41
             $id        = $faker->uuid;
42 42
             $mysqluuid = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
43 43
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
                 'status'          => rand(0, 1),
52 52
                 'last_login'      => rand(0, 10) === 7 ? null : $faker->dateTimeBetween('-10 days', 'now')->format('Y-m-d H:i:s'),
53 53
                 'created_at'      => $faker->dateTimeBetween('-20 days', '-10 days')->format('Y-m-d H:i:s'),
54
-                'face_img'        => $faceImages[rand(0, (count($faceImages) - 1))],
55
-                'profile_img'     => $profileImages[rand(0, (count($profileImages) - 1))]
54
+                'face_img'        => $faceImages[ rand(0, (count($faceImages) - 1)) ],
55
+                'profile_img'     => $profileImages[ rand(0, (count($profileImages) - 1)) ]
56 56
             ];
57 57
 
58 58
             $users->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/seeds/ACategory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
         $category = $this->table('category');
12 12
         $count    = rand(5, 10);
13 13
 
14
-        for($i = 0; $i < $count; $i++) {
14
+        for ($i = 0; $i < $count; $i++) {
15 15
             $id           = $faker->uuid;
16 16
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
17 17
             $categoryName = $faker->name;
Please login to merge, or discard this patch.
data/phinx/seeds/ArticleVideos.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         $allUsers    = array_column($articleVideos->getAdapter()->fetchAll('select admin_user_uuid from admin_users'), 'admin_user_uuid');
27 27
         $allCategory = array_column($articleVideos->getAdapter()->fetchAll('select category_uuid from category'), 'category_uuid');
28 28
 
29
-        for($i = 0; $i < $count; $i++) {
29
+        for ($i = 0; $i < $count; $i++) {
30 30
             // Insert Article
31 31
             $id           = $faker->uuid;
32 32
             $mysqlUuid    = (new MysqlUuid\Uuid($id))->toFormat(new MysqlUuid\Formats\Binary());
33 33
             $title        = $faker->sentence();
34
-            $userUuid     = $allUsers[rand(0, (count($allUsers) - 1))];
35
-            $categoryUuid = $allCategory[rand(0, (count($allCategory) - 1))];
34
+            $userUuid     = $allUsers[ rand(0, (count($allUsers) - 1)) ];
35
+            $categoryUuid = $allCategory[ rand(0, (count($allCategory) - 1)) ];
36 36
             $data         = [
37 37
                 'article_uuid'      => $mysqlUuid,
38 38
                 'article_id'        => $id,
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
                 'sub_title'    => $faker->sentence(),
57 57
                 'body'         => $faker->paragraph(30),
58 58
                 'lead'         => $faker->paragraph(5),
59
-                'video_url'    => self::VIDEOS[rand(0, (count(self::VIDEOS) - 1))],
60
-                'featured_img' => $featuredImages[rand(0, (count($featuredImages) - 1))],
61
-                'main_img'     => $mainImages[rand(0, (count($mainImages) - 1))]
59
+                'video_url'    => self::VIDEOS[ rand(0, (count(self::VIDEOS) - 1)) ],
60
+                'featured_img' => $featuredImages[ rand(0, (count($featuredImages) - 1)) ],
61
+                'main_img'     => $mainImages[ rand(0, (count($mainImages) - 1)) ]
62 62
             ];
63 63
 
64 64
             $articleVideos->insert($data)->save();
Please login to merge, or discard this patch.
data/phinx/migrations/20160908142829_admin_users.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        $this->table('admin_users', ['id' => false, 'primary_key' => 'admin_user_uuid'])
12
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
11
+        $this->table('admin_users', [ 'id' => false, 'primary_key' => 'admin_user_uuid' ])
12
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
13 13
             ->addColumn('admin_user_id', 'text')
14 14
             ->addColumn('first_name', 'text')
15 15
             ->addColumn('last_name', 'text')
16
-            ->addColumn('introduction', 'text', ['null' => true])
17
-            ->addColumn('biography', 'text', ['null' => true])
18
-            ->addColumn('email', 'string', ['limit' => 128])
19
-            ->addColumn('password', 'char', ['limit' => 60])
20
-            ->addColumn('status', 'integer', ['default' => 0])// 0 => not active, 1 = active
21
-            ->addColumn('face_img', 'text', ['null' => true])
22
-            ->addColumn('profile_img', 'text', ['null' => true])
23
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
24
-            ->addColumn('last_login', 'datetime', ['null' => true])
25
-            ->addIndex(['email'], ['name' => 'email_INDEX'])
16
+            ->addColumn('introduction', 'text', [ 'null' => true ])
17
+            ->addColumn('biography', 'text', [ 'null' => true ])
18
+            ->addColumn('email', 'string', [ 'limit' => 128 ])
19
+            ->addColumn('password', 'char', [ 'limit' => 60 ])
20
+            ->addColumn('status', 'integer', [ 'default' => 0 ])// 0 => not active, 1 = active
21
+            ->addColumn('face_img', 'text', [ 'null' => true ])
22
+            ->addColumn('profile_img', 'text', [ 'null' => true ])
23
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
24
+            ->addColumn('last_login', 'datetime', [ 'null' => true ])
25
+            ->addIndex([ 'email' ], [ 'name' => 'email_INDEX' ])
26 26
             ->create();
27 27
 
28 28
         // Insert one default admin user with password testtest
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     private function getImage($faker, $type = 'people', $width = 400, $height = 400)
52 52
     {
53 53
         $conf     = include __DIR__ . "/../../../config/autoload/local.php";
54
-        $p        = $conf['upload']['public_path'];
54
+        $p        = $conf[ 'upload' ][ 'public_path' ];
55 55
         $upload   = new \UploadHelper\Upload($p, '');
56 56
         $filename = md5(rand()) . '.jpg';
57
-        $path     = $p . $filename[0] . '/' . $filename[1] . '/' . $filename[2] . '/' . $filename;
57
+        $path     = $p . $filename[ 0 ] . '/' . $filename[ 1 ] . '/' . $filename[ 2 ] . '/' . $filename;
58 58
         $upload->getPath($filename); // create sub folders
59 59
         $img = file_get_contents($faker->imageUrl(400, 400, $type));
60 60
         file_put_contents($path, $img);
Please login to merge, or discard this patch.
packages/Article/src/Mapper/ArticleMapper.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Zend\Db\Adapter\AdapterAwareInterface;
8 8
 use Zend\Db\TableGateway\AbstractTableGateway;
9 9
 use Zend\Db\Sql\Delete;
10
-use Zend\Db\Sql\Insert;
11 10
 
12 11
 /**
13 12
  * Class ArticleMapper.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
     public function getCategories($articleId)
45 45
     {
46 46
         $select = $this->getSql()->select()
47
-            ->columns([])
48
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['name', 'slug', 'category_id'])
49
-            ->where(['articles.article_id' => $articleId]);
47
+            ->columns([ ])
48
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'name', 'slug', 'category_id' ])
49
+            ->where([ 'articles.article_id' => $articleId ]);
50 50
 
51 51
         return $this->selectWith($select);
52 52
     }
Please login to merge, or discard this patch.
packages/Article/src/Service/EventService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -63,6 +63,9 @@
 block discarded – undo
63 63
         return $this->getPagination($select, $page, $limit);
64 64
     }
65 65
 
66
+    /**
67
+     * @param integer $limit
68
+     */
66 69
     public function fetchLatest($limit)
67 70
     {
68 71
         return $this->articleEventsMapper->getLatest($limit);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 
102 102
         $article = $articleFilter->getValues();
103 103
         $article += [
104
-            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']),
104
+            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]),
105 105
             'type' => ArticleType::EVENT,
106 106
             'article_id' => $id,
107 107
             'article_uuid' => $uuId
108 108
         ];
109
-        unset($article['admin_user_id']);
109
+        unset($article[ 'admin_user_id' ]);
110 110
 
111
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
112
-        unset($article['category_id']);
111
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
112
+        unset($article[ 'category_id' ]);
113 113
 
114 114
         $event = $eventFilter->getValues() + [
115 115
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
             throw new FilterException($articleFilter->getMessages() + $eventFilter->getMessages());
132 132
         }
133 133
 
134
-        $article = $articleFilter->getValues() + ['article_uuid' => $oldArticle->article_uuid];
134
+        $article = $articleFilter->getValues() + [ 'article_uuid' => $oldArticle->article_uuid ];
135 135
         $event = $eventFilter->getValues() + [
136 136
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
137 137
                 'main_img' => $this->upload->uploadImage($data, 'main_img')
138 138
             ];
139 139
 
140
-        $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']);
141
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
142
-        unset($article['category_id'], $article['admin_user_id']);
140
+        $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]);
141
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
142
+        unset($article[ 'category_id' ], $article[ 'admin_user_id' ]);
143 143
 
144 144
         // We don't want to force user to re-upload image on edit
145
-        if (!$event['featured_img']) {
146
-            unset($event['featured_img']);
145
+        if (!$event[ 'featured_img' ]) {
146
+            unset($event[ 'featured_img' ]);
147 147
         } else {
148 148
             $this->upload->deleteFile($oldArticle->featured_img);
149 149
         }
150 150
 
151
-        if (!$event['main_img']) {
152
-            unset($event['main_img']);
151
+        if (!$event[ 'main_img' ]) {
152
+            unset($event[ 'main_img' ]);
153 153
         } else {
154 154
             $this->upload->deleteFile($oldArticle->main_img);
155 155
         }
156 156
 
157
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
158
-        $this->articleEventsMapper->update($event, ['article_uuid' => $article['article_uuid']]);
157
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
158
+        $this->articleEventsMapper->update($event, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
159 159
     }
160 160
 
161 161
     public function deleteArticle($id)
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $this->upload->deleteFile($event->main_img);
170 170
         $this->upload->deleteFile($event->featured_img);
171
-        $this->articleEventsMapper->delete(['article_uuid' => $event->article_uuid]);
171
+        $this->articleEventsMapper->delete([ 'article_uuid' => $event->article_uuid ]);
172 172
         $this->delete($event->article_uuid);
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
packages/Article/src/Service/PostService.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -203,6 +203,9 @@
 block discarded – undo
203 203
         return $this->articleMapper->getCategories($articleId);
204 204
     }
205 205
 
206
+    /**
207
+     * @param integer $limit
208
+     */
206 209
     public function getLatestWeb($limit)
207 210
     {
208 211
         return $this->articlePostsMapper->getLatest($limit);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 
138 138
         $article = $articleFilter->getValues();
139 139
         $article += [
140
-            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']),
140
+            'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]),
141 141
             'type' => ArticleType::POST,
142 142
             'article_id' => $id,
143 143
             'article_uuid' => $uuId
144 144
         ];
145 145
 
146
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
147
-        unset($article['category_id'], $article['admin_user_id']);
146
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
147
+        unset($article[ 'category_id' ], $article[ 'admin_user_id' ]);
148 148
 
149 149
         $post = $postFilter->getValues() + [
150 150
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
151 151
                 'main_img' => $this->upload->uploadImage($data, 'main_img'),
152
-                'article_uuid' => $article['article_uuid']
152
+                'article_uuid' => $article[ 'article_uuid' ]
153 153
             ];
154 154
 
155 155
         $this->articleMapper->insert($article);
@@ -166,31 +166,31 @@  discard block
 block discarded – undo
166 166
             throw new FilterException($articleFilter->getMessages() + $postFilter->getMessages());
167 167
         }
168 168
 
169
-        $article = $articleFilter->getValues() + ['article_uuid' => $oldArticle->article_uuid];
169
+        $article = $articleFilter->getValues() + [ 'article_uuid' => $oldArticle->article_uuid ];
170 170
         $post = $postFilter->getValues() + [
171 171
                 'featured_img' => $this->upload->uploadImage($data, 'featured_img'),
172 172
                 'main_img' => $this->upload->uploadImage($data, 'main_img')
173 173
             ];
174 174
 
175
-        $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']);
176
-        $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid;
177
-        unset($article['category_id'], $article['admin_user_id']);
175
+        $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]);
176
+        $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid;
177
+        unset($article[ 'category_id' ], $article[ 'admin_user_id' ]);
178 178
 
179 179
         // We don't want to force user to re-upload image on edit
180
-        if (!$post['featured_img']) {
181
-            unset($post['featured_img']);
180
+        if (!$post[ 'featured_img' ]) {
181
+            unset($post[ 'featured_img' ]);
182 182
         } else {
183 183
             $this->upload->deleteFile($oldArticle->featured_img);
184 184
         }
185 185
 
186
-        if (!$post['main_img']) {
187
-            unset($post['main_img']);
186
+        if (!$post[ 'main_img' ]) {
187
+            unset($post[ 'main_img' ]);
188 188
         } else {
189 189
             $this->upload->deleteFile($oldArticle->main_img);
190 190
         }
191 191
 
192
-        $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]);
193
-        $this->articlePostsMapper->update($post, ['article_uuid' => $article['article_uuid']]);
192
+        $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
193
+        $this->articlePostsMapper->update($post, [ 'article_uuid' => $article[ 'article_uuid' ] ]);
194 194
     }
195 195
 
196 196
     public function deleteArticle($id)
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
         $this->upload->deleteFile($post->main_img);
205 205
         $this->upload->deleteFile($post->featured_img);
206
-        $this->articlePostsMapper->delete(['article_uuid' => $post->article_uuid]);
206
+        $this->articlePostsMapper->delete([ 'article_uuid' => $post->article_uuid ]);
207 207
         $this->delete($post->article_uuid);
208 208
     }
209 209
 
Please login to merge, or discard this patch.