ContactFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createContact() 0 10 2
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Types;
5
6
7
use DateTimeInterface;
8
use Psr\Http\Message\UploadedFileInterface;
9
use TheCodingMachine\GraphQL\Controllers\Annotations\Factory;
10
use TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Models\Contact;
11
12
class ContactFactory
13
{
14
    /**
15
     * @Factory()
16
     * @param string $name
17
     * @param Contact|null $manager
18
     * @param Contact[] $relations
19
     * @return Contact
20
     */
21
    public function createContact(string $name, DateTimeInterface $birthDate, ?UploadedFileInterface $photo = null, ?Contact $manager = null, array $relations= []): Contact
22
    {
23
        $contact = new Contact($name);
24
        if ($photo) {
25
            $contact->setPhoto($photo);
26
        }
27
        $contact->setBirthDate($birthDate);
28
        $contact->setManager($manager);
29
        $contact->setRelations($relations);
30
        return $contact;
31
    }
32
}
33