Overview

Namespaces

  • Jyxo
    • Beholder
      • TestCase
    • Gettext
      • Parser
    • Input
      • Chain
      • Filter
      • Validator
    • Mail
      • Email
        • Attachment
      • Parser
      • Sender
    • Rpc
      • Json
      • Xml
    • Shell
    • Spl
    • Svn
    • Time
    • Webdav
  • PHP

Classes

  • Chain
  • Factory
  • Filter
  • Fluent
  • Upload
  • Validator

Interfaces

  • FilterInterface
  • ValidatorInterface

Exceptions

  • Exception
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated

Class Fluent

Class implementing "fluent" design pattern for \Jyxo\Input.

Allows chaining multiple validators and checking multiple values in one validation cycle.

Namespace: Jyxo\Input
Category: Jyxo
Package: Jyxo\Input
Copyright: Copyright (c) 2005-2011 Jyxo, s.r.o.
License: https://github.com/jyxo/php/blob/master/license.txt
Author: Jakub Tománek
Located at Input/Fluent.php
Methods summary
public
# __construct( )

Constructor.

Constructor.

public Jyxo\Input\Fluent
# check( mixed $var, string $name )

Starts a new value checking.

Starts a new value checking.

Parameters

$var
mixed
Value to check.
$name
string
Variable name

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# all( )

Validates all variables.

Validates all variables.

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# defaultValue( mixed $value )

Sets a default value in case the validation fails.

Sets a default value in case the validation fails.

Parameters

$value
mixed
Default value

Returns

Jyxo\Input\Fluent

Throws

BadMethodCallException
There is no active variable.
public Jyxo\Input\Fluent
# validate( string $name, string $errorMessage = null, mixed $param = null )

Adds a validator to the chain.

Adds a validator to the chain.

Parameters

$name
string
Validator name
$errorMessage
string
Validator error message
$param
mixed
Additional validator parameter

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# filter( string $name, mixed $param = null )

Adds a filter to the chain.s

Adds a filter to the chain.s

Parameters

$name
string
Filter name
$param
mixed
Additional filter parameter

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# walk( boolean $addFilter = true )

Adds a subchain to the current chain that treats the value a an array. Automatically adds the isArray validator.

Adds a subchain to the current chain that treats the value a an array. Automatically adds the isArray validator.

Parameters

$addFilter
boolean
Add the Trim filter (removes empty elements)

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# condition( string $name, mixed $param = null )

Adds a conditional chain.

Adds a conditional chain.

If there are conditions in the current chain, adds the condition as a subchain.

Parameters

$name
string
Validator name
$param
mixed
Additional validator parameter

Returns

Jyxo\Input\Fluent

Throws

BadMethodCallException
There is no active variable
public Jyxo\Input\Fluent
# close( )

Closes a chain.

Closes a chain.

Returns

Jyxo\Input\Fluent
public boolean
# isValid( boolean $assocErrors = false )

Performs validation and filtering of all variables.

Performs validation and filtering of all variables.

Parameters

$assocErrors
boolean
Return error messages in an associative array

Returns

boolean
public
# validateAll( )

Calls isValid(), but throws an exception on error.

Calls isValid(), but throws an exception on error.

The exception contains only the first validation error message.

Throws

Jyxo\Input\Validator\Exception
Validation failed
public array
# getValues( )

Returns all values.

Returns all values.

Returns

array
public mixed
# getValue( string $name )

Returns a value by name.

Returns a value by name.

Parameters

$name
string
Variable name

Returns

mixed

Throws

Jyxo\Input\Exception
No variable with the given name
public array
# getErrors( )

Returns errors.

Returns errors.

Returns

array
public Jyxo\Input\Fluent
# post( string $name, mixed $default = null )

Checks a POST variable.

Checks a POST variable.

Parameters

$name
string
Variable name
$default
mixed
Default value

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# query( string $name, mixed $default = null )

Checks a GET variable.

Checks a GET variable.

Parameters

$name
string
Variable name
$default
mixed
Default value

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# request( string $name, mixed $default = null )

Checks a POST/GET variable

Checks a POST/GET variable

Parameters

$name
string
Variable name
$default
mixed
Default value

Returns

Jyxo\Input\Fluent
public Jyxo\Input\Fluent
# file( string $index )

Checks file upload.

Checks file upload.

Requires \Jyxo\Input\Upload.

Parameters

$index
string
File index

Returns

Jyxo\Input\Fluent

See

Jyxo\Input\Upload
public mixed
# __get( string $offset )

Magic getter for easier retrieving of values.

Magic getter for easier retrieving of values.

Parameters

$offset
string
Value name

Returns

mixed

Throws

Jyxo\Input\Exception
No variable with the given name
Constants summary
string VALIDATORS_PREFIX '\Jyxo\Input\Validator\\'
#

Validator class names prefix.

Validator class names prefix.

string FILTERS_PREFIX '\Jyxo\Input\Filter\\'
#

Filter class names prefix.

Filter class names prefix.

Jyxo PHP Library API documentation generated by ApiGen 2.3.0