public function set($value) { $type = gettype($value); if ($type === 'object') { $value = serialize($value); } $json = json_encode(['type' => $type, 'value' => $value]); $this->cacheItem->set(Crypto::encrypt($json, $this->key)); return $this; }