PHP Class Webiny\Component\StdLib\StdObject\StdObjectWrapper

This class is used when we need to return a standard object, but none of the current available standard objects fit the role.
Inheritance: extends AbstractStdObject, use trait Webiny\Component\StdLib\ValidatorTrait
Show file Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$value

Public Methods

Method Description
__construct ( mixed $value ) Constructor.
__toString ( ) : mixed To string implementation.
isArrayObject ( mixed $var ) : boolean Check if $var is an instance of ArrayObject.
isDateTimeObject ( mixed $var ) : boolean Check if $var is an instance of DateTimeObject.
isFileObject ( mixed $var ) : boolean Check if $var is an instance of FileObject.
isStringObject ( mixed $var ) : boolean Check if $var is an instance of StringObject.
isUrlObject ( mixed $var ) : boolean Check if $var is an instance of UrlObject.
returnStdObject ( mixed &$var ) : ArrayObject | StdObjectWrapper | StringObject This function make sure you are returning a standard object.
toArray ( mixed $var ) : array Returns an array based on given $var.
toBool ( mixed $var ) : boolean Returns a bool value based on whatever value passed in.
These values are considered TRUE: '1', 'true', 'on', 'yes', 'y'
toString ( mixed $var ) : string Returns a string based on given $var.

Method Details

__construct() public method

Set standard object value.
public __construct ( mixed $value )
$value mixed

__toString() public method

To string implementation.
public __toString ( ) : mixed
return mixed

isArrayObject() public static method

Check if $var is an instance of ArrayObject.
public static isArrayObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean

isDateTimeObject() public static method

Check if $var is an instance of DateTimeObject.
public static isDateTimeObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean

isFileObject() public static method

Check if $var is an instance of FileObject.
public static isFileObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean

isStringObject() public static method

Check if $var is an instance of StringObject.
public static isStringObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean

isUrlObject() public static method

Check if $var is an instance of UrlObject.
public static isUrlObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean

returnStdObject() public static method

This function make sure you are returning a standard object.
public static returnStdObject ( mixed &$var ) : ArrayObject | StdObjectWrapper | StringObject
$var mixed
return Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | StdObjectWrapper | StringObject

toArray() public static method

This function checks if $var is an array, ArrayObject or something else. This function tries to cast the element to array and return it.
public static toArray ( mixed $var ) : array
$var mixed
return array

toBool() public static method

Returns a bool value based on whatever value passed in.
These values are considered TRUE: '1', 'true', 'on', 'yes', 'y'
public static toBool ( mixed $var ) : boolean
$var mixed
return boolean

toString() public static method

This function checks if $var is a string, StringObject or something else. In the end a string is returned.
public static toString ( mixed $var ) : string
$var mixed
return string

Property Details

$value protected property

protected $value