Passed
Push — 0.7.0 ( 7cf8ff...8cbd21 )
by Alexander
04:15 queued 11s
created

Readers::read()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php 
2
3
/**
4
 * Lenevor Framework
5
 *
6
 * LICENSE
7
 *
8
 * This source file is subject to the new BSD license that is bundled
9
 * with this package in the file LICENSE.
10
 * It is also available through the world-wide-web at this URL:
11
 * https://lenevor.com/license
12
 * If you did not receive a copy of the license and are unable to
13
 * obtain it through the world-wide-web, please send an email
14
 * to [email protected] so we can send you a copy immediately.
15
 *
16
 * @package     Lenevor
17
 * @subpackage  Base
18
 * @link        https://lenevor.com
19
 * @copyright   Copyright (c) 2019 - 2021 Alexander Campo <[email protected]>
20
 * @license     https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /LICENSE
21
 */
22
23
namespace Syscodes\Dotenv\Repository\Adapters;
24
25
/**
26
 * Reads an environment variable.
27
 * 
28
 * @author Alexander Campo <[email protected]>
29
 */
30
final class Readers
31
{
32
    /**
33
     * The set of readers to use.
34
     * 
35
     * @var \Syscodes\Dotenv\Repository\Adapters\Readers $readers
36
     */
37
    protected $readers;
38
39
    /**
40
     * Constructor. The create new Readers instance.
41
     * 
42
     * @param  \Syscodes\Dotenv\Repository\Adapters\Readers  $readers
43
     * 
44
     * return void
45
     */
46
    public function __construct(array $readers)
47
    {
48
        $this->readers = $readers;
0 ignored issues
show
Documentation Bug introduced by
It seems like $readers of type array is incompatible with the declared type Syscodes\Dotenv\Repository\Adapters\Readers of property $readers.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
    }
50
51
    /**
52
     * Read an environment variable
53
     * 
54
     * @param  string  $name
55
     * 
56
     * @return mixed
57
     */
58
    public function read(string $name)
59
    {
60
        foreach ($this->readers as $reader) {
61
            return $reader->read($name);
62
        }
63
64
        return null;
65
    }
66
}