private function canonicalizeFieldValue($fieldname, $fieldvalue)
    {
        switch ($fieldname) {
            case 'email':
                return strtolower(trim($fieldvalue));

            case 'username':
                return strtolower(preg_replace('/[^a-zA-Z0-9_\\-]/', '', $fieldvalue));

            default:
                return trim($fieldvalue);
        }
    }
private function canonicalizeFieldValue($fieldname, $fieldvalue)
    {
        switch ($fieldname) {
            case 'email':
                return strtolower(trim($fieldvalue));

            case 'username':
                return strtolower(preg_replace('/[^a-zA-Z0-9_\\-]/', '', $fieldvalue));

            default:
                return trim($fieldvalue);
        }
    }
private function canonicalizeFieldValue ( $ fieldname , $ fieldvalue ) { switch ( $ fieldname ) { case 'email' : return strtolower ( trim ( $ fieldvalue ) ) ; case 'username' : return strtolower ( preg_replace ( '/[^a-zA-Z0-9_\\-]/' , '' , $ fieldvalue ) ) ; default : return trim ( $ fieldvalue ) ; } }
Create a correctly canonicalized value for a field, depending on its name.

@param string $fieldname
@param string $fieldvalue

@return string
Create a correctly canonicalized value for a field depending on its name .