ErrorTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 18
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A __toError() 0 16 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\ORM\Command\Traits;
6
7
/**
8
 * Describes why command has been locked up
9
 *
10
 * @internal
11
 */
12
trait ErrorTrait
13
{
14
    public function __toError()
15
    {
16
        $missing = [];
17
        if (\property_exists($this, 'waitScope')) {
18
            foreach ($this->waitScope ?? [] as $name => $n) {
19
                $missing[] = "scope:{$name}";
20
            }
21
        }
22
23
        if (\property_exists($this, 'waitContext')) {
24
            foreach ($this->waitContext ?? [] as $name => $n) {
25
                $missing[] = "{$name}";
26
            }
27
        }
28
29
        return \sprintf('%s(%s)', $this::class, \implode(', ', $missing));
30
    }
31
}
32