Composition   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
1
<?php
2
3
namespace Swaggest\JsonSchema\Structure;
4
5
use Swaggest\JsonSchema\Constraint\Properties;
6
use Swaggest\JsonSchema\Constraint\Type;
7
use Swaggest\JsonSchema\Schema;
8
use Swaggest\JsonSchema\SchemaContract;
9
use Swaggest\JsonSchema\Wrapper;
10
11
/**
12
 * @todo think of anyOf, allOf, oneOf
13
 */
14
class Composition extends Schema
15
{
16
    /**
17
     * @param SchemaContract... $schema
18
     * @throws \Swaggest\JsonSchema\Exception
19 2
     */
20
    public function __construct()
21 2
    {
22 2
        $this->type = Type::OBJECT;
23 2
        $properties = new Properties();
24
        $this->properties = $properties;
25 2
26 2
        foreach (func_get_args() as $arg) {
27 2
            if ($arg instanceof Wrapper) {
28
                $properties->__set($arg->objectItemClass, $arg->nested());
29
            }
30 2
        }
31
    }
32
33
}