Test Failed
Pull Request — master (#37)
by Divine Niiquaye
03:24
created

Statement   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 43
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 3 1
A isClosureWrappable() 0 3 1
A getArguments() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of DivineNii opensource projects.
7
 *
8
 * PHP version 7.4 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2021 DivineNii (https://divinenii.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Rade\DI\Definitions;
19
20
/**
21
 * Represents a type of dynamic referencing allowing us to resolve a service not defined in the container.
22
 *
23
 * @author Divine Niiquaye Ibok <[email protected]>
24
 */
25
class Statement
26
{
27
    /** @var mixed */
28
    private $value;
29
30
    /** @var array<int|string,mixed> */
31
    private array $args;
32
33
    private bool $inlineWrap;
34
35
    /**
36
     * Statement constructor.
37
     *
38
     * @param mixed                   $value
39
     * @param array<int|string,mixed> $args
40
     * @param bool $closure Resolved value will be wrapped in a closure
41
     */
42
    public function __construct($value, array $args = [], bool $closure = false)
43
    {
44
        $this->value = $value;
45
        $this->args = $args;
46
        $this->inlineWrap = $closure;
47
    }
48
49
    /**
50
     * @return mixed
51
     */
52
    public function getValue()
53
    {
54
        return $this->value;
55
    }
56
57
    /**
58
     * @return array<int|string,mixed>
59
     */
60
    public function getArguments(): array
61
    {
62
        return $this->args;
63
    }
64
65
    public function isClosureWrappable(): bool
66
    {
67
        return $this->inlineWrap;
68
    }
69
}
70