RoleBlock::wrapItem()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 3
nc 2
nop 2
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