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

PathItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addOperation() 0 3 1
A __construct() 0 15 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 PathItem
17
{
18
    private $ref;
19
    private $summary;
20
    private $description;
21
    private $get;
22
    private $put;
23
    private $post;
24
    private $delete;
25
    private $options;
26
    private $head;
27
    private $patch;
28
    private $trace;
29
    private $servers;
30
    private $parameters;
31
32
    public function __construct(?string $ref = null, string $summary = '', string $description = '', Operation $get = null, Operation $put = null, Operation $post = null, Operation $delete = null, Operation $options = null, Operation $head = null, Operation $patch = null, Operation $trace = null, array $servers = [], array $parameters = [])
33
    {
34
        $this->ref = $ref;
35
        $this->summary = $summary;
36
        $this->description = $description;
37
        $this->get = $get;
38
        $this->put = $put;
39
        $this->post = $post;
40
        $this->delete = $delete;
41
        $this->options = $options;
42
        $this->head = $head;
43
        $this->patch = $patch;
44
        $this->trace = $trace;
45
        $this->servers = $servers;
46
        $this->parameters = $parameters;
47
    }
48
49
    public function addOperation(string $method, Operation $operation)
50
    {
51
        $this->{strtolower($method)} = $operation;
52
    }
53
}
54