Completed
Push — develop ( b9b8dc...f49312 )
by Baptiste
02:08
created

Primitive::fromValue()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Definition\Service\Argument;
5
6
use Innmind\Compose\{
7
    Definition\Service\Argument,
8
    Definitions
9
};
10
use Innmind\Immutable\StreamInterface;
11
12
final class Primitive implements Argument
13
{
14
    private $value;
15
16 3
    private function __construct($value)
17
    {
18 3
        $this->value = $value;
19 3
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 3
    public static function fromValue($value): Argument
25
    {
26 3
        return new self($value);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 2
    public function resolve(
33
        StreamInterface $built,
34
        Definitions $definitions
35
    ): StreamInterface {
36 2
        return $built->add($this->value);
37
    }
38
}
39