AbstractSitemapService   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configureSettings() 0 3 1
A generate() 0 4 1
A createEntry() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\SitemapBundle\Sitemap;
13
14
use Core23\SitemapBundle\Model\Url;
15
use Core23\SitemapBundle\Model\UrlInterface;
16
use Symfony\Component\OptionsResolver\OptionsResolver;
17
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
18
use Symfony\Component\Routing\RouterInterface;
19
20
/**
21
 * @deprecated without any replacement
22
 */
23
abstract class AbstractSitemapService implements SitemapServiceInterface
24
{
25
    /**
26
     * @var RouterInterface
27
     */
28
    private $router;
29
30
    public function __construct(RouterInterface $router)
31
    {
32
        $this->router = $router;
33
    }
34
35
    public function configureSettings(OptionsResolver $resolver): void
36
    {
37
    }
38
39
    /**
40
     * @param string $name
41
     * @param int    $absolute
42
     */
43
    final protected function generate($name, array $parameters = [], $absolute = UrlGeneratorInterface::ABSOLUTE_URL): string
44
    {
45
        return $this->router->generate($name, $parameters, $absolute);
46
    }
47
48
    final protected function createEntry(string $location, ?int $priority, ?string $changeFreq = null, ?\DateTime $lastMod = null): UrlInterface
49
    {
50
        return new Url($location, $priority, $changeFreq, $lastMod);
51
    }
52
}
53