summaryrefslogtreecommitdiffstats
path: root/core/namespace/ItemFactory.php
blob: e5793d4ba2e65d9372879ba2e3002bc0456cc941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
<?php
abstract class ItemFactory extends Factory implements FactoryInterface {
	public static function build($itemID): Item {
		if(!$Instance = parent::fetchInstance($itemID)) {
			$Item = (new ReflectionClass(get_called_class()))->getNamespaceName().'\\Item';
			$Instance = parent::storeInstance($itemID, new $Item($itemID, \Application::getDatabase()));
		}

		return $Instance;
	}
}
?>