Lines 100.00% 6 / 6
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Covered by tests of size
Name Lines Methods CRAP
 setName 100.00% 1 / 1 100.00% 1 / 1 1
 setRedirectUri 100.00% 1 / 1 100.00% 1 / 1 1
 setConfidential 100.00% 1 / 1 100.00% 1 / 1 1
 supportsGrantType 100.00% 3 / 3 100.00% 1 / 1 2
26final class ClientEntity implements ClientEntityInterface
27{
28    use EntityTrait;
29    use ClientTrait;
30
31    public ?string $secret = null {
32        get {
33            return $this->secret;
34        }
35        set {
36            $this->secret = $value;
37        }
38    }
39
40    /** @var string[] */
41    public array $allowedGrants = [] {
42        set {
43            $this->allowedGrants = $value;
44        }
45    }
46
47    public function setName(string $name): void
48    {
49        $this->name = $name;
50    }
51
52    /**
53     * @param string|string[] $redirectUri
54     */
55    public function setRedirectUri(string|array $redirectUri): void
56    {
57        $this->redirectUri = $redirectUri;
58    }
59
60    public function setConfidential(bool $isConfidential): void
61    {
62        $this->isConfidential = $isConfidential;
63    }
64
65    public function supportsGrantType(string $grantType): bool
66    {
67        if ($this->allowedGrants === []) {
68            return true;
69        }
70
71        return in_array($grantType, $this->allowedGrants, strict: true);
72    }
73}