ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
BaseConsumer.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
31 abstract class BaseConsumer implements DeliveryConsumer
32 {
33  use GetRevisionTrait;
34 
35  protected ?int $revision_number = null;
36  protected string $file_name = '';
40 
44  public function __construct(
45  StorableResource $resource,
46  StreamAccess $stream_access,
47  FileNamePolicy $file_name_policy
48  ) {
49  $this->resource = $resource;
50  $this->stream_access = $stream_access;
51  $this->file_name_policy = $file_name_policy;
52  $this->file_name = $resource->getCurrentRevision()->getInformation()->getTitle();
53  }
54 
55  abstract public function run(): void;
56 
60  public function setRevisionNumber(int $revision_number): DeliveryConsumer
61  {
62  $this->revision_number = $revision_number;
63  return $this;
64  }
65 
66  public function overrideFileName(string $file_name): DeliveryConsumer
67  {
68  $this->file_name = $file_name;
69  return $this;
70  }
71 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(StorableResource $resource, StreamAccess $stream_access, FileNamePolicy $file_name_policy)
DownloadConsumer constructor.
run()
This runs the actual DeliveryConsumer.