Completed
Pull Request — master (#6)
by Veaceslav
11:19
created

SchemaBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 31
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
    public function createSchema(): Objects\Schema
16
    {
17
        return new Objects\Schema(
18
            $this->getAttributes(),
19
            $this->getExtensions()
20
        );
21
    }
22
23
    public function createSchemaAggregate(): Objects\SchemaAggregate
24
    {
25
        return $this->createSchema();
26
    }
27
28
    public function setAttributes(array $attributes): self
29
    {
30
        $this->attributes = $attributes;
31
32
        return $this;
33
    }
34
35
    private function getAttributes(): array
36
    {
37
        return $this->attributes;
38
    }
39
}
40