@@ -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 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function __invoke(Request $request, Response $response, callable $next = null): HtmlResponse |
47 | 47 | { |
48 | 48 | // Set custom html from view file |
49 | - return new HtmlResponse($this->template->render('web::home', ['layout' => 'layout/web'])); |
|
49 | + return new HtmlResponse($this->template->render('web::home', [ 'layout' => 'layout/web' ])); |
|
50 | 50 | |
51 | 51 | //$article = $this->postService->getHomepage(); |
52 | 52 | // |
@@ -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, 3); |
59 | 59 |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $urlSlug1 = $request->getAttribute('segment_1'); |
49 | 49 | $urlSlug2 = $request->getAttribute('segment_2'); |
50 | 50 | |
51 | - if($urlSlug2) { |
|
51 | + if ($urlSlug2) { |
|
52 | 52 | $categorySlug = $urlSlug1; |
53 | 53 | $postSlug = $urlSlug2; |
54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | list($previousPost, $nextPost) = $this->postService->fetchNearestArticle($post->published_at); |
63 | 63 | |
64 | - if(!$post) { |
|
64 | + if (!$post) { |
|
65 | 65 | $response = $response->withStatus(404); |
66 | 66 | |
67 | 67 | return $next($request, $response, new \Exception("Post by URL does not exist!", 404)); |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if($urlSlug2) { |
52 | 52 | $categorySlug = $urlSlug1; |
53 | 53 | $postSlug = $urlSlug2; |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | $categorySlug = null; |
57 | 56 | $postSlug = $urlSlug1; |
58 | 57 | } |
@@ -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 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $urlSlug = $request->getAttribute('category'); |
56 | 56 | $categories = $this->categoryService->allWeb(); |
57 | 57 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
58 | 58 | |
59 | - if(!$category) { |
|
60 | - $category = (object)[ |
|
59 | + if (!$category) { |
|
60 | + $category = (object) [ |
|
61 | 61 | 'name' => 'SveeEeEEeeEe', |
62 | 62 | 'slug' => 'all' |
63 | 63 | ]; |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $videos = $this->videoService->fetchWebArticles($page, 5); |
56 | 56 | |
57 | 57 | return new HtmlResponse($this->template->render('web::videos', [ |
@@ -12,67 +12,67 @@ |
||
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' => 'body', |
42 | 42 | 'required' => true, |
43 | - 'filters' => [['name' => 'StringTrim']], |
|
43 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
44 | 44 | 'validators' => [ |
45 | - ['name' => 'NotEmpty'], |
|
46 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
45 | + [ 'name' => 'NotEmpty' ], |
|
46 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
47 | 47 | ], |
48 | 48 | ]); |
49 | 49 | |
50 | 50 | $inputFilter->add([ |
51 | 51 | 'name' => 'start_at', |
52 | 52 | 'required' => true, |
53 | - 'filters' => [['name' => 'StringTrim']], |
|
54 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
53 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
54 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
55 | 55 | ]); |
56 | 56 | |
57 | 57 | $inputFilter->add([ |
58 | 58 | 'name' => 'end_at', |
59 | 59 | 'required' => true, |
60 | - 'filters' => [['name' => 'StringTrim']], |
|
61 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
60 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
61 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
62 | 62 | ]); |
63 | 63 | |
64 | 64 | $inputFilter->add([ |
65 | 65 | 'name' => 'longitude', |
66 | 66 | 'required' => true, |
67 | - 'filters' => [['name' => 'StringTrim']], |
|
68 | - 'validators' => [['name' => 'NotEmpty']], |
|
67 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
68 | + 'validators' => [ [ 'name' => 'NotEmpty' ] ], |
|
69 | 69 | ]); |
70 | 70 | |
71 | 71 | $inputFilter->add([ |
72 | 72 | 'name' => 'latitude', |
73 | 73 | 'required' => true, |
74 | - 'filters' => [['name' => 'StringTrim']], |
|
75 | - 'validators' => [['name' => 'NotEmpty']], |
|
74 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
75 | + 'validators' => [ [ 'name' => 'NotEmpty' ] ], |
|
76 | 76 | ]); |
77 | 77 | |
78 | 78 | $this->inputFilter = $inputFilter; |
@@ -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 Article\Mapper; |
6 | 6 | |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | public function getPaginationSelect($status = null) |
36 | 36 | { |
37 | 37 | $select = $this->getSql()->select() |
38 | - ->columns(['title', 'body', 'longitude', 'latitude']) |
|
38 | + ->columns([ 'title', 'body', 'longitude', 'latitude' ]) |
|
39 | 39 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
40 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name']) |
|
41 | - ->where(['articles.type' => ArticleType::EVENT]) |
|
42 | - ->order(['created_at' => 'desc']); |
|
40 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
41 | + ->where([ 'articles.type' => ArticleType::EVENT ]) |
|
42 | + ->order([ 'created_at' => 'desc' ]); |
|
43 | 43 | |
44 | - if($status) { |
|
45 | - $select->where(['articles.status' => (int)$status]); |
|
44 | + if ($status) { |
|
45 | + $select->where([ 'articles.status' => (int) $status ]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $select; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $select = $this->getSql()->select() |
54 | 54 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
55 | - ->where(['articles.article_id' => $id]); |
|
55 | + ->where([ 'articles.article_id' => $id ]); |
|
56 | 56 | |
57 | 57 | return $this->selectWith($select)->current(); |
58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $select = $this->getSql()->select() |
63 | 63 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
64 | - ->where(['articles.slug' => $slug]); |
|
64 | + ->where([ 'articles.slug' => $slug ]); |
|
65 | 65 | |
66 | 66 | return $this->selectWith($select)->current(); |
67 | 67 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | public function getLatest($limit = 50) |
70 | 70 | { |
71 | 71 | $select = $this->getSql()->select() |
72 | - ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
73 | - ->where(['articles.status' => 1]) |
|
74 | - ->order(['published_at' => 'desc']) |
|
72 | + ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
73 | + ->where([ 'articles.status' => 1 ]) |
|
74 | + ->order([ 'published_at' => 'desc' ]) |
|
75 | 75 | ->limit($limit); |
76 | 76 | |
77 | 77 | return $this->selectWith($select); |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | public function getFuture() |
81 | 81 | { |
82 | 82 | $select = $this->getSql()->select() |
83 | - ->where(['articles.status' => 1]) |
|
84 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']); |
|
83 | + ->where([ 'articles.status' => 1 ]) |
|
84 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]); |
|
85 | 85 | |
86 | 86 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
87 | 87 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | public function getPastSelect() |
92 | 92 | { |
93 | 93 | $select = $this->getSql()->select() |
94 | - ->where(['articles.status' => 1]) |
|
95 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']); |
|
94 | + ->where([ 'articles.status' => 1 ]) |
|
95 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]); |
|
96 | 96 | |
97 | 97 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
98 | 98 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Mapper; |
5 | 5 | |
@@ -34,18 +34,18 @@ discard block |
||
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 | - ->where(['articles.type' => ArticleType::POST]) |
|
40 | - ->order(['created_at' => 'desc']); |
|
39 | + ->where([ 'articles.type' => ArticleType::POST ]) |
|
40 | + ->order([ 'created_at' => 'desc' ]); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function get($id) |
44 | 44 | { |
45 | 45 | $select = $this->getSql()->select() |
46 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage']) |
|
46 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ]) |
|
47 | 47 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
48 | - ->where(['articles.article_id' => $id]); |
|
48 | + ->where([ 'articles.article_id' => $id ]); |
|
49 | 49 | |
50 | 50 | return $this->selectWith($select)->current(); |
51 | 51 | } |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | { |
55 | 55 | $select = $this->getSql()->select() |
56 | 56 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
57 | - ->join('article_categories', 'article_categories.article_uuid = articles.article_uuid', []) |
|
58 | - ->join('category', 'category.category_uuid = article_categories.category_uuid', ['category_slug' => 'slug']) |
|
57 | + ->join('article_categories', 'article_categories.article_uuid = articles.article_uuid', [ ]) |
|
58 | + ->join('category', 'category.category_uuid = article_categories.category_uuid', [ 'category_slug' => 'slug' ]) |
|
59 | 59 | ->limit(1); |
60 | 60 | |
61 | - if($direction > 0) { |
|
61 | + if ($direction > 0) { |
|
62 | 62 | $select->where->greaterThan('published_at', $publishedAt); |
63 | - $select->order(['published_at' => 'asc']); |
|
64 | - } elseif($direction < 0) { |
|
63 | + $select->order([ 'published_at' => 'asc' ]); |
|
64 | + } elseif ($direction < 0) { |
|
65 | 65 | $select->where->lessThan('published_at', $publishedAt); |
66 | - $select->order(['published_at' => 'desc']); |
|
66 | + $select->order([ 'published_at' => 'desc' ]); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $this->selectWith($select)->current(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $select = $this->getSql()->select() |
75 | 75 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
76 | - ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]); |
|
76 | + ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]); |
|
77 | 77 | |
78 | 78 | return $this->selectWith($select)->current(); |
79 | 79 | } |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | public function getBySlug($slug) |
82 | 82 | { |
83 | 83 | $select = $this->getSql()->select() |
84 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
84 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
85 | 85 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
86 | - ->join('article_categories', 'article_categories.article_uuid = articles.article_uuid', []) |
|
87 | - ->join('category', 'category.category_uuid = article_categories.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug']) |
|
88 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
89 | - ->where(['articles.slug' => $slug, 'articles.status' => 1]); |
|
86 | + ->join('article_categories', 'article_categories.article_uuid = articles.article_uuid', [ ]) |
|
87 | + ->join('category', 'category.category_uuid = article_categories.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ]) |
|
88 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
89 | + ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]); |
|
90 | 90 | |
91 | 91 | return $this->selectWith($select)->current(); |
92 | 92 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getAll() |
95 | 95 | { |
96 | 96 | $select = $this->getSql()->select() |
97 | - ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']); |
|
97 | + ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]); |
|
98 | 98 | |
99 | 99 | return $this->selectWith($select); |
100 | 100 | } |
@@ -106,12 +106,12 @@ discard block |
||
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('article_categories', 'article_categories.article_uuid = articles.article_uuid') |
111 | 111 | ->join('category', 'category.category_uuid = article_categories.category_uuid', |
112 | - ['category_name' => 'name', 'category_id', 'category_slug' => 'slug']) |
|
113 | - ->where(['articles.status' => 1]) |
|
114 | - ->order(['articles.published_at' => 'desc']) |
|
112 | + [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ]) |
|
113 | + ->where([ 'articles.status' => 1 ]) |
|
114 | + ->order([ 'articles.published_at' => 'desc' ]) |
|
115 | 115 | ->limit($limit); |
116 | 116 | |
117 | 117 | return $this->selectWith($select); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | 'admin/pagination' => __DIR__ . '/../templates/admin/partial/pagination.phtml', |
14 | 14 | ], |
15 | 15 | 'paths' => [ |
16 | - 'admin' => [__DIR__ . '/../templates/admin'], |
|
16 | + 'admin' => [ __DIR__ . '/../templates/admin' ], |
|
17 | 17 | ], |
18 | 18 | ], |
19 | 19 | |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | 'name' => 'auth', |
31 | 31 | 'path' => '/auth/:action', |
32 | 32 | 'middleware' => Controller\AuthController::class, |
33 | - 'allowed_methods' => ['GET', 'POST'], |
|
33 | + 'allowed_methods' => [ 'GET', 'POST' ], |
|
34 | 34 | ], |
35 | 35 | [ |
36 | 36 | 'name' => 'admin', |
37 | 37 | 'path' => '/admin', |
38 | 38 | 'middleware' => Action\IndexAction::class, |
39 | - 'allowed_methods' => ['GET'], |
|
39 | + 'allowed_methods' => [ 'GET' ], |
|
40 | 40 | ], |
41 | 41 | [ |
42 | 42 | 'name' => 'admin.users', |
43 | 43 | 'path' => '/admin/users', |
44 | 44 | 'middleware' => Controller\UserController::class, |
45 | - 'allowed_methods' => ['GET'] |
|
45 | + 'allowed_methods' => [ 'GET' ] |
|
46 | 46 | ], |
47 | 47 | [ |
48 | 48 | 'name' => 'admin.users.action', |
49 | 49 | 'path' => '/admin/users/:action/:id', |
50 | 50 | 'middleware' => Controller\UserController::class, |
51 | - 'allowed_methods' => ['GET', 'POST'] |
|
51 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
52 | 52 | ], |
53 | 53 | ], |
54 | 54 |