System   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 15 2
1
<?php
2
3
namespace App\Tenant\Loader\Identity;
4
5
use Ds\Component\Database\Util\Objects;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Database\Util\Objects 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...
6
use Ds\Component\Tenant\Entity\Tenant;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Tenant\Entity\Tenant 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...
7
8
/**
9
 * Trait System
10
 */
11
trait System
12
{
13
    /**
14
     * @var \App\Service\SystemService
15
     */
16
    private $systemService;
17
18
    /**
19
     * @var string
20
     */
21
    private $path;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function load(Tenant $tenant)
27
    {
28
        $data = (array) json_decode(json_encode($tenant->getData()));
29
        $objects = Objects::parseFile($this->path, $data);
30
        $manager = $this->systemService->getManager();
31
32
        foreach ($objects as $object) {
33
            $system = $this->systemService->createInstance();
34
            $system
35
                ->setUuid($object->uuid)
36
                ->setOwner($object->owner)
37
                ->setOwnerUuid($object->owner_uuid)
38
                ->setTenant($object->tenant);
39
            $manager->persist($system);
40
            $manager->flush();
41
        }
42
    }
43
}
44