ILIAS
release_8 Revision v8.23
◀ ilDoc Overview
TokenStream.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\ResourceStorage\Consumer\StreamAccess
;
22
23
use
ILIAS\Filesystem\Stream\Stream
;
24
29
class
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
}
ILIAS\ResourceStorage\Consumer\StreamAccess
Definition:
Encrypt.php:21
ILIAS\Filesystem\Stream\Stream
Class Stream.
Definition:
Stream.php:32
ILIAS\Filesystem\Stream\Stream\read
read($length)
Definition:
Stream.php:270
ILIAS\Filesystem\Stream\Stream\rewind
rewind()
Definition:
Stream.php:220
ILIAS\ResourceStorage\Consumer\StreamAccess\TokenStream\getMimeType
getMimeType()
Definition:
TokenStream.php:33
Stream
ILIAS\ResourceStorage\Consumer\StreamAccess\TokenStream
Definition:
TokenStream.php:29
ILIAS\ResourceStorage\Consumer\StreamAccess\TokenStream\$mime_type
string $mime_type
Definition:
TokenStream.php:31
src
ResourceStorage
Consumer
StreamAccess
TokenStream.php
Generated on Sun Aug 31 2025 22:02:46 for ILIAS by
1.8.13 (using
Doxyfile
)