Completed
Push — feature/update-json-schema-dep ( f753ff...de5535 )
by Narcotic
02:40
created

SchemaFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
nc 1
cc 1
eloc 2
nop 1
crap 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 1
    public function __construct(RefResolver $resolver)
29
    {
30 1
        $this->refResolver = $resolver;
31 1
    }
32
33
    /**
34
     * Create JSON schema
35
     *
36
     * @param string $uri Schema URI
37
     * @return \stdClass
38
     */
39 1
    public function createSchema($uri)
40
    {
41 1
        return $this->refResolver->resolve($uri);
42
    }
43
}
44