Extractor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 4
c 4
b 1
f 0
lcom 0
cbo 1
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A extract() 0 18 4
1
<?php
2
3
namespace Silk\Exchange\Extractor;
4
5
use Silk\Configuration\PropertyConfiguration;
6
7
/**
8
 * Class Extractor
9
 * Responsável por executar a extração dos dados do objeto.
10
 * @author  Lucas A. de Araújo <[email protected]>
11
 * @package Silk\Exchange\Extractor
12
 */
13
class Extractor
14
{
15
    /**
16
     * Extrai as informações existentes em uma classe
17
     * @param $object
18
     * @return array
19
     */
20
    public static function extract($object)
21
    {
22
        $array = [];
23
24
        foreach ((new \ReflectionClass($object))->getProperties() as $property) {
25
            $config = new PropertyConfiguration($property, $object);
26
27
            if ($config->ignore() || $config->shouldIgnoreIfNull())
28
                continue;
29
30
            $name = $config->getAlias();
31
            $data = $config->getValue();
32
33
            $array[$name] = $data;
34
        }
35
36
        return $array;
37
    }
38
}