PHP Class Venturecraft\Revisionable\FieldFormatter

Mostra file Open project: venturecraft/revisionable Class Usage Examples

Public Methods

Method Description
boolean ( $value, array $options = null ) : string Boolean.
datetime ( string $value, string $format = 'Y-m-d H:i:s' ) : formatted Format the datetime
format ( $key, $value, $formats ) : string Format the value according to the provided formats.
isEmpty ( $value, array $options = [] ) : string Check if a field is empty.
string ( $value, $format = null ) : formatted Format the string response, default is to just return the string.

Method Details

boolean() public static method

Boolean.
public static boolean ( $value, array $options = null ) : string
$value
$options array The false / true values to return
return string Formatted version of the boolean field

datetime() public static method

Format the datetime
public static datetime ( string $value, string $format = 'Y-m-d H:i:s' ) : formatted
$value string
$format string
return formatted datetime

format() public static method

Format the value according to the provided formats.
public static format ( $key, $value, $formats ) : string
$key
$value
$formats
return string formatted value

isEmpty() public static method

Check if a field is empty.
public static isEmpty ( $value, array $options = [] ) : string
$value
$options array
return string

string() public static method

Format the string response, default is to just return the string.
public static string ( $value, $format = null ) : formatted
$value
$format
return formatted string