コード例 #1
0
 private function matchesHash(CompleteEvent $event, $hash, StreamInterface $body)
 {
     $body->seek(0);
     while (!$body->eof()) {
         $this->hash->update($body->read(16384));
     }
     $result = $this->hash->complete();
     if ($hash !== $result) {
         throw new MessageIntegrityException(sprintf('Message integrity check failure. Expected "%s" but' . ' got "%s"', $hash, $result), $event->getRequest(), $event->getResponse());
     }
 }
コード例 #2
0
 public function seek($offset, $whence = SEEK_SET)
 {
     if ($offset === 0) {
         $this->hash->reset();
         return $this->stream->seek($offset);
     } else {
         // Seeking arbitrarily is not supported.
         return false;
     }
 }