Safe method call, if the name doesn't match, won't throw an error
487112
private function safeMethod (&$target,string $method) {
		if (method_exists($target, $method)) {
			$target->$method();
			return true;
		}
		else {
			return false;
		}
	}
229913
def is_valid_name_error(name: str, node: Node = None) -> Optional[GraphQLError]:
    """"""
    if not isinstance(name, str):
        raise TypeError("Expected string")
    if name.startswith("__"):
        return GraphQLError(
            f"Name {name!r} must not begin with '__',"
            " which is reserved by GraphQL introspection.",
            node,
        )
    if not re_name.match(name):
        return GraphQLError(
            f"Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but {name!r} does not.", node
        )
    return None
715479
function( name, actual, expected ) {
		return this.ok( name, actual === expected, this.equal, "\nValues should match\nActual:" + actual + "\nExpected:" + expected );
	}
291035
public static void validateSimonName(String name) {
		if (!checkName(name)) {
			throw new SimonException("Simon name must match following pattern: '" + SimonUtils.NAME_PATTERN.pattern() + "', used name: " + name);
		}
	}
1086952
function( name, actual, expected ) {
		var self = this, passed = true;

		try {
			self._objectMatch( actual, expected );
			passed = false;
		}
		catch ( e ) {
		}
		
		return self.ok( name, passed, self.notDeepEqual, 'Objects are not supposed to match' );
	}
495681
def check_match(self, name):
        
        return any(pattern.match(name) for pattern in self.patterns)
910161
def fix_return_value(v, method_name, method=None, checker=None):
    
    # remove common check prefix
    method_name = (method_name or method.__func__.__name__).replace("check_","")
    if v is None or not isinstance(v, Result):
        v = Result(value=v, name=method_name)

    v.name         = v.name or method_name

    v.checker      = checker
    v.check_method = method

    return v
1242966
def _errcheck(result, func, arguments):
    

    if result != 0:
        raise XdoException(
            'Function {0} returned error code {1}'
            .format(func.__name__, result))
    return None
10444
private void validateName(String name) throws DDFException {
    Boolean isNameExisted;
    try {
      this.getManager().getDDFByName(name);
      isNameExisted = true;
    } catch (DDFException e) {
      isNameExisted = false;
    }
    if(isNameExisted) {
      throw new DDFException(String.format("DDF with name %s already exists", name));
    }

    Pattern p = Pattern.compile("^[a-zA-Z0-9_-]*$");
    Matcher m = p.matcher(name);
    if(!m.find()) {
      throw new DDFException(String.format("Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, " +
          "numbers 0-9) and dash (\"-\") and underscore (\"_\")", name));
    }
  }
935742
def match_value_by_name(expected_type, actual_value):
        
        if expected_type == None:
            return True
        if actual_value == None:
            raise Exception("Actual value cannot be null")

        return TypeMatcher.match_type_by_name(expected_type, type(actual_value))
3002
def check(self, obj, value, errors):
        
        fieldname = "%s.%s" % (type(obj).__name__, self._name)

        if value is None:
            if not self._null:
                errors.append("%s may not be 'null'" % fieldname)

            # If None, just leave. The rest of checks don't make any sense.
            return

        for has_error in [self._has_wrong_type, self._has_wrong_length,
                          self._is_not_one_of, self._has_subproblems]:
            if has_error(fieldname, value, errors):
                break
51600
private static Name checkNotReserved(Name name, String action) {
    if (isReserved(name)) {
      throw new IllegalArgumentException("cannot " + action + ": " + name);
    }
    return name;
  }
874218
def method_name_exist(self, meth_name):
        

        methods = self.current_class.get_methods()
        for m in methods:
            if m.name == meth_name:
                return True
        return False
522303
public static void checkNotEmpty(final String name,
                                     final Map<?, ?> parameter) {
        if (parameter == null || parameter.size() == 0) {
            throw new IllegalArgumentException("Parameter named '" + name + "' should be filled!");
        }
    }
1033456
public void expectExactMatch(String name, String anotherName) {
        expectExactMatch(name, anotherName, messages.get(Validation.EXACT_MATCH_KEY.name(), name, anotherName));
    }
908223
static void throwExceptionWhenMultipleMethodMatchesFound(String helpInfo, Method[] methods) {
        if (methods == null || methods.length < 2) {
            throw new IllegalArgumentException(
                                                      "Internal error: throwExceptionWhenMultipleMethodMatchesFound needs at least two methods.");
        }
        StringBuilder sb = new StringBuilder();
        sb.append("Several matching methods found, please specify the ");
        sb.append(helpInfo);
        sb.append(" so that PowerMock can determine which method you're referring to.\n");
        sb.append("Matching methods in class ").append(methods[0].getDeclaringClass().getName()).append(" were:\n");

        for (Method method : methods) {
            sb.append(method.getReturnType().getName()).append(" ");
            sb.append(method.getName()).append("( ");
            final Class<?>[] parameterTypes = method.getParameterTypes();
            for (Class<?> paramType : parameterTypes) {
                sb.append(paramType.getName()).append(".class ");
            }
            sb.append(")\n");
        }
        throw new TooManyMethodsFoundException(sb.toString());
    }
1349251
public void expectMatch(String name, String anotherName, String message) {
        String value = Optional.ofNullable(get(name)).orElse("");
        String anotherValue = Optional.ofNullable(get(anotherName)).orElse("");

        if (( StringUtils.isBlank(value) && StringUtils.isBlank(anotherValue) ) || ( StringUtils.isNotBlank(value) && !value.equalsIgnoreCase(anotherValue)  )) {
            addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_KEY.name(), name, anotherName)));
        } 
    }