From 67b836164997527b91452b19adbcb8aa3c5decf1 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 15 May 2016 18:31:47 -0400 Subject: Refactoring: added controlled middleware and changed response class --- app/Controller/TaskInternalLink.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'app/Controller/TaskInternalLink.php') diff --git a/app/Controller/TaskInternalLink.php b/app/Controller/TaskInternalLink.php index ac5e04b7..6ff20252 100644 --- a/app/Controller/TaskInternalLink.php +++ b/app/Controller/TaskInternalLink.php @@ -2,6 +2,8 @@ namespace Kanboard\Controller; +use Kanboard\Core\Controller\PageNotFoundException; + /** * TaskInternalLink Controller * @@ -9,20 +11,21 @@ namespace Kanboard\Controller; * @author Olivier Maridat * @author Frederic Guillot */ -class TaskInternalLink extends Base +class TaskInternalLink extends BaseController { /** * Get the current link * * @access private * @return array + * @throws PageNotFoundException */ private function getTaskLink() { $link = $this->taskLink->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { - return $this->notfound(); + throw new PageNotFoundException(); } return $link; @@ -32,6 +35,10 @@ class TaskInternalLink extends Base * Creation form * * @access public + * @param array $values + * @param array $errors + * @throws PageNotFoundException + * @throws \Kanboard\Core\Controller\AccessForbiddenException */ public function create(array $values = array(), array $errors = array()) { @@ -67,13 +74,17 @@ class TaskInternalLink extends Base $this->flash->failure(t('Unable to create your link.')); } - $this->create($values, $errors); + return $this->create($values, $errors); } /** * Edit form * * @access public + * @param array $values + * @param array $errors + * @throws PageNotFoundException + * @throws \Kanboard\Core\Controller\AccessForbiddenException */ public function edit(array $values = array(), array $errors = array()) { @@ -116,7 +127,7 @@ class TaskInternalLink extends Base $this->flash->failure(t('Unable to update your link.')); } - $this->edit($values, $errors); + return $this->edit($values, $errors); } /** -- cgit v1.2.3