Completed
Push — master ( f47c26...a9ca42 )
by
unknown
02:25
created

CompanyDataFixture::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusInvoicingPlugin\Fixture;
14
15
use BitBag\SyliusInvoicingPlugin\Fixture\Factory\FixtureFactoryInterface;
16
use Sylius\Bundle\FixturesBundle\Fixture\AbstractFixture;
17
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
18
19
final class CompanyDataFixture extends AbstractFixture
20
{
21
    /** @var FixtureFactoryInterface */
22
    private $companyDataFixtureFactory;
23
24
    public function __construct(FixtureFactoryInterface $companyDataFixtureFactory)
25
    {
26
        $this->companyDataFixtureFactory = $companyDataFixtureFactory;
27
    }
28
29
    public function load(array $options): void
30
    {
31
        $this->companyDataFixtureFactory->load($options['custom']);
32
    }
33
34
    public function getName(): string
35
    {
36
        return 'company_data';
37
    }
38
39
    protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void
40
    {
41
        $optionsNode
42
            ->children()
43
                ->arrayNode('custom')
44
                    ->prototype('array')
45
                        ->children()
46
                            ->scalarNode('name')->defaultNull()->end()
47
                            ->scalarNode('vatNumber')->defaultNull()->end()
48
                            ->scalarNode('street')->defaultNull()->end()
49
                            ->scalarNode('city')->defaultNull()->end()
50
                            ->scalarNode('postcode')->defaultNull()->end()
51
                            ->scalarNode('countryCode')->defaultNull()->end()
52
                            ->scalarNode('seller')->defaultNull()->end()
53
                        ->end()
54
                    ->end()
55
                ->end()
56
            ->end()
57
        ;
58
    }
59
}
60