@@ -63,6 +63,9 @@ |
||
| 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); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 88 | 88 | $eventFilter = $this->eventFilter->getInputFilter()->setData($data); |
| 89 | 89 | |
| 90 | - if(!$articleFilter->isValid() || !$eventFilter->isValid()) { |
|
| 90 | + if (!$articleFilter->isValid() || !$eventFilter->isValid()) { |
|
| 91 | 91 | throw new FilterException($articleFilter->getMessages() + $eventFilter->getMessages()); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $article = $articleFilter->getValues(); |
| 98 | 98 | $article += [ |
| 99 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
| 99 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
| 100 | 100 | 'type' => ArticleType::EVENT, |
| 101 | 101 | 'article_id' => $id, |
| 102 | 102 | 'article_uuid' => $uuId |
| 103 | 103 | ]; |
| 104 | - unset($article['admin_user_id']); |
|
| 104 | + unset($article[ 'admin_user_id' ]); |
|
| 105 | 105 | |
| 106 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 107 | - unset($article['category_id']); |
|
| 106 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 107 | + unset($article[ 'category_id' ]); |
|
| 108 | 108 | |
| 109 | 109 | $event = $eventFilter->getValues() + [ |
| 110 | 110 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
@@ -122,50 +122,50 @@ discard block |
||
| 122 | 122 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 123 | 123 | $eventFilter = $this->eventFilter->getInputFilter()->setData($data); |
| 124 | 124 | |
| 125 | - if(!$articleFilter->isValid() || !$eventFilter->isValid()) { |
|
| 125 | + if (!$articleFilter->isValid() || !$eventFilter->isValid()) { |
|
| 126 | 126 | throw new FilterException($articleFilter->getMessages() + $eventFilter->getMessages()); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $article = $articleFilter->getValues() + ['article_uuid' => $oldArticle->article_uuid]; |
|
| 129 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $oldArticle->article_uuid ]; |
|
| 130 | 130 | $event = $eventFilter->getValues() + [ |
| 131 | 131 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
| 132 | 132 | 'main_img' => $this->upload->uploadImage($data, 'main_img') |
| 133 | 133 | ]; |
| 134 | 134 | |
| 135 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
| 136 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 137 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 135 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
| 136 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 137 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 138 | 138 | |
| 139 | 139 | // We don't want to force user to re-upload image on edit |
| 140 | - if (!$event['featured_img']) { |
|
| 141 | - unset($event['featured_img']); |
|
| 140 | + if (!$event[ 'featured_img' ]) { |
|
| 141 | + unset($event[ 'featured_img' ]); |
|
| 142 | 142 | } |
| 143 | 143 | else { |
| 144 | 144 | $this->upload->deleteFile($oldArticle->featured_img); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (!$event['main_img']) { |
|
| 148 | - unset($event['main_img']); |
|
| 147 | + if (!$event[ 'main_img' ]) { |
|
| 148 | + unset($event[ 'main_img' ]); |
|
| 149 | 149 | } |
| 150 | 150 | else { |
| 151 | 151 | $this->upload->deleteFile($oldArticle->main_img); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
| 155 | - $this->articleEventsMapper->update($event, ['article_uuid' => $article['article_uuid']]); |
|
| 154 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 155 | + $this->articleEventsMapper->update($event, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | public function deleteArticle($id) |
| 159 | 159 | { |
| 160 | 160 | $event = $this->articleEventsMapper->get($id); |
| 161 | 161 | |
| 162 | - if(!$event) { |
|
| 162 | + if (!$event) { |
|
| 163 | 163 | throw new \Exception('Article not found!'); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $this->upload->deleteFile($event->main_img); |
| 167 | 167 | $this->upload->deleteFile($event->featured_img); |
| 168 | - $this->articleEventsMapper->delete(['article_uuid' => $event->article_uuid]); |
|
| 168 | + $this->articleEventsMapper->delete([ 'article_uuid' => $event->article_uuid ]); |
|
| 169 | 169 | $this->delete($event->article_uuid); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -139,15 +139,13 @@ |
||
| 139 | 139 | // We don't want to force user to re-upload image on edit |
| 140 | 140 | if (!$event['featured_img']) { |
| 141 | 141 | unset($event['featured_img']); |
| 142 | - } |
|
| 143 | - else { |
|
| 142 | + } else { |
|
| 144 | 143 | $this->upload->deleteFile($oldArticle->featured_img); |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | 146 | if (!$event['main_img']) { |
| 148 | 147 | unset($event['main_img']); |
| 149 | - } |
|
| 150 | - else { |
|
| 148 | + } else { |
|
| 151 | 149 | $this->upload->deleteFile($oldArticle->main_img); |
| 152 | 150 | } |
| 153 | 151 | |
@@ -203,6 +203,9 @@ |
||
| 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); |
@@ -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\Service; |
| 6 | 6 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 96 | 96 | $postFilter = $this->postFilter->getInputFilter()->setData($data); |
| 97 | 97 | |
| 98 | - if(!$articleFilter->isValid() || !$postFilter->isValid()) { |
|
| 98 | + if (!$articleFilter->isValid() || !$postFilter->isValid()) { |
|
| 99 | 99 | throw new FilterException($articleFilter->getMessages() + $postFilter->getMessages()); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -104,19 +104,19 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $article = $articleFilter->getValues(); |
| 106 | 106 | $article += [ |
| 107 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
| 107 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
| 108 | 108 | 'type' => ArticleType::POST, |
| 109 | 109 | 'article_id' => $id, |
| 110 | 110 | 'article_uuid' => $uuId |
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 114 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 113 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 114 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 115 | 115 | |
| 116 | 116 | $post = $postFilter->getValues() + [ |
| 117 | 117 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
| 118 | 118 | 'main_img' => $this->upload->uploadImage($data, 'main_img'), |
| 119 | - 'article_uuid' => $article['article_uuid'] |
|
| 119 | + 'article_uuid' => $article[ 'article_uuid' ] |
|
| 120 | 120 | ]; |
| 121 | 121 | |
| 122 | 122 | $this->articleMapper->insert($article); |
@@ -129,37 +129,37 @@ discard block |
||
| 129 | 129 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 130 | 130 | $postFilter = $this->postFilter->getInputFilter()->setData($data); |
| 131 | 131 | |
| 132 | - if(!$articleFilter->isValid() || !$postFilter->isValid()) { |
|
| 132 | + if (!$articleFilter->isValid() || !$postFilter->isValid()) { |
|
| 133 | 133 | throw new FilterException($articleFilter->getMessages() + $postFilter->getMessages()); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $article = $articleFilter->getValues() + ['article_uuid' => $oldArticle->article_uuid]; |
|
| 136 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $oldArticle->article_uuid ]; |
|
| 137 | 137 | $post = $postFilter->getValues() + [ |
| 138 | 138 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
| 139 | 139 | 'main_img' => $this->upload->uploadImage($data, 'main_img') |
| 140 | 140 | ]; |
| 141 | 141 | |
| 142 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
| 143 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 144 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 142 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
| 143 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 144 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 145 | 145 | |
| 146 | 146 | // We don't want to force user to re-upload image on edit |
| 147 | - if (!$post['featured_img']) { |
|
| 148 | - unset($post['featured_img']); |
|
| 147 | + if (!$post[ 'featured_img' ]) { |
|
| 148 | + unset($post[ 'featured_img' ]); |
|
| 149 | 149 | } |
| 150 | 150 | else { |
| 151 | 151 | $this->upload->deleteFile($oldArticle->featured_img); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if (!$post['main_img']) { |
|
| 155 | - unset($post['main_img']); |
|
| 154 | + if (!$post[ 'main_img' ]) { |
|
| 155 | + unset($post[ 'main_img' ]); |
|
| 156 | 156 | } |
| 157 | 157 | else { |
| 158 | 158 | $this->upload->deleteFile($oldArticle->main_img); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
| 162 | - $this->articlePostsMapper->update($post, ['article_uuid' => $article['article_uuid']]); |
|
| 161 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 162 | + $this->articlePostsMapper->update($post, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function deleteArticle($id) |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $this->upload->deleteFile($post->main_img); |
| 174 | 174 | $this->upload->deleteFile($post->featured_img); |
| 175 | - $this->articlePostsMapper->delete(['article_uuid' => $post->article_uuid]); |
|
| 175 | + $this->articlePostsMapper->delete([ 'article_uuid' => $post->article_uuid ]); |
|
| 176 | 176 | $this->delete($post->article_uuid); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -146,15 +146,13 @@ |
||
| 146 | 146 | // We don't want to force user to re-upload image on edit |
| 147 | 147 | if (!$post['featured_img']) { |
| 148 | 148 | unset($post['featured_img']); |
| 149 | - } |
|
| 150 | - else { |
|
| 149 | + } else { |
|
| 151 | 150 | $this->upload->deleteFile($oldArticle->featured_img); |
| 152 | 151 | } |
| 153 | 152 | |
| 154 | 153 | if (!$post['main_img']) { |
| 155 | 154 | unset($post['main_img']); |
| 156 | - } |
|
| 157 | - else { |
|
| 155 | + } else { |
|
| 158 | 156 | $this->upload->deleteFile($oldArticle->main_img); |
| 159 | 157 | } |
| 160 | 158 | |
@@ -23,49 +23,49 @@ |
||
| 23 | 23 | /** |
| 24 | 24 | * |
| 25 | 25 | * |
| 26 | - * @var ArticleMapper |
|
| 26 | + * @var ArticleMapper |
|
| 27 | 27 | */ |
| 28 | 28 | private $articleMapper; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * |
| 32 | 32 | * |
| 33 | - * @var ArticlePostsMapper |
|
| 33 | + * @var ArticlePostsMapper |
|
| 34 | 34 | */ |
| 35 | 35 | private $articlePostsMapper; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * |
| 39 | 39 | * |
| 40 | - * @var ArticleFilter |
|
| 40 | + * @var ArticleFilter |
|
| 41 | 41 | */ |
| 42 | 42 | private $articleFilter; |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * |
| 46 | 46 | * |
| 47 | - * @var PostFilter |
|
| 47 | + * @var PostFilter |
|
| 48 | 48 | */ |
| 49 | 49 | private $postFilter; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * |
| 53 | 53 | * |
| 54 | - * @var CategoryMapper |
|
| 54 | + * @var CategoryMapper |
|
| 55 | 55 | */ |
| 56 | 56 | private $categoryMapper; |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * |
| 60 | 60 | * |
| 61 | - * @var Upload |
|
| 61 | + * @var Upload |
|
| 62 | 62 | */ |
| 63 | 63 | private $upload; |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * |
| 67 | 67 | * |
| 68 | - * @var AdminUsersMapper |
|
| 68 | + * @var AdminUsersMapper |
|
| 69 | 69 | */ |
| 70 | 70 | private $adminUsersMapper; |
| 71 | 71 | |
@@ -91,6 +91,9 @@ |
||
| 91 | 91 | return $this->getPagination($select, $page, $limit); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | + /** |
|
| 95 | + * @param integer $limit |
|
| 96 | + */ |
|
| 94 | 97 | public function fetchLatest($limit) |
| 95 | 98 | { |
| 96 | 99 | return $this->articleVideosMapper->getLatest($limit); |
@@ -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\Service; |
| 6 | 6 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 107 | 107 | $videosFilter = $this->videosFilter->getInputFilter()->setData($data); |
| 108 | 108 | |
| 109 | - if(!$articleFilter->isValid() || !$videosFilter->isValid()) { |
|
| 109 | + if (!$articleFilter->isValid() || !$videosFilter->isValid()) { |
|
| 110 | 110 | throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages()); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $article = $articleFilter->getValues(); |
| 117 | 117 | $article += [ |
| 118 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
| 118 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
| 119 | 119 | 'type' => ArticleType::VIDEO, |
| 120 | 120 | 'article_id' => $id, |
| 121 | 121 | 'article_uuid' => $uuId |
| 122 | 122 | ]; |
| 123 | 123 | |
| 124 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 125 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 124 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 125 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 126 | 126 | |
| 127 | 127 | $videos = $videosFilter->getValues() + [ |
| 128 | 128 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 141 | 141 | $videosFilter = $this->videosFilter->getInputFilter()->setData($data); |
| 142 | 142 | |
| 143 | - if(!$articleFilter->isValid() || !$videosFilter->isValid()) { |
|
| 143 | + if (!$articleFilter->isValid() || !$videosFilter->isValid()) { |
|
| 144 | 144 | throw new FilterException($articleFilter->getMessages() + $videosFilter->getMessages()); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $article = $articleFilter->getValues() + ['article_uuid' => $oldArticle->article_uuid]; |
|
| 148 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 149 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
| 150 | - unset($article['category_id']); |
|
| 151 | - unset($article['admin_user_id']); |
|
| 147 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $oldArticle->article_uuid ]; |
|
| 148 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 149 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
| 150 | + unset($article[ 'category_id' ]); |
|
| 151 | + unset($article[ 'admin_user_id' ]); |
|
| 152 | 152 | |
| 153 | 153 | $videos = $videosFilter->getValues() + [ |
| 154 | 154 | 'featured_img' => $this->upload->uploadImage($data, 'featured_img'), |
@@ -156,35 +156,35 @@ discard block |
||
| 156 | 156 | ]; |
| 157 | 157 | |
| 158 | 158 | // We don't want to force user to re-upload image on edit |
| 159 | - if(!$videos['featured_img']) { |
|
| 160 | - unset($videos['featured_img']); |
|
| 159 | + if (!$videos[ 'featured_img' ]) { |
|
| 160 | + unset($videos[ 'featured_img' ]); |
|
| 161 | 161 | } |
| 162 | 162 | else { |
| 163 | 163 | $this->upload->deleteFile($oldArticle->featured_img); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if(!$videos['main_img']) { |
|
| 167 | - unset($videos['main_img']); |
|
| 166 | + if (!$videos[ 'main_img' ]) { |
|
| 167 | + unset($videos[ 'main_img' ]); |
|
| 168 | 168 | } |
| 169 | 169 | else { |
| 170 | 170 | $this->upload->deleteFile($oldArticle->main_img); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
| 174 | - $this->articleVideosMapper->update($videos, ['article_uuid' => $article['article_uuid']]); |
|
| 173 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 174 | + $this->articleVideosMapper->update($videos, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function deleteArticle($id) |
| 178 | 178 | { |
| 179 | 179 | $video = $this->articleVideosMapper->get($id); |
| 180 | 180 | |
| 181 | - if(!$video) { |
|
| 181 | + if (!$video) { |
|
| 182 | 182 | throw new \Exception('Article not found!'); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $this->upload->deleteFile($video->main_img); |
| 186 | 186 | $this->upload->deleteFile($video->featured_img); |
| 187 | - $this->articleVideosMapper->delete(['article_uuid' => $video->article_uuid]); |
|
| 187 | + $this->articleVideosMapper->delete([ 'article_uuid' => $video->article_uuid ]); |
|
| 188 | 188 | $this->delete($video->article_uuid); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -158,15 +158,13 @@ |
||
| 158 | 158 | // We don't want to force user to re-upload image on edit |
| 159 | 159 | if(!$videos['featured_img']) { |
| 160 | 160 | unset($videos['featured_img']); |
| 161 | - } |
|
| 162 | - else { |
|
| 161 | + } else { |
|
| 163 | 162 | $this->upload->deleteFile($oldArticle->featured_img); |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | 165 | if(!$videos['main_img']) { |
| 167 | 166 | unset($videos['main_img']); |
| 168 | - } |
|
| 169 | - else { |
|
| 167 | + } else { |
|
| 170 | 168 | $this->upload->deleteFile($oldArticle->main_img); |
| 171 | 169 | } |
| 172 | 170 | |
@@ -22,49 +22,49 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * |
| 24 | 24 | * |
| 25 | - * @var ArticleMapper |
|
| 25 | + * @var ArticleMapper |
|
| 26 | 26 | */ |
| 27 | 27 | private $articleMapper; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * |
| 31 | 31 | * |
| 32 | - * @var ArticleVideosMapper |
|
| 32 | + * @var ArticleVideosMapper |
|
| 33 | 33 | */ |
| 34 | 34 | private $articleVideosMapper; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * |
| 38 | 38 | * |
| 39 | - * @var ArticleFilter |
|
| 39 | + * @var ArticleFilter |
|
| 40 | 40 | */ |
| 41 | 41 | private $articleFilter; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * |
| 45 | 45 | * |
| 46 | - * @var VideoFilter |
|
| 46 | + * @var VideoFilter |
|
| 47 | 47 | */ |
| 48 | 48 | private $videosFilter; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * |
| 52 | 52 | * |
| 53 | - * @var CategoryMapper |
|
| 53 | + * @var CategoryMapper |
|
| 54 | 54 | */ |
| 55 | 55 | private $categoryMapper; |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * |
| 59 | 59 | * |
| 60 | - * @var Upload |
|
| 60 | + * @var Upload |
|
| 61 | 61 | */ |
| 62 | 62 | private $upload; |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * |
| 66 | 66 | * |
| 67 | - * @var AdminUsersMapper |
|
| 67 | + * @var AdminUsersMapper |
|
| 68 | 68 | */ |
| 69 | 69 | private $adminUsersMapper; |
| 70 | 70 | |
@@ -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 | |
@@ -86,19 +86,19 @@ discard block |
||
| 86 | 86 | $select->where->notEqualTo('slug', 'videos'); |
| 87 | 87 | $select->where->notEqualTo('slug', 'events'); |
| 88 | 88 | |
| 89 | - if($inHomepage !== null) { |
|
| 90 | - $select->where(['is_in_homepage' => $inHomepage]); |
|
| 89 | + if ($inHomepage !== null) { |
|
| 90 | + $select->where([ 'is_in_homepage' => $inHomepage ]); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if($inCategoryList !== null) { |
|
| 94 | - $select->where(['is_in_category_list' => $inCategoryList]); |
|
| 93 | + if ($inCategoryList !== null) { |
|
| 94 | + $select->where([ 'is_in_category_list' => $inCategoryList ]); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if($limit) { |
|
| 97 | + if ($limit) { |
|
| 98 | 98 | $select->limit($limit); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if($order) { |
|
| 101 | + if ($order) { |
|
| 102 | 102 | $select->order($order); |
| 103 | 103 | } else { |
| 104 | 104 | $select->order(new Expression('rand()')); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 54 | 54 | $discussionFilter = $this->discussionFilter->getInputFilter()->setData($data); |
| 55 | 55 | |
| 56 | - if(!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
| 56 | + if (!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
| 57 | 57 | throw new FilterException($articleFilter->getMessages() + $discussionFilter->getMessages()); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,16 +62,16 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $article = $articleFilter->getValues(); |
| 64 | 64 | $article += [ |
| 65 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
| 65 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
| 66 | 66 | 'type' => ArticleType::DISCUSSION, |
| 67 | 67 | 'article_id' => $id, |
| 68 | 68 | 'article_uuid' => $uuId |
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 72 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 71 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 72 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 73 | 73 | |
| 74 | - $discussion = $discussionFilter->getValues() + ['article_uuid' => $uuId]; |
|
| 74 | + $discussion = $discussionFilter->getValues() + [ 'article_uuid' => $uuId ]; |
|
| 75 | 75 | |
| 76 | 76 | $this->articleMapper->insert($article); |
| 77 | 77 | $this->articleDiscussionsMapper->insert($discussion); |
@@ -83,30 +83,30 @@ discard block |
||
| 83 | 83 | $articleFilter = $this->articleFilter->getInputFilter()->setData($data); |
| 84 | 84 | $discussionFilter = $this->discussionFilter->getInputFilter()->setData($data); |
| 85 | 85 | |
| 86 | - if(!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
| 86 | + if (!$articleFilter->isValid() || !$discussionFilter->isValid()) { |
|
| 87 | 87 | throw new FilterException($articleFilter->getMessages() + $discussionFilter->getMessages()); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $article = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid]; |
|
| 90 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ]; |
|
| 91 | 91 | $discussion = $discussionFilter->getValues(); |
| 92 | 92 | |
| 93 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
| 94 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
| 95 | - unset($article['category_id'], $article['admin_user_id']); |
|
| 93 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
| 94 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
| 95 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
| 96 | 96 | |
| 97 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
| 98 | - $this->articleDiscussionsMapper->update($discussion, ['article_uuid' => $article['article_uuid']]); |
|
| 97 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 98 | + $this->articleDiscussionsMapper->update($discussion, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function deleteArticle($id) |
| 102 | 102 | { |
| 103 | 103 | $discussion = $this->articleDiscussionsMapper->get($id); |
| 104 | 104 | |
| 105 | - if(!$discussion) { |
|
| 105 | + if (!$discussion) { |
|
| 106 | 106 | throw new \Exception('Article not found!'); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $this->articleDiscussionsMapper->delete(['article_uuid' => $discussion->article_uuid]); |
|
| 109 | + $this->articleDiscussionsMapper->delete([ 'article_uuid' => $discussion->article_uuid ]); |
|
| 110 | 110 | $this->delete($discussion->article_uuid); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -90,11 +90,9 @@ discard block |
||
| 90 | 90 | } else { |
| 91 | 91 | $this->discussionService->createArticle($user, $data); |
| 92 | 92 | } |
| 93 | - } |
|
| 94 | - catch(FilterException $fe) { |
|
| 93 | + } catch(FilterException $fe) { |
|
| 95 | 94 | return $this->edit($fe->getArrayMessages()); |
| 96 | - } |
|
| 97 | - catch(\Exception $e) { |
|
| 95 | + } catch(\Exception $e) { |
|
| 98 | 96 | throw $e; |
| 99 | 97 | } |
| 100 | 98 | |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | { |
| 106 | 104 | try { |
| 107 | 105 | $this->discussionService->deleteArticle($this->request->getAttribute('id')); |
| 108 | - } |
|
| 109 | - catch(\Exception $e) { |
|
| 106 | + } catch(\Exception $e) { |
|
| 110 | 107 | throw $e; |
| 111 | 108 | } |
| 112 | 109 | |
@@ -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\Controller; |
| 6 | 6 | |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | public function index(): \Psr\Http\Message\ResponseInterface |
| 58 | 58 | { |
| 59 | 59 | $params = $this->request->getQueryParams(); |
| 60 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 61 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
| 60 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 61 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
| 62 | 62 | |
| 63 | 63 | $discussions = $this->discussionService->fetchAllArticles($page, $limit); |
| 64 | 64 | |
| 65 | - return new HtmlResponse($this->template->render('article::discussion/index', ['list' => $discussions, 'layout' => 'layout/admin'])); |
|
| 65 | + return new HtmlResponse($this->template->render('article::discussion/index', [ 'list' => $discussions, 'layout' => 'layout/admin' ])); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return \Psr\Http\Message\ResponseInterface |
| 74 | 74 | */ |
| 75 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
| 75 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
| 76 | 76 | { |
| 77 | 77 | $id = $this->request->getAttribute('id'); |
| 78 | 78 | $discussion = $this->discussionService->fetchSingleArticle($id); |
| 79 | 79 | $categories = $this->categoryService->getAll(); |
| 80 | 80 | |
| 81 | - if($this->request->getParsedBody()) { |
|
| 82 | - $discussion = (object)($this->request->getParsedBody() + (array)$discussion); |
|
| 81 | + if ($this->request->getParsedBody()) { |
|
| 82 | + $discussion = (object) ($this->request->getParsedBody() + (array) $discussion); |
|
| 83 | 83 | $discussion->article_id = $id; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | $data = $this->request->getParsedBody(); |
| 99 | 99 | $user = $this->session->getStorage()->user; |
| 100 | 100 | |
| 101 | - if($id) { |
|
| 101 | + if ($id) { |
|
| 102 | 102 | $this->discussionService->updateArticle($data, $id); |
| 103 | 103 | } else { |
| 104 | 104 | $this->discussionService->createArticle($user, $data); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - catch(FilterException $fe) { |
|
| 107 | + catch (FilterException $fe) { |
|
| 108 | 108 | return $this->edit($fe->getArrayMessages()); |
| 109 | 109 | } |
| 110 | - catch(\Exception $e) { |
|
| 110 | + catch (\Exception $e) { |
|
| 111 | 111 | throw $e; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | try { |
| 120 | 120 | $this->discussionService->deleteArticle($this->request->getAttribute('id')); |
| 121 | 121 | } |
| 122 | - catch(\Exception $e) { |
|
| 122 | + catch (\Exception $e) { |
|
| 123 | 123 | throw $e; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -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\Controller; |
| 6 | 6 | |
@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | public function index(): \Psr\Http\Message\ResponseInterface |
| 35 | 35 | { |
| 36 | 36 | $params = $this->request->getQueryParams(); |
| 37 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 38 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
| 37 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 38 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
| 39 | 39 | $events = $this->eventService->fetchAllArticles($page, $limit); |
| 40 | 40 | |
| 41 | - return new HtmlResponse($this->template->render('article::event/index', ['list' => $events, 'layout' => 'layout/admin'])); |
|
| 41 | + return new HtmlResponse($this->template->render('article::event/index', [ 'list' => $events, 'layout' => 'layout/admin' ])); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
| 44 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
| 45 | 45 | { |
| 46 | 46 | $id = $this->request->getAttribute('id'); |
| 47 | 47 | $event = $this->eventService->fetchSingleArticle($id); |
| 48 | 48 | $categories = $this->categoryService->getAll(); |
| 49 | 49 | |
| 50 | - if($this->request->getParsedBody()) { |
|
| 51 | - $event = (object)($this->request->getParsedBody() + (array)$event); |
|
| 50 | + if ($this->request->getParsedBody()) { |
|
| 51 | + $event = (object) ($this->request->getParsedBody() + (array) $event); |
|
| 52 | 52 | $event->article_id = $id; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -68,16 +68,16 @@ discard block |
||
| 68 | 68 | $data = $this->request->getParsedBody(); |
| 69 | 69 | $data += (new Request())->getFiles()->toArray(); |
| 70 | 70 | |
| 71 | - if($id) { |
|
| 71 | + if ($id) { |
|
| 72 | 72 | $this->eventService->updateArticle($data, $id); |
| 73 | 73 | } else { |
| 74 | 74 | $this->eventService->createArticle($user, $data); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | - catch(FilterException $fe) { |
|
| 77 | + catch (FilterException $fe) { |
|
| 78 | 78 | return $this->edit($fe->getArrayMessages()); |
| 79 | 79 | } |
| 80 | - catch(\Exception $e) { |
|
| 80 | + catch (\Exception $e) { |
|
| 81 | 81 | throw $e; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | try { |
| 90 | 90 | $this->eventService->deleteArticle($this->request->getAttribute('id')); |
| 91 | 91 | } |
| 92 | - catch(\Exception $e) { |
|
| 92 | + catch (\Exception $e) { |
|
| 93 | 93 | throw $e; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -72,11 +72,9 @@ discard block |
||
| 72 | 72 | } else { |
| 73 | 73 | $this->eventService->createArticle($user, $data); |
| 74 | 74 | } |
| 75 | - } |
|
| 76 | - catch(FilterException $fe) { |
|
| 75 | + } catch(FilterException $fe) { |
|
| 77 | 76 | return $this->edit($fe->getArrayMessages()); |
| 78 | - } |
|
| 79 | - catch(\Exception $e) { |
|
| 77 | + } catch(\Exception $e) { |
|
| 80 | 78 | throw $e; |
| 81 | 79 | } |
| 82 | 80 | |
@@ -87,8 +85,7 @@ discard block |
||
| 87 | 85 | { |
| 88 | 86 | try { |
| 89 | 87 | $this->eventService->deleteArticle($this->request->getAttribute('id')); |
| 90 | - } |
|
| 91 | - catch(\Exception $e) { |
|
| 88 | + } catch(\Exception $e) { |
|
| 92 | 89 | throw $e; |
| 93 | 90 | } |
| 94 | 91 | |
@@ -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\Controller; |
| 6 | 6 | |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | public function index(): HtmlResponse |
| 69 | 69 | { |
| 70 | 70 | $params = $this->request->getQueryParams(); |
| 71 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
| 72 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
| 71 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
| 72 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
| 73 | 73 | $videos = $this->videoService->fetchAllArticles($page, $limit); |
| 74 | 74 | |
| 75 | - return new HtmlResponse($this->template->render('article::video/index', ['list' => $videos, 'layout' => 'layout/admin'])); |
|
| 75 | + return new HtmlResponse($this->template->render('article::video/index', [ 'list' => $videos, 'layout' => 'layout/admin' ])); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return \Psr\Http\Message\ResponseInterface |
| 82 | 82 | */ |
| 83 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
| 83 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
| 84 | 84 | { |
| 85 | 85 | $id = $this->request->getAttribute('id'); |
| 86 | 86 | $video = $this->videoService->fetchSingleArticle($id); |
| 87 | 87 | $categories = $this->categoryService->getAll(); |
| 88 | 88 | |
| 89 | - if($this->request->getParsedBody()) { |
|
| 90 | - $video = (object)($this->request->getParsedBody() + (array)$video); |
|
| 89 | + if ($this->request->getParsedBody()) { |
|
| 90 | + $video = (object) ($this->request->getParsedBody() + (array) $video); |
|
| 91 | 91 | $video->article_id = $id; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | $data = $this->request->getParsedBody(); |
| 115 | 115 | $data += (new Request())->getFiles()->toArray(); |
| 116 | 116 | |
| 117 | - if($id) { |
|
| 117 | + if ($id) { |
|
| 118 | 118 | $this->videoService->updateArticle($data, $id); |
| 119 | 119 | } else { |
| 120 | 120 | $this->videoService->createArticle($user, $data); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - catch(FilterException $fe) { |
|
| 123 | + catch (FilterException $fe) { |
|
| 124 | 124 | return $this->edit($fe->getArrayMessages()); |
| 125 | 125 | } |
| 126 | - catch(\Exception $e) { |
|
| 126 | + catch (\Exception $e) { |
|
| 127 | 127 | throw $e; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -141,12 +141,12 @@ discard block |
||
| 141 | 141 | try { |
| 142 | 142 | $this->videoService->deleteArticle($this->request->getAttribute('id')); |
| 143 | 143 | } |
| 144 | - catch(\Exception $e) { |
|
| 144 | + catch (\Exception $e) { |
|
| 145 | 145 | throw $e; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $this->response->withStatus(302)->withHeader( |
| 149 | - 'Location', $this->router->generateUri('admin.videos', ['action' => 'index']) |
|
| 149 | + 'Location', $this->router->generateUri('admin.videos', [ 'action' => 'index' ]) |
|
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -117,11 +117,9 @@ discard block |
||
| 117 | 117 | } else { |
| 118 | 118 | $this->videoService->createArticle($user, $data); |
| 119 | 119 | } |
| 120 | - } |
|
| 121 | - catch(FilterException $fe) { |
|
| 120 | + } catch(FilterException $fe) { |
|
| 122 | 121 | return $this->edit($fe->getArrayMessages()); |
| 123 | - } |
|
| 124 | - catch(\Exception $e) { |
|
| 122 | + } catch(\Exception $e) { |
|
| 125 | 123 | throw $e; |
| 126 | 124 | } |
| 127 | 125 | |
@@ -138,8 +136,7 @@ discard block |
||
| 138 | 136 | { |
| 139 | 137 | try { |
| 140 | 138 | $this->videoService->deleteArticle($this->request->getAttribute('id')); |
| 141 | - } |
|
| 142 | - catch(\Exception $e) { |
|
| 139 | + } catch(\Exception $e) { |
|
| 143 | 140 | throw $e; |
| 144 | 141 | } |
| 145 | 142 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | return [ |
| 12 | 12 | 'templates' => [ |
| 13 | 13 | 'paths' => [ |
| 14 | - 'article' => [__DIR__ . '/../templates/article'], |
|
| 14 | + 'article' => [ __DIR__ . '/../templates/article' ], |
|
| 15 | 15 | ], |
| 16 | 16 | ], |
| 17 | 17 | |
@@ -51,49 +51,49 @@ discard block |
||
| 51 | 51 | 'name' => 'admin.posts', |
| 52 | 52 | 'path' => '/admin/posts', |
| 53 | 53 | 'middleware' => Controller\PostController::class, |
| 54 | - 'allowed_methods' => ['GET'], |
|
| 54 | + 'allowed_methods' => [ 'GET' ], |
|
| 55 | 55 | ], |
| 56 | 56 | [ |
| 57 | 57 | 'name' => 'admin.posts.action', |
| 58 | 58 | 'path' => '/admin/posts/:action/:id', |
| 59 | 59 | 'middleware' => Controller\PostController::class, |
| 60 | - 'allowed_methods' => ['GET', 'POST'], |
|
| 60 | + 'allowed_methods' => [ 'GET', 'POST' ], |
|
| 61 | 61 | ], |
| 62 | 62 | [ |
| 63 | 63 | 'name' => 'admin.discussions', |
| 64 | 64 | 'path' => '/admin/discussions', |
| 65 | 65 | 'middleware' => Controller\DiscussionController::class, |
| 66 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 66 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 67 | 67 | ], |
| 68 | 68 | [ |
| 69 | 69 | 'name' => 'admin.discussions.action', |
| 70 | 70 | 'path' => '/admin/discussions/:action/:id', |
| 71 | 71 | 'middleware' => Controller\DiscussionController::class, |
| 72 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 72 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 73 | 73 | ], |
| 74 | 74 | [ |
| 75 | 75 | 'name' => 'admin.events', |
| 76 | 76 | 'path' => '/admin/events', |
| 77 | 77 | 'middleware' => Controller\EventController::class, |
| 78 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 78 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 79 | 79 | ], |
| 80 | 80 | [ |
| 81 | 81 | 'name' => 'admin.events.action', |
| 82 | 82 | 'path' => '/admin/events/:action/:id', |
| 83 | 83 | 'middleware' => Controller\EventController::class, |
| 84 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 84 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 85 | 85 | ], |
| 86 | 86 | [ |
| 87 | 87 | 'name' => 'admin.videos', |
| 88 | 88 | 'path' => '/admin/videos', |
| 89 | 89 | 'middleware' => Controller\VideoController::class, |
| 90 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 90 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 91 | 91 | ], |
| 92 | 92 | [ |
| 93 | 93 | 'name' => 'admin.videos.action', |
| 94 | 94 | 'path' => '/admin/videos/:action/:id', |
| 95 | 95 | 'middleware' => Controller\VideoController::class, |
| 96 | - 'allowed_methods' => ['GET', 'POST'] |
|
| 96 | + 'allowed_methods' => [ 'GET', 'POST' ] |
|
| 97 | 97 | ] |
| 98 | 98 | ], |
| 99 | 99 | |