Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace Illuminate\Contracts\Support; |
| 4 | |
| 5 | use Countable; |
| 6 | |
| 7 | interface MessageBag extends Arrayable, Countable |
| 8 | { |
| 9 | /** |
| 10 | * Get the keys present in the message bag. |
| 11 | * |
| 12 | * @return array |
| 13 | */ |
| 14 | public function keys(); |
| 15 | |
| 16 | /** |
| 17 | * Add a message to the bag. |
| 18 | * |
| 19 | * @param string $key |
| 20 | * @param string $message |
| 21 | * @return $this |
| 22 | */ |
| 23 | public function add($key, $message); |
| 24 | |
| 25 | /** |
| 26 | * Merge a new array of messages into the bag. |
| 27 | * |
| 28 | * @param \Illuminate\Contracts\Support\MessageProvider|array $messages |
| 29 | * @return $this |
| 30 | */ |
| 31 | public function merge($messages); |
| 32 | |
| 33 | /** |
| 34 | * Determine if messages exist for a given key. |
| 35 | * |
| 36 | * @param string|array $key |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function has($key); |
| 40 | |
| 41 | /** |
| 42 | * Get the first message from the bag for a given key. |
| 43 | * |
| 44 | * @param string|null $key |
| 45 | * @param string|null $format |
| 46 | * @return string |
| 47 | */ |
| 48 | public function first($key = null, $format = null); |
| 49 | |
| 50 | /** |
| 51 | * Get all of the messages from the bag for a given key. |
| 52 | * |
| 53 | * @param string $key |
| 54 | * @param string|null $format |
| 55 | * @return array |
| 56 | */ |
| 57 | public function get($key, $format = null); |
| 58 | |
| 59 | /** |
| 60 | * Get all of the messages for every key in the bag. |
| 61 | * |
| 62 | * @param string|null $format |
| 63 | * @return array |
| 64 | */ |
| 65 | public function all($format = null); |
| 66 | |
| 67 | /** |
| 68 | * Get the raw messages in the container. |
| 69 | * |
| 70 | * @return array |
| 71 | */ |
| 72 | public function getMessages(); |
| 73 | |
| 74 | /** |
| 75 | * Get the default message format. |
| 76 | * |
| 77 | * @return string |
| 78 | */ |
| 79 | public function getFormat(); |
| 80 | |
| 81 | /** |
| 82 | * Set the default message format. |
| 83 | * |
| 84 | * @param string $format |
| 85 | * @return $this |
| 86 | */ |
| 87 | public function setFormat($format = ':message'); |
| 88 | |
| 89 | /** |
| 90 | * Determine if the message bag has any messages. |
| 91 | * |
| 92 | * @return bool |
| 93 | */ |
| 94 | public function isEmpty(); |
| 95 | |
| 96 | /** |
| 97 | * Determine if the message bag has any messages. |
| 98 | * |
| 99 | * @return bool |
| 100 | */ |
| 101 | public function isNotEmpty(); |
| 102 | } |