PHP Class App\Libraries\Str

Inheritance: extends Illuminate\Support\Str
Show file Open project: sroutier/laravel-5.1-enterprise-starter-kit Class Usage Examples

Public Methods

Method Description
head ( $value, integer $limit = 100, string $end = '...' ) : string Returns the input string shrunk to the limit size, by cutting in the end (tail).
head_and_tail ( $value, integer $limit = 100, string $mid = '...' ) : string Returns the input string shrunk to the limit size, by cutting in the middle.
isBoolean ( $str ) : boolean Evaluate the input string and returns true if it can be converted to a boolean.
isNullOrEmptyString ( $question ) : boolean Return true if the trim'ed value is unset, null or empty.
tail ( $value, integer $limit = 100, string $start = '...' ) : string Returns the input string shrunk to the limit size, by cutting in the start (head).
toBoolean ( $str ) : boolean Converts the input string to it's boolean representation.

Method Details

head() public static method

The start (head) of a string will be returned with an ellipsis after it where the text is cut.
public static head ( $value, integer $limit = 100, string $end = '...' ) : string
$value
$limit integer
$end string
return string

head_and_tail() public static method

The start (head) and end (tail) of a string will be returned with an ellipsis between them where the text is cut.
public static head_and_tail ( $value, integer $limit = 100, string $mid = '...' ) : string
$value
$limit integer
$mid string
return string

isBoolean() public static method

Evaluate the input string and returns true if it can be converted to a boolean.
public static isBoolean ( $str ) : boolean
$str
return boolean

isNullOrEmptyString() public static method

Modification from: http://stackoverflow.com/a/381275 Author: Michael Haren (http://stackoverflow.com/users/29/michael-haren)
public static isNullOrEmptyString ( $question ) : boolean
$question
return boolean

tail() public static method

The end (tail) of a string will be returned with an ellipsis before it where the text is cut.
public static tail ( $value, integer $limit = 100, string $start = '...' ) : string
$value
$limit integer
$start string
return string

toBoolean() public static method

Converts the input string to it's boolean representation.
public static toBoolean ( $str ) : boolean
$str
return boolean