RenderRelations   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 7 2
A compute() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Generator;
6
7
use Cycle\Schema\Definition\Entity;
8
use Cycle\Schema\GeneratorInterface;
9
use Cycle\Schema\Registry;
10
11
/**
12
 * Renders all required relations columns, indexes and foreign keys.
13
 */
14
final class RenderRelations implements GeneratorInterface
15
{
16
    public function run(Registry $registry): Registry
17
    {
18
        foreach ($registry as $entity) {
19
            $this->compute($registry, $entity);
20
        }
21 264
22
        return $registry;
23 264
    }
24 264
25
    protected function compute(Registry $registry, Entity $entity): void
26
    {
27 264
        foreach ($registry->getRelations($entity) as $relation) {
28
            $relation->render($registry);
29
        }
30
    }
31
}
32