Compare commits

...

9 Commits

Author SHA1 Message Date
jay ae21edd5bb remove has 2026-08-12 16:12:23 -04:00
jay a793b842b1 re-namespace 2026-08-12 16:02:02 -04:00
jay e664b84072 re-namespace and remove class 2026-08-12 16:01:10 -04:00
jay 6318a565ec remove required() 2026-08-12 15:53:02 -04:00
jay 4adc20284c change static to self 2026-08-12 15:37:20 -04:00
jay 7e2ee30244 call ->load() 2026-08-12 15:34:59 -04:00
jay 622b69f82d fix typeerror 2026-08-12 15:26:54 -04:00
jay af5ca24364 spacing 2026-08-12 15:21:22 -04:00
jay e0ac5c6e1f delete 2026-08-12 15:20:43 -04:00
5 changed files with 30 additions and 45 deletions
-2
View File
@@ -1,2 +0,0 @@
# Environment
+1 -1
View File
@@ -4,7 +4,7 @@
"license": "MIT",
"autoload": {
"psr-4": {
"Potter\\Environment\\": "src/Potter/Environment/"
"Potter\\": "src/Potter/"
}
},
"authors": [
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Potter;
use \Dotenv\Dotenv;
use \Potter\Container;
trait Environment
{
private static function addEnvironment(Container $container): void
{
$container->addShared(Dotenv::class, function () {
return Dotenv::createImmutable(getcwd()); });
}
private static function addEnvironmentBehaviour(Container $container): void
{
self::addEnvironment($container);
$environment = self::getEnvironment($container);
$environment->load();
}
private static function getEnvironment(Container $container): Dotenv
{
return $container->get(Dotenv::class);
}
}
-33
View File
@@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Potter\Environment;
use \Potter\Container;
trait Behaviour
{
private static function addEnvironment(Container $container): void
{
$container->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);
}
}
-9
View File
@@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
namespace Potter\Environment;
final class Environment
extends \Dotenv\Dotenv
{ }