Passed
Pull Request — master (#2)
by Pol
04:33
created

PartitionItemFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\phpartition\Partition;
6
7
use drupol\phpartition\Contract\PartitionItem as PartitionItemInterface;
8
9
/**
10
 * Class PartitionItemFactory.
11
 */
12
class PartitionItemFactory
13
{
14
    public static function create($value): PartitionItemInterface
15
    {
16
        if ($value instanceof PartitionItemInterface) {
17
            return $value;
18
        }
19
20
        return new PartitionItem($value);
21
    }
22
}
23