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

Reader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A read() 0 13 3
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.md.
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.md
21
 */
22
23
namespace Syscodes\Dotenv\Store\Contributors;
24
25
use InvalidArgumentException;
26
27
/**
28
 * Allows the read files and converting string in array.
29
 * 
30
 * @author Alexander Campo <[email protected]>
31
 */
32
final class Reader
33
{
34
    /**
35
     * Read the file(s), and return their raw content.
36
     * 
37
     * @param  string[]  $filePaths
38
     * @param  bool  $modeEnabled  (true by default)
39
     * 
40
     * @return array 
41
     */
42
    public static function read(array $filePaths, bool $modeEnabled = true)
43
    {
44
        $output = '';
45
46
        foreach ($filePaths as $filePath) {
47
            $output = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
48
            
49
            if ($modeEnabled) {
50
                break;
51
            }
52
        }
53
54
        return $output;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $output also could return the type string which is incompatible with the documented return type array.
Loading history...
55
    }
56
}