SymfonyFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDriverName() 0 4 1
A supportsJavascript() 0 4 1
A configure() 0 3 1
A buildDriver() 0 13 2
1
<?php
2
3
/*
4
 * This file is part of the Behat Symfony2Extension
5
 *
6
 * (c) Konstantin Kudryashov <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Behat\Symfony2Extension\ServiceContainer\Driver;
13
14
use Behat\MinkExtension\ServiceContainer\Driver\DriverFactory;
15
use Behat\Symfony2Extension\ServiceContainer\Symfony2Extension;
16
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
17
use Symfony\Component\DependencyInjection\Definition;
18
use Symfony\Component\DependencyInjection\Reference;
19
20
/**
21
 * @author Christophe Coevoet <[email protected]>
22
 */
23
final class SymfonyFactory implements DriverFactory
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getDriverName()
29
    {
30
        return 'symfony2';
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function supportsJavascript()
37
    {
38
        return false;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function configure(ArrayNodeDefinition $builder)
45
    {
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function buildDriver(array $config)
52
    {
53
        if (!class_exists('Behat\Mink\Driver\BrowserKitDriver')) {
54
            throw new \RuntimeException(
55
                'Install MinkBrowserKitDriver in order to use the symfony2 driver.'
56
            );
57
        }
58
59
        return new Definition('Behat\Symfony2Extension\Driver\KernelDriver', array(
60
            new Reference(Symfony2Extension::KERNEL_ID),
61
            '%mink.base_url%',
62
        ));
63
    }
64
}
65