Failed Conditions
Push — master ( 47f59b...bc2c08 )
by Florent
04:48
created

OAuth2::getCustom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2019 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\SecurityBundle\Annotation;
15
16
use BadMethodCallException;
17
use function Safe\sprintf;
18
19
/**
20
 * @Annotation
21
 * @Target({"CLASS", "METHOD"})
22
 */
23
class OAuth2
24
{
25
    /**
26
     * @var null|string
27
     */
28
    private $scope;
29
30
    /**
31
     * @var null|string
32
     */
33
    private $token_type;
34
35
    /**
36
     * @var null|string
37
     */
38
    private $client_id;
39
40
    /**
41
     * @var null|string
42
     */
43
    private $resource_owner_id;
44
45
    /**
46
     * @var null|array
47
     */
48
    private $custom;
49
50
    public function __construct(array $data)
51
    {
52
        foreach ($data as $key => $value) {
53
            if (!property_exists($this, $key)) {
54
                throw new BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
55
            }
56
            $this->{$key} = $value;
57
        }
58
    }
59
60
    public function getClientId(): ?string
61
    {
62
        return $this->client_id;
63
    }
64
65
    public function getResourceOwnerId(): ?string
66
    {
67
        return $this->resource_owner_id;
68
    }
69
70
    public function getScope(): ?string
71
    {
72
        return $this->scope;
73
    }
74
75
    public function getTokenType(): ?string
76
    {
77
        return $this->token_type;
78
    }
79
80
    public function getCustom(): ?array
81
    {
82
        return $this->custom;
83
    }
84
}
85