ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
FilePayload.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 public function __construct(
29 private string $uri,
30 private string $mime_type,
31 private string $file_name,
32 private string $disposition,
33 private int $user_id = 0
34 ) {
35 $modification_time = @filemtime($uri);
37 'p' => $uri,
38 'm' => $mime_type,
39 'n' => $file_name,
40 'd' => $disposition,
41 'u' => $user_id,
42 'mt' => $modification_time,
43 ]);
44 }
45
46 public static function fromArray(array $raw_payload): self
47 {
48 return new self(
49 $raw_payload['p'],
50 $raw_payload['m'],
51 $raw_payload['n'],
52 $raw_payload['d'],
53 $raw_payload['u'],
54 $raw_payload['mt'] ?? false
55 );
56 }
57
58 public function getUri(): string
59 {
60 return $this->uri;
61 }
62
63 public function getMimeType(): string
64 {
65 return $this->mime_type;
66 }
67
68 public function getFileName(): string
69 {
70 return $this->file_name;
71 }
72
73 public function getDisposition(): string
74 {
75 return $this->disposition;
76 }
77
78 public function getUserId(): int
79 {
80 return $this->user_id;
81 }
82}
__construct(private string $uri, private string $mime_type, private string $file_name, private string $disposition, private int $user_id=0)
Definition: FilePayload.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc