GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BaseObjectMethods   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 26
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A unpack() 0 8 2
A methods() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of Underscore.php
6
 *
7
 * (c) Maxime Fabre <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Underscore\Methods;
14
15
/**
16
 * Methods to manage objects.
17
 */
18
class BaseObjectMethods extends CollectionMethods
19
{
20
21
    /**
22
     * Get all methods from an object.
23
     *
24
     *
25
     */
26
    public static function methods(object $object) : array
27
    {
28 1
        return get_class_methods($object::class);
29
    }
30 1
31
    /**
32
     * Unpack an object's properties.
33
     *
34
     *
35
     */
36
    public static function unpack(object $object, mixed $attribute = null) : object
37
    {
38
        $object = (array) $object;
39
        $object = $attribute
40
            ? ArraysMethods::get($object, $attribute)
41 1
            : ArraysMethods::first($object);
42
43 1
        return (object) $object;
44 1
    }
45
}
46