Completed
Pull Request — master (#3407)
by Antoine
06:51 queued 02:47
created

OpenApi   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 63
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getTags() 0 3 1
A getInfo() 0 3 1
A getServers() 0 3 1
A getPaths() 0 3 1
A getComponents() 0 3 1
A getOpenapi() 0 3 1
A getExternalDocs() 0 3 1
A getSecurity() 0 3 1
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