Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 13 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
18 | View Code Duplication | public function load(WorkingDirectory $currentDirectory) |
|
|
|||
19 | { |
||
20 | $loader = new Dotenv($currentDirectory->getCurrentDirectoryAbsolute()); |
||
21 | |||
22 | try { |
||
23 | $loader->load(); |
||
24 | } catch (InvalidPathException $e) { |
||
25 | // assuming .env file is missing here and then just proceed to check global env variables |
||
26 | } |
||
27 | |||
28 | $loader->required(EnvironmentLoader::MANDATORY_ENV_VARIABLES) |
||
29 | ->notEmpty(); |
||
30 | } |
||
31 | } |
||
32 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.