Passed
Push — orm-management ( 19e760...de38f8 )
by Laurent
01:44
created

Company::fromModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 1
dl 0
loc 18
rs 9.7998
c 0
b 0
f 0
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 Administration\Infrastructure\Persistence\DoctrineOrm\Entities;
15
16
use Administration\Domain\Company\Model\Company as CompanyModel;
17
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * @ORM\Table(name="company")
21
 * @ORM\Entity(repositoryClass="Administration\Infrastructure\Persistence\DoctrineOrm\Repositories\DoctrineCompanyRepository")
22
 */
23
class Company
24
{
25
    /** @ORM\Embedded(class="Contact") */
26
    private Contact $contact;
27
28
    public function __construct(Contact $contact)
29
    {
30
        $this->contact = $contact;
31
    }
32
33
    public static function fromModel(CompanyModel $companyModel): self
34
    {
35
        $contact = new Contact(
36
            $companyModel->uuid(),
37
            $companyModel->name(),
38
            $companyModel->address(),
39
            $companyModel->zipCode(),
40
            $companyModel->town(),
41
            $companyModel->country(),
42
            $companyModel->phone(),
43
            $companyModel->facsimile(),
44
            $companyModel->email(),
45
            $companyModel->contactName(),
46
            $companyModel->cellphone(),
47
            $companyModel->slug()
48
        );
49
50
        return new self($contact);
51
    }
52
}
53