Message
final class Message implements Stringable (View source)
simple usage examples:
// display simple error message 'Error'
echo Message::error()->getDisplay(); // get simple success message 'Success' $message = Message::success();
// get special notice $message = Message::notice(__('This is a localized notice'));
Methods
No description
magic method: return string representation for this object
get Message with customized content
get Message for type of affected rows
get Message for type of deleted rows
get Message for type of inserted rows
get Message of type success with custom content
No description
No description
No description
No description
add parameter as raw HTML, usually in conjunction with strings
add a bunch of messages at once
add a bunch of messages at once
add another raw message to be concatenated on displaying
add another raw message to be concatenated on displaying
add another html message to be concatenated on displaying
returns compiled message
No description
returns Message::$string
No description
Details
__construct(string $string = '', MessageType $type = MessageType::Notice, array $params = [])
No description
string
__toString()
magic method: return string representation for this object
static Message
success(string $string = '', array $params = [])
get Message of type success
shorthand for getting a simple success message
static Message
error(string $string = '', array $params = [])
get Message of type error
shorthand for getting a simple error message
static Message
notice(string $string, array $params = [])
get Message of type notice
shorthand for getting a simple notice message
static Message
raw(string $message, MessageType $type = MessageType::Notice)
get Message with customized content
shorthand for getting a customized message
static Message
getMessageForAffectedRows(int $rows)
get Message for type of affected rows
shorthand for getting a customized message
static Message
getMessageForDeletedRows(int $rows)
get Message for type of deleted rows
shorthand for getting a customized message
static Message
getMessageForInsertedRows(int $rows)
get Message for type of inserted rows
shorthand for getting a customized message
static Message
rawError(string $message)
get Message of type error with custom content
shorthand for getting a customized error message
static Message
rawNotice(string $message)
get Message of type notice with custom content
shorthand for getting a customized notice message
static Message
rawSuccess(string $message)
get Message of type success with custom content
shorthand for getting a customized success message
bool
isSuccess()
No description
bool
isNotice()
No description
bool
isError()
No description
void
setType(MessageType $type)
No description
void
addParam(Message|string|int|float $param)
add string or Message parameter
usage
$message->addParam('[em]some string[/em]');
void
addParamHtml(string $param)
add parameter as raw HTML, usually in conjunction with strings
usage
$message->addParamHtml('<img src="img">');
void
addMessages(array $messages, string $separator = ' ')
add a bunch of messages at once
void
addMessagesString(array $messages, string $separator = ' ')
add a bunch of messages at once
void
addMessage(Message $message, string $separator = ' ')
add another raw message to be concatenated on displaying
void
addText(string $message, string $separator = ' ')
add another raw message to be concatenated on displaying
void
addHtml(string $message, string $separator = ' ')
add another html message to be concatenated on displaying
string
getMessage()
returns compiled message
string
getMessageWithIcon()
No description
string
getString()
returns Message::$string
string
getContext()
No description
string
getDisplay(Template|null $template = null)
returns HTML code for displaying this message