Beispiel #1
0
 /**
  * Creates a unique key that can be used to retrieve the file from the storage backend.
  *
  * @ORM\PrePersist()
  *
  * @return $this
  */
 public function createKey()
 {
     /**
      * The associated file has a unique key that can be used to retrieve the key from the backend storage.
      */
     $this->key = sprintf('%s/%s.%s', $this->path, UniqueStringUtil::shortHash(), $this->extension);
     return $this;
 }
 /**
  * Test that binary string with length of 20 is returned.
  */
 public function testLongHash()
 {
     $hash = UniqueStringUtil::longHash();
     $this->assertTrue(is_int(bindec($hash)));
     $this->assertTrue(strlen($hash) === 20);
 }