<?php
/**
 * A class for validating strings against an email regex pattern and
 * minimum/maximum character length constraints.
 */
class validator_email extends validator_string
{
    ////////////////////////////////////////////////////////////////////////////
    // Construct and destruct functions.

    /**
     * @param integer (optional) $minimum The minimum length constraint.
     * @param integer (optional) $maximum The maximum length constraint.
     * @param boolean (optional) $inclusive Whether the minimum/maximum
     * constraint is inclusive or not.
     * @param string (optional) $error The error message.
     * @param boolean (optional) $reverse Whether the validator is in reverse
     * mode or not.
     */
    public function __construct($minimum = null, $maximum = null, $inclusive = true, $error = null, $reverse = false)
    {
        parent::__construct('~^[^@\s][^@]+@[-a-z0-9]+(\.[a-z]+)+$~i', $minimum, $maximum, $inclusive, $error, $reverse);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Overload functions.

    ////////////////////////////////////////////////////////////////////////////
    // Interface functions.

    ////////////////////////////////////////////////////////////////////////////
    // Internal functions.
}
