Completed
Push — master ( 625a74...74c3c7 )
by Eric
07:53
created

LocaleResource   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 29
ccs 19
cts 19
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 3
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Locale\Resource;
13
14
use Lug\Bundle\ResourceBundle\Controller\Controller;
15
use Lug\Bundle\ResourceBundle\Repository\Doctrine\MongoDB\Repository as DoctrineMongoDBRepository;
16
use Lug\Bundle\ResourceBundle\Repository\Doctrine\ORM\Repository as DoctrineORMRepository;
17
use Lug\Component\Locale\Form\Type\Doctrine\MongoDB\LocaleChoiceType as DoctrineMongoDBLocaleChoiceType;
18
use Lug\Component\Locale\Form\Type\Doctrine\ORM\LocaleChoiceType as DoctrineORMLocaleChoiceType;
19
use Lug\Component\Locale\Form\Type\LocaleType;
20
use Lug\Component\Locale\Model\Locale;
21
use Lug\Component\Locale\Model\LocaleInterface;
22
use Lug\Component\Resource\Domain\DomainManager;
23
use Lug\Component\Resource\Factory\Factory;
24
use Lug\Component\Resource\Model\Resource;
25
26
/**
27
 * @author GeLo <[email protected]>
28
 */
29
class LocaleResource extends Resource
30
{
31
    /**
32
     * @param string $bundlePath
33
     * @param string $driver
34
     */
35 11
    public function __construct($bundlePath, $driver = self::DRIVER_DOCTRINE_ORM)
36
    {
37 11
        $orm = $driver === self::DRIVER_DOCTRINE_ORM;
38
39 11
        parent::__construct(
40 11
            'locale',
41 11
            $driver,
42 11
            'default',
43 11
            $bundlePath.'/Resources/config/resources',
44 11
            self::DRIVER_MAPPING_FORMAT_XML,
45 11
            LocaleInterface::class,
46 11
            Locale::class,
47 11
            Controller::class,
48 11
            Factory::class,
49 11
            $orm ? DoctrineORMRepository::class : DoctrineMongoDBRepository::class,
50 11
            DomainManager::class,
51 11
            LocaleType::class,
52 11
            $orm ? DoctrineORMLocaleChoiceType::class : DoctrineMongoDBLocaleChoiceType::class,
53 11
            'code',
54
            'code'
55 11
        );
56 11
    }
57
}
58