Bolt\Users::checkAvailability PHP Method

checkAvailability() public method

Depending on the field type, different pre-massaging of the compared values are applied, because what constitutes 'equal' for the purpose of this filtering depends on the field type.
public checkAvailability ( string $fieldname, string $value, integer $currentid ) : boolean
$fieldname string
$value string
$currentid integer
return boolean
    public function checkAvailability($fieldname, $value, $currentid = 0)
    {
        foreach ($this->users as $user) {
            if ($this->canonicalizeFieldValue($fieldname, $user[$fieldname]) === $this->canonicalizeFieldValue($fieldname, $value) && $user['id'] != $currentid) {
                return false;
            }
        }
        // no clashes found, OK!
        return true;
    }