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

Operation   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 39
c 1
b 0
f 0
dl 0
loc 100
rs 10
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A addResponse() 0 5 1
A getDescription() 0 3 1
A getParameters() 0 3 1
A getExternalDocs() 0 3 1
A getSummary() 0 3 1
A getDeprecated() 0 3 1
A getTags() 0 3 1
A getCallbacks() 0 3 1
A getOperationId() 0 3 1
A getSecurity() 0 3 1
A getResponses() 0 3 1
A getServers() 0 3 1
A getRequestBody() 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 Operation
17
{
18
    private $tags;
19
    private $summary;
20
    private $description;
21
    private $operationId;
22
    /**
23
     * @Parameter | Reference
24
     */
25
    private $parameters;
26
27
    private $requestBody;
28
    private $responses;
29
    private $callbacks;
30
    private $deprecated;
31
    private $security;
32
    private $servers;
33
    private $externalDocs;
34
35
    public function __construct(string $operationId = null, array $tags = [], array $responses = [], string $summary = '', string $description = '', $externalDocs = [], array $parameters = [], RequestBody $requestBody = null, $callbacks = [], bool $deprecated = false, $security = [], array $servers = [])
36
    {
37
        $this->tags = $tags;
38
        $this->summary = $summary;
39
        $this->description = $description;
40
        $this->operationId = $operationId;
41
        $this->parameters = $parameters;
42
        $this->requestBody = $requestBody;
43
        $this->responses = $responses;
44
        $this->callbacks = $callbacks;
45
        $this->deprecated = $deprecated;
46
        $this->security = $security;
47
        $this->servers = $servers;
48
        $this->externalDocs = $externalDocs;
49
    }
50
51
    public function addResponse(Response $response, $status = 'default')
52
    {
53
        $this->responses[$status] = $response;
54
55
        return $this;
56
    }
57
58
    public function getTags()
59
    {
60
        return $this->tags;
61
    }
62
63
    public function getSummary()
64
    {
65
        return $this->summary;
66
    }
67
68
    public function getDescription()
69
    {
70
        return $this->description;
71
    }
72
73
    public function getOperationId()
74
    {
75
        return $this->operationId;
76
    }
77
78
    public function getParameters()
79
    {
80
        return $this->parameters;
81
    }
82
83
    public function getRequestBody()
84
    {
85
        return $this->requestBody;
86
    }
87
88
    public function getResponses()
89
    {
90
        return $this->responses;
91
    }
92
93
    public function getCallbacks()
94
    {
95
        return $this->callbacks;
96
    }
97
98
    public function getDeprecated()
99
    {
100
        return $this->deprecated;
101
    }
102
103
    public function getSecurity()
104
    {
105
        return $this->security;
106
    }
107
108
    public function getServers()
109
    {
110
        return $this->servers;
111
    }
112
113
    public function getExternalDocs()
114
    {
115
        return $this->externalDocs;
116
    }
117
}
118