RestRequestOptionsRegistry::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Maba\Bundle\RestBundle\Service;
5
6
use Maba\Bundle\RestBundle\Entity\RestRequestOptions;
7
8
/**
9
 * @internal
10
 */
11
class RestRequestOptionsRegistry
12
{
13
    /**
14
     * @var array|RestRequestOptions[] associative array
15
     */
16
    private $restRequestOptionsByController;
17
18 81
    public function __construct()
19
    {
20 81
        $this->restRequestOptionsByController = [];
21 81
    }
22
23 81
    public function registerRestRequestOptions(RestRequestOptions $options, string $controller)
24
    {
25 81
        $this->restRequestOptionsByController[$controller] = $options;
26 81
    }
27
28
    /**
29
     * @param string $controller
30
     * @return RestRequestOptions|null
31
     */
32 37
    public function getRestRequestOptionsForController(string $controller)
33
    {
34 37
        return $this->restRequestOptionsByController[$controller] ?? null;
35
    }
36
}
37