diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-08-10 10:46:41 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-08-10 10:46:41 +0200 |
commit | c14579871fa1241713128a2d0d5514af004e3371 (patch) | |
tree | 6b28c42958650d94c9aa1947a0b5c32eb869d89f /src/Singleton.php |
initial commit
Diffstat (limited to 'src/Singleton.php')
-rw-r--r-- | src/Singleton.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Singleton.php b/src/Singleton.php new file mode 100644 index 0000000..b4d4598 --- /dev/null +++ b/src/Singleton.php @@ -0,0 +1,17 @@ +<?php + +namespace App; + +trait Singleton +{ + private static self $instance; + + public static function getInstance(): self + { + if (! isset(self::$instance)) { + self::$instance = new self(); + } + + return self::$instance; + } +} |