Passed
Branch master (75df93)
by Ivan
01:51
created

ItemHelper::getIdentifier()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\Navigation\Helper;
6
7
use Everlution\Navigation\Item\IdentifiableInterface;
8
use Everlution\Navigation\Item\ItemInterface;
9
10
/**
11
 * Class ItemHelper
12
 *
13
 * @author Martin Adamik <[email protected]>
14
 */
15
class ItemHelper
16
{
17
    public static function getIdentifier(ItemInterface $item): string
18
    {
19
        return $item instanceof IdentifiableInterface ? $item->getIdentifier() : get_class($item);
20
    }
21
}
22