Skip to content

Instantly share code, notes, and snippets.

@kobus1998
Created August 13, 2019 13:03
Show Gist options
  • Save kobus1998/b81a91ff7210064129319327b60237b5 to your computer and use it in GitHub Desktop.
Save kobus1998/b81a91ff7210064129319327b60237b5 to your computer and use it in GitHub Desktop.
simple pool trait
<?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