SymfonyFactory::getDriverName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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