Determine if the given class method allows guests.

@param  string  $class
@param  string  $method
@return bool
979201
protected function methodAllowsGuests($class, $method)
    {
        try {
            $reflection = new ReflectionClass($class);

            $method = $reflection->getMethod($method);
        } catch (Exception $e) {
            return false;
        }

        if ($method) {
            $parameters = $method->getParameters();

            return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]);
        }

        return false;
    }
1064203
protected function isCallable($arg, $method = null)
    {
        if (is_callable($arg) || is_callable([$arg, $method]) || $this->isClass($arg)) {
            return true;
        }

        return false;
    }
1363535
public function methodIsCallable($method)
    {
        return ! $this->methodIsBlacklisted($method) &&
            method_exists($this, $method) &&
            ! method_exists(ModelFilter::class, $method);
    }
68970
public function hasClassProperty($class)
    {
        if (! is_array($class)) {
            $class = func_get_args();
        }

        if (isset($this->htmlAttributes['class']) && is_array($this->htmlAttributes['class'])) {
            foreach ($this->htmlAttributes['class'] as $i => $string) {
                foreach ($class as $className) {
                    if (strpos($string, $className) !== false) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
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;
    }
1058417
public function hasImplementedEvent($method)
    {
        $method = new \ReflectionMethod($this, $method);
        $declaringClass = $method->getDeclaringClass();

        return 0 === strpos($declaringClass->name, 'Piwik\Plugins');
    }
304071
public function containsClass($class)
    {
        $class = is_object($class) ? get_class($class) : $class;
        foreach ($this->candidates as $candidate) {
            if ($candidate instanceof $class) {
                return true;
            }
        }

        return false;
    }
950575
public function isAllowed($url, $method = 'all')
    {
        $url = trim($url, '/');
        foreach ($this->rules as list($_method, $rule)) {
            if (($method == 'all' || strtolower($method) == strtolower($_method)) && preg_match($rule, $url, $matches)) {
                return true;
            }
        }
        return false;
    }
181271
private function guess($class, $property, $method)
    {
        if (!$this->translatableManager->isTranslatable($class)) {
            return null;
        }

        $firstGuess = $this->genericTypeGuesser->$method($class, $property);

        if (!$firstGuess instanceof Guess) {
            return null;
        }

        $secondGuess = $this->genericTypeGuesser->$method($this->translatableManager->getTranslationClass($class), $property);

        if (!$secondGuess instanceof Guess) {
            return null;
        }

        return $firstGuess->getConfidence() > $secondGuess->getConfidence() ? $firstGuess : $secondGuess;
    }
1216212
public static function hasMethod(string $method, $objectOrClass): bool
    {
        try {
            $reflectionClass = self::getReflectionClass($objectOrClass);
            return $reflectionClass->hasMethod($method);
        } catch (Exception $e) {
            return false;
        }
    }
801950
private function isMethodReadable(\ReflectionMethod $method)
    {
        // if method starts with _ - skip
        if ('_' === substr($method->getName(), 0, 1)) {
            return false;
        }

        $hasNoRouteMethod = (bool) $this->readMethodAnnotation($method, 'NoRoute');
        $hasNoRouteClass = (bool) $this->readClassAnnotation($method->getDeclaringClass(), 'NoRoute');

        $hasNoRoute = $hasNoRouteMethod || $hasNoRouteClass;
        // since NoRoute extends Route we need to exclude all the method NoRoute annotations
        $hasRoute = (bool) $this->readMethodAnnotation($method, 'Route') && !$hasNoRouteMethod;

        // if method has NoRoute annotation and does not have Route annotation - skip
        if ($hasNoRoute && !$hasRoute) {
            return false;
        }

        return true;
    }
923028
protected function hasMethod($method, ClassMetadataInfo $metadata)
    {
        if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) {
            // don't generate method if its already on the base class.
            $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name);

            if ($reflClass->hasMethod($method)) {
                return true;
            }
        }

        // check traits for existing method
        foreach ($this->getTraits($metadata) as $trait) {
            if ($trait->hasMethod($method)) {
                return true;
            }
        }

        return (
            isset($this->staticReflection[$metadata->name]) &&
            in_array(strtolower($method), $this->staticReflection[$metadata->name]['methods'])
        );
    }
345694
public function clear($class, $method)
    {
        // we know which one we're clearing
        if ($method) {
            $this->redis->del($class.':'.$method);

            return true;
        } else {
            // they want to clear the whole class so we have to get a method list
            $methods = $this->redis->hkeys('method_list:'.$class);

            // delete the method from the list of cached methods and clear the cache items
            $this->redis->pipeline(function($pipe) use ($class, $methods) {

                $pipe->del('method_list:'.$class);

                foreach ($methods as $method) {
                    $pipe->del($class.':'.$method);
                }
            });

            return true;
        }
    }
487112
private function safeMethod (&$target,string $method) {
		if (method_exists($target, $method)) {
			$target->$method();
			return true;
		}
		else {
			return false;
		}
	}
934491
public static function findFieldClass($method)
    {
        // If alias exists.
        if (isset(static::$fieldAlias[$method])) {
            $method = static::$fieldAlias[$method];
        }

        $class = Arr::get(static::$availableFields, $method);

        if (class_exists($class)) {
            return $class;
        }

        return false;
    }
1096262
public static function isMethod($method = null) {
		return isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) == strtolower(trim($method)) : false;
	}
1372792
public function isValidMethod($method)
    {
        $reflection = $this->getReflection()->getMethod($method);

        return ! $reflection->isAbstract()
                && $reflection->isPublic()
                && preg_match($this->methodRule, $method) > 0;
    }