Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FaqController
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 index
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Controllers;
6
7use Engelsystem\Config\Config;
8use Engelsystem\Http\Response;
9use Engelsystem\Models\Faq;
10
11class FaqController extends BaseController
12{
13    use HasUserNotifications;
14
15    /** @var string[] */
16    protected array $permissions = [
17        'faq.view',
18    ];
19
20    public function __construct(
21        protected Config $config,
22        protected Faq $faq,
23        protected Response $response
24    ) {
25    }
26
27    public function index(): Response
28    {
29        $text = $this->config->get('faq_text');
30
31        $faq = $this->faq->orderBy('question')->get();
32
33        return $this->response->withView(
34            'pages/faq/index.twig',
35            ['text' => $text, 'items' => $faq]
36        );
37    }
38}