public static function create(FormField $field, $submittedData)
    {
        switch ($field->getType()) {
            case 'email':
                $object = new SpecialEmailValidator($field, $submittedData);
                break;
            default:
                throw FormFieldException::noSuchType($field->getType());
                break;
        }

        return $object;
    }
public static function create(FormField $field, $submittedData)
    {
        switch ($field->getType()) {
            case 'email':
                $object = new SpecialEmailValidator($field, $submittedData);
                break;
            default:
                throw FormFieldException::noSuchType($field->getType());
                break;
        }

        return $object;
    }
public static function create ( FormField $ field , $ submittedData ) { switch ( $ field -> getType ( ) ) { case 'email' : $ object = new SpecialEmailValidator ( $ field , $ submittedData ) ; break ; default : throw FormFieldException :: noSuchType ( $ field -> getType ( ) ) ; break ; } return $ object ; }
Factory method to create an appropriate type

@param  FormField     $field
@param  $submittedData
@return SpecialEmailValidator
@throws FormFieldException
Factory method to create an appropriate type