for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package Fuel\Validation
* @version 2.0
* @author Fuel Development Team
* @license MIT License
* @copyright 2010 - 2013 Fuel Development Team
* @link http://fuelphp.com
*/
namespace Fuel\Validation\Rule;
use Fuel\Validation\AbstractRule;
* Validates that a field is a valid IP address. Returns true for both IPv4 and v6.
*
* @package Fuel\Validation\Rule
* @since 2.0
class Mac extends AbstractRule
{
* Contains the rule failure message
* @var string
protected $message = 'The field is not a valid MAC address.';
* Returns true if the given value is a valid MAC address
* @param mixed $value Value to validate
* @param string $field Unused by this rule
* @param array $allFields Unused by this rule
* @return bool
public function validate($value, $field = null, $allFields = null)
return (preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $value) == 1);
}