GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#153)
by joseph
05:51
created

TemplateEntityDtoFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createDtoFromTemplateEntity() 0 9 2
A __construct() 0 3 1
A create() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace TemplateNamespace\Entity\Factories;
4
5
// phpcs:disable -- line length
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\DataTransferObjects\DtoFactory;
7
use TemplateNamespace\Entities\TemplateEntity;
8
use TemplateNamespace\Entity\DataTransferObjects\TemplateEntityDto;
9
10
// phpcs: enable
11
class TemplateEntityDtoFactory
12
{
13
    /**
14
     * @var DtoFactory
15
     */
16
    private $dtoFactory;
17
18
    public function __construct(DtoFactory $dtoFactory)
19
    {
20
        $this->dtoFactory = $dtoFactory;
21
    }
22
23
    public function create(): TemplateEntityDto
24
    {
25
        return $this->dtoFactory->createEmptyDtoFromEntityFqn(TemplateEntity::class);
26
    }
27
28
    public function createDtoFromTemplateEntity(TemplateEntity $entity): TemplateEntityDto
29
    {
30
        if (false === ($entity instanceof TemplateEntity)) {
31
            throw new \InvalidArgumentException(
32
                'Invalid Entity: expecting instance of ' . TemplateEntity::class
33
                . ', got ' . \get_class($entity));
34
        }
35
36
        return $this->dtoFactory->createDtoFromEntity($entity);
37
38
    }
39
40
}
41