Passed
Pull Request — master (#2)
by Pol
03:09
created

PartitionItemFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 2
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