/** * Returns thumbnail data for the given transaction. * * Handles the cache layer around the creation as well. * * @param Transaction $transaction * * @return string */ protected function getThumbnail(Transaction $transaction) { $cacheKey = $transaction->getHash(); if ($this->cache->contains($cacheKey)) { return $this->cache->fetch($cacheKey); } $imageData = $this->creator->create($transaction); $this->cache->save($cacheKey, $imageData, $this->cacheTime); return $imageData; }
public function create(Transaction $transaction) { $this->transaction = $transaction; return $transaction->getHash(); }