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

CompanyDataFixture   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 4 1
A getName() 0 4 1
A configureOptionsNode() 0 20 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