PersonLoader   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 12 1
1
<?php declare(strict_types = 1);
2
3
namespace Simplex\Quickstart\Module\Demo\DataFixture;
4
5
use Doctrine\Common\DataFixtures\AbstractFixture;
6
use Doctrine\Common\Persistence\ObjectManager;
7
use Ramsey\Uuid\Uuid;
8
use Simplex\Quickstart\Module\Demo\Model\Person;
9
use Simplex\Quickstart\Shared\Testing\ReflectionPropertyCapabilities;
10
11
final class PersonLoader extends AbstractFixture
12
{
13
    use ReflectionPropertyCapabilities;
14
15
    public const PERSON_1_NAME = 'Joe Smith';
16
    public const PERSON_1_EMAIL = '[email protected]';
17
    public const PERSON_1_PASSWORD = 'foobar';
18
    public const PERSON_1_ID = '1dd60ffa-6e48-47f2-a03a-f89620c17e03';
19
20 6
    public function load(ObjectManager $manager)
21
    {
22 6
        $person = Person::register(
23 6
            self::PERSON_1_NAME,
24 6
            self::PERSON_1_EMAIL,
25 6
            self::PERSON_1_PASSWORD
26
        );
27
28 6
        $this->setProperty($person, 'id', Uuid::fromString(self::PERSON_1_ID));
29
30 6
        $manager->persist($person);
31 6
        $manager->flush();
32 6
    }
33
}
34