Rule
[ class tree: Rule ] [ index: Rule ] [ all elements ]

Class: Formagic_Rule_RangeComparsion_Abstract

Source Location: /Rule/RangeComparison/Abstract.php

Class Overview

Formagic_Rule_Abstract
   |
   --Formagic_Rule_RangeComparsion_Abstract

Abstract implementation of range comparsion rules


Author(s):

  • Florian Sonnenburg

Version:

  • $Id: Abstract.php 126 2011-05-18 18:41:58Z meweasle $

Copyright:

  • Copyright (c) 2007-2011 Florian Sonnenburg

Variables

Methods


Child classes:

Formagic_Rule_StringLength
Checks if value is between min and max length
Formagic_Rule_NumericRange
Checks if value is between min and max length

Inherited Variables

Inherited Methods

Class: Formagic_Rule_Abstract

Formagic_Rule_Abstract::__construct()
Constructor
Formagic_Rule_Abstract::getMessage()
Returns translated error message of rule
Formagic_Rule_Abstract::getName()
Returns rule type identification string.
Formagic_Rule_Abstract::setMessage()
Sets the error message property.
Formagic_Rule_Abstract::validate()
Abstract of main validate method. Returns boolean value of check success.
Formagic_Rule_Abstract::_init()
Allows subclass initialization.

Class Details

[line 38]
Abstract implementation of range comparsion rules



Tags:

author:  Florian Sonnenburg
version:  $Id: Abstract.php 126 2011-05-18 18:41:58Z meweasle $
copyright:  Copyright (c) 2007-2011 Florian Sonnenburg
abstract:  


[ Top ]


Class Variables

$_max =

[line 50]

The maximal length



Tags:

access:  protected

Type:   integer


[ Top ]

$_messages = array(
        'min'     => '',
        'max'     => '',
        'between' => ''
    )

[line 56]

Array of messages



Tags:

access:  protected

Type:   array


[ Top ]

$_min =

[line 44]

The minimal length



Tags:

access:  protected

Type:   integer


[ Top ]



Class Methods


method setMessage [line 98]

void setMessage( type $message)

setMessage not supported by range comparison rules.



Tags:

throws:  Formagic_Exception
access:  public


Overrides Formagic_Rule_Abstract::setMessage() (Sets the error message property.)

Parameters:

type   $message  

[ Top ]

method setMessages [line 109]

Formagic_Rule_RangeComparsion_Abstract setMessages( $messages)

Sets messages array



Tags:

access:  public


Parameters:

array   $messages   Array of messages

[ Top ]

method validate [line 137]

boolean validate( string $value)

Performs rule check

Length rule checks if value is between min and max length. The validation method depends on $this->_type.




Tags:

return:  The validation result
access:  public


Overrides Formagic_Rule_Abstract::validate() (Abstract of main validate method. Returns boolean value of check success.)

Parameters:

string   $value   The item to checked

[ Top ]

method _execBetween [line 197]

type _execBetween( type $range)



Tags:

access:  protected


Parameters:

type   $range  

[ Top ]

method _execMax [line 165]

type _execMax( type $range)



Tags:

access:  protected


Parameters:

type   $range  

[ Top ]

method _execMin [line 181]

type _execMin( type $range)



Tags:

access:  protected


Parameters:

type   $range  

[ Top ]

method _getMessage [line 214]

string _getMessage( string $key)

Returns a translates message string.



Tags:

return:  Translated filled message
access:  protected


Parameters:

string   $key   Message type

[ Top ]

method _getRange [line 126]

mixed _getRange( string $value)

Returns range check value.



Tags:

return:  Check range value
abstract:  
access:  protected


Overridden in child classes as:

Formagic_Rule_StringLength::_getRange()
Returns range check value.
Formagic_Rule_NumericRange::_getRange()
Returns value as integer.

Parameters:

string   $value   Item value

[ Top ]

method _init [line 76]

void _init( $arguments)

Allows subclass initialization.

Allowed options for this rule are:

  • (integer)min: Minimal length to be checked (optional, defaults to 0)
  • (integer)max: Maximal length to be checked (optional, defaults to 0)

Will throw an exception, if neither "min" nor "max" option provided.




Tags:

access:  protected


Overrides Formagic_Rule_Abstract::_init() (Allows subclass initialization.)

Parameters:

array   $arguments   Array of arguments passed to __construct()

[ Top ]


Documentation generated on Sun, 22 May 2011 22:40:03 +0200 by phpDocumentor 1.4.3