/** * Generates a cache key based on provided data * * @param mixed $data * * @return string * @throws InvalidArgumentException in case if value was not converted */ public function generate($data) { if ($data instanceof InfoProviderInterface) { $data = $data->getCacheKeyInfo(); } if ($this->converter && !is_string($data)) { $convertedData = $this->converter->convert($data); if ($convertedData === false) { throw new InvalidArgumentException($data); } $data = $convertedData; } elseif (!is_string($data)) { throw new InvalidArgumentException($data); } $cacheKey = $this->normalizer->normalize($data); if ($this->prefix) { return $this->prefix . $cacheKey; } return $cacheKey; }
/** * Method returns an array with configuration for specified tag in specified source. * * @param $tagName * @param $source * @return array */ public function getConfig($tagName, $source) { $config = $this->reader->read($tagName, $source); return $this->converter->convert($config); }