BitBagSyliusWishlistExtension   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 13
c 4
b 0
f 0
dl 0
loc 33
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMigrationsDirectory() 0 3 1
A getNamespacesOfMigrationsExecutedBefore() 0 3 1
A prepend() 0 4 1
A load() 0 8 1
A getMigrationsNamespace() 0 3 1
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusWishlistPlugin\DependencyInjection;
12
13
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait;
14
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
18
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
19
20
final class BitBagSyliusWishlistExtension extends AbstractResourceExtension implements PrependExtensionInterface
21
{
22
    use PrependDoctrineMigrationsTrait;
23
24
    public function load(array $config, ContainerBuilder $container): void
25
    {
26
        $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

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