Completed
Pull Request — 2.x (#246)
by Christian
01:20
created

BaseBreadcrumbMenuBlockService::getRootMenu()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 25
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 25
rs 8.5806
cc 4
eloc 11
nc 8
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[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 Sonata\SeoBundle\Block\Breadcrumb;
13
14
use Knp\Menu\FactoryInterface;
15
use Knp\Menu\Provider\MenuProviderInterface;
16
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
17
18
/**
19
 * Abstract class for breadcrumb menu services.
20
 *
21
 * @author Sylvain Deloux <[email protected]>
22
 *
23
 * @deprecated since 3.x, to be removed with 4.0.
24
 */
25
abstract class BaseBreadcrumbMenuBlockService extends AbstractBreadcrumbMenuService
26
{
27
    /**
28
     * @param string                $context
29
     * @param string                $name
30
     * @param EngineInterface       $templating
31
     * @param MenuProviderInterface $menuProvider
32
     * @param FactoryInterface      $factory
33
     */
34
    public function __construct($context, $name, EngineInterface $templating, MenuProviderInterface $menuProvider, FactoryInterface $factory)
35
    {
36
        @trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
37
            'The '.__CLASS__.' class is deprecated since 3.x, to be removed in 4.0. '.
38
            'Use '.AbstractBreadcrumbMenuService::class.' instead.',
39
            E_USER_DEPRECATED
40
        );
41
42
        parent::__construct($name, $context, $templating, $menuProvider, $factory);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getName()
49
    {
50
        return sprintf('Breadcrumb %s', $this->getContext());
51
    }
52
}
53