diff --git a/src/Potter/Environment/Behaviour.php b/src/Potter/Environment/Behaviour.php new file mode 100644 index 0000000..5540b31 --- /dev/null +++ b/src/Potter/Environment/Behaviour.php @@ -0,0 +1,33 @@ +addShared(Environment::class, function () { + return Environment::createImmutable(getcwd()); + }); + } + + private static function addEnvironmentBehaviour(Container $container): void + { + static::addEnvironment($container); + self::getEnvironment($container)->required(['APPLICATION_NAME']); + } + + private static function getEnvironment(Container $container): Environment + { + return $container->get(Environment::class); + } + + private static function hasEnvironment(Container $container): bool + { + return $container->has(Environment::class); + } +}