src/lapistano/ProxyObject/ProxyBuilder.php
public function getProxy()
    {
        include_once(__DIR__ . '/Generator.php');

        $proxyClass = Generator::generate(
            $this->className, $this->methods, $this->properties, $this->proxyClassName, $this->autoload
        );

        $classname = $proxyClass['proxyClassName'];

        if (!empty($proxyClass['namespaceName'])) {
            $classname = $proxyClass['namespaceName'] . '\\' . $proxyClass['proxyClassName'];
        }

        if (!class_exists($classname, false)) {
            eval($proxyClass['code']);
        }

        if ($this->invokeOriginalConstructor && !interface_exists($this->className, $this->autoload)) {

            if (empty($this->constructorArgs)) {
                return new $classname();
            }

            $proxy = new \ReflectionClass($classname);

            return $proxy->newInstanceArgs($this->constructorArgs);
        }

        return $this->getInstanceOf($classname);
    }
public function getProxy()
    {
        include_once(__DIR__ . '/Generator.php');

        $proxyClass = Generator::generate(
            $this->className, $this->methods, $this->properties, $this->proxyClassName, $this->autoload
        );

        $classname = $proxyClass['proxyClassName'];

        if (!empty($proxyClass['namespaceName'])) {
            $classname = $proxyClass['namespaceName'] . '\\' . $proxyClass['proxyClassName'];
        }

        if (!class_exists($classname, false)) {
            eval($proxyClass['code']);
        }

        if ($this->invokeOriginalConstructor && !interface_exists($this->className, $this->autoload)) {

            if (empty($this->constructorArgs)) {
                return new $classname();
            }

            $proxy = new \ReflectionClass($classname);

            return $proxy->newInstanceArgs($this->constructorArgs);
        }

        return $this->getInstanceOf($classname);
    }
Creates a proxy object using a fluent interface.

@return object Instance of the proxied class exposing the configured attributes and methods.