Completed
Push — master ( 55fdf1...0c48af )
by Johannes
02:35
created

EnvironmentFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Lichtenwallner  (https://lichtenwallner.at)
4
 *
5
 * @see https://github.com/jolicht/markdown-cms for the canonical source repository
6
 * @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
7
 * @copyright Copyright (c) Johannes Lichtenwallner
8
 */
9
declare(strict_types = 1);
10
namespace Jolicht\MarkdownCms\CommonMark;
11
12
use Interop\Container\ContainerInterface;
13
use League\CommonMark\Environment;
14
use League\CommonMark\Inline\Element\Image;
15
use Jolicht\MarkdownCms\Markdown\Renderer\ImageRenderer;
16
17
class EnvironmentFactory
18
{
19
    public function __invoke(ContainerInterface $container) : Environment
20
    {
21
        $environment = Environment::createCommonMarkEnvironment();
22
        $environment->addInlineRenderer(Image::class, $container->get(ImageRenderer::class));
23
        return $environment;
24
    }
25
}