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

ReadForum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 18
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\Entity\Forum;
8
use ProjetNormandie\ForumBundle\Service\MarkAsReadService;
9
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10
use Symfony\Component\HttpFoundation\JsonResponse;
11
12
class ReadForum extends AbstractController
13
{
14
    private MarkAsReadService $markAsReadService;
15
16
    public function __construct(MarkAsReadService $markAsReadService)
17
    {
18
        $this->markAsReadService = $markAsReadService;
19
    }
20
21
22
    /**
23
     * @param Forum $forum
24
     * @return JsonResponse
25
     */
26
    public function __invoke(Forum $forum): JsonResponse
27
    {
28
        $this->markAsReadService->readForum($forum);
29
        return new JsonResponse(['sucess' => true]);
30
    }
31
}
32