Passed
Push — main ( 0df40c...ce1342 )
by Michael
04:28 queued 52s
created

ClassString::interfaceExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MichaelRubel\ValueObjects\Complex;
6
7
use MichaelRubel\ValueObjects\ValueObject;
8
9
/**
10
 * @method static static make(string $classString)
11
 */
12
class ClassString extends ValueObject
13
{
14
    /**
15
     * Create a new instance of the value object.
16
     *
17
     * @param  string|null  $classString
18
     */
19 12
    public function __construct(protected ?string $classString)
20
    {
21
        //
22
    }
23
24
    /**
25
     * @return bool
26
     */
27 5
    public function classExists(): bool
28
    {
29 5
        return class_exists($this->value());
30
    }
31
32
    /**
33
     * @return bool
34
     */
35 5
    public function interfaceExists(): bool
36
    {
37 5
        return interface_exists($this->value());
38
    }
39
40
    /**
41
     * Get the object value.
42
     *
43
     * @return string
44
     */
45 10
    public function value(): string
46
    {
47 10
        return (string) $this->classString;
48
    }
49
}
50