Returns an array with a the instance of \ReflectionMethod as first key
and the prefix of the method as second or null if not found.
976570
private function getMutatorMethod(string $class, string $property): ?array
    {
        $ucProperty = ucfirst($property);
        $ucSingulars = (array) Inflector::singularize($ucProperty);

        foreach ($this->mutatorPrefixes as $prefix) {
            $names = [$ucProperty];
            if (\in_array($prefix, $this->arrayMutatorPrefixes)) {
                $names = array_merge($names, $ucSingulars);
            }

            foreach ($names as $name) {
                try {
                    $reflectionMethod = new \ReflectionMethod($class, $prefix.$name);
                    if ($reflectionMethod->isStatic()) {
                        continue;
                    }

                    // Parameter can be optional to allow things like: method(array $foo = null)
                    if ($reflectionMethod->getNumberOfParameters() >= 1) {
                        return [$reflectionMethod, $prefix];
                    }
                } catch (\ReflectionException $e) {
                    // Try the next prefix if the method doesn't exist
                }
            }
        }

        return null;
    }
1141172
private function getMethodCallbacks(ReflectionMethod $method)
    {
        $events = [
            Events::prePersist,
            Events::postPersist,
            Events::preUpdate,
            Events::postUpdate,
            Events::preRemove,
            Events::postRemove,
            Events::postLoad,
            Events::preFlush,
        ];

        return array_filter($events, static function ($eventName) use ($method) {
            return $eventName === $method->getName();
        });
    }
815830
public function getPublicMethods() {
        $reflect = new ReflectionClass($this);
        $publicMethods = $reflect->getMethods(ReflectionMethod::IS_PUBLIC);
        $publicMethods = array_map(
            function ($m) {
                return $m->name;
            },
            $publicMethods
        );
        $publicMethods = array_filter(
            $publicMethods,
            function ($m) {
                $ignoreMethods = array('__construct', 'main', 'getPublicMethods');
                return !in_array($m, $ignoreMethods);
            }
        );
        return $publicMethods;
    }
50136
public Object[] getMetaMethods() {
        MetaClass metaClass = InvokerHelper.getMetaClass(objectUnderInspection);
        List metaMethods = metaClass.getMetaMethods();
        Object[] result = new Object[metaMethods.size()];
        int i = 0;
        for (Iterator iter = metaMethods.iterator(); iter.hasNext(); i++) {
            MetaMethod metaMethod = (MetaMethod) iter.next();
            result[i] = methodInfo(metaMethod);
        }
        return result;
    }
834286
public function listMissingMethod()
    {
        if (!is_null($this->listMissingMethod)) return $this->listMissingMethod;

        $required = $this->listRequiredMethod();
        $missing = array();

        foreach ($required as $methodName => $data) {
            if (!$this->reflection->hasMethod($methodName)) {
                $missing[$methodName] = $data;
            }
        }

        $this->listMissingMethod = $missing;

        return $missing;
    }
1076004
public static function getCachedMethods(): array
    {
        return [
            'getTypePrefix' => true,
            'getType' => true,
            'getFlexDirectory' => true,
            'getCacheKey' => true,
            'getCacheChecksum' => true,
            'getTimestamp' => true,
            'hasProperty' => true,
            'getProperty' => true,
            'hasNestedProperty' => true,
            'getNestedProperty' => true,
            'orderBy' => true,

            'render' => false,
            'isAuthorized' => 'session',
            'search' => true,
            'sort' => true,
        ];
    }
622941
public static function getKey($callable)
    {
        /** @var string|null $class */
        $class = null;
        /** @var string|null $method */
        $method = null;

        if (is_string($callable)) {
            $method = $callable; // works for 'Cls::method' case as well
        } elseif (is_array($callable)) {
            $class = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
            $method = $callable[1];
        } elseif (is_object($callable)) {
            if ($callable instanceof \ReflectionFunctionAbstract) {
                if ($callable->isClosure()) {
                    return null;
                }

                $class = $callable instanceof \ReflectionMethod ? $callable->class : null;
                $method = $callable->name;
            } else {
                if ($callable instanceof \Closure) {
                    return null;
                }

                $class = get_class($callable);
                $method = '__invoke';
            }
        }

        return strtolower(($class ? $class . '::' : '') . $method);
    }
1167985
public function getMethodName()
    {
        if (!empty($this->methodRef)) {
            return substr($this->methodRef, strpos($this->methodRef, ':') + 1);
        }

        return null;
    }
448824
private function getClassPublicMethods(): array
    {
        return \array_filter(\array_map(
            function (\ReflectionMethod $method): string {
                return !$method->isStatic() ? $method->getName() : '';
            },
            (new \ReflectionObject($this))->getMethods(\ReflectionMethod::IS_PUBLIC)
        ));
    }
582063
public function getMethodNameGet()
    {
        $methodName = str_replace(' ', '', ucwords(str_replace(array(
            '_is_', '_has_', '_in_', '_',
        ), ' ', strtolower($this->getName(true)))));

        $type = $this->getType();

        switch (true) {
            case ($type instanceof Type\TypeBool) && stripos($this->getName(), '_has_') !== false:
                $methodPrefix = 'has';
                break;
            case ($type instanceof Type\TypeBool) && stripos($this->getName(), '_is_') !== false:
                $methodPrefix = 'is';
                break;
            case ($type instanceof Type\TypeBool) && stripos($this->getName(), '_in_') !== false:
                $methodPrefix = 'in';
                break;
            default:
                $methodPrefix = 'get';
                break;
        }

        return $methodPrefix . $methodName;
    }
833936
public function getMethodAnnotations(\ReflectionMethod $method)
    {
        return array_merge(
            $this->reader->getMethodAnnotations($method),
            $this->converter->getMethodAnnotations($method)
        );
    }
982136
public function retrieveAllPaymentmethods()
    {
        if (isset($this->_paymentMethodsArray))
            return $this;

        $obj = new stdClass();
        // Must be in specific order for checksum ---------
        $obj->MerchantID = $this->_merchantID;
        $obj->SecretCode = $this->_secretCode;
        $obj->Timestamp = $this->getTimeStamp();
        // ------------------------------------------------
        $obj->Checksum = $this->generateChecksum($obj);
        $obj->SecretCode = null;

        $this->_paymentMethods = $this->client->GetMyPaymentMethods(array('request' => $obj));

        if (isset($this->_paymentMethods->GetMyPaymentMethodsResult->PaymentMethods->PaymentMethod)) {
            $this->_paymentMethodsArray = $this->clean($this->_paymentMethods);
        }

        return $this;
    }
435264
public function getMethodData(ReflectionMethod $method, $prefix)
    {
        $verb = $this->getVerb($name = $method->name);
        $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix));
        return compact('verb', 'plain', 'uri');
    }
817443
protected function _reflectionCache()
    {
        $class = get_class($this);
        if (isset(self::$_reflectionCache[$class])) {
            return self::$_reflectionCache[$class];
        }

        $events = $this->implementedEvents();
        $eventMethods = [];
        foreach ($events as $e => $binding) {
            if (is_array($binding) && isset($binding['callable'])) {
                /* @var string $callable */
                $callable = $binding['callable'];
                $binding = $callable;
            }
            $eventMethods[$binding] = true;
        }

        $baseClass = 'Cake\ORM\Behavior';
        if (isset(self::$_reflectionCache[$baseClass])) {
            $baseMethods = self::$_reflectionCache[$baseClass];
        } else {
            $baseMethods = get_class_methods($baseClass);
            self::$_reflectionCache[$baseClass] = $baseMethods;
        }

        $return = [
            'finders' => [],
            'methods' => []
        ];

        $reflection = new ReflectionClass($class);

        foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
            $methodName = $method->getName();
            if (in_array($methodName, $baseMethods) ||
                isset($eventMethods[$methodName])
            ) {
                continue;
            }

            if (substr($methodName, 0, 4) === 'find') {
                $return['finders'][lcfirst(substr($methodName, 4))] = $methodName;
            } else {
                $return['methods'][$methodName] = $methodName;
            }
        }

        return self::$_reflectionCache[$class] = $return;
    }
943560
public function loadDependenciesByReflectionMethod(ReflectionMethod $reflectionMethod)
    {

        // initialize the array for the dependencies
        $dependencies = array();

        // load the object manager instance
        /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
        $objectManager = $this->getNamingDirectory()->search(
            sprintf('php:global/%s/%s', $this->getApplication()->getUniqueName(), ObjectManagerInterface::IDENTIFIER)
        );

        // iterate over the constructor parameters
        /** @var \AppserverIo\Lang\Reflection\ParameterInterface $reflectionParameter */
        foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
            $dependencies[] = $this->get($objectManager->getPreference($reflectionParameter->getType()));
        }

        // return the initialized dependencies
        return $dependencies;
    }
561785
protected function getMethodCallbacks(\ReflectionMethod $method)
    {
        $callbacks = [];
        $annotations = $this->reader->getMethodAnnotations($method);

        foreach ($annotations as $annotation) {
            if ($annotation instanceof ORM\PrePersist) {
                $callbacks[] = [$method->name, Events::prePersist];
            }

            if ($annotation instanceof ORM\PostPersist) {
                $callbacks[] = [$method->name, Events::postPersist];
            }

            if ($annotation instanceof ORM\PreUpdate) {
                $callbacks[] = [$method->name, Events::preUpdate];
            }

            if ($annotation instanceof ORM\PostUpdate) {
                $callbacks[] = [$method->name, Events::postUpdate];
            }

            if ($annotation instanceof ORM\PreRemove) {
                $callbacks[] = [$method->name, Events::preRemove];
            }

            if ($annotation instanceof ORM\PostRemove) {
                $callbacks[] = [$method->name, Events::postRemove];
            }

            if ($annotation instanceof ORM\PostLoad) {
                $callbacks[] = [$method->name, Events::postLoad];
            }

            if ($annotation instanceof ORM\PreFlush) {
                $callbacks[] = [$method->name, Events::preFlush];
            }
        }

        return $callbacks;
    }
819624
protected function getMethodArgs(\ReflectionMethod $method)
	{
		$methodArgs = array();

		foreach ($method->getParameters() as $param)
		{
			$dependency        = $param->getClass();
			$dependencyVarName = $param->getName();

			// If we have a dependency, that means it has been type-hinted.
			if ($dependency !== null)
			{
				$dependencyClassName = $dependency->getName();

				// If the dependency class name is registered with this container or a parent, use it.
				if ($this->getRaw($dependencyClassName) !== null)
				{
					$depObject = $this->get($dependencyClassName);
				}
				else
				{
					$depObject = $this->buildObject($dependencyClassName);
				}

				if ($depObject instanceof $dependencyClassName)
				{
					$methodArgs[] = $depObject;

					continue;
				}
			}

			// Finally, if there is a default parameter, use it.
			if ($param->isOptional())
			{
				$methodArgs[] = $param->getDefaultValue();

				continue;
			}

			// Couldn't resolve dependency, and no default was provided.
			throw new DependencyResolutionException(sprintf('Could not resolve dependency: %s', $dependencyVarName));
		}

		return $methodArgs;
	}