PHP Class JBZoo\Utils\Filter

Exibir arquivo Open project: jbzoo/utils Class Usage Examples

Public Methods

Method Description
_ ( mixed $value, string | Closure $filters = 'raw' ) : mixed Apply custom filter to variable
alias ( $string ) : mixed Get safe string
alpha ( $value ) : mixed Return only alpha chars
alphanum ( $value ) : mixed Return only alpha and digits chars
arr ( mixed $value, string | Closure $filter = null ) : string Cleanup array
base64 ( $value ) : string Return only chars for base64
bool ( string $string ) : boolean Converts many english words that equate to true or false to boolean.
className ( $input ) : string Convert words to PHP Class name
clean ( $string ) : string
cmd ( array $value ) : string Cleanup system command
data ( array | Data $data ) : Data
digits ( $value ) : mixed Return only digits chars
email ( $email ) : mixed Validate email
esc ( $string ) : string
float ( string $value, integer $round = 10 ) : float
html ( $string ) : string
int ( string $value ) : integer Smart convert any string to int
low ( $string ) : string String to lower and trim
parseLines ( $input ) : string Parse lines to assoc list
path ( $value ) : string Rmove whitespaces
raw ( $string ) : mixed RAW placeholder
strip ( $string ) : mixed Get safe string
stripQuotes ( string $value ) : string Strip quotes.
stripSpace ( $string ) : string Strip spaces
trim ( $value ) : string Remove whitespaces
trimExtend ( $value ) : string Remove whitespaces
ucfirst ( $input ) : string First char to upper, other to lower
up ( $string ) : string String to upper and trim
xml ( $string ) : string

Method Details

_() public static method

Apply custom filter to variable
public static _ ( mixed $value, string | Closure $filters = 'raw' ) : mixed
$value mixed
$filters string | Closure
return mixed

alias() public static method

Get safe string
public static alias ( $string ) : mixed
$string
return mixed

alpha() public static method

Return only alpha chars
public static alpha ( $value ) : mixed
$value
return mixed

alphanum() public static method

Return only alpha and digits chars
public static alphanum ( $value ) : mixed
$value
return mixed

arr() public static method

Cleanup array
public static arr ( mixed $value, string | Closure $filter = null ) : string
$value mixed
$filter string | Closure
return string

base64() public static method

Return only chars for base64
public static base64 ( $value ) : string
$value
return string

bool() public static method

Converts many english words that equate to true or false to boolean.
public static bool ( string $string ) : boolean
$string string The string to convert to boolean
return boolean

className() public static method

Convert words to PHP Class name
public static className ( $input ) : string
$input
return string

clean() public static method

public static clean ( $string ) : string
$string
return string

cmd() public static method

Cleanup system command
public static cmd ( array $value ) : string
$value array
return string

data() public static method

public static data ( array | Data $data ) : Data
$data array | JBZoo\Data\Data
return JBZoo\Data\Data

digits() public static method

Return only digits chars
public static digits ( $value ) : mixed
$value
return mixed

email() public static method

Validate email
Deprecation: See JBZoo\Utils\Email
public static email ( $email ) : mixed
$email
return mixed

esc() public static method

public static esc ( $string ) : string
$string
return string

float() public static method

public static float ( string $value, integer $round = 10 ) : float
$value string
$round integer
return float

html() public static method

public static html ( $string ) : string
$string
return string

int() public static method

Smart convert any string to int
public static int ( string $value ) : integer
$value string
return integer

low() public static method

String to lower and trim
public static low ( $string ) : string
$string
return string

parseLines() public static method

Parse lines to assoc list
public static parseLines ( $input ) : string
$input
return string

path() public static method

Rmove whitespaces
public static path ( $value ) : string
$value
return string

raw() public static method

RAW placeholder
public static raw ( $string ) : mixed
$string
return mixed

strip() public static method

Get safe string
public static strip ( $string ) : mixed
$string
return mixed

stripQuotes() public static method

Strip quotes.
public static stripQuotes ( string $value ) : string
$value string
return string

stripSpace() public static method

Strip spaces
public static stripSpace ( $string ) : string
$string
return string

trim() public static method

Remove whitespaces
public static trim ( $value ) : string
$value
return string

trimExtend() public static method

Remove whitespaces
public static trimExtend ( $value ) : string
$value
return string

ucfirst() public static method

First char to upper, other to lower
public static ucfirst ( $input ) : string
$input
return string

up() public static method

String to upper and trim
public static up ( $string ) : string
$string
return string

xml() public static method

public static xml ( $string ) : string
$string
return string