woocommerce-pos
/
vendor_prefixed
/
phpfastcache
/
phpfastcache
/
lib
/
Phpfastcache
/
Drivers
/
Files
/
Item.php
Item.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.9.14, at vendor_prefixed/phpfastcache/phpfastcache/lib/Phpfastcache/Drivers/Files/Item.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * This file is part of phpFastCache. |
| 6 | * |
| 7 | * @license MIT License (MIT) |
| 8 | * |
| 9 | * For full copyright and license information, please see the docs/CREDITS.txt file. |
| 10 | * |
| 11 | * @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> https://www.phpfastcache.com |
| 12 | * @author Georges.L (Geolim4) <contact@geolim4.com> |
| 13 | * |
| 14 | */ |
| 15 | declare (strict_types=1); |
| 16 | namespace WCPOS\Vendor\Phpfastcache\Drivers\Files; |
| 17 | |
| 18 | use WCPOS\Vendor\Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
| 19 | use WCPOS\Vendor\Phpfastcache\Core\Item\ItemBaseTrait; |
| 20 | use WCPOS\Vendor\Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 21 | use WCPOS\Vendor\Phpfastcache\Drivers\Files\Driver as FilesDriver; |
| 22 | use WCPOS\Vendor\Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException; |
| 23 | /** |
| 24 | * Class Item |
| 25 | * @package phpFastCache\Drivers\Files |
| 26 | */ |
| 27 | class Item implements ExtendedCacheItemInterface |
| 28 | { |
| 29 | use ItemBaseTrait { |
| 30 | ItemBaseTrait::__construct as __BaseConstruct; |
| 31 | } |
| 32 | /** |
| 33 | * Item constructor. |
| 34 | * @param Driver $driver |
| 35 | * @param $key |
| 36 | * @throws PhpfastcacheInvalidArgumentException |
| 37 | */ |
| 38 | public function __construct(FilesDriver $driver, $key) |
| 39 | { |
| 40 | $this->__BaseConstruct($driver, $key); |
| 41 | } |
| 42 | /** |
| 43 | * @param ExtendedCacheItemPoolInterface $driver |
| 44 | * @return static |
| 45 | * @throws PhpfastcacheInvalidArgumentException |
| 46 | */ |
| 47 | public function setDriver(ExtendedCacheItemPoolInterface $driver) |
| 48 | { |
| 49 | if ($driver instanceof FilesDriver) { |
| 50 | $this->driver = $driver; |
| 51 | return $this; |
| 52 | } |
| 53 | throw new PhpfastcacheInvalidArgumentException('Invalid driver instance'); |
| 54 | } |
| 55 | } |
| 56 |