PHP Class Gajus\Dora\Input

Afficher le fichier Open project: gajus/dora

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

public __toString ( )

deriveName() public static méthode

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

getAttribute() public méthode

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

getNamePath() public méthode

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

getProperty() public méthode

public getProperty ( string $name ) : mixed
$name string Name of the property.
Résultat mixed

getUid() public méthode

public getUid ( )

getValue() public méthode

public getValue ( ) : mixed
Résultat mixed

setProperty() public méthode

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

toString() public méthode

public toString ( )