Commit cc94311c authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Ajoute d'une méthode pour comparer rapidement le contenu de deux fichiers.

Showing with 20 additions and 0 deletions
+20 -0
......@@ -687,4 +687,14 @@ class UploadedFile implements UploadedFileInterface
$this->actualPath = $this->path;
}
/**
* {@inheritdoc}
*
* Ne compare que la taille et la somme de contrôle : il existe une très faible probabilité que deux fichiers de
* même taille et même checksum soient différents.
*/
public function hasSameContent(UploadedFileInterface $other)
{
return $other->getSize() === $this->getSize() && $other->getChecksum() === $this->getChecksum();
}
}
......@@ -381,4 +381,14 @@ interface UploadedFileInterface
* @internal
*/
public function toArray();
/**
* Détermine si ce fichier a le même contenu qu'un autre fichier.
*
* @param UploadedFileInterface $other
* @return bool True si les deux fichiers ont le même contenu.
*
* @api
*/
public function hasSameContent(UploadedFileInterface $other);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment