Passed
Pull Request — master (#3407)
by Antoine
03:51
created

OpenApi::getExternalDocs()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\OpenApi;
15
16
class OpenApi
17
{
18
    public const VERSION = '3.0.2';
19
20
    private $openapi;
21
    private $info;
22
    private $servers;
23
    private $paths;
24
    private $components;
25
    private $security;
26
    private $tags;
27
    private $externalDocs;
28
29
    public function __construct(Info $info, array $servers = [], Paths $paths, Components $components = null, array $security = [], array $tags = [], $externalDocs = null)
30
    {
31
        $this->openapi = self::VERSION;
32
        $this->info = $info;
33
        $this->servers = $servers;
34
        $this->paths = $paths;
35
        $this->components = $components;
36
        $this->security = $security;
37
        $this->tags = $tags;
38
        $this->externalDocs = $externalDocs;
39
    }
40
41
    public function getOpenapi(): string
42
    {
43
        return $this->openapi;
44
    }
45
46
    public function getInfo(): Info
47
    {
48
        return $this->info;
49
    }
50
51
    public function getServers(): array
52
    {
53
        return $this->servers;
54
    }
55
56
    public function getPaths(): Paths
57
    {
58
        return $this->paths;
59
    }
60
61
    public function getComponents(): Components
62
    {
63
        return $this->components;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->components could return the type null which is incompatible with the type-hinted return ApiPlatform\Core\OpenApi\Components. Consider adding an additional type-check to rule them out.
Loading history...
64
    }
65
66
    public function getSecurity(): array
67
    {
68
        return $this->security;
69
    }
70
71
    public function getTags(): array
72
    {
73
        return $this->tags;
74
    }
75
76
    public function getExternalDocs(): array
77
    {
78
        return $this->externalDocs;
79
    }
80
}
81