| @@ -19,7 +19,7 @@ discard block | ||
| 19 | 19 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. | 
| 20 | 20 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | 
| 21 | 21 | </p>'; | 
| 22 | -   }elseif($step_number == 2){
 | |
| 22 | +   } elseif($step_number == 2){
 | |
| 23 | 23 | $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, | 
| 24 | 24 | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, | 
| 25 | 25 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. | 
| 33 | 33 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | 
| 34 | 34 | </p>'; | 
| 35 | -   }elseif($step_number == 3){
 | |
| 35 | +   } elseif($step_number == 3){
 | |
| 36 | 36 | $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, | 
| 37 | 37 | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, | 
| 38 | 38 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | 
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. | 
| 52 | 52 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | 
| 53 | 53 | </p>'; | 
| 54 | -   }else{
 | |
| 54 | +   } else{
 | |
| 55 | 55 | $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, | 
| 56 | 56 | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, | 
| 57 | 57 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | 
| @@ -96,17 +96,14 @@ discard block | ||
| 96 | 96 | |
| 97 | 97 |              if($userId){ | 
| 98 | 98 | $this->adminUserService->updateUser($data, $userId); | 
| 99 | - } | |
| 100 | -            else{ | |
| 99 | +            } else{ | |
| 101 | 100 | $this->adminUserService->registerNewUser($data); | 
| 102 | 101 | } | 
| 103 | 102 | |
| 104 | 103 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); | 
| 105 | - } | |
| 106 | -        catch(FilterException $fe){ | |
| 104 | +        } catch(FilterException $fe){ | |
| 107 | 105 | return $this->edit($fe->getArrayMessages()); | 
| 108 | - } | |
| 109 | -        catch(\Exception $e){ | |
| 106 | +        } catch(\Exception $e){ | |
| 110 | 107 | throw $e; | 
| 111 | 108 | } | 
| 112 | 109 | } | 
| @@ -118,8 +115,7 @@ discard block | ||
| 118 | 115 | $this->adminUserService->delete($userId); | 
| 119 | 116 | |
| 120 | 117 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); | 
| 121 | - } | |
| 122 | -        catch(\Exception $e){ | |
| 118 | +        } catch(\Exception $e){ | |
| 123 | 119 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); | 
| 124 | 120 | } | 
| 125 | 121 | } | 
| @@ -98,7 +98,7 @@ | ||
| 98 | 98 | /** | 
| 99 | 99 | * Clears user session. | 
| 100 | 100 | * | 
| 101 | - * @return static | |
| 101 | + * @return \Psr\Http\Message\ResponseInterface | |
| 102 | 102 | */ | 
| 103 | 103 | public function logout(): \Psr\Http\Message\ResponseInterface | 
| 104 | 104 |      { | 
| @@ -86,8 +86,7 @@ | ||
| 86 | 86 | $this->session->getStorage()->user = $this->adminUserService->loginUser($email, $password); | 
| 87 | 87 | |
| 88 | 88 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin')); | 
| 89 | - } | |
| 90 | -        catch(\Exception $e) { | |
| 89 | +        } catch(\Exception $e) { | |
| 91 | 90 | return $this->login($e->getMessage()); | 
| 92 | 91 | |
| 93 | 92 | //@todo set $e->getMessage() to flash messanger and print messages in next page | 
| @@ -29,6 +29,9 @@ discard block | ||
| 29 | 29 | $this->adapter = $adapter; | 
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | + /** | |
| 33 | + * @param string $id | |
| 34 | + */ | |
| 32 | 35 | public function get($id) | 
| 33 | 36 |      { | 
| 34 | 37 | return $this->select(['admin_user_id' => $id])->current(); | 
| @@ -38,7 +41,7 @@ discard block | ||
| 38 | 41 | * Get admin user by email. | 
| 39 | 42 | * | 
| 40 | 43 | * @param string $email email | 
| 41 | - * @return array|\ArrayObject|null | |
| 44 | + * @return string | |
| 42 | 45 | */ | 
| 43 | 46 | public function getByEmail(string $email) | 
| 44 | 47 |      { | 
| @@ -48,7 +51,6 @@ discard block | ||
| 48 | 51 | /** | 
| 49 | 52 | * Updates login data. | 
| 50 | 53 | * | 
| 51 | - * @param string $uuid admin user id | |
| 52 | 54 | * @return int number of affected rows | 
| 53 | 55 | */ | 
| 54 | 56 | public function updateLogin(string $userId) : int | 
| @@ -56,6 +58,9 @@ discard block | ||
| 56 | 58 |          return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]); | 
| 57 | 59 | } | 
| 58 | 60 | |
| 61 | + /** | |
| 62 | + * @param string $userId | |
| 63 | + */ | |
| 59 | 64 | public function getPaginationSelect($userId) | 
| 60 | 65 |      { | 
| 61 | 66 | $select = $this->getSql()->select()->order(['created_at' => 'desc']); | 
| @@ -85,17 +85,14 @@ discard block | ||
| 85 | 85 | |
| 86 | 86 |              if($id){ | 
| 87 | 87 | $this->categoryService->updateCategory($data, $id); | 
| 88 | - } | |
| 89 | -            else{ | |
| 88 | +            } else{ | |
| 90 | 89 | $this->categoryService->createCategory($data); | 
| 91 | 90 | } | 
| 92 | 91 | |
| 93 | 92 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); | 
| 94 | - } | |
| 95 | -        catch(FilterException $fe){ | |
| 93 | +        } catch(FilterException $fe){ | |
| 96 | 94 | return $this->edit($fe->getArrayMessages()); | 
| 97 | - } | |
| 98 | -        catch(\Exception $e){ | |
| 95 | +        } catch(\Exception $e){ | |
| 99 | 96 | throw $e; | 
| 100 | 97 | } | 
| 101 | 98 | } | 
| @@ -107,8 +104,7 @@ discard block | ||
| 107 | 104 | $this->categoryService->delete($id); | 
| 108 | 105 | |
| 109 | 106 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); | 
| 110 | - } | |
| 111 | -        catch(\Exception $e){ | |
| 107 | +        } catch(\Exception $e){ | |
| 112 | 108 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); | 
| 113 | 109 | } | 
| 114 | 110 | } | 
| @@ -64,17 +64,14 @@ discard block | ||
| 64 | 64 | |
| 65 | 65 |              if($id){ | 
| 66 | 66 | $this->menuService->updateMenuItem($data, $id); | 
| 67 | - } | |
| 68 | -            else{ | |
| 67 | +            } else{ | |
| 69 | 68 | $this->menuService->addMenuItem($data); | 
| 70 | 69 | } | 
| 71 | 70 | |
| 72 | 71 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu')); | 
| 73 | - } | |
| 74 | -        catch(FilterException $fe){ | |
| 72 | +        } catch(FilterException $fe){ | |
| 75 | 73 | return $this->edit($fe->getArrayMessages()); | 
| 76 | - } | |
| 77 | -        catch(\Exception $e){ | |
| 74 | +        } catch(\Exception $e){ | |
| 78 | 75 | throw $e; | 
| 79 | 76 | } | 
| 80 | 77 | } | 
| @@ -86,8 +83,7 @@ discard block | ||
| 86 | 83 | $this->menuService->delete($id); | 
| 87 | 84 | |
| 88 | 85 |              return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu')); | 
| 89 | - } | |
| 90 | -        catch(\Exception $e){ | |
| 86 | +        } catch(\Exception $e){ | |
| 91 | 87 | throw $e; | 
| 92 | 88 | } | 
| 93 | 89 | } | 
| @@ -12,7 +12,6 @@ | ||
| 12 | 12 | /** | 
| 13 | 13 | * Fetches a list of ArticleEntity models. | 
| 14 | 14 | * | 
| 15 | - * @param array $params | |
| 16 | 15 | * @return ArrayObject | 
| 17 | 16 | */ | 
| 18 | 17 | public function fetchAllArticles($page, $limit); | 
| @@ -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 | |
| @@ -112,15 +112,12 @@ discard block | ||
| 112 | 112 | |
| 113 | 113 |              if($id){ | 
| 114 | 114 | $this->postService->updateArticle($data, $id); | 
| 115 | - } | |
| 116 | -            else{ | |
| 115 | +            } else{ | |
| 117 | 116 | $this->postService->createArticle($user, $data); | 
| 118 | 117 | } | 
| 119 | - } | |
| 120 | -        catch(FilterException $fe){ | |
| 118 | +        } catch(FilterException $fe){ | |
| 121 | 119 | return $this->edit($fe->getArrayMessages()); | 
| 122 | - } | |
| 123 | -        catch(\Exception $e){ | |
| 120 | +        } catch(\Exception $e){ | |
| 124 | 121 | throw $e; | 
| 125 | 122 | } | 
| 126 | 123 | |
| @@ -137,8 +134,7 @@ discard block | ||
| 137 | 134 |      { | 
| 138 | 135 |          try{ | 
| 139 | 136 |              $this->postService->deleteArticle($this->request->getAttribute('id')); | 
| 140 | - } | |
| 141 | -        catch(\Exception $e){ | |
| 137 | +        } catch(\Exception $e){ | |
| 142 | 138 | throw $e; | 
| 143 | 139 | } | 
| 144 | 140 | |