Completed
Push — master ( 280ca2...4c75e7 )
by Johannes
02:18
created

SitemapObserverFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 3
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\Parser\Observer;
11
12
use Zend\ServiceManager\Factory\FactoryInterface;
13
use Interop\Container\ContainerInterface;
14
use Sabre\Xml\Writer as XmlWriter;
15
16
class SitemapObserverFactory implements FactoryInterface
17
{
18
    /**
19
     * Get sitemap observer
20
     * @return SitemapObserver
21
     * {@inheritDoc}
22
     * @see \Zend\ServiceManager\Factory\FactoryInterface::__invoke()
23
     */
24
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null) : SitemapObserver
25
    {
26
        $config = $container->get('config');
27
        return new SitemapObserver(
28
            new XmlWriter(),
29
            $config['markdown_cms']['options']['sitemap_path'],
30
            $config['markdown_cms']['options']['base_url']
31
        );
32
    }
33
}