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

EventDispatcherFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 11
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createEventDispatcher() 0 8 3
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