Frame   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 67
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
A toArray() 0 16 1
A getFile() 0 4 1
A getLinenumber() 0 4 1
A isApplicationFrame() 0 4 1
1
<?php
2
3
namespace Facade\FlareClient\Stacktrace;
4
5
class Frame
6
{
7
    /** @var string */
8
    private $file;
9
10
    /** @var int */
11
    private $lineNumber;
12
13
    /** @var string */
14
    private $method;
15
16
    /** @var string */
17
    private $class;
18
19
    /** @var bool */
20
    private $isApplicationFrame;
21
22
    public function __construct(
23
        string $file,
24
        int $lineNumber,
25
        string $method = null,
26
        string $class = null,
27
        bool $isApplicationFrame = false
28
    ) {
29
        $this->file = $file;
30
31
        $this->lineNumber = $lineNumber;
32
33
        $this->method = $method;
34
35
        $this->class = $class;
36
37
        $this->isApplicationFrame = $isApplicationFrame;
38
    }
39
40
    public function toArray(): array
41
    {
42
        $codeSnippet = (new Codesnippet())
43
            ->snippetLineCount(31)
44
            ->surroundingLine($this->lineNumber)
45
            ->get($this->file);
46
47
        return [
48
            'line_number' => $this->lineNumber,
49
            'method' => $this->method,
50
            'class' => $this->class,
51
            'code_snippet' => $codeSnippet,
52
            'file' => $this->file,
53
            'is_application_frame' => $this->isApplicationFrame,
54
        ];
55
    }
56
57
    public function getFile(): string
58
    {
59
        return $this->file;
60
    }
61
62
    public function getLinenumber(): int
63
    {
64
        return $this->lineNumber;
65
    }
66
67
    public function isApplicationFrame()
68
    {
69
        return $this->isApplicationFrame;
70
    }
71
}
72