MetaFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 18
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
class MetaFactory implements MetaFactoryInterface
21
{
22
    protected $context;
23
24
    public function __construct(Context $context)
25
    {
26
        $this->context = $context;
27
    }
28
29
    public function create($value, array $configuration = null): Meta
30
    {
31
        if (null === $configuration) {
32
            $configuration = $this->context->getConfigurationForValue($value);
33
        }
34
35
        return new Meta($this->context, $value, $configuration);
36
    }
37
}
38