aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-10-25 17:03:33 +0200
committerWilly Micieli <micieli@laposte.net>2019-10-25 17:03:33 +0200
commit165ddcf25bed9ad937efff165059f99e3d3597c7 (patch)
treef1a267e2829a0369b8531b5cc15379c6c9930d78
parentd65d2d360929b0288285150604b4410ac19728dd (diff)
downloadimperium-165ddcf25bed9ad937efff165059f99e3d3597c7.zip
imperium-165ddcf25bed9ad937efff165059f99e3d3597c7.tar.gz
reformat classe
-rw-r--r--imperium/Controller/Task.php153
1 files changed, 77 insertions, 76 deletions
diff --git a/imperium/Controller/Task.php b/imperium/Controller/Task.php
index faf4570..41c9dde 100644
--- a/imperium/Controller/Task.php
+++ b/imperium/Controller/Task.php
@@ -1,87 +1,88 @@
<?php
-namespace Imperium\Controller;
+namespace Imperium\Controller {
-use DI\DependencyException;
-use DI\NotFoundException;
-use Imperium\Action\Todo;
-use Imperium\Exception\Kedavra;
-use Imperium\Html\Form\Form;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Symfony\Component\HttpFoundation\Response;
-use Twig\Error\LoaderError;
-use Twig\Error\RuntimeError;
-use Twig\Error\SyntaxError;
+ use DI\DependencyException;
+ use DI\NotFoundException;
+ use Imperium\Action\Todo;
+ use Imperium\Exception\Kedavra;
+ use Imperium\Html\Form\Form;
+ use Symfony\Component\HttpFoundation\RedirectResponse;
+ use Symfony\Component\HttpFoundation\Response;
+ use Twig\Error\LoaderError;
+ use Twig\Error\RuntimeError;
+ use Twig\Error\SyntaxError;
-class Task extends Controller
-{
- /**
- *
- * Close a task
- *
- * @param int $id
- *
- * @return RedirectResponse
- *
- * @throws DependencyException
- * @throws NotFoundException
- * @throws Kedavra
- *
- */
- public function finish(int $id): RedirectResponse
+ class Task extends Controller
{
- return Todo::destroy($id) ? $this->back('removed') : $this->back('not removed',false);
- }
+ /**
+ *
+ * Close a task
+ *
+ * @param int $id
+ *
+ * @return RedirectResponse
+ *
+ * @throws DependencyException
+ * @throws NotFoundException
+ * @throws Kedavra
+ *
+ */
+ public function finish(int $id): RedirectResponse
+ {
+ return Todo::destroy($id) ? $this->back('removed') : $this->back('not removed',false);
+ }
- /**
- *
- * Create a task
- *
- * @return RedirectResponse
- *
- * @throws DependencyException
- * @throws Kedavra
- * @throws NotFoundException
- *
- */
- public function add(): RedirectResponse
- {
- $todo = collect($this->request()->request->all())->del(CSRF_TOKEN,'method')->all();
- return Todo::create($todo) ? $this->back('created') : $this->back('fail',false);
- }
+ /**
+ *
+ * Create a task
+ *
+ * @return RedirectResponse
+ *
+ * @throws DependencyException
+ * @throws Kedavra
+ * @throws NotFoundException
+ *
+ */
+ public function add(): RedirectResponse
+ {
+ $todo = collect($this->request()->request->all())->del(CSRF_TOKEN,'method')->all();
+ return Todo::create($todo) ? $this->back('created') : $this->back('fail',false);
+ }
- /**
- *
- * Display all tasks
- *
- * @return Response
- *
- * @throws DependencyException
- * @throws Kedavra
- * @throws NotFoundException
- * @throws LoaderError
- * @throws RuntimeError
- * @throws SyntaxError
- *
- */
- public function home(): Response
- {
- $todo = Todo::query()->by('due',self::ASC)->all();
- $form = $this->form()->start('task','add')
- ->row()
- ->input(Form::TEXT,'task','task')
- ->end_row_and_new()
- ->textarea('description','description')
- ->end_row_and_new()
- ->input(Form::DATE,'due','The due date')
- ->end_row_and_new()
- ->select(false,'priority',['none','low','medium','high'])
- ->end_row_and_new()
- ->submit('add')
- ->end_row()
- ->get();
- return $this->view('@todo/home',compact('todo','form'));
+ /**
+ *
+ * Display all tasks
+ *
+ * @return Response
+ *
+ * @throws DependencyException
+ * @throws Kedavra
+ * @throws NotFoundException
+ * @throws LoaderError
+ * @throws RuntimeError
+ * @throws SyntaxError
+ *
+ */
+ public function home(): Response
+ {
+ $todo = Todo::query()->by('due',self::ASC)->all();
+ $form = $this->form()->start('task','add')
+ ->row()
+ ->input(Form::TEXT,'task','task')
+ ->end_row_and_new()
+ ->textarea('description','description')
+ ->end_row_and_new()
+ ->input(Form::DATE,'due','The due date')
+ ->end_row_and_new()
+ ->select(false,'priority',['none','low','medium','high'])
+ ->end_row_and_new()
+ ->submit('add')
+ ->end_row()
+ ->get();
+ return $this->view('@todo/home',compact('todo','form'));
+ }
}
} \ No newline at end of file