Passed
Pull Request — master (#11)
by
unknown
23:16
created

AuthenticationScheme::getDocumentationUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the tmilos/scim-schema package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Tmilos\ScimSchema\Model\SPC;
13
14
use Tmilos\ScimSchema\Model\SerializableInterface;
15
16
class AuthenticationScheme implements SerializableInterface
17
{
18
    public const string OAUTH = 'oauth';
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 18 at column 24
Loading history...
19
20
    public const string OAUTH2 = 'oauth2';
21
22
    public const string OAUTH_BEARER_TOKEN = 'oauthbearertoken';
23
24
    public const string HTTP_BASIC = 'httpbasic';
25
26
    public const string HTTP_DIGEST = 'httpdigest';
27
28
    /**
29
     * @param string $type
30
     * @param string $name
31
     * @param string $description
32
     * @param string $specUri
33
     * @param string $documentationUri
34
     */
35
    public function __construct(private $type, private $name, private $description, private $specUri, private $documentationUri)
36
    {
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getType()
43
    {
44
        return $this->type;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getName()
51
    {
52
        return $this->name;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getDescription()
59
    {
60
        return $this->description;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getSpecUri()
67
    {
68
        return $this->specUri;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getDocumentationUri()
75
    {
76
        return $this->documentationUri;
77
    }
78
79
    public function serializeObject(): array
80
    {
81
        $result = [
82
            'type' => $this->type,
83
            'name' => $this->name,
84
            'description' => $this->description,
85
        ];
86
87
        if ($this->specUri) {
88
            $result['specUri'] = $this->specUri;
89
        }
90
91
        if ($this->documentationUri) {
92
            $result['documentationUri'] = $this->documentationUri;
93
        }
94
95
        return $result;
96
    }
97
98
    /**
99
     * @return AuthenticationScheme
100
     */
101
    public static function deserializeObject(array $data): static
102
    {
103
        return new static(
104
            $data['type'],
105
            $data['name'],
106
            $data['description'],
107
            $data['specUri'] ?? null,
108
            $data['documentationUri'] ?? null
109
        );
110
    }
111
}
112