PHP Interface Xtreamwayz\HTMLFormValidator\FormFactoryInterface

Show file Open project: xtreamwayz/html-form-validator

Public Methods

Method Description
__construct ( string $htmlForm, Zend\InputFilter\Factory $factory = null, array $defaultValues = [] ) FormFactory constructor: Load html form and optionally set an InputFilter
asString ( Xtreamwayz\HTMLFormValidator\ValidationResultInterface $result = null ) : string Return form as a string. Optionally inject the error messages for the result.
fromHtml ( string $htmlForm, array $defaultValues = [] ) : Xtreamwayz\HTMLFormValidator\FormFactoryInterface Load html form and optionally set default data
validate ( array $data, null | string $method = null ) : Xtreamwayz\HTMLFormValidator\ValidationResultInterface Validate the loaded form with the data
validateRequest ( Psr\Http\Message\ServerRequestInterface $request ) : Xtreamwayz\HTMLFormValidator\ValidationResultInterface

Method Details

__construct() public method

FormFactory constructor: Load html form and optionally set an InputFilter
public __construct ( string $htmlForm, Zend\InputFilter\Factory $factory = null, array $defaultValues = [] )
$htmlForm string
$factory Zend\InputFilter\Factory
$defaultValues array

asString() public method

Return form as a string. Optionally inject the error messages for the result.
public asString ( Xtreamwayz\HTMLFormValidator\ValidationResultInterface $result = null ) : string
$result Xtreamwayz\HTMLFormValidator\ValidationResultInterface
return string

fromHtml() public static method

Load html form and optionally set default data
public static fromHtml ( string $htmlForm, array $defaultValues = [] ) : Xtreamwayz\HTMLFormValidator\FormFactoryInterface
$htmlForm string
$defaultValues array
return Xtreamwayz\HTMLFormValidator\FormFactoryInterface

validate() public method

Validate the loaded form with the data
public validate ( array $data, null | string $method = null ) : Xtreamwayz\HTMLFormValidator\ValidationResultInterface
$data array the submitted data to be validated
$method null | string the request method (POST, GET, etc.)
return Xtreamwayz\HTMLFormValidator\ValidationResultInterface

validateRequest() public method

public validateRequest ( Psr\Http\Message\ServerRequestInterface $request ) : Xtreamwayz\HTMLFormValidator\ValidationResultInterface
$request Psr\Http\Message\ServerRequestInterface
return Xtreamwayz\HTMLFormValidator\ValidationResultInterface