FixtureList   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 39
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A constructFromFixturesLoader() 0 5 1
A getFixtures() 0 3 1
A getMetadata() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hgraca\DoctrineTestDbRegenerationBundle\Doctrine;
6
7
use Doctrine\Common\DataFixtures\FixtureInterface;
8
use Doctrine\Common\DataFixtures\Loader;
9
use InvalidArgumentException;
10
11
final class FixtureList
12
{
13
    /**
14
     * @var FixtureInterface[]
15
     */
16
    private $fixtures;
17
18
    /**
19
     * @var Metadata[]
20
     */
21
    private $metadata;
22
23
    /**
24
     * @param Metadata[] $metadata
25
     * @param FixtureInterface[] $fixtures
26
     *
27
     * @throws InvalidArgumentException
28
     */
29 16
    private function __construct(array $metadata, FixtureInterface ...$fixtures)
30
    {
31 16
        $this->fixtures = $fixtures;
32 16
        $this->metadata = $metadata;
33 16
    }
34
35 16
    public static function constructFromFixturesLoader(Loader $fixturesLoader): self
36
    {
37 16
        $fixtures = $fixturesLoader->getFixtures();
38
39 16
        return new self(Metadata::constructFromFixtures($fixtures), ...$fixtures);
40
    }
41
42 12
    public function getFixtures(): array
43
    {
44 12
        return $this->fixtures;
45
    }
46
47 4
    public function getMetadata(): array
48
    {
49 4
        return $this->metadata;
50
    }
51
}
52