ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPRGMessageCollection.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
27  protected array $success = [];
28  protected array $error = [];
29  protected string $description = '';
30 
31  public function withNewTopic(string $description): ilPRGMessageCollection
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 }
withNewTopic(string $description)
add(bool $success, string $message, string $record_identitifer)
$message
Definition: xapiexit.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...