Completed
Push — master ( bca24d...1b0d8b )
by John
03:18
created

OpenApiDefinitionValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 3
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\PhpApi\Descriptions 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\PhpApi\Descriptions\Description\Document\Definition\Validator;
10
11
use KleijnWeb\PhpApi\Descriptions\Description\Schema\Validator\DefaultValidator;
12
use KleijnWeb\PhpApi\Descriptions\Description\Schema\Validator\SchemaValidator;
13
14
/**
15
 * @author John Kleijn <[email protected]>
16
 */
17
class OpenApiDefinitionValidator extends MetaSchemaValidator
18
{
19
    /**
20
     * SpecificationValidator constructor.
21
     *
22
     * @param SchemaValidator  $validator
23
     * @param string|\stdClass $schema
24
     */
25
    public function __construct(SchemaValidator $validator = null, $schema = null)
26
    {
27
        if (null === $schema) {
28
            $schema = json_decode(file_get_contents(__DIR__ . '/../../../../../assets/swagger-schema.json'));
29
        }
30
        parent::__construct($schema, $validator ?: new DefaultValidator());
31
    }
32
}
33