PHP Class Gajus\Dora\Input

Datei anzeigen Open project: gajus/dora

Public Methods

Method Description
__construct ( string $name, array $attributes = null, array $properties = null, null | string $template = null )
__toString ( )
deriveName ( $name_path ) : string Convert array selector representation (['baz', 'foo_bar']) to English friendly representation (Bar Foo Bar).
getAttribute ( $name ) : null | string If [id] is undefined at the time of request, Dora will use instance UID.
getNamePath ( ) : array Parse input[name] into an array reprensentation.
getProperty ( string $name ) : mixed
getUid ( )
getValue ( ) : mixed
setProperty ( string $name, mixed $value ) : mixed
toString ( )

Private Methods

Method Description
setAttribute ( string $name, string $value ) Type checking ommission is intentional. PHP does not provide scalar data type hinting. Non-scallar variables will thrown an error when cast to string. Manual validation is an unnecessary overhead.
stringifyAttributes ( ) Generate string representation of the input attributes.

Method Details

__construct() public method

public __construct ( string $name, array $attributes = null, array $properties = null, null | string $template = null )
$name string Input name.
$attributes array HTML attributes.
$properties array Input properties, e.g. input name.
$template null | string

__toString() public method

public __toString ( )

deriveName() public static method

If selector name is ends with "_id", then Id is dropped off the name.
public static deriveName ( $name_path ) : string
return string

getAttribute() public method

If [id] is undefined at the time of request, Dora will use instance UID.
public getAttribute ( $name ) : null | string
return null | string Attribute value.

getNamePath() public method

Parse input[name] into an array reprensentation.
public getNamePath ( ) : array
return array [name="a[b][c][]"] is represented ['a', 'b', 'c'].

getProperty() public method

public getProperty ( string $name ) : mixed
$name string Name of the property.
return mixed

getUid() public method

public getUid ( )

getValue() public method

public getValue ( ) : mixed
return mixed

setProperty() public method

public setProperty ( string $name, mixed $value ) : mixed
$name string Name of the property.
$value mixed
return mixed

toString() public method

public toString ( )