Completed
Push — master ( ff3370...c7a062 )
by Beñat
38s queued 33s
created

LoadUserData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A type() 0 4 1
A getOrder() 0 4 1
A load() 0 15 2
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\IdentityAccess\Infrastructure\Persistence\Doctrine\DataFixtures;
16
17
use BenGorUser\User\Application\Command\SignUp\SignUpUserCommand;
18
use Doctrine\Common\Persistence\ObjectManager;
19
use Kreta\SharedKernel\Infrastructure\Persistence\Doctrine\DataFixtures\AbstractFixture;
20
21
class LoadUserData extends AbstractFixture
22
{
23
    protected function type() : string
24
    {
25
        return 'user';
26
    }
27
28
    public function getOrder() : int
29
    {
30
        return 1;
31
    }
32
33
    public function load(ObjectManager $manager) : void
34
    {
35
        $i = 0;
36
        while ($i < $this->amount()) {
37
            $this->commandBus()->handle(
38
                new SignUpUserCommand(
39
                    'user' . $i . '@kreta.io',
40
                    '123456',
41
                    ['ROLE_USER'],
42
                    $this->fakeIds()[$i]
43
                )
44
            );
45
            ++$i;
46
        }
47
    }
48
}
49