Passed
Push — master ( c36d6d...6cd33d )
by Julito
11:42
created

UpdateVisibilityDocument   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Controller\Api;
8
9
use Chamilo\CourseBundle\Entity\CDocument;
10
use Chamilo\CourseBundle\Repository\CDocumentRepository;
11
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
12
use Symfony\Component\HttpKernel\Attribute\AsController;
13
14
#[AsController]
15
class UpdateVisibilityDocument extends AbstractController
16
{
17
    public function __invoke(CDocument $document, CDocumentRepository $repo): CDocument
18
    {
19
        $repo->toggleVisibilityPublishedDraft($document);
20
21
        return $document;
22
    }
23
}
24