From: Vincent Vanwaelscappel Date: Mon, 6 Sep 2021 18:09:19 +0000 (+0200) Subject: wip #4666 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f50b4deff7579cc11c2933bec51615e4a34d0401;p=fluidbook_tools.git wip #4666 @0.5 --- diff --git a/src/PDF/Document.php b/src/PDF/Document.php index c3ebc57..daecb3a 100644 --- a/src/PDF/Document.php +++ b/src/PDF/Document.php @@ -10,6 +10,11 @@ class Document { protected $in; + /** + * @var string + */ + protected $hash = null; + /** * @var int */ @@ -29,6 +34,17 @@ class Document $this->in = $in; } + /** + * @return string + */ + public function getHash(): string + { + if (null === $this->hash) { + $this->hash = hash_file('sha256', $this->in, false); + } + return $this->hash; + } + public function getInfos($force = false) { if (!$force && $this->pages) {