/**
  * Returns whether the file exists
  *
  * @param IdEntity|null $entity
  * @param string $size
  *
  * @return bool
  */
 public function hasFile(IdEntity $entity = null, $size)
 {
     if (null === $entity || null === $entity->getId()) {
         return false;
     }
     return is_file($this->getFileSystemPath($entity, $size));
 }
 /**
  * Generates the file name
  *
  * @param IdEntity $entity
  *
  * @throws \InvalidArgumentException
  * @return string
  */
 protected function getFileName(IdEntity $entity)
 {
     if (is_null($entity->getId())) {
         throw new \InvalidArgumentException("Entity id must be set");
     }
     if (is_null($this->hashPrefix)) {
         return "{$entity->getId()}.{$this->fileExtension}";
     }
     return md5("{$this->hashPrefix}-{$entity->getId()}") . ".{$this->fileExtension}";
 }