22
33namespace librarianphp \Web ;
44
5+ use Librarian \Provider \ContentServiceProvider ;
56use Librarian \Provider \TwigServiceProvider ;
6- use Librarian \Request ;
7- use Librarian \WebController ;
87use Librarian \Response ;
9- use Librarian \Provider \ ContentServiceProvider ;
8+ use Librarian \WebController ;
109
1110class IndexController extends WebController
1211{
@@ -23,10 +22,11 @@ public function handle(): void
2322 $ content = $ content_provider ->fetch ($ this ->getApp ()->config ->site_index );
2423 if ($ content ) {
2524 $ response = new Response ($ twig ->render ($ indexTpl , [
26- 'content ' => $ content
25+ 'content ' => $ content,
2726 ]));
2827
2928 $ response ->output ();
29+
3030 return ;
3131 }
3232 }
@@ -35,7 +35,7 @@ public function handle(): void
3535 $ limit = $ this ->getApp ()->config ->posts_per_page ?? 10 ;
3636 $ params = $ request ->getParams ();
3737
38- if (key_exists ('page ' , $ params )) {
38+ if (array_key_exists ('page ' , $ params )) {
3939 $ page = $ params ['page ' ];
4040 }
4141
@@ -44,9 +44,9 @@ public function handle(): void
4444 $ content_list = $ content_provider ->fetchAll ($ start , $ limit );
4545
4646 $ output = $ twig ->render ('content/listing.html.twig ' , [
47- 'content_list ' => $ content_list ,
47+ 'content_list ' => $ content_list ,
4848 'total_pages ' => $ content_provider ->fetchTotalPages ($ limit ),
49- 'current_page ' => $ page
49+ 'current_page ' => $ page,
5050 ]);
5151
5252 $ response = new Response ($ output );
0 commit comments