Passed
Pull Request — master (#793)
by Def
16:09 queued 13:53
created

AbstractContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getException() 0 3 1
A setException() 0 4 1
A getMethodName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Logger\Context;
6
7
use Throwable;
8
use Yiisoft\Db\Logger\ContextInterface;
9
10
abstract class AbstractContext implements ContextInterface
11
{
12
    private Throwable|null $exception = null;
13
14
    public function __construct(private string $methodName)
15
    {
16
    }
17
18
    public function getMethodName(): string
19
    {
20
        return $this->methodName;
21
    }
22
23
    public function setException(Throwable $e): static
24
    {
25
        $this->exception = $e;
26
        return $this;
27
    }
28
29
    public function getException(): Throwable|null
30
    {
31
        return $this->exception;
32
    }
33
}
34