src/lapistano/ProxyObject/Generator.php
protected static function getProxiedMethods($fullClassName, \ReflectionClass $class, array $methods = null)
    {
        $proxyMethods = array();
        $proxiedMethods = '';
        $templateDir = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR;

        if (is_array($methods) && count($methods) > 0) {

            foreach ($methods as $methodName) {

                if ($class->hasMethod($methodName)) {

                    $method = $class->getMethod($methodName);

                    if (self::canProxyMethod($method)) {
                        $proxyMethods[] = $method;
                        continue;
                    }

                    throw new GeneratorException(
                        sprintf('Can not proxy method "%s" of class "%s".', $methodName, $fullClassName),
                        GeneratorException::CANNOT_PROXY_METHOD
                    );
                }

                throw new GeneratorException(
                    sprintf('Class "%s" has no protected method "%s".', $fullClassName, $methodName),
                    GeneratorException::NO_PROTECTED_METHOD_DEFINED
                );
            }
        } else {

            $proxyMethods = self::canProxyMethods($class->getMethods(\ReflectionMethod::IS_PROTECTED));

            if (empty($proxyMethods ) && self::$exposeProperties === false) {
                throw new GeneratorException(
                    sprintf('Class "%s" has no protected methods.', $fullClassName),
                    GeneratorException::NO_PROTECTED_METHOD_DEFINED
                );
            }
        }

        foreach ($proxyMethods as $method) {
            $proxiedMethods .= self::generateProxiedMethodDefinition($templateDir, $method);
        }

        return $proxiedMethods;
    }
protected static function getProxiedMethods($fullClassName, \ReflectionClass $class, array $methods = null)
    {
        $proxyMethods = array();
        $proxiedMethods = '';
        $templateDir = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR;

        if (is_array($methods) && count($methods) > 0) {

            foreach ($methods as $methodName) {

                if ($class->hasMethod($methodName)) {

                    $method = $class->getMethod($methodName);

                    if (self::canProxyMethod($method)) {
                        $proxyMethods[] = $method;
                        continue;
                    }

                    throw new GeneratorException(
                        sprintf('Can not proxy method "%s" of class "%s".', $methodName, $fullClassName),
                        GeneratorException::CANNOT_PROXY_METHOD
                    );
                }

                throw new GeneratorException(
                    sprintf('Class "%s" has no protected method "%s".', $fullClassName, $methodName),
                    GeneratorException::NO_PROTECTED_METHOD_DEFINED
                );
            }
        } else {

            $proxyMethods = self::canProxyMethods($class->getMethods(\ReflectionMethod::IS_PROTECTED));

            if (empty($proxyMethods ) && self::$exposeProperties === false) {
                throw new GeneratorException(
                    sprintf('Class "%s" has no protected methods.', $fullClassName),
                    GeneratorException::NO_PROTECTED_METHOD_DEFINED
                );
            }
        }

        foreach ($proxyMethods as $method) {
            $proxiedMethods .= self::generateProxiedMethodDefinition($templateDir, $method);
        }

        return $proxiedMethods;
    }
Generate string representing the set of methods to be reflected.

@param array            $fullClassName
@param \ReflectionClass $class
@param array            $methods

@return array Information about the method to be proxied.

@throws GeneratorException