Class

Dat0r\Runtime\Field\Field

abstract class Field implements IField

Base class that all Dat0r IField implementations should extend.

Provides a pretty complete implementation for the IField interface.

basic options: 'validator', 'valueholder', 'defaultvalue', 'mandatory'

Methods

static IField create(string $name, array $options = array())

Creates a new field instance.

__construct(string $name, array $options = array())

Constructs a new field instance.

string getName()

Returns the name of the field.

array getOptions()

Returns the field's options.

mixed getOption(string $name, mixed $default = null)

Returns a field option by name if it exists.

boolean hasOption(string $name)

Tells if a field currently owns a specific option.

IValueHolder getDefaultValue()

Returns the default value of the field.

mixed getNullValue()

Returns a field's null value.

string getValidator()

IValueHolder createValueHolder()

Creates a IValueHolder instance dedicated to the current field instance.

Details

at line 49
static public IField create(string $name, array $options = array())

Creates a new field instance.

Parameters

string $name
array $options

Return Value

IField

at line 60
public __construct(string $name, array $options = array())

Constructs a new field instance.

Parameters

string $name
array $options

at line 71
public string getName()

Returns the name of the field.

Return Value

string

at line 81
public array getOptions()

Returns the field's options.

Return Value

array

at line 95
public mixed getOption(string $name, mixed $default = null)

Returns a field option by name if it exists.

Otherwise an optional default is returned.

Parameters

string $name
mixed $default

Return Value

mixed

at line 107
public boolean hasOption(string $name)

Tells if a field currently owns a specific option.

Parameters

string $name

Return Value

boolean

at line 117
public IValueHolder getDefaultValue()

Returns the default value of the field.

Return Value

IValueHolder

at line 127
public mixed getNullValue()

Returns a field's null value.

Return Value

mixed

at line 138
public string getValidator()

Return Value

string Fully qualified name of an IValidator implementation.

at line 176
public IValueHolder createValueHolder()

Creates a IValueHolder instance dedicated to the current field instance.

Return Value

IValueHolder