Completed
Push — master ( bcbb00...7969fb )
by
unknown
14s queued 11s
created

BitBagSyliusWishlistExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitBag\SyliusWishlistPlugin\DependencyInjection;
6
7
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait;
8
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
9
use Symfony\Component\Config\FileLocator;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
12
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
13
14
final class BitBagSyliusWishlistExtension extends AbstractResourceExtension implements PrependExtensionInterface
15
{
16
    use PrependDoctrineMigrationsTrait;
17
18
    public function load(array $config, ContainerBuilder $container): void
19
    {
20
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
0 ignored issues
show
Bug introduced by
It seems like $this->getConfiguration(array(), $container) can also be of type null; however, parameter $configuration of Symfony\Component\Depend...:processConfiguration() does only seem to accept Symfony\Component\Config...\ConfigurationInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

20
        $config = $this->processConfiguration(/** @scrutinizer ignore-type */ $this->getConfiguration([], $container), $config);
Loading history...
21
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
22
        $this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container);
23
        $loader->load('services.yml');
24
        $container->setParameter('wishlist_cookie_token', $config['wishlist_cookie_token']);
25
    }
26
27
    public function prepend(ContainerBuilder $container): void
28
    {
29
        trigger_deprecation('bitbag/wishlist-plugin', '2.0', 'Doctrine migrations existing in a bundle will be removed, move migrations to the project directory.');
30
        $this->prependDoctrineMigrations($container);
31
    }
32
33
    protected function getMigrationsNamespace(): string
34
    {
35
        return 'BitBag\SyliusWishlistPlugin\Migrations';
36
    }
37
38
    protected function getMigrationsDirectory(): string
39
    {
40
        return '@BitBagSyliusWishlistPlugin/Migrations';
41
    }
42
43
    protected function getNamespacesOfMigrationsExecutedBefore(): array
44
    {
45
        return ['Sylius\Bundle\CoreBundle\Migrations'];
46
    }
47
}
48