Passed
Push — 0.7.0 ( 91f75a...a316e5 )
by Alexander
09:55
created

Resolver::getFilePath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
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.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\Resolve;
24
25
use Throwable;
26
use InvalidArgumentException;
27
28
/**
29
 * Gets the file path .env
30
 * 
31
 * @author Alexander Campo <[email protected]>
32
 */
33
final class Resolver
34
{
35
    /**
36
     * Returns the full path to the file.
37
     * 
38
     * @param  string  $path
39
     * @param  string  $file
40
     * 
41
     * @return string
42
     */
43
    public static function getFilePath(string $path, string $file)
44
    {
45
        try {
46
            return (string) rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file;
47
        } catch (Throwable $e) {
48
            throw new InvalidArgumentException("The path [{$path}] of file [{$file}] no exist");
49
        }
50
    }
51
}