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::unpack()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
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