BrowscapPHP\Cache\BrowscapCache::getItem PHP Method

getItem() public method

Get an item.
public getItem ( string $cacheId, boolean $withVersion = true, boolean &$success = null ) : mixed
$cacheId string
$withVersion boolean
$success boolean
return mixed Data on success, null on failure
    public function getItem($cacheId, $withVersion = true, &$success = null)
    {
        if ($withVersion) {
            $cacheId .= '.' . $this->getVersion();
        }
        if (!$this->cache->hasItem($cacheId)) {
            $success = false;
            return null;
        }
        $success = null;
        $data = $this->cache->getItem($cacheId, $success);
        if (!$success) {
            $success = false;
            return null;
        }
        if (!isset($data['content'])) {
            $success = false;
            return null;
        }
        $success = true;
        return unserialize($data['content']);
    }