Passed
Push — GENERAL_BUG_REVIEW_240927 ( 5b3eaa )
by Rafael
49:18
created

get_only_class()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
/**
4
 * Returns the class name of the object without the namespace
5
 *
6
 * @param object $object
7
 * @return string
8
 */
9
function get_only_class(object $object): string
10
{
11
    $array_object = explode('\\', get_class($object));
12
    if (empty($array_object)) {
13
        return '';
14
    }
15
    return end($array_object);
16
}