Test Failed
Pull Request — master (#37)
by Divine Niiquaye
02:55
created

Parameter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
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
 * This class represents a global parameter from the container.
22
 *
23
 * @author Divine Niiquaye Ibok <[email protected]>
24
 */
25
class Parameter implements \Stringable
26
{
27
    private string $parameter;
28
    private bool $resolve;
29
30
    public function __construct(string $parameter, bool $resolve = false)
31
    {
32
        $this->resolve = $resolve;
33
        $this->parameter = $parameter;
34
    }
35
36
    public function shouldResolve(): bool
37
    {
38
        return $this->resolve;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     *
44
     * @return string The parameter identifier
45
     */
46
    public function __toString()
47
    {
48
        return $this->parameter;
49
    }
50
}
51