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

Class: Formagic_Rule_Abstract

Source Location: /Rule/Abstract.php

Class Overview


FormagicRule abstract superclass


Author(s):

  • Florian Sonnenburg

Version:

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

Copyright:

  • Copyright (c) 2007-2009 Florian Sonnenburg

Variables

Methods


Child classes:

Formagic_Rule_ItemDependency
Checks if dependencies between given items are matched
Formagic_Rule_RangeComparsion_Abstract
Abstract implementation of range comparsion rules
Formagic_Rule_Regex
Checks if value is given
Formagic_Rule_Equal
Checks if value is given
Formagic_Rule_Mandatory
Checks if value is given
Formagic_Rule_Numeric
Checks if value is numeric
Formagic_Rule_Email
Email rule checks if a valid email address is entered.

Class Details

[line 31]
FormagicRule abstract superclass



Tags:

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


[ Top ]


Class Variables

$_message =  'Please enter a valid value'

[line 37]

Message string



Tags:

access:  protected

Type:   string


[ Top ]

$_name =

[line 43]

Rule type identifier.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 53]

Formagic_Rule_Abstract __construct( [ $arguments = array()])

Constructor

The default error message that is displayed if the rule is violated can be overwritten by $errorMessage.




Tags:

access:  public


Parameters:

array   $arguments   The rule options.

[ Top ]

method getMessage [line 97]

string getMessage( )

Returns translated error message of rule



Tags:

return:  Message string
access:  public


[ Top ]

method getName [line 109]

string getName( )

Returns rule type identification string.



Tags:

return:  The rule name
access:  public


[ Top ]

method setMessage [line 86]

Formagic_Rule_Abstract setMessage( mixed $message)

Sets the error message property.

Usually a rule will have one error message string that is used if the validation fails. If neccessary, Formagic_Rule_Abstract::_errorMessage can hold other variables, eg. an array of error messages for different outcomes of the validation process.

Implements a fluent interface pattern.




Tags:

return:  object.
see:  Formagic_Rule_Abstract::__construct()
access:  public


Overridden in child classes as:

Formagic_Rule_RangeComparsion_Abstract::setMessage()
setMessage not supported by range comparison rules.

Parameters:

mixed   $message   The error message value.

[ Top ]

method validate [line 125]

boolean validate( string $value)

Abstract of main validate method. Returns boolean value of check success.

Subclasses have to implement their behavior here.




Tags:

return:  The rule check result
abstract:  
access:  public


Overridden in child classes as:

Formagic_Rule_ItemDependency::validate()
Performs rule check
Formagic_Rule_RangeComparsion_Abstract::validate()
Performs rule check
Formagic_Rule_Regex::validate()
Regex validation
Formagic_Rule_Equal::validate()
Performs rule check
Formagic_Rule_Mandatory::validate()
Performs rule check
Formagic_Rule_Numeric::validate()
Performs rule check
Formagic_Rule_Email::validate()
Performs rule check

Parameters:

string   $value   The value to be validated.

[ Top ]

method _init [line 68]

void _init( $arguments)

Allows subclass initialization.



Tags:

access:  protected


Overridden in child classes as:

Formagic_Rule_ItemDependency::_init()
Defines dependent items and validate condition.
Formagic_Rule_RangeComparsion_Abstract::_init()
Allows subclass initialization.
Formagic_Rule_Regex::_init()
Allows subclass initialization.
Formagic_Rule_Equal::_init()
Allow subclass initialization.
Formagic_Rule_Email::_init()
Initializes email rule.

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