Passed
Pull Request — master (#7302)
by Angel Fernando Quiroz
09:53
created

SchemaCollectionController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 16 1
1
<?php
2
3
/* For licensing terms,
4
see /license.txt */
5
6
declare(strict_types=1);
7
8
namespace Chamilo\CoreBundle\Controller\Scim;
9
10
use Chamilo\CoreBundle\Traits\Scim\UserSchemaControllerTrait;
11
use Symfony\Component\HttpFoundation\JsonResponse;
12
use Symfony\Component\HttpFoundation\Response;
13
use Symfony\Component\Routing\Attribute\Route;
14
15
#[Route('/scim/v2/Schemas', name: 'scim_schemas', methods: ['GET'])]
16
class SchemaCollectionController extends AbstractScimController
17
{
18
    use UserSchemaControllerTrait;
19
20
    public function __invoke(): JsonResponse
21
    {
22
        $schemas = [
23
            'schemas' => ['urn:ietf:params:scim:api:messages:2.0:ListResponse'],
24
            'itemsPerPage' => 1,
25
            'startIndex' => 1,
26
            'totalResults' => 1,
27
            'Resources' => [
28
                $this->getUserCoreSchema(),
29
            ],
30
        ];
31
32
        return new JsonResponse(
33
            $schemas,
34
            Response::HTTP_OK,
35
            ['Content-Type' => self::SCIM_CONTENT_TYPE]
36
        );
37
    }
38
}
39