Passed
Push — develop ( e3219b...3a1d34 )
by Laurent
01:38
created

CreateCompany   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createCompany() 0 18 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Company\Application\Company\Factory;
15
16
use Company\Domain\Model\Company;
17
use Core\Domain\Common\Command\CommandInterface;
18
use Core\Domain\Common\Model\VO\ContactUuid;
19
use Core\Domain\Common\Model\VO\EmailField;
20
use Core\Domain\Common\Model\VO\NameField;
21
use Core\Domain\Common\Model\VO\PhoneField;
22
23
class CreateCompany
24
{
25
    public function createCompany(CommandInterface $commandCompany): Company
26
    {
27
        $contactUuid = null === $commandCompany->uuid() ? ContactUuid::generate() : ContactUuid::fromString(
0 ignored issues
show
Bug introduced by
The method uuid() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Administration\Domain\Su...\Command\CreateSupplier. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        $contactUuid = null === $commandCompany->/** @scrutinizer ignore-call */ uuid() ? ContactUuid::generate() : ContactUuid::fromString(
Loading history...
28
            $commandCompany->uuid()
29
        );
30
31
        return Company::create(
32
            $contactUuid,
33
            NameField::fromString($commandCompany->companyName()),
0 ignored issues
show
Bug introduced by
The method companyName() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
            NameField::fromString($commandCompany->/** @scrutinizer ignore-call */ companyName()),
Loading history...
34
            $commandCompany->address(),
0 ignored issues
show
Bug introduced by
The method address() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
            $commandCompany->/** @scrutinizer ignore-call */ 
35
                             address(),
Loading history...
35
            $commandCompany->zipCode(),
0 ignored issues
show
Bug introduced by
The method zipCode() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
            $commandCompany->/** @scrutinizer ignore-call */ 
36
                             zipCode(),
Loading history...
36
            $commandCompany->town(),
0 ignored issues
show
Bug introduced by
The method town() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
            $commandCompany->/** @scrutinizer ignore-call */ 
37
                             town(),
Loading history...
37
            $commandCompany->country(),
0 ignored issues
show
Bug introduced by
The method country() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
            $commandCompany->/** @scrutinizer ignore-call */ 
38
                             country(),
Loading history...
38
            PhoneField::fromString($commandCompany->phone()),
0 ignored issues
show
Bug introduced by
The method phone() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
            PhoneField::fromString($commandCompany->/** @scrutinizer ignore-call */ phone()),
Loading history...
39
            PhoneField::fromString($commandCompany->facsimile()),
0 ignored issues
show
Bug introduced by
The method facsimile() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
            PhoneField::fromString($commandCompany->/** @scrutinizer ignore-call */ facsimile()),
Loading history...
40
            EmailField::fromString($commandCompany->email()),
0 ignored issues
show
Bug introduced by
The method email() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or User\Application\Command\AbstractUser or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
            EmailField::fromString($commandCompany->/** @scrutinizer ignore-call */ email()),
Loading history...
41
            $commandCompany->contactName(),
0 ignored issues
show
Bug introduced by
The method contactName() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
            $commandCompany->/** @scrutinizer ignore-call */ 
42
                             contactName(),
Loading history...
42
            PhoneField::fromString($commandCompany->cellphone())
0 ignored issues
show
Bug introduced by
The method cellphone() does not exist on Core\Domain\Common\Command\CommandInterface. It seems like you code against a sub-type of Core\Domain\Common\Command\CommandInterface such as Administration\Domain\Su...\Command\CreateSupplier or Company\Application\Comp...Command\AbstractCompany or Administration\Domain\Su...er\Command\EditSupplier. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
            PhoneField::fromString($commandCompany->/** @scrutinizer ignore-call */ cellphone())
Loading history...
43
        );
44
    }
45
}
46