Passed
Push — master ( c12f94...3e1cf8 )
by Anton
03:42
created

RenderRelations   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 2

1 Method

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