ActivityController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 8 2
1
<?php
2
3
namespace App\Controller\Api;
4
5
use Doctrine\ODM\MongoDB\DocumentManager;
6
use Fig\Link\Link;
7
use Nelmio\ApiDocBundle\Annotation\Security;
8
use Swagger\Annotations as SWG;
9
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10
use Symfony\Component\HttpFoundation\Request;
11
use Symfony\Component\HttpFoundation\Response;
12
use Symfony\Component\Routing\Annotation\Route;
13
14
/**
15
 * Provide routes for activity API.
16
 *
17
 * @Route("/api/activity", name="api_activity_", defaults={"_format": "json"})
18
 */
19
class ActivityController extends AbstractController
20
{
21
    /**
22
     * List activity.
23
     *
24
     * @Route("", name="index", methods={"GET"})
25
     * @SWG\Response(
26
     *     response=200,
27
     *     description="Returns activity",
28
     *     @SWG\Schema(
29
     *         type="array",
30
     *         @SWG\Items(type="string")
31
     *     )
32
     * )
33
     * @SWG\Tag(name="activity")
34
     * @Security(name="Bearer")
35
     */
36
    public function index(DocumentManager $dm, Request $request, string $mercurePublicUrl, bool $mercureEnabled = true): Response
37
    {
38
        if($mercureEnabled) {
39
            $this->addLink($request, new Link('mercure', $mercurePublicUrl));
40
        }
41
42
        $data = $dm->getRepository('App:Provider')->findUpdateInProgress();
43
        return $this->json($data);
44
    }
45
46
}
47