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.
Completed
Pull Request — master (#58)
by joseph
18:31
created

EntityEmbeddableSetter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Embeddable;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\CodeHelper;
6
use gossi\codegen\model\PhpClass;
7
use gossi\codegen\model\PhpInterface;
8
use gossi\codegen\model\PhpTrait;
9
10
/**
11
 * Class EntityEmbeddableSetter
12
 *
13
 * @package EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Embeddable
14
 * @SuppressWarnings(PHPMD.StaticAccess)
15
 */
16
class EntityEmbeddableSetter
17
{
18
    /**
19
     * @var CodeHelper
20
     */
21
    protected $codeHelper;
22
23 9
    public function __construct(CodeHelper $codeHelper)
24
    {
25 9
        $this->codeHelper = $codeHelper;
26 9
    }
27
28 8
    public function setEntityHasEmbeddable(string $entityFqn, string $embeddableTraitFqn)
29
    {
30 8
        $entityReflection     = new \ReflectionClass($entityFqn);
31 8
        $entity               = PhpClass::fromFile($entityReflection->getFileName());
32 8
        $embeddableReflection = new \ReflectionClass($embeddableTraitFqn);
33 8
        $trait                = PhpTrait::fromFile($embeddableReflection->getFileName());
34 8
        $interfaceFqn         = \str_replace(
35 8
            'Trait',
36 8
            'Interface',
37 8
            $embeddableTraitFqn
38
        );
39 8
        $interfaceReflection  = new \ReflectionClass($interfaceFqn);
40 8
        $interface            = PhpInterface::fromFile($interfaceReflection->getFileName());
41 8
        $entity->addTrait($trait)
42 8
               ->addInterface($interface);
43 8
        $this->codeHelper->generate($entity, $entityReflection->getFileName());
44 8
    }
45
}
46