Kahlan\Plugin\Double::_generateClassMethods PHP Method

_generateClassMethods() protected static method

Creates method definitions from a class name.
protected static _generateClassMethods ( string $class, boolean $layer = null ) : string
$class string A class name.
$layer boolean If `true`, all public methods are "overriden".
return string The generated methods.
    protected static function _generateClassMethods($class, $layer = null)
    {
        $result = [];
        if (!class_exists($class)) {
            throw new MissingImplementationException("Unexisting class `{$class}`");
        }
        $result = static::_generateAbstractMethods($class);
        if ($layer === false) {
            return $result;
        }
        $reflection = Inspector::inspect($class);
        if (!$layer && !$reflection->isInternal()) {
            return $result;
        }
        $finals = $reflection->getMethods(ReflectionMethod::IS_FINAL);
        $methods = array_diff($reflection->getMethods(ReflectionMethod::IS_PUBLIC), $finals);
        foreach ($methods as $method) {
            $result[$method->getName()] = static::_generateMethod($method, true);
        }
        return $result;
    }