This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.

28 lines
733 B
PHP
Raw Normal View History

2010-11-30 09:41:08 +11:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Array and variable validation.
*
2013-03-20 09:35:19 +11:00
* @package OSB
* @category Modifications
2010-11-30 09:41:08 +11:00
* @author Deon George
2013-03-20 09:35:19 +11:00
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
2010-11-30 09:41:08 +11:00
*/
2012-11-10 10:13:57 +11:00
abstract class Valid extends Kohana_Valid {
2010-11-30 09:41:08 +11:00
/**
* Checks if a field matches the value of another field, if it is set.
* Field is ignored if it is blank.
*
2011-05-14 17:35:33 +10:00
* @param array array of values
* @param string field name
2010-11-30 09:41:08 +11:00
* @param string field name to match
* @return boolean
*/
2011-05-14 17:35:33 +10:00
public static function matches_ifset($array, $field, $match)
2012-08-01 22:43:33 +10:00
{
2011-05-14 17:35:33 +10:00
return isset($array[$match]) ? ($array[$field] === $array[$match]) : TRUE;
2010-11-30 09:41:08 +11:00
}
}
?>