Completed
Push — master ( bf375b...cc5661 )
by Rafał
07:07
created

MetaFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Templates System.
5
 *
6
 * Copyright 2015 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Component\TemplatesSystem\Gimme\Factory;
16
17
use SWP\Component\TemplatesSystem\Gimme\Context\Context;
18
use SWP\Component\TemplatesSystem\Gimme\Meta\Meta;
19
20
/**
21
 * Class MetaFactory.
22
 */
23
class MetaFactory implements MetaFactoryInterface
24
{
25
    /**
26
     * @var Context
27
     */
28
    protected $context;
29
30
    /**
31
     * MetaFactory constructor.
32
     *
33
     * @param Context $context
34
     */
35
    public function __construct(Context $context)
36
    {
37
        $this->context = $context;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function create($value, array $configuration = null)
44
    {
45
        if (null === $configuration) {
46
            $configuration = $this->context->getConfigurationForValue($value);
47
        }
48
49
        return new Meta($this->context, $value, $configuration);
50
    }
51
}
52