PHP 클래스 Overtrue\Validation\MessageBag

상속: implements Countabl\Countable, implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: overtrue/validation 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$format string Default format for message output.
$messages array All of the registered messages.

공개 메소드들

메소드 설명
__construct ( array $messages = [] ) : MessageBag Create a new message bag instance.
__toString ( ) : string Convert the message bag to its string representation.
add ( string $key, string $message ) Add a message to the bag.
all ( string $format = null ) : array Get all of the messages for every key in the bag.
any ( ) : boolean Determine if the message bag has any messages.
count ( ) : integer Get the number of messages in the container.
first ( string $key = null, string $format = null ) : string Get the first message from the bag for a given key.
get ( string $key, string $format = null ) : array Get all of the messages from the bag for a given key.
getFormat ( ) : string Get the default message format.
getMessageBag ( ) : MessageBag Get the messages for the instance.
getMessages ( ) : array Get the raw messages in the container.
has ( string $key = null ) : boolean Determine if messages exist for a given key.
isEmpty ( ) : boolean Determine if the message bag has any messages.
jsonSerialize ( ) : array Convert the object into something JSON serializable.
merge ( array $messages ) Merge a new array of messages into the bag.
setFormat ( string $format = ':message' ) : MessageBag Set the default message format.
toArray ( ) : array Get the instance as an array.
toJson ( integer $options ) : string Convert the object to its JSON representation.

보호된 메소드들

메소드 설명
checkFormat ( string $format ) : string Get the appropriate format based on the given format.
isUnique ( string $key, string $message ) : boolean Determine if a key and message combination already exists.
transform ( array $messages, string $format, string $messageKey ) : array Format an array of messages.

메소드 상세

__construct() 공개 메소드

Create a new message bag instance.
public __construct ( array $messages = [] ) : MessageBag
$messages array
리턴 MessageBag

__toString() 공개 메소드

Convert the message bag to its string representation.
public __toString ( ) : string
리턴 string

add() 공개 메소드

Add a message to the bag.
public add ( string $key, string $message )
$key string
$message string

all() 공개 메소드

Get all of the messages for every key in the bag.
public all ( string $format = null ) : array
$format string
리턴 array

any() 공개 메소드

Determine if the message bag has any messages.
public any ( ) : boolean
리턴 boolean

checkFormat() 보호된 메소드

Get the appropriate format based on the given format.
protected checkFormat ( string $format ) : string
$format string
리턴 string

count() 공개 메소드

Get the number of messages in the container.
public count ( ) : integer
리턴 integer

first() 공개 메소드

Get the first message from the bag for a given key.
public first ( string $key = null, string $format = null ) : string
$key string
$format string
리턴 string

get() 공개 메소드

Get all of the messages from the bag for a given key.
public get ( string $key, string $format = null ) : array
$key string
$format string
리턴 array

getFormat() 공개 메소드

Get the default message format.
public getFormat ( ) : string
리턴 string

getMessageBag() 공개 메소드

Get the messages for the instance.
public getMessageBag ( ) : MessageBag
리턴 MessageBag

getMessages() 공개 메소드

Get the raw messages in the container.
public getMessages ( ) : array
리턴 array

has() 공개 메소드

Determine if messages exist for a given key.
public has ( string $key = null ) : boolean
$key string
리턴 boolean

isEmpty() 공개 메소드

Determine if the message bag has any messages.
public isEmpty ( ) : boolean
리턴 boolean

isUnique() 보호된 메소드

Determine if a key and message combination already exists.
protected isUnique ( string $key, string $message ) : boolean
$key string
$message string
리턴 boolean

jsonSerialize() 공개 메소드

Convert the object into something JSON serializable.
public jsonSerialize ( ) : array
리턴 array

merge() 공개 메소드

Merge a new array of messages into the bag.
public merge ( array $messages )
$messages array

setFormat() 공개 메소드

Set the default message format.
public setFormat ( string $format = ':message' ) : MessageBag
$format string
리턴 MessageBag

toArray() 공개 메소드

Get the instance as an array.
public toArray ( ) : array
리턴 array

toJson() 공개 메소드

Convert the object to its JSON representation.
public toJson ( integer $options ) : string
$options integer
리턴 string

transform() 보호된 메소드

Format an array of messages.
protected transform ( array $messages, string $format, string $messageKey ) : array
$messages array
$format string
$messageKey string
리턴 array

프로퍼티 상세

$format 보호되어 있는 프로퍼티

Default format for message output.
protected string $format
리턴 string

$messages 보호되어 있는 프로퍼티

All of the registered messages.
protected array $messages
리턴 array