RenderRelations::compute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 2
rs 10
c 0
b 0
f 0
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