Completed
Pull Request — master (#3407)
by Antoine
05:48
created

Operation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 27
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A addResponse() 0 5 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