Completed
Pull Request — 3.x (#248)
by
unknown
01:55
created

EventDispatcherFactory::createEventDispatcher()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
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\NotificationBundle\Factory;
13
14
use Symfony\Component\DependencyInjection\ContainerInterface;
15
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
16
use Symfony\Component\EventDispatcher\EventDispatcher;
17
use Symfony\Component\HttpKernel\Kernel;
18
19
final class EventDispatcherFactory
20
{
21
    public static function createEventDispatcher(ContainerInterface $container)
22
    {
23
        if (Kernel::MAJOR_VERSION <= 3 && Kernel::MINOR_VERSION < 3) {
24
            return new ContainerAwareEventDispatcher($container);
25
        }
26
27
        return new EventDispatcher();
28
    }
29
}
30