blob: 38be66620610a4bf87c41c787857e18ca7c9f433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<?php
abstract class Factory implements FactoryInterface {
public static $storage = [];
#===============================================================================
# Adds an instance of a class to the runtime instance cache
#===============================================================================
protected static function storeInstance($identifier, $instance) {
return self::$storage[get_called_class()][$identifier] = $instance;
}
#===============================================================================
# Gets an instance of a class from the runtime instance cache
#===============================================================================
protected static function fetchInstance($identifier) {
return self::$storage[get_called_class()][$identifier] ?? FALSE;
}
}
?>
|