Returns whether or not the method is allowed.

@param string|null $method

@return bool
426168
protected function isMethodAllowed(?string $method)
    {
        if ($this->isAllMethodsAllowed()) {
            return true;
        }

        return in_array(strtoupper($method), $this->allowMethods);
    }
882180
public static function validMethod($data, $method)
    {
        $valid = false;
        if (strstr($data, '|')) {
            foreach (explode('|', $data) as $value) {
                $valid = self::checkMethods($value, $method);
                if ($valid) {
                    break;
                }
            }
        } else {
            $valid = self::checkMethods($data, $method);
        }

        return $valid;
    }
67937
public function isMethodAllowed(string $method): bool
    {
        if (\in_array($method, $this->methods, true)) {
            return true;
        }

        if ($method === HttpMethod::HEAD) {
            return \in_array(HttpMethod::GET, $this->methods, true);
        }

        return false;
    }
1197654
private function checkMethodExist(string $method):int
    {
        if (in_array($method, $this->methodsReq)) {
            return (1);
        } else {
            new Server500(new \ArrayObject(array("explain" => "Unknown method $method for Allowed method request",
                "solution" => "Allowed methods request must be ".json_encode($this->methodsReq))));
        }
        return (0);
    }
254220
public static function isAlwaysAllowed(string $method): bool
    {
        return in_array($method, [self::HEAD, self::GET]);
    }
224885
public function isMethod($methods)
    {
        if (is_array($methods)) {
            return in_array($this->getMethod(), $methods);
        }

        if (is_string($methods)) {
            return ($this->getMethod() == $methods);
        }

        return false;
    }
118837
public function isSupportedMethod($method) {
        if (!is_string($method)) throw new IllegalTypeException('Illegal type of parameter $method: '.gettype($method));
        return isset($this->methods[strtoupper($method)]);
    }
481650
public function check( $method = NULL ){
		$method			= $this->method;
		if( $method && $this->validateMethod( $method ) )
			$method		= $method;
		$currentStatus	= $this->status;
		switch( $method ){
			case self::METHOD_SOCKET:
				$this->checkUsingSocket();
				break;
			case self::METHOD_PING:
				$this->checkUsingSystemPing();
				break;
		}
		if( $this->status !== $currentStatus ){
			if( $this->callbackOnChange ){
				call_user_func_array( $this->callbackOnChange, array( $this->status ) );
			}
		}
	}
829678
public function isMethodFailure(): bool
    {
        if ($this->isSuccess() || $this->allowedMethods === self::HTTP_METHOD_ANY) {
            return false;
        }

        return true;
    }
404772
public function satisfies(string $method = null, string $expectedPath = null): bool
    {
        return $this->methodEquals($method) && $this->satisfiesPath($expectedPath);
    }
1314820
private static function methodNotRestricted($method, $callingMethod = null)
    {
        $method = self::getCalledMethod($method);

        $methodVisibility = self::getModifiers(get_called_class(), $method);

        if ($callingMethod) {
            $message = "$method method called from $callingMethod is restricted by hooky options";
        } else {
            $message = "$method method is restricted by hooky options";
        }

        if (self::$hookableMethods && ! in_array($method, self::$hookableMethods)) {
            throw new \BadMethodCallException($message);
        }

        // check if this is an interface method
        if (($methodVisibility & Constants::ABSTRACT_ONLY)
            && ($abstractBitExcluded = $methodVisibility ^ Constants::ABSTRACT_ONLY)
            && $abstractBitExcluded & self::$defaultAccessibility) {
            return true;
        } elseif ((self::$defaultAccessibility & Constants::ABSTRACT_ONLY)) {
            $message = "$method method called from $callingMethod is restricted by hooky options. Must be implemented "
                ."from an interface or abstract method.";

            throw new \BadMethodCallException($message);
        }

        if ($methodVisibility & self::$defaultAccessibility) {
            return true;
        }

        throw new \BadMethodCallException($message);
    }
1127867
protected function validateMethod($method)
    {
        if (null === $method) {
            return;
        }

        if (!is_string($method)) {
            throw new InvalidArgumentException('HTTP method must be a string.');
        }

        if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
            throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s"', $method));
        }
    }
676134
protected function allowedCache($method)
    {
        $cacheEnabled = config('repository.cache.enabled', true);

        if (!$cacheEnabled) {
            return false;
        }

        $cacheOnly = isset($this->cacheOnly) ? $this->cacheOnly : config('repository.cache.allowed.only', null);
        $cacheExcept = isset($this->cacheExcept) ? $this->cacheExcept : config('repository.cache.allowed.except', null);

        if (is_array($cacheOnly)) {
            return in_array($method, $cacheOnly);
        }

        if (is_array($cacheExcept)) {
            return !in_array($method, $cacheExcept);
        }

        if (is_null($cacheOnly) && is_null($cacheExcept)) {
            return true;
        }

        return false;
    }
798465
protected function _isMethodExists($method)
    {
        $return = method_exists($this, $method);
        if ($return) {
            ## it must be exists also be public accessible
            $ref    = $this->_newReflection();
            $ref    = $ref->getMethod($method);
            $return = $return && $ref->isPublic();
        }

        $ignored = $this->doWhichMethodIgnored();
        return $return && !in_array($method, $ignored);
    }
494035
final public function hasMethod($method)
    {
        if (!Str::is($method)
            || !Str::match($method, "/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/")
        ) {
            throw new \InvalidArgumentException(
                "The \$method parameter must be a string and follow the PHP rules of method naming."
            );
        }

        return method_exists($this, $method);
    }
598351
final public function get($method = null) {

        if ( empty($method) ) {

            $return = $this->rpc_methods;

        } else if ( array_key_exists($method, $this->rpc_methods) ) {

            $return = $this->rpc_methods[$method];

        } else {

            $return = null;

        }

        return $return;

    }
1242693
public function disallowMethod($class, $method = null)
    {
        if (is_array($class)) {
            foreach ($class as $elem) {
                unset($this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])]);
            }
        } else {
            unset($this->allowedMethods[strtolower($class)][strtolower($method)]);
        }
    }