Passed
Push — master ( 4326ac...342126 )
by Mr
02:06
created

MockValue   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A makeEmpty() 0 3 1
A isEmpty() 0 3 1
A customFactory() 0 3 1
A getValue() 0 3 1
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/interop project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Tests\Interop\Fixture;
10
11
use Daikon\Interop\FromNativeInterface;
12
use Daikon\Interop\FromToNativeTrait;
13
use Daikon\Interop\MakeEmptyInterface;
14
use Daikon\Interop\ToNativeInterface;
15
16
final class MockValue implements FromNativeInterface, ToNativeInterface, MakeEmptyInterface
17
{
18
    use FromToNativeTrait;
19
20
    private ?string $value;
21
22
    public static function makeEmpty(): self
23
    {
24
        return new self;
25
    }
26
27
    public function isEmpty(): bool
28
    {
29
        return !isset($this->value);
30
    }
31
32
    public static function customFactory(array $state): self
33
    {
34
        return new self($state['custom']);
35
    }
36
37
    public function getValue(): ?string
38
    {
39
        return $this->value;
40
    }
41
42
    private function __construct(string $value = null)
43
    {
44
        $this->value = $value;
45
    }
46
}
47