ILIAS  release_8 Revision v8.24
TokenStream.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
29class TokenStream extends Stream
30{
31 private ?string $mime_type = null;
32
33 public function getMimeType(): ?string
34 {
35 if ($this->mime_type === null) {
36 $finfo = finfo_open(FILEINFO_MIME_TYPE);
37 //We only need the first few bytes to determine the mime-type this helps to reduce RAM-Usage
38 $this->rewind();
39 $this->mime_type = finfo_buffer($finfo, $this->read(255)) ?: 'application/octet-stream';
40 $this->rewind();
41 }
42 return $this->mime_type;
43 }
44}
read($length)
@inheritDoc
Definition: Stream.php:270