public function route($args) { $id = array_shift($args); $articles = $this->articleService->getAll(); if ($id !== null) { $article = $this->articleService->getArticle($id); } elseif (isset($this->app->flashData()['article'])) { $article = $this->app->flashData()['article']; } else { $article = null; } $this->app->render('admin/admin-article.html.twig', array('token' => $_SESSION['token'], 'stylesheets' => $this->getStyles(), 'type' => 'article', 'articles' => $articles, 'article' => $article)); }