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.

HydratableTrait::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Audiens\AdobeClient\Entity;
4
5
use Zend\Hydrator\Reflection;
6
7
/**
8
 * Class HydratableTrait
9
 */
10
trait HydratableTrait
11
{
12
    /**
13
     * @param array $objectArray
14
     *
15
     * @return self
16
     */
17
    public static function fromArray(array $objectArray)
18
    {
19
20
        $object = new self();
21
        self::getHydrator()->hydrate($objectArray, $object);
22
23
        return $object;
24
    }
25
26
    /**
27
     * @return array
28
     */
29
    public function toArray()
30
    {
31
        return self::getHydrator()->extract($this);
32
    }
33
34
    /**
35
     * @return Reflection
36
     */
37
    private static function getHydrator()
38
    {
39
        $hydrator = new Reflection();
40
41
        return $hydrator;
42
    }
43
}
44