Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit 831da02

Browse files
committed
rm SingletonTrait
1 parent 2001610 commit 831da02

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

src/Gtk.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717
class Gtk
1818
{
1919
use ProxyTrait;
20-
use SingletonTrait;
2120

2221
public LibraryInformation $info;
2322

2423
public Loader $loader;
2524

25+
/**
26+
* @var self|null
27+
*/
28+
private static ?self $instance = null;
29+
2630
/**
2731
* Gtk constructor.
2832
*/
@@ -35,6 +39,23 @@ public function __construct()
3539
self::setInstance($this);
3640
}
3741

42+
/**
43+
* @return self $this
44+
*/
45+
public static function getInstance(): self
46+
{
47+
return self::$instance ??= new static();
48+
}
49+
50+
/**
51+
* @param self|null $instance
52+
* @return void
53+
*/
54+
public static function setInstance(?self $instance): void
55+
{
56+
self::$instance = $instance;
57+
}
58+
3859
/**
3960
* @return Loader
4061
*/
@@ -50,6 +71,7 @@ private function loader(): Loader
5071
return $loader;
5172
}
5273

74+
5375
/**
5476
* @param LibraryInterface $library
5577
* @return LibraryInformation

src/Support/SingletonTrait.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)