MetaFactory::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 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