Completed
Push — master ( fcd315...e54b6a )
by John
02:20
created

OpenApiDescription   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 20
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 12 5
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\ApiDescriptions package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\ApiDescriptions\Description\OpenApi;
10
11
use KleijnWeb\ApiDescriptions\Description\Description;
12
use KleijnWeb\ApiDescriptions\Document\Document;
13
14
/**
15
 * @author John Kleijn <[email protected]>
16
 */
17
class OpenApiDescription extends Description
18
{
19
    /**
20
     * Description constructor.
21
     *
22
     * @param Document $document
23
     */
24
    public function __construct(Document $document)
25
    {
26
        $this->document = $document;
27
        $this->host     = isset($document->host) ? $document->host : null;
28
        $this->schemes  = isset($document->schemes) ? $document->schemes : [];
29
30
        if (isset($this->document->paths)) {
31
            foreach ($this->document->paths as $path => $pathItem) {
32
                $this->paths[$path] = new OpenApiPath($path, $pathItem);
33
            }
34
        }
35
    }
36
}
37