Completed
Pull Request — master (#6)
by Veaceslav
02:38 queued 01:30
created

SchemaBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 31
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createSchema() 0 7 1
A createSchemaAggregate() 0 4 1
A setAttributes() 0 6 1
A getAttributes() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Builders;
6
7
use Aweapi\Openapi\Objects;
8
9
final class SchemaBuilder implements Objects\SchemaFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $attributes = [];
14
15 13
    public function createSchema(): Objects\Schema
16
    {
17 13
        return new Objects\Schema(
18 13
            $this->getAttributes(),
19 13
            $this->getExtensions()
20
        );
21
    }
22
23 8
    public function createSchemaAggregate(): Objects\SchemaAggregate
24
    {
25 8
        return $this->createSchema();
26
    }
27
28 13
    public function setAttributes(array $attributes): self
29
    {
30 13
        $this->attributes = $attributes;
31
32 13
        return $this;
33
    }
34
35 13
    private function getAttributes(): array
36
    {
37 13
        return $this->attributes;
38
    }
39
}
40