Passed
Push — master ( 41e710...91ffae )
by Aleksei
06:19 queued 21s
created

Shared   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
dl 0
loc 19
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 4 1
A getReturnClass() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Config;
6
7
/**
8
 * Static permanent object
9
 */
10
final class Shared extends Binding
11
{
12 1078
    public function __construct(
13
        public readonly object $value,
14
        public readonly bool $singleton = false,
15 1078
    ) {}
16
17
    public function __toString(): string
18
    {
19
        return 'Shared object of class ' . $this->value::class;
20
    }
21
22
    /**
23
     * @return class-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
24
     * @internal
25
     */
26 911
    public function getReturnClass(): string
27
    {
28 911
        return $this->value::class;
29
    }
30
}
31