@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Meetup; |
| 4 | 4 | |
| 5 | 5 | use GuzzleHttp\Client; |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | public function getAttendees($eventUrl) |
| 35 | 35 | { |
| 36 | 36 | if (strpos($eventUrl, 'meetup.com') === false) { |
| 37 | - return []; |
|
| 37 | + return [ ]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | try { |
| 41 | 41 | $parts = explode('/', $eventUrl); |
| 42 | - $meetupId = $parts[count($parts) - 2]; |
|
| 42 | + $meetupId = $parts[ count($parts) - 2 ]; |
|
| 43 | 43 | $uri = sprintf(self::API_URL, $meetupId, $this->key); |
| 44 | 44 | $request = new Request('GET', $uri); |
| 45 | 45 | $response = $this->httpClient->send($request); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | return $attendees; |
| 51 | 51 | } catch (\Exception $e) { |
| 52 | - return []; |
|
| 52 | + return [ ]; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -36,18 +36,18 @@ discard block |
||
| 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', |
| 41 | 41 | 'article_events.article_uuid = articles.article_uuid') |
| 42 | 42 | ->join( |
| 43 | 43 | 'admin_users', |
| 44 | 44 | 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
| 45 | - ['admin_user_id', 'first_name', 'last_name'] |
|
| 46 | - )->where(['articles.type' => ArticleType::EVENT]) |
|
| 47 | - ->order(['created_at' => 'desc']); |
|
| 45 | + [ 'admin_user_id', 'first_name', 'last_name' ] |
|
| 46 | + )->where([ 'articles.type' => ArticleType::EVENT ]) |
|
| 47 | + ->order([ 'created_at' => 'desc' ]); |
|
| 48 | 48 | |
| 49 | 49 | if ($status) { |
| 50 | - $select->where(['articles.status' => (int)$status]); |
|
| 50 | + $select->where([ 'articles.status' => (int) $status ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $select; |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | ) |
| 69 | 69 | ->join('admin_users', |
| 70 | 70 | 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
| 71 | - ['admin_user_id'], 'left') |
|
| 72 | - ->where(['articles.article_id' => $id]); |
|
| 71 | + [ 'admin_user_id' ], 'left') |
|
| 72 | + ->where([ 'articles.article_id' => $id ]); |
|
| 73 | 73 | |
| 74 | 74 | return $this->selectWith($select)->current(); |
| 75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 'category_id' |
| 88 | 88 | ], 'left' |
| 89 | 89 | ) |
| 90 | - ->where(['articles.slug' => $slug]); |
|
| 90 | + ->where([ 'articles.slug' => $slug ]); |
|
| 91 | 91 | |
| 92 | 92 | return $this->selectWith($select)->current(); |
| 93 | 93 | } |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | $select = $this->getSql()->select() |
| 98 | 98 | ->join('articles', |
| 99 | 99 | 'article_events.article_uuid = articles.article_uuid', |
| 100 | - ['article_id', 'slug', 'published_at']) |
|
| 100 | + [ 'article_id', 'slug', 'published_at' ]) |
|
| 101 | 101 | ->join('category', |
| 102 | 102 | 'category.category_uuid = articles.category_uuid', |
| 103 | - ['category_slug' => 'slug']) |
|
| 104 | - ->where(['articles.status' => 1]) |
|
| 105 | - ->order(['published_at' => 'desc']) |
|
| 103 | + [ 'category_slug' => 'slug' ]) |
|
| 104 | + ->where([ 'articles.status' => 1 ]) |
|
| 105 | + ->order([ 'published_at' => 'desc' ]) |
|
| 106 | 106 | ->limit($limit); |
| 107 | 107 | |
| 108 | 108 | return $this->selectWith($select); |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | public function getFuture() |
| 112 | 112 | { |
| 113 | 113 | $select = $this->getSql()->select() |
| 114 | - ->where(['articles.status' => 1]) |
|
| 114 | + ->where([ 'articles.status' => 1 ]) |
|
| 115 | 115 | ->join('articles', |
| 116 | 116 | 'articles.article_uuid = article_events.article_uuid', |
| 117 | - ['article_id', 'slug', 'published_at']) |
|
| 117 | + [ 'article_id', 'slug', 'published_at' ]) |
|
| 118 | 118 | ->join('category', |
| 119 | 119 | 'category.category_uuid = articles.category_uuid', |
| 120 | - ['category_slug' => 'slug']) |
|
| 120 | + [ 'category_slug' => 'slug' ]) |
|
| 121 | 121 | ->order(new Expression('rand()')); |
| 122 | 122 | |
| 123 | 123 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | public function getPastSelect() |
| 129 | 129 | { |
| 130 | 130 | $select = $this->getSql()->select() |
| 131 | - ->where(['articles.status' => 1]) |
|
| 131 | + ->where([ 'articles.status' => 1 ]) |
|
| 132 | 132 | ->join('articles', |
| 133 | 133 | 'articles.article_uuid = article_events.article_uuid', |
| 134 | - ['article_id', 'slug', 'published_at']) |
|
| 134 | + [ 'article_id', 'slug', 'published_at' ]) |
|
| 135 | 135 | ->join('category', |
| 136 | 136 | 'category.category_uuid = articles.category_uuid', |
| 137 | - ['category_slug' => 'slug']) |
|
| 138 | - ->order(['start_at' => 'desc']); |
|
| 137 | + [ 'category_slug' => 'slug' ]) |
|
| 138 | + ->order([ 'start_at' => 'desc' ]); |
|
| 139 | 139 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
| 140 | 140 | |
| 141 | 141 | return $select; |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $select = $this->getSql()->select() |
| 36 | 36 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid', |
| 37 | - ['slug', 'published_at', 'status', 'article_id']) |
|
| 37 | + [ 'slug', 'published_at', 'status', 'article_id' ]) |
|
| 38 | 38 | ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
| 39 | - ['admin_user_id', 'first_name', 'last_name']) |
|
| 39 | + [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
| 40 | 40 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 41 | - ['category_slug' => 'slug']) |
|
| 42 | - ->where(['articles.type' => ArticleType::VIDEO]) |
|
| 43 | - ->order(['articles.created_at' => 'desc']); |
|
| 41 | + [ 'category_slug' => 'slug' ]) |
|
| 42 | + ->where([ 'articles.type' => ArticleType::VIDEO ]) |
|
| 43 | + ->order([ 'articles.created_at' => 'desc' ]); |
|
| 44 | 44 | |
| 45 | 45 | if ($isActive !== null) { |
| 46 | - $select->where(['articles.status' => (int)$isActive]); |
|
| 46 | + $select->where([ 'articles.status' => (int) $isActive ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $select; |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | public function get($id) |
| 53 | 53 | { |
| 54 | 54 | $select = $this->getSql()->select() |
| 55 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title']) |
|
| 55 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ]) |
|
| 56 | 56 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
| 57 | 57 | ->join( |
| 58 | 58 | 'category', 'category.category_uuid = articles.category_uuid', |
| 59 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
| 59 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
| 60 | 60 | ) |
| 61 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
| 62 | - ->where(['articles.article_id' => $id]); |
|
| 61 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
| 62 | + ->where([ 'articles.article_id' => $id ]); |
|
| 63 | 63 | |
| 64 | 64 | return $this->selectWith($select)->current(); |
| 65 | 65 | } |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | public function getLatest($limit = 50) |
| 68 | 68 | { |
| 69 | 69 | $select = $this->getSql()->select() |
| 70 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 71 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
| 72 | - ->where(['articles.status' => 1]) |
|
| 73 | - ->order(['published_at' => 'desc']) |
|
| 70 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 71 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
| 72 | + ->where([ 'articles.status' => 1 ]) |
|
| 73 | + ->order([ 'published_at' => 'desc' ]) |
|
| 74 | 74 | ->limit($limit); |
| 75 | 75 | |
| 76 | 76 | return $this->selectWith($select); |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $select = $this->getSql()->select() |
| 82 | 82 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
| 83 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
| 84 | - ->where(['articles.slug' => $slug]); |
|
| 83 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
| 84 | + ->where([ 'articles.slug' => $slug ]); |
|
| 85 | 85 | |
| 86 | 86 | return $this->selectWith($select)->current(); |
| 87 | 87 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | callable $next = null |
| 62 | 62 | ) { |
| 63 | 63 | $params = $request->getQueryParams(); |
| 64 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 64 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 65 | 65 | $urlSlug = $request->getAttribute('category'); |
| 66 | 66 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
| 67 | 67 | |
@@ -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 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | callable $next = null |
| 62 | 62 | ) { |
| 63 | 63 | $params = $request->getQueryParams(); |
| 64 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 64 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 65 | 65 | $urlSlug = $request->getAttribute('category'); |
| 66 | 66 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
| 67 | 67 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | callable $next = null |
| 62 | 62 | ) { |
| 63 | 63 | $params = $request->getQueryParams(); |
| 64 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 64 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 65 | 65 | $urlSlug = $request->getAttribute('category'); |
| 66 | 66 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
| 67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Default category for all posts |
| 74 | - $category = (object)[ |
|
| 74 | + $category = (object) [ |
|
| 75 | 75 | 'name' => 'Svi članci', |
| 76 | 76 | 'slug' => 'all', |
| 77 | 77 | 'title' => 'Svi članci', |