SyntaxErrorException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 9
rs 10
c 4
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 3
1
<?php
2
3
namespace yentu\exceptions;
4
5
/**
6
 * Reports syntax errors in migration scripts with an attempt to show the actual line where error ocurred.
7
 */
8
class SyntaxErrorException extends YentuException {
9
10
    public function __construct(string $message, string $homePath, ?array $trace = null)
11
    {
12
        parent::__construct($message);
13
        foreach ($trace ?? $this->getTrace() as $item) {
14
            if (realpath($homePath . DIRECTORY_SEPARATOR . "migrations") === dirname($item['file'] ?? '')) {
15
                $this->message = "On line {$item['line']} of {$item['file']}: {$this->message}";
16
                break;
17
            }
18
        }
19
    }
20
}
21