]> _ Git - fluidbook_tools.git/commitdiff
wip #4666 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Sep 2021 18:09:19 +0000 (20:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Sep 2021 18:09:19 +0000 (20:09 +0200)
src/PDF/Document.php

index c3ebc578148595b7d4efe9520a31f6f87511e873..daecb3a4a340861aec384565f784dc33e8642297 100644 (file)
@@ -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) {