From 7dea458c6868311cd2cde0f7fa1de2c1599377bf Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Wed, 19 Oct 2022 09:48:12 +0200 Subject: [PATCH] =?UTF-8?q?TExternalFile=20=E2=86=92=20IExternalConfigFile?= =?UTF-8?q?=20(interface=20instead=20of=20trait)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/EnvReader/EnvConfig.php | 4 +--- .../{TExternalFile.php => IExternalConfigFile.php} | 6 +++--- tests/test_env.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) rename src/EnvReader/{TExternalFile.php => IExternalConfigFile.php} (53%) diff --git a/src/EnvReader/EnvConfig.php b/src/EnvReader/EnvConfig.php index 81637bb..e52dd2d 100644 --- a/src/EnvReader/EnvConfig.php +++ b/src/EnvReader/EnvConfig.php @@ -4,9 +4,7 @@ namespace jrosset\EnvReader; use Exception; -abstract class EnvConfig extends GenericConfig { - use TExternalFile; - +abstract class EnvConfig extends GenericConfig implements IExternalConfigFile { /** * @inheritDoc */ diff --git a/src/EnvReader/TExternalFile.php b/src/EnvReader/IExternalConfigFile.php similarity index 53% rename from src/EnvReader/TExternalFile.php rename to src/EnvReader/IExternalConfigFile.php index f075648..6505bd6 100644 --- a/src/EnvReader/TExternalFile.php +++ b/src/EnvReader/IExternalConfigFile.php @@ -3,13 +3,13 @@ namespace jrosset\EnvReader; /** - * Trait for config based on an external file + * Interface for config based on an external file */ -trait TExternalFile { +interface IExternalConfigFile { /** * Get the external config file path * * @return string The config file path */ - protected abstract function getConfigFilePath (): string; + public function getConfigFilePath (): string; } \ No newline at end of file diff --git a/tests/test_env.php b/tests/test_env.php index b148c5e..8ee92f7 100644 --- a/tests/test_env.php +++ b/tests/test_env.php @@ -12,7 +12,7 @@ class Env extends EnvConfig { 'WEBSITE_NAME' => 'Generic site', ]; } - protected function getConfigFilePath (): string { + public function getConfigFilePath (): string { return __DIR__ . '/.env'; } }