Kint_Object_TraceFrame   A
last analyzed

Complexity

Total Complexity 20

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 20
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
F assignFrame() 0 58 20
1
<?php
2
3
class Kint_Object_TraceFrame extends Kint_Object
0 ignored issues
show
Coding Style introduced by
Kint_Object_TraceFrame does not seem to conform to the naming convention (^[A-Z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
4
{
5
    public $trace;
6
    public $hints = array('trace_frame');
7
8
    public function assignFrame(array &$frame)
9
    {
10
        $this->trace = array(
11
            'function' => isset($frame['function']) ? $frame['function'] : null,
12
            'line' => isset($frame['line']) ? $frame['line'] : null,
13
            'file' => isset($frame['file']) ? $frame['file'] : null,
14
            'class' => isset($frame['class']) ? $frame['class'] : null,
15
            'type' => isset($frame['type']) ? $frame['type'] : null,
16
            'object' => null,
17
            'args' => null,
18
        );
19
20
        if ($this->trace['class'] && method_exists($this->trace['class'], $this->trace['function'])) {
21
            $func = new ReflectionMethod($this->trace['class'], $this->trace['function']);
22
            $this->trace['function'] = new Kint_Object_Method($func);
23
        } elseif (!$this->trace['class'] && function_exists($this->trace['function'])) {
24
            $func = new ReflectionFunction($this->trace['function']);
25
            $this->trace['function'] = new Kint_Object_Method($func);
26
        }
27
28
        foreach ($this->value->contents as $frame_prop) {
0 ignored issues
show
Coding Style introduced by
$frame_prop does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
29
            if ($frame_prop->name === 'object') {
0 ignored issues
show
Coding Style introduced by
$frame_prop does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
30
                $this->trace['object'] = $frame_prop;
0 ignored issues
show
Coding Style introduced by
$frame_prop does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
31
                $this->trace['object']->name = null;
32
                $this->trace['object']->operator = Kint_Object::OPERATOR_NONE;
33
            }
34
            if ($frame_prop->name === 'args') {
0 ignored issues
show
Coding Style introduced by
$frame_prop does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
35
                $this->trace['args'] = $frame_prop->value->contents;
0 ignored issues
show
Coding Style introduced by
$frame_prop does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
36
37
                if (is_object($this->trace['function'])) {
38
                    foreach (array_values($this->trace['function']->parameters) as $param) {
39
                        if (isset($this->trace['args'][$param->position])) {
40
                            $this->trace['args'][$param->position]->name = $param->getName();
41
                        }
42
                    }
43
                }
44
            }
45
        }
46
47
        $this->clearRepresentations();
48
49
        if (isset($this->trace['file'], $this->trace['line']) && is_readable($this->trace['file'])) {
50
            $this->addRepresentation(new Kint_Object_Representation_Source($this->trace['file'], $this->trace['line']));
51
        }
52
53
        if ($this->trace['args']) {
54
            $args = new Kint_Object_Representation('Arguments');
55
            $args->contents = $this->trace['args'];
56
            $this->addRepresentation($args);
57
        }
58
59
        if ($this->trace['object']) {
60
            $callee = new Kint_Object_Representation('object');
61
            $callee->label = 'Callee object ['.$this->trace['object']->classname.']';
62
            $callee->contents[] = $this->trace['object'];
63
            $this->addRepresentation($callee);
64
        }
65
    }
66
}
67