@@ -44,6 +44,9 @@ |
||
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() |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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()')); |
@@ -12,24 +12,24 @@ discard block |
||
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 |
||
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; |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getCategoryIds($articleId) |
33 | 33 | { |
34 | - $categories = []; |
|
35 | - foreach($this->articleMapper->getCategories($articleId) as $category) { |
|
36 | - $categories[] = $category->category_id; |
|
34 | + $categories = [ ]; |
|
35 | + foreach ($this->articleMapper->getCategories($articleId) as $category) { |
|
36 | + $categories[ ] = $category->category_id; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $categories; |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | |
42 | 42 | public function delete($articleId) |
43 | 43 | { |
44 | - $this->articleMapper->delete(['article_uuid' => $articleId]); |
|
44 | + $this->articleMapper->delete([ 'article_uuid' => $articleId ]); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -10,20 +10,20 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function up() |
12 | 12 | { |
13 | - $this->table('article_events', ['id' => false]) |
|
14 | - ->addColumn('article_uuid', 'binary', ['limit' => 16]) |
|
13 | + $this->table('article_events', [ 'id' => false ]) |
|
14 | + ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ]) |
|
15 | 15 | ->addColumn('title', 'text') |
16 | - ->addColumn('sub_title', 'text', ['null' => true]) |
|
16 | + ->addColumn('sub_title', 'text', [ 'null' => true ]) |
|
17 | 17 | ->addColumn('place_name', 'text') |
18 | 18 | ->addColumn('body', 'text') |
19 | 19 | ->addColumn('longitude', 'text') |
20 | 20 | ->addColumn('latitude', 'text') |
21 | - ->addColumn('featured_img', 'text', ['null' => true]) |
|
22 | - ->addColumn('main_img', 'text', ['null' => true]) |
|
21 | + ->addColumn('featured_img', 'text', [ 'null' => true ]) |
|
22 | + ->addColumn('main_img', 'text', [ 'null' => true ]) |
|
23 | 23 | ->addColumn('start_at', 'datetime') |
24 | 24 | ->addColumn('end_at', 'datetime') |
25 | - ->addColumn('event_url', 'text', ['null' => true]) |
|
26 | - ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
25 | + ->addColumn('event_url', 'text', [ 'null' => true ]) |
|
26 | + ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
27 | 27 | ->create(); |
28 | 28 | |
29 | 29 | // $this->insertDummyData(); |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | |
37 | 37 | private function insertDummyData() |
38 | 38 | { |
39 | - $ids = []; |
|
39 | + $ids = [ ]; |
|
40 | 40 | $rows = $this->fetchAll('select admin_user_uuid from admin_users;'); |
41 | - foreach($rows as $r){ |
|
42 | - $ids[] = $r['admin_user_uuid']; |
|
41 | + foreach ($rows as $r) { |
|
42 | + $ids[ ] = $r[ 'admin_user_uuid' ]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $faker = Faker\Factory::create(); |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | $count = rand(25, 300); |
48 | 48 | |
49 | 49 | // Download N images and set it randomly to the events |
50 | - for($i = 0; $i < 5; $i++){ |
|
50 | + for ($i = 0; $i < 5; $i++) { |
|
51 | 51 | $image = $faker->image(); |
52 | 52 | $destination = $upload->getPath(basename($image)); |
53 | 53 | rename($image, $destination); |
54 | - $mainImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
54 | + $mainImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
55 | 55 | |
56 | 56 | $image = $faker->image(); |
57 | 57 | $destination = $upload->getPath(basename($image)); |
58 | 58 | rename($image, $destination); |
59 | - $featuredImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
59 | + $featuredImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
60 | 60 | } |
61 | 61 | |
62 | - for($i = 0; $i < $count; $i++){ |
|
62 | + for ($i = 0; $i < $count; $i++) { |
|
63 | 63 | $start = rand(1, 20); |
64 | 64 | $id = $faker->uuid; |
65 | 65 | $mysqluuid = (new Uuid($id))->toFormat(new Binary()); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'article_id' => $id, |
71 | 71 | 'slug' => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')), |
72 | 72 | 'status' => 1, |
73 | - 'admin_user_uuid' => $ids[array_rand($ids)], |
|
73 | + 'admin_user_uuid' => $ids[ array_rand($ids) ], |
|
74 | 74 | 'type' => ArticleType::EVENT |
75 | 75 | ]; |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | 'longitude' => $faker->longitude, |
82 | 82 | 'latitude' => $faker->latitude, |
83 | 83 | 'place_name' => $faker->sentence(1), |
84 | - 'main_img' => $mainImg[array_rand($mainImg)], |
|
85 | - 'featured_img' => $featuredImg[array_rand($featuredImg)], |
|
84 | + 'main_img' => $mainImg[ array_rand($mainImg) ], |
|
85 | + 'featured_img' => $featuredImg[ array_rand($featuredImg) ], |
|
86 | 86 | 'start_at' => date("Y-m-d H:i:s", strtotime("+$start day +$start hours")), |
87 | 87 | 'end_at' => date("Y-m-d H:i:s", strtotime("+$start day +" . ($start + rand(1, 5)) . " hours")) |
88 | 88 | ]; |
@@ -6,21 +6,21 @@ |
||
6 | 6 | { |
7 | 7 | public function up() |
8 | 8 | { |
9 | - $this->table('articles', ['id' => false, 'primary_key' => 'article_uuid']) |
|
10 | - ->addColumn('article_uuid', 'binary', ['limit' => 16]) |
|
9 | + $this->table('articles', [ 'id' => false, 'primary_key' => 'article_uuid' ]) |
|
10 | + ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ]) |
|
11 | 11 | ->addColumn('article_id', 'text') |
12 | - ->addColumn('slug', 'text', ['null' => true]) |
|
13 | - ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP']) |
|
14 | - ->addColumn('published_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP']) |
|
12 | + ->addColumn('slug', 'text', [ 'null' => true ]) |
|
13 | + ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ]) |
|
14 | + ->addColumn('published_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ]) |
|
15 | 15 | ->addColumn('type', 'integer')// see Core\Entity\ArticleType |
16 | 16 | ->addColumn('status', 'integer')// active, not active, ... |
17 | - ->addColumn('admin_user_uuid', 'binary', ['limit' => 16]) |
|
18 | - ->addColumn('is_wysiwyg_editor', 'boolean', ['default' => false]) |
|
19 | - ->addColumn('category_uuid', 'binary', ['limit' => 16]) |
|
20 | - ->addForeignKey('category_uuid', 'category', 'category_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
21 | - ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
22 | - ->addIndex('type', ['name' => 'type_INDEX']) |
|
23 | - ->addIndex('published_at', ['name' => 'published_at_INDEX']) |
|
17 | + ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ]) |
|
18 | + ->addColumn('is_wysiwyg_editor', 'boolean', [ 'default' => false ]) |
|
19 | + ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ]) |
|
20 | + ->addForeignKey('category_uuid', 'category', 'category_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
21 | + ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
22 | + ->addIndex('type', [ 'name' => 'type_INDEX' ]) |
|
23 | + ->addIndex('published_at', [ 'name' => 'published_at_INDEX' ]) |
|
24 | 24 | ->create(); |
25 | 25 | } |
26 | 26 |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function up() |
12 | 12 | { |
13 | - $this->table('article_posts', ['id' => false]) |
|
14 | - ->addColumn('article_uuid', 'binary', ['limit' => 16]) |
|
13 | + $this->table('article_posts', [ 'id' => false ]) |
|
14 | + ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ]) |
|
15 | 15 | ->addColumn('title', 'text') |
16 | 16 | ->addColumn('body', 'text') |
17 | 17 | ->addColumn('lead', 'text') |
18 | - ->addColumn('featured_img', 'text', ['null' => true]) |
|
19 | - ->addColumn('main_img', 'text', ['null' => true]) |
|
20 | - ->addColumn('has_layout', 'boolean', ['default' => true]) |
|
21 | - ->addColumn('is_homepage', 'boolean', ['default' => false]) |
|
22 | - ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
18 | + ->addColumn('featured_img', 'text', [ 'null' => true ]) |
|
19 | + ->addColumn('main_img', 'text', [ 'null' => true ]) |
|
20 | + ->addColumn('has_layout', 'boolean', [ 'default' => true ]) |
|
21 | + ->addColumn('is_homepage', 'boolean', [ 'default' => false ]) |
|
22 | + ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
23 | 23 | ->create(); |
24 | 24 | |
25 | 25 | // $this->insertDummyData(); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | private function insertDummyData() |
34 | 34 | { |
35 | - $ids = []; |
|
35 | + $ids = [ ]; |
|
36 | 36 | $rows = $this->fetchAll('select admin_user_uuid from admin_users;'); |
37 | - foreach($rows as $r) { |
|
38 | - $ids[] = $r['admin_user_uuid']; |
|
37 | + foreach ($rows as $r) { |
|
38 | + $ids[ ] = $r[ 'admin_user_uuid' ]; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $faker = Faker\Factory::create(); |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $count = rand(25, 300); |
44 | 44 | |
45 | 45 | // Download N images and set it randomly to posts |
46 | - for($i = 0; $i < 5; $i++) { |
|
46 | + for ($i = 0; $i < 5; $i++) { |
|
47 | 47 | $image = $faker->image(); |
48 | 48 | $destination = $upload->getPath(basename($image)); |
49 | 49 | rename($image, $destination); |
50 | - $mainImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
50 | + $mainImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
51 | 51 | |
52 | 52 | $image = $faker->image(); |
53 | 53 | $destination = $upload->getPath(basename($image)); |
54 | 54 | rename($image, $destination); |
55 | - $featuredImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
55 | + $featuredImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
56 | 56 | } |
57 | 57 | |
58 | - for($i = 0; $i < $count; $i++) { |
|
58 | + for ($i = 0; $i < $count; $i++) { |
|
59 | 59 | $id = $faker->uuid; |
60 | 60 | $mysqluuid = (new Uuid($id))->toFormat(new Binary()); |
61 | 61 | $title = $faker->sentence(7, 20); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'article_id' => $id, |
66 | 66 | 'slug' => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')), |
67 | 67 | 'status' => 1, |
68 | - 'admin_user_uuid' => $ids[array_rand($ids)], |
|
68 | + 'admin_user_uuid' => $ids[ array_rand($ids) ], |
|
69 | 69 | 'type' => ArticleType::POST |
70 | 70 | ]; |
71 | 71 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | 'title' => $title, |
75 | 75 | 'body' => $faker->paragraph(15), |
76 | 76 | 'lead' => $faker->paragraph(5), |
77 | - 'main_img' => $mainImg[array_rand($mainImg)], |
|
78 | - 'featured_img' => $featuredImg[array_rand($featuredImg)] |
|
77 | + 'main_img' => $mainImg[ array_rand($mainImg) ], |
|
78 | + 'featured_img' => $featuredImg[ array_rand($featuredImg) ] |
|
79 | 79 | ]; |
80 | 80 | |
81 | 81 | $this->insert('articles', $article); |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function up() |
12 | 12 | { |
13 | - $this->table('article_videos', ['id' => false]) |
|
14 | - ->addColumn('article_uuid', 'binary', ['limit' => 16]) |
|
13 | + $this->table('article_videos', [ 'id' => false ]) |
|
14 | + ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ]) |
|
15 | 15 | ->addColumn('title', 'text') |
16 | - ->addColumn('sub_title', 'text', ['null' => true]) |
|
16 | + ->addColumn('sub_title', 'text', [ 'null' => true ]) |
|
17 | 17 | ->addColumn('body', 'text') |
18 | 18 | ->addColumn('lead', 'text') |
19 | 19 | ->addColumn('video_url', 'text') |
20 | - ->addColumn('featured_img', 'text', ['null' => true]) |
|
21 | - ->addColumn('main_img', 'text', ['null' => true]) |
|
22 | - ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
20 | + ->addColumn('featured_img', 'text', [ 'null' => true ]) |
|
21 | + ->addColumn('main_img', 'text', [ 'null' => true ]) |
|
22 | + ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
23 | 23 | ->create(); |
24 | 24 | |
25 | 25 | // $this->insertDummyData(); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | private function insertDummyData() |
34 | 34 | { |
35 | - $ids = []; |
|
35 | + $ids = [ ]; |
|
36 | 36 | $rows = $this->fetchAll('select admin_user_uuid from admin_users;'); |
37 | - foreach($rows as $r) { |
|
38 | - $ids[] = $r['admin_user_uuid']; |
|
37 | + foreach ($rows as $r) { |
|
38 | + $ids[ ] = $r[ 'admin_user_uuid' ]; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $faker = Faker\Factory::create(); |
@@ -48,19 +48,19 @@ discard block |
||
48 | 48 | ]; |
49 | 49 | |
50 | 50 | // Download N images and set it randomly to posts |
51 | - for($i = 0; $i < 5; $i++) { |
|
51 | + for ($i = 0; $i < 5; $i++) { |
|
52 | 52 | $image = $faker->image(); |
53 | 53 | $destination = $upload->getPath(basename($image)); |
54 | 54 | rename($image, $destination); |
55 | - $mainImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
55 | + $mainImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
56 | 56 | |
57 | 57 | $image = $faker->image(); |
58 | 58 | $destination = $upload->getPath(basename($image)); |
59 | 59 | rename($image, $destination); |
60 | - $featuredImg[] = substr($destination, strlen('/var/www/unfinished/public')); |
|
60 | + $featuredImg[ ] = substr($destination, strlen('/var/www/unfinished/public')); |
|
61 | 61 | } |
62 | 62 | |
63 | - for($i = 0; $i < $count; $i++) { |
|
63 | + for ($i = 0; $i < $count; $i++) { |
|
64 | 64 | $id = $faker->uuid; |
65 | 65 | $mysqluuid = (new Uuid($id))->toFormat(new Binary()); |
66 | 66 | $title = $faker->sentence(7, 20); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'article_id' => $id, |
71 | 71 | 'slug' => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')), |
72 | 72 | 'status' => 1, |
73 | - 'admin_user_uuid' => $ids[array_rand($ids)], |
|
73 | + 'admin_user_uuid' => $ids[ array_rand($ids) ], |
|
74 | 74 | 'type' => ArticleType::POST |
75 | 75 | ]; |
76 | 76 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | 'title' => $title, |
80 | 80 | 'body' => $faker->paragraph(15), |
81 | 81 | 'lead' => $faker->paragraph(5), |
82 | - 'main_img' => $mainImg[array_rand($mainImg)], |
|
83 | - 'featured_img' => $featuredImg[array_rand($featuredImg)], |
|
84 | - 'video_url' => $embedCodes[rand(0, 2)] |
|
82 | + 'main_img' => $mainImg[ array_rand($mainImg) ], |
|
83 | + 'featured_img' => $featuredImg[ array_rand($featuredImg) ], |
|
84 | + 'video_url' => $embedCodes[ rand(0, 2) ] |
|
85 | 85 | ]; |
86 | 86 | |
87 | 87 | $this->insert('articles', $article); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Web\Action; |
6 | 6 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function __invoke(Request $request, Response $response, callable $next = null) |
54 | 54 | { |
55 | 55 | $params = $request->getQueryParams(); |
56 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
56 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
57 | 57 | $futureEvents = $this->eventService->fetchFutureEvents(); |
58 | 58 | $pastEvents = $this->eventService->fetchPastEventsPagination($page, 10); |
59 | 59 |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | public function getInputFilter() |
21 | 21 | { |
22 | - if(!$this->inputFilter){ |
|
22 | + if (!$this->inputFilter) { |
|
23 | 23 | $inputFilter = new InputFilter(); |
24 | 24 | |
25 | 25 | $inputFilter->add([ |
26 | 26 | 'name' => 'first_name', |
27 | 27 | 'required' => true, |
28 | - 'filters' => [['name' => 'StringTrim']], |
|
28 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
29 | 29 | 'validators' => [ |
30 | - ['name' => 'NotEmpty'], |
|
31 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
30 | + [ 'name' => 'NotEmpty' ], |
|
31 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
32 | 32 | ], |
33 | 33 | ]); |
34 | 34 | |
35 | 35 | $inputFilter->add([ |
36 | 36 | 'name' => 'last_name', |
37 | 37 | 'required' => true, |
38 | - 'filters' => [['name' => 'StringTrim']], |
|
38 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
39 | 39 | 'validators' => [ |
40 | - ['name' => 'NotEmpty'], |
|
41 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
40 | + [ 'name' => 'NotEmpty' ], |
|
41 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
42 | 42 | ], |
43 | 43 | ]); |
44 | 44 | |
45 | 45 | $inputFilter->add([ |
46 | 46 | 'name' => 'email', |
47 | 47 | 'required' => true, |
48 | - 'filters' => [['name' => 'StringTrim']], |
|
48 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
49 | 49 | 'validators' => [ |
50 | - ['name' => 'NotEmpty'], |
|
51 | - ['name' => 'EmailAddress'], |
|
52 | - ['name' => 'dbnorecordexists', 'options' => ['adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email']], |
|
50 | + [ 'name' => 'NotEmpty' ], |
|
51 | + [ 'name' => 'EmailAddress' ], |
|
52 | + [ 'name' => 'dbnorecordexists', 'options' => [ 'adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email' ] ], |
|
53 | 53 | |
54 | 54 | ], |
55 | 55 | ]); |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | $inputFilter->add([ |
58 | 58 | 'name' => 'introduction', |
59 | 59 | 'required' => false, |
60 | - 'filters' => [['name' => 'StringTrim']] |
|
60 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
61 | 61 | ]); |
62 | 62 | |
63 | 63 | $inputFilter->add([ |
64 | 64 | 'name' => 'biography', |
65 | 65 | 'required' => false, |
66 | - 'filters' => [['name' => 'StringTrim']] |
|
66 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
67 | 67 | ]); |
68 | 68 | |
69 | 69 | $inputFilter->add([ |
70 | 70 | 'name' => 'password', |
71 | 71 | 'required' => true, |
72 | 72 | 'validators' => [ |
73 | - ['name' => 'NotEmpty'], |
|
74 | - ['name' => 'StringLength', 'options' => ['min' => 7, 'max' => 255]] |
|
73 | + [ 'name' => 'NotEmpty' ], |
|
74 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 7, 'max' => 255 ] ] |
|
75 | 75 | ], |
76 | 76 | ]); |
77 | 77 | |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | 'name' => 'confirm_password', |
80 | 80 | 'required' => true, |
81 | 81 | 'validators' => [ |
82 | - ['name' => 'NotEmpty'], |
|
83 | - ['name' => 'Identical', 'options' => ['token' => 'password']], |
|
82 | + [ 'name' => 'NotEmpty' ], |
|
83 | + [ 'name' => 'Identical', 'options' => [ 'token' => 'password' ] ], |
|
84 | 84 | ], |
85 | 85 | ]); |
86 | 86 | |
87 | 87 | $inputFilter->add([ |
88 | 88 | 'name' => 'status', |
89 | 89 | 'required' => true, |
90 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Digits']] |
|
90 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Digits' ] ] |
|
91 | 91 | ]); |
92 | 92 | |
93 | 93 | $this->inputFilter = $inputFilter; |