Overview

Namespaces

  • Nethgui
    • Adapter
    • Authorization
    • Component
    • Controller
      • Collection
      • Table
    • Exception
    • Log
    • Model
    • Module
      • Help
      • Notification
    • Renderer
    • Serializer
    • System
    • Test
      • Tool
      • Unit
        • Nethgui
          • Adapter
            • ParameterSet
          • Authorization
          • Log
          • Module
            • Notification
          • Renderer
          • Serializer
          • System
          • Utility
          • View
        • Test
          • Tool
    • Utility
    • View
    • Widget
      • Xhtml
  • None
  • Test
    • Tool

Classes

  • AlwaysFailValidator
  • CallbackValidator
  • NethPlatform
  • Process
  • SessionDatabase
  • Validator

Interfaces

  • DatabaseInterface
  • MandatoryValidatorInterface
  • PlatformConsumerInterface
  • PlatformInterface
  • ProcessInterface
  • ValidatorInterface
  • Overview
  • Namespace
  • Class
  • Deprecated

Class Validator

Check a list of conditions that must be satisfied.

Nethgui\System\Validator implements Nethgui\System\MandatoryValidatorInterface
Namespace: Nethgui\System
Author: Davide Principi davide.principi@nethesis.it
Located at System/Validator.php
Methods summary
public
# __construct( Nethgui\System\PlatformInterface $platform )
public Nethgui\System\Validator
# orValidator( Nethgui\System\ValidatorInterface $v1, Nethgui\System\ValidatorInterface $v2 )

Parameters

$v1
$v2

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# memberOf( )

If the first and only argument is an array checks if current value is in that array.

If the first and only argument is an array checks if current value is in that array.

Otherwise you can pass arbitrary arguments. It will be checked if the current value matches any of them.

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# regexp( string $e, string $meaning = 'valid_regexp' )

Parameters

$e
A PHP preg_match compatible regular expression
$meaning
The error message template

Returns

Nethgui\System\Validator

See

preg_match
public Nethgui\System\Validator
# notEmpty( )

Checks if current value is not empty

Checks if current value is not empty

Returns

Nethgui\System\Validator

See

PHP empty
public Nethgui\System\Validator
# isEmpty( )

Checks if current value is empty

Checks if current value is empty

Returns

Nethgui\System\Validator

See

PHP empty
public Nethgui\System\Validator
# forceResult( boolean $result )

Force the evaluation result

Force the evaluation result

Parameters

$result
status

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# ipV4Address( )

Check if the given value is a valid IPv4 address

Check if the given value is a valid IPv4 address

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# hostname( integer $minDots = 0, integer $maxDots = PHP_INT_MAX )

Check if the given value is a valid host name

Check if the given value is a valid host name

Parameters

$minDots
Default 0
$maxDots
Default PHP_INT_MAX

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# ipV6Address( )

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# ipV4Netmask( )

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# macAddress( )

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# ipV6Netmask( )

Returns

Nethgui\System\Validator
public
# integer( )
public
# positive( )
public
# negative( )
public
# lessThan( $cmp )
public
# greatThan( $cmp )
public
# equalTo( $cmp )
public
# minLength( $length )
public
# maxLength( $length )
public Nethgui\System\Validator
# not( )

Invert the evaluation result for the next rule.

Invert the evaluation result for the next rule.

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# username( )

Check if the value is a valid Unix user name

Check if the value is a valid Unix user name

Returns

Nethgui\System\Validator
public
# date( $format = NULL )

Valid date

Valid date

Default format is given by the current user language settings.

See

513


public
# time( )

Valid time 24-hours format HH:MM(:SS)?

Valid time 24-hours format HH:MM(:SS)?

See

513


public Nethgui\System\Validator
# collectionValidator( Nethgui\System\Validator $v )

Check if the value is collection of elements satisfying the given validator

Check if the value is collection of elements satisfying the given validator

Parameters

$v
Member validator

Returns

Nethgui\System\Validator
public Nethgui\System\Validator
# platform( type $validatorName )

Invoke an external validation script

Invoke an external validation script

Parameters

$validatorName

Returns

Nethgui\System\Validator

Throws

InvalidArgumentException
public Nethgui\System\Validator
# email( )

The restricted mail address validator

The restricted mail address validator

Returns

Nethgui\System\Validator

See

1249


public
# cidrBlock( )
public array
# getFailureInfo( )

Tells why validation failed

Tells why validation failed

If evaluate() returns FALSE the validator object must return an explanation of the problem as an array of arrays.

Returns

array
An array of arrays of two elements: a template string and an array of arguments, to invoke strtr().

See

Nethgui\System\Validator::evaluate()

Api

Implementation of

Nethgui\System\ValidatorInterface::getFailureInfo()
public boolean
# evaluate( mixed $value )

Test if $value is accepted by this validator.

Test if $value is accepted by this validator.

Parameters

$value

Returns

boolean

Api

Implementation of

Nethgui\System\ValidatorInterface::evaluate()
protected
# mergeFailureInfo( Nethgui\System\ValidatorInterface $validator )
protected
# addFailureInfo( $template, $args = array() )
protected
# setMandatoryConditional( $value )
public boolean
# isMandatory( )

Tell if an empty value is NOT allowed.

Tell if an empty value is NOT allowed.

Returns

boolean
FALSE if empty is allowed, TRUE otherwise.

Api

Implementation of

Nethgui\System\MandatoryValidatorInterface::isMandatory()
Nethgui Framework API documentation generated by ApiGen