Passed
Pull Request — develop (#166)
by Laurent
04:22 queued 02:52
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 extends Contact
24
{
25
    public function __construct(Contact $contact)
26
    {
27
        parent::__construct(
28
            $contact->uuid,
29
            $contact->companyName,
30
            $contact->address,
31
            $contact->zipCode,
32
            $contact->town,
33
            $contact->country,
34
            $contact->phone,
35
            $contact->facsimile,
36
            $contact->email,
37
            $contact->contactName,
38
            $contact->cellphone,
39
            $contact->slug
40
        );
41
    }
42
43
    public static function fromModel(CompanyModel $companyModel): self
44
    {
45
        $contact = Contact::create(
46
            $companyModel->uuid(),
47
            $companyModel->companyName(),
48
            $companyModel->address(),
49
            $companyModel->zipCode(),
50
            $companyModel->town(),
51
            $companyModel->country(),
52
            $companyModel->phone(),
53
            $companyModel->facsimile(),
54
            $companyModel->email(),
55
            $companyModel->contactName(),
56
            $companyModel->cellphone(),
57
            $companyModel->slug()
58
        );
59
60
        return new self($contact);
61
    }
62
}
63