Created
August 13, 2019 13:03
-
-
Save kobus1998/b81a91ff7210064129319327b60237b5 to your computer and use it in GitHub Desktop.
simple pool trait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Pool | |
{ | |
/** @var array **/ | |
protected static $aPool = []; | |
public static function addToPool($key, $val) | |
{ | |
self::$aPool[$key] = $val; | |
} | |
public static function getFromPool($key) | |
{ | |
return self::$aPool[$key] ?? null; | |
} | |
public static function existsInPool($key) | |
{ | |
return isset(self::$aPool[$key]); | |
} | |
public static function getPool() | |
{ | |
return self::$aPool; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment