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

ClassString::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 0
c 1
b 0
f 1
dl 0
loc 2
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
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