Passed
Push — develop ( c95ce3...d0c957 )
by BENARD
22:42 queued 19:38
created

ReadAllForum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProjetNormandie\ForumBundle\Controller;
6
7
use ProjetNormandie\ForumBundle\Service\MarkAsReadService;
8
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9
use Symfony\Component\HttpFoundation\JsonResponse;
10
11
class ReadAllForum extends AbstractController
12
{
13
    private MarkAsReadService $markAsReadService;
14
15
    public function __construct(MarkAsReadService $markAsReadService)
16
    {
17
        $this->markAsReadService = $markAsReadService;
18
    }
19
20
    /**
21
     * @return JsonResponse
22
     */
23
    public function __invoke(): JsonResponse
24
    {
25
        $this->markAsReadService->readAll();
26
        return new JsonResponse(['sucess' => true]);
27
    }
28
}
29