ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilMailValueObject.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24  private readonly array $attachments;
25 
30  public function __construct(
31  private readonly string $from,
32  private readonly string $recipients,
33  private readonly string $recipients_cc,
34  private readonly string $recipients_bcc,
35  private readonly string $subject,
36  private readonly string $body,
37  array $attachments,
38  private readonly bool $use_placeholders = false,
39  private readonly bool $save_in_sent_box = false
40  ) {
41  $this->attachments = array_filter(array_map('trim', $attachments));
42  if (ilStr::strLen($this->subject) > 255) {
43  throw new InvalidArgumentException('Subject must not be longer than 255 characters');
44  }
45  }
46 
47  public function getRecipients(): string
48  {
49  return $this->recipients;
50  }
51 
52  public function getRecipientsCC(): string
53  {
54  return $this->recipients_cc;
55  }
56 
57  public function getRecipientsBCC(): string
58  {
59  return $this->recipients_bcc;
60  }
61 
62  public function getSubject(): string
63  {
64  return $this->subject;
65  }
66 
67  public function getBody(): string
68  {
69  return $this->body;
70  }
71 
75  public function getAttachments(): array
76  {
77  return $this->attachments;
78  }
79 
80  public function isUsingPlaceholders(): bool
81  {
82  return $this->use_placeholders;
83  }
84 
85  public function shouldSaveInSentBox(): bool
86  {
87  return $this->save_in_sent_box;
88  }
89 
90  public function getFrom(): string
91  {
92  return $this->from;
93  }
94 }
static strLen(string $a_string)
Definition: class.ilStr.php:60
__construct(private readonly string $from, private readonly string $recipients, private readonly string $recipients_cc, private readonly string $recipients_bcc, private readonly string $subject, private readonly string $body, array $attachments, private readonly bool $use_placeholders=false, private readonly bool $save_in_sent_box=false)