ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPRGMessageCollection.php
Go to the documentation of this file.
1<?php declare(strict_types = 1);
2
8{
9 protected $success = [];
10 protected $error = [];
11 protected $description = '';
12
14 {
15 $clone = clone $this;
16 $clone->success = [];
17 $clone->error = [];
18 $clone->description = $description;
19 return $clone;
20 }
21
25 public function getSuccess() : array
26 {
27 return $this->success;
28 }
29
33 public function getErrors() : array
34 {
35 return $this->error;
36 }
37
38 public function hasSuccess() : bool
39 {
40 return count($this->success) > 0;
41 }
42
43 public function hasErrors() : bool
44 {
45 return count($this->error) > 0;
46 }
47
48 public function hasAnyMessages() : bool
49 {
50 return count($this->error) > 0 || count($this->success) > 0;
51 }
52
53 public function getDescription() : string
54 {
55 return $this->description;
56 }
57
58 public function add(bool $success, string $message, string $record_identitifer) : void
59 {
60 $entry = [$message, $record_identitifer];
61 if ($success) {
62 $this->success[] = $entry;
63 } else {
64 $this->error[] = $entry;
65 }
66 }
67}
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
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)
success()
Definition: success.php:2
$message
Definition: xapiexit.php:14