Completed
Push — master ( d77527...b74ec4 )
by Aleksandar
19:52
created
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.
src/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   +4 added lines, -4 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
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     public function getCategories($articleId)
46 46
     {
47 47
         $select = $this->getSql()->select()
48
-            ->columns([])
49
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['name', 'slug', 'category_id'])
50
-            ->where(['articles.article_id' => $articleId]);
48
+            ->columns([ ])
49
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'name', 'slug', 'category_id' ])
50
+            ->where([ 'articles.article_id' => $articleId ]);
51 51
 
52 52
         return $this->selectWith($select);
53 53
     }
Please login to merge, or discard this patch.
src/Category/src/Mapper/CategoryMapper.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -44,6 +44,9 @@
 block discarded – undo
44 44
         return $select;
45 45
     }
46 46
 
47
+    /**
48
+     * @param integer $limit
49
+     */
47 50
     public function getCategoryPostsSelect($categoryId = null, $limit = null)
48 51
     {
49 52
         $select = $this->getSql()->select()
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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 Category\Mapper;
6 6
 
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function get($id)
36 36
     {
37
-        return $this->select(['category_id' => $id])->current();
37
+        return $this->select([ 'category_id' => $id ])->current();
38 38
     }
39 39
 
40 40
     public function getPaginationSelect()
41 41
     {
42
-        $select = $this->getSql()->select()->order(['name' => 'asc']);
42
+        $select = $this->getSql()->select()->order([ 'name' => 'asc' ]);
43 43
 
44 44
         return $select;
45 45
     }
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
     public function getCategoryPostsSelect($categoryId = null, $limit = null)
48 48
     {
49 49
         $select = $this->getSql()->select()
50
-            ->columns(['category_name' => 'name', 'category_slug' => 'slug'])
51
-            ->join('articles', 'articles.category_uuid = category.category_uuid', ['article_id', 'slug', 'admin_user_uuid', 'published_at'])
52
-            ->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', ['*'], 'right')
53
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name', 'face_img'])
54
-            ->where(['articles.status' => 1])
55
-            ->order(['published_at' => 'desc']);
56
-
57
-        if($categoryId) {
58
-            $select->where(['category_id' => $categoryId]);
50
+            ->columns([ 'category_name' => 'name', 'category_slug' => 'slug' ])
51
+            ->join('articles', 'articles.category_uuid = category.category_uuid', [ 'article_id', 'slug', 'admin_user_uuid', 'published_at' ])
52
+            ->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', [ '*' ], 'right')
53
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name', 'face_img' ])
54
+            ->where([ 'articles.status' => 1 ])
55
+            ->order([ 'published_at' => 'desc' ]);
56
+
57
+        if ($categoryId) {
58
+            $select->where([ 'category_id' => $categoryId ]);
59 59
         }
60 60
 
61
-        if($limit) {
61
+        if ($limit) {
62 62
             $select->limit($limit);
63 63
         }
64 64
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
         $select->where->notEqualTo('slug', 'videos');
75 75
         $select->where->notEqualTo('slug', 'events');
76 76
 
77
-        if($limit) {
77
+        if ($limit) {
78 78
             $select->limit($limit);
79 79
         }
80 80
 
81
-        if($order) {
81
+        if ($order) {
82 82
             $select->order($order);
83 83
         } else {
84 84
             $select->order(new Expression('rand()'));
Please login to merge, or discard this patch.