Completed
Push — master ( 083704...dda2e6 )
by Narcotic
05:24 queued 02:48
created

SchemaFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 28
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createSchema() 0 4 1
1
<?php
2
/**
3
 * SchemaFactory class file
4
 */
5
namespace Graviton\JsonSchemaBundle\Schema;
6
7
use JsonSchema\RefResolver;
8
9
/**
10
 * JSON schema factory
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class SchemaFactory
17
{
18
    /**
19
     * @var RefResolver
20
     */
21
    private $refResolver;
22
23
    /**
24
     * Constructor
25
     *
26
     * @param RefResolver $resolver Ref resolver
27
     */
28
    public function __construct(RefResolver $resolver)
29
    {
30
        $this->refResolver = $resolver;
31
    }
32
33
    /**
34
     * Create JSON schema
35
     *
36
     * @param string $uri Schema URI
37
     * @return \stdClass
38
     */
39
    public function createSchema($uri)
40
    {
41
        return $this->refResolver->resolve($uri);
42
    }
43
}
44