Creates method definitions from a class name.

@param  string  $class A class name.
@param  integer $mask  The method mask to filter.
@return array          The generated methods.
165499
protected static function _generateAbstractMethods($class)
    {
        $result = [];
        if (!class_exists($class)) {
            throw new MissingImplementationException("Unexisting parent class `{$class}`");
        }
        $reflection = Inspector::inspect($class);
        $methods = $reflection->getMethods(ReflectionMethod::IS_ABSTRACT);
        foreach ($methods as $method) {
            $result[$method->getName()] = static::_generateMethod($method);
        }
        return $result;
    }
77499
private function generateMethods(ClassMetadata $class)
    {
        $methods           = '';
        $methodNames       = [];
        $reflectionMethods = $class->getReflectionClass()->getMethods(\ReflectionMethod::IS_PUBLIC);
        $skippedMethods    = [
            '__sleep'   => true,
            '__clone'   => true,
            '__wakeup'  => true,
            '__get'     => true,
            '__set'     => true,
            '__isset'   => true,
        ];

        foreach ($reflectionMethods as $method) {
            $name = $method->getName();

            if ($method->isConstructor() ||
                isset($skippedMethods[strtolower($name)]) ||
                isset($methodNames[$name]) ||
                $method->isFinal() ||
                $method->isStatic() ||
                ( ! $method->isPublic())
            ) {
                continue;
            }

            $methodNames[$name] = true;
            $methods           .= "\n    /**\n"
                . "     * {@inheritDoc}\n"
                . "     */\n"
                . '    public function ';

            if ($method->returnsReference()) {
                $methods .= '&';
            }

            $methods .= $name . '(' . $this->buildParametersString($method->getParameters()) . ')';
            $methods .= $this->getMethodReturnType($method);
            $methods .= "\n" . '    {' . "\n";

            if ($this->isShortIdentifierGetter($method, $class)) {
                $identifier = lcfirst(substr($name, 3));
                $fieldType  = $class->getTypeOfField($identifier);
                $cast       = in_array($fieldType, ['integer', 'smallint']) ? '(int) ' : '';

                $methods .= '        if ($this->__isInitialized__ === false) {' . "\n";
                $methods .= '            ';
                $methods .= $this->shouldProxiedMethodReturn($method) ? 'return ' : '';
                $methods .= $cast . ' parent::' . $method->getName() . "();\n";
                $methods .= '        }' . "\n\n";
            }

            $invokeParamsString = implode(', ', $this->getParameterNamesForInvoke($method->getParameters()));
            $callParamsString   = implode(', ', $this->getParameterNamesForParentCall($method->getParameters()));

            $methods .= "\n        \$this->__initializer__ "
                . "&& \$this->__initializer__->__invoke(\$this, " . var_export($name, true)
                . ", [" . $invokeParamsString . "]);"
                . "\n\n        "
                . ($this->shouldProxiedMethodReturn($method) ? 'return ' : '')
                . "parent::" . $name . '(' . $callParamsString . ');'
                . "\n" . '    }' . "\n";
        }

        return $methods;
    }
173886
public function methods($object)
    {
        $methods = (new ReflectionClass($object))->getMethods(ReflectionMethod::IS_PUBLIC);

        $iterator = function(ReflectionMethod $method)
        {
            return $method->getName();
        };

        return array_map($iterator, $methods);
    }
1331258
private function createMethodRule(string $class, string $method): RuleInterface
    {
        $rule = (new Rule())
            ->setName($method)
            ->setTarget($this->target(RequestProperties::REQ_ACTION, $method))
            ->setEffect(new Logical([$class, $method]))
            ->setName("$class::$method");

        return $rule;
    }
1023681
protected function classMethod(&$class = NULL, &$method = NULL, $command)
    {
        $commandEx = explode(':', $command);
        $class     = $commandEx[0];
        $method    = $commandEx[1] ?? NULL;
    }
456168
public function all(string $class=""): \ArrayIterator
    {
        return new \ArrayIterator(
            array_merge(
                $this->in($class)->getArrayCopy(), 
                $this->out($class)->getArrayCopy()
            )
        );
    }
743807
protected function getReflectionMethod($class, $method)
    {
        if (!isset($this->methodReflectors[$class])) {
            $this->methodReflectors[$class] = [];
        }
        if (!isset($this->methodReflectors[$class][$method])) {
            $this->methodReflectors[$class][$method] = new \ReflectionMethod($class, $method);
        }

        return $this->methodReflectors[$class][$method];
    }
458972
private function call_filter_callback( $class, $method, $args ) {
		$result = empty( $args ) ? null : reset( $args );
		$app    = $this->get_target_app( $class );
		if ( empty( $app ) ) {
			return $result;
		}

		if ( $app->is_filter_callable( $method ) ) {
			return $app->filter_callback( $method, $args );
		}

		return $result;
	}
1328490
protected function findOrCreateMethod(Class_ $class, $name)
    {
        $foundMethods = array_filter(
            $class->getMethods(),
            function (ClassMethod $method) use ($name) {
                return $name === $method->name;
            }
        );

        $method = reset($foundMethods);

        if (!$method) {
            $class->stmts[] = $method = new ClassMethod($name);
        }

        return $method;
    }
1052529
private function readDocBlockCallees($class, ReflectionMethod $method, $docBlock)
    {
        $callees = array();
        $description = $this->readDescription($docBlock);
        $docBlock = $this->mergeMultilines($docBlock);

        foreach (explode("\n", $docBlock) as $docLine) {
            $docLine = preg_replace(self::DOCLINE_TRIMMER_REGEX, '', $docLine);

            if ($this->isEmpty($docLine)) {
                continue;
            }

            if ($this->isNotAnnotation($docLine)) {
                continue;
            }

            if ($callee = $this->readDocLineCallee($class, $method, $docLine, $description)) {
                $callees[] = $callee;
            }
        }

        return $callees;
    }
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;
    }
1300925
private static function getMethods($methods, $class): array
    {
        $methods[] = \array_fill_keys(\get_class_methods($class), 0);
        $parent = \get_parent_class($class);
        if ($parent) {
            \array_merge($methods, self::getMethods($methods, $parent));
        }
        return $methods[0];
    }
825499
protected function parseClassEvent( $class, $prefix )
	{
		if ( Str::contains( $class, '@' ) )
			return explode( '@', $class );

		$method = Str::contains( $prefix, 'composing' ) ? 'compose' : 'create';

		return [$class, $method];
	}
625361
public function allMethodNames($custom = false)
    {
        $class = static::class;
        if (!isset(self::$built_in_methods[$class])) {
            self::$built_in_methods[$class] = array_map('strtolower', get_class_methods($this));
        }

        if ($custom && isset(self::$extra_methods[$class])) {
            return array_merge(self::$built_in_methods[$class], array_keys(self::$extra_methods[$class]));
        } else {
            return self::$built_in_methods[$class];
        }
    }
134412
public function getSpecificSubclassMapping(string $class): self
    {
        if ($this->class->getClassName() === $class) {
            return $this;
        }

        if (!is_subclass_of($class, $this->class->getClassName(), true)) {
            throw InvalidArgumentException::format(
                'Invalid class supplied to %s: must be a subclass of %s, %s given',
                __METHOD__, $this->class->getClassName(), $class
            );
        }

        foreach ($this->subClassMappings as $mapping) {
            if (is_subclass_of($class, $mapping->getDefinition()->getClassName(), true)) {
                return $mapping->getDefinition()->getSpecificSubclassMapping($class);
            }
        }

        throw InvalidArgumentException::format(
            'Invalid class supplied to %s: cannot find mapping for %s',
            __METHOD__, $class
        );
    }
655766
private function generateArgumentsMap(
        $class,
        string $method = '__construct',
        array $predefined = []
    ) : array {
        $arguments = [];
        $refMethod = new \ReflectionMethod($class, $method);

        /* @var $parameter \ReflectionParameter */
        foreach ($refMethod->getParameters() as $parameter) {
            $arg = [
                'value'   => null,
                'isClass' => false,
            ];

            if (isset($predefined[$parameter->getName()])) {
                //Get a predefined parameter
                $arg['value'] = $predefined[$parameter->getName()];
            } elseif ($parameter->isDefaultValueAvailable()) {
                //Parameter has a default value, just pass it
                $arg['value'] = $parameter->getDefaultValue();
            } elseif ($parameter->hasType()) {
                /* @var $pClass \ReflectionClass */
                $pClass = $parameter->getClass();

                //Only possible to pass get classes
                if (is_null($pClass)) {
                    $pName = $parameter->getName();

                    throw new \Exception("Parameter '$pName' is not a class");
                }

                $arg['value'] = $pClass->getName();
                $arg['isClass'] = true;
            } else {
                throw new \Exception('Could not define a value');
            }

            $arguments[] = $arg;
        }

        return $arguments;
    }
924185
protected function createDefinition(string $class): Definition
    {
        $path = $this->basePath . DIRECTORY_SEPARATOR . str_replace('\\', '.', $class) . '.yml';

        if (! is_file($path)) {
            throw new DefinitionNotFoundException($class);
        }

        $config = $this->readConfig($path);
        $definition = new Definition($class);

        foreach ($this->processors as $processor)
        {
            $processor->process($config, $definition);
        }

        return $definition;
    }