ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilPRGMessageCollection.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected array $success = [];
28 protected array $error = [];
29 protected string $description = '';
30
32 {
33 $clone = clone $this;
34 $clone->success = [];
35 $clone->error = [];
36 $clone->description = $description;
37 return $clone;
38 }
39
43 public function getSuccess(): array
44 {
45 return $this->success;
46 }
47
51 public function getErrors(): array
52 {
53 return $this->error;
54 }
55
56 public function hasSuccess(): bool
57 {
58 return count($this->success) > 0;
59 }
60
61 public function hasErrors(): bool
62 {
63 return count($this->error) > 0;
64 }
65
66 public function hasAnyMessages(): bool
67 {
68 return count($this->error) > 0 || count($this->success) > 0;
69 }
70
71 public function getDescription(): string
72 {
73 return $this->description;
74 }
75
76 public function add(bool $success, string $message, string $record_identitifer): void
77 {
78 $entry = [$message, $record_identitifer];
79 if ($success) {
80 $this->success[] = $entry;
81 } else {
82 $this->error[] = $entry;
83 }
84 }
85}
error(string $a_errmsg)
Holds information about multi-actions, mainly in context of member-assignemnts and status changes.
add(bool $success, string $message, string $record_identitifer)
withNewTopic(string $description)
$message
Definition: xapiexit.php:31