RoleBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A wrapItem() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Renderer\PhpFileRenderer\Item;
6
7
use Cycle\ORM\SchemaInterface;
8
use Cycle\Schema\Renderer\PhpFileRenderer\Exporter\ArrayBlock;
9
use Cycle\Schema\Renderer\PhpFileRenderer\Exporter\ArrayItem;
10
11
class RoleBlock extends ArrayBlock
12
{
13
    /**
14
     * @param int|string $key
15
     * @param mixed $value
16
     */
17
    protected function wrapItem($key, $value): ArrayItem
18
    {
19
        $item = parent::wrapItem($key, $value);
20
        if ($key === SchemaInterface::RELATIONS && is_array($value)) {
21
            $item->setValue(new RelationsBlock($value), false);
22
        }
23
        return $item;
24
    }
25
}
26