ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\LegalDocuments\Consumer\InlineSrcBuilder Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\Consumer\InlineSrcBuilder:
+ Collaboration diagram for ILIAS\LegalDocuments\Consumer\InlineSrcBuilder:

Public Member Functions

 __construct (private Services $file_delivery)
 
 getRevisionURL (Revision $revision, bool $signed=true, float $valid_for_at_least_minutes=60.0, ?string $filename=null)
 
 getFlavourURLs (Flavour $flavour, bool $signed=true)
 
 buildDataURLFromStream (FileStream $stream)
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 33 of file InlineSrcBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Consumer\InlineSrcBuilder::__construct ( private Services  $file_delivery)

Definition at line 35 of file InlineSrcBuilder.php.

37  {
38 
39  }

Member Function Documentation

◆ buildDataURLFromStream()

ILIAS\LegalDocuments\Consumer\InlineSrcBuilder::buildDataURLFromStream ( FileStream  $stream)

Definition at line 81 of file InlineSrcBuilder.php.

Referenced by ILIAS\LegalDocuments\Consumer\InlineSrcBuilder\getFlavourURLs(), and ILIAS\LegalDocuments\Consumer\InlineSrcBuilder\getRevisionURL().

81  : string
82  {
83  $mime_type = mime_content_type($stream->getMetadata()['uri']) ?: 'application/octet-stream';
84  $base64 = base64_encode((string) $stream);
85  return "data:$mime_type;base64,$base64";
86  }
+ Here is the caller graph for this function:

◆ getFlavourURLs()

ILIAS\LegalDocuments\Consumer\InlineSrcBuilder::getFlavourURLs ( Flavour  $flavour,
bool  $signed = true 
)
Exceptions

Implements ILIAS\LegalDocuments\Consumer\SrcBuilder.

Definition at line 68 of file InlineSrcBuilder.php.

References ILIAS\LegalDocuments\Consumer\InlineSrcBuilder\buildDataURLFromStream().

71  : \Generator {
72  if ($signed) {
73  throw new \RuntimeException('InlineSrcBuilder does not support signed URLs');
74  }
75  foreach ($flavour->getStreamResolvers() as $stream_resolver) {
76  $stream = $stream_resolver->getStream();
77  yield $this->buildDataURLFromStream($stream);
78  }
79  }
+ Here is the call graph for this function:

◆ getRevisionURL()

ILIAS\LegalDocuments\Consumer\InlineSrcBuilder::getRevisionURL ( Revision  $revision,
bool  $signed = true,
float  $valid_for_at_least_minutes = 60.0,
?string  $filename = null 
)
Parameters
string | null$filename
Exceptions

Implements ILIAS\LegalDocuments\Consumer\SrcBuilder.

Definition at line 41 of file InlineSrcBuilder.php.

References $filename, ILIAS\LegalDocuments\Consumer\InlineSrcBuilder\buildDataURLFromStream(), and null.

46  : string {
47  if ($signed) {
48  throw new \RuntimeException('InlineSrcBuilder does not support signed URLs');
49  }
50  $sream_resolver = $revision->maybeStreamResolver();
51  if ($sream_resolver !== null) {
52  $stream = $sream_resolver->getStream();
53  if ($sream_resolver->isInMemory()) {
54  return $this->buildDataURLFromStream($stream);
55  }
56 
57  $this->file_delivery->buildTokenURL(
58  $stream,
59  $filename ?? $revision->getTitle(),
60  Disposition::INLINE,
61  6, // FSX TODO
62  1
63  );
64  }
65  return '';
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: