Completed
Push — master ( 43c84d...dfcd02 )
by WEBEWEB
03:46
created

AbstractContainerAwareCommand::getTranslator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
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 WBW\Bundle\CoreBundle\Command;
13
14
use Psr\Log\LoggerInterface;
15
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
16
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
17
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
18
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
19
use Symfony\Component\Routing\RouterInterface;
20
use Symfony\Component\Translation\TranslatorInterface;
21
22
/**
23
 * Abstract container aware command.
24
 *
25
 * @author webeweb <https://github.com/webeweb/>
26
 * @package WBW\Bundle\CoreBundle\Command
27
 */
28
abstract class AbstractContainerAwareCommand extends ContainerAwareCommand {
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...d\ContainerAwareCommand has been deprecated with message: since Symfony 4.2, use {@see Command} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
29
30
    /**
31
     * Get the event dispatcher.
32
     *
33
     * @return EventDispatcherInterface Returns the event dispatcher.
34
     * @throws ServiceCircularReferenceException Throws a service circular exception when a circular reference is detected.
35
     * @throws ServiceNotFoundException Throws a service not found hen the service is not defined.
36
     */
37
    protected function getEventDispatcher() {
38
        return $this->getContainer()->get("event_dispatcher");
39
    }
40
41
    /**
42
     * Get the logger.
43
     *
44
     * @return LoggerInterface Returns the logger.
45
     * @throws ServiceCircularReferenceException Throws a service circular exception when a circular reference is detected.
46
     * @throws ServiceNotFoundException Throws a service not found hen the service is not defined.
47
     */
48
    protected function getLogger() {
49
        return $this->getContainer()->get("logger");
50
    }
51
52
    /**
53
     * Get the router.
54
     *
55
     * @return RouterInterface Returns the router.
56
     * @throws ServiceCircularReferenceException Throws a service circular exception when a circular reference is detected.
57
     * @throws ServiceNotFoundException Throws a service not found hen the service is not defined.
58
     */
59
    protected function getRouter() {
60
        return $this->getContainer()->get("router");
61
    }
62
63
    /**
64
     * Get the translator.
65
     *
66
     * @return TranslatorInterface Returns the translator.
67
     * @throws ServiceCircularReferenceException Throws a service circular exception when a circular reference is detected.
68
     * @throws ServiceNotFoundException Throws a service not found hen the service is not defined.
69
     */
70
    protected function getTranslator() {
71
        return $this->getContainer()->get("translator");
72
    }
73
}
74