src/DataCollector/ProxyFactory.php
public function createProxy($class, &$proxyFile = null)
    {
        $proxyClass = $this->getProxyClass($class);
        $class      = '\\'.rtrim($class, '\\');
        $proxyFile  = $this->proxyDirectory.'/'.$proxyClass.'.php';

        if (class_exists($proxyClass)) {
            return $proxyClass;
        }

        if (file_exists($proxyFile)) {
            require $proxyFile;

            return $proxyClass;
        }

        $content = file_get_contents(dirname(__DIR__).'/Resources/proxy/template.php');
        $content = str_replace('__TPL_CLASS__', $proxyClass, $content);
        $content = str_replace('__TPL_EXTENDS__', $class, $content);

        $this->checkProxyDirectory();
        file_put_contents($proxyFile, $content);
        require $proxyFile;

        return $proxyClass;
    }
public function createProxy($class, &$proxyFile = null)
    {
        $proxyClass = $this->getProxyClass($class);
        $class      = '\\'.rtrim($class, '\\');
        $proxyFile  = $this->proxyDirectory.'/'.$proxyClass.'.php';

        if (class_exists($proxyClass)) {
            return $proxyClass;
        }

        if (file_exists($proxyFile)) {
            require $proxyFile;

            return $proxyClass;
        }

        $content = file_get_contents(dirname(__DIR__).'/Resources/proxy/template.php');
        $content = str_replace('__TPL_CLASS__', $proxyClass, $content);
        $content = str_replace('__TPL_EXTENDS__', $class, $content);

        $this->checkProxyDirectory();
        file_put_contents($proxyFile, $content);
        require $proxyFile;

        return $proxyClass;
    }
public function createProxy ( $ class , & $ proxyFile = null ) { $ proxyClass = $ this -> getProxyClass ( $ class ) ; $ class = '\\' . rtrim ( $ class , '\\' ) ; $ proxyFile = $ this -> proxyDirectory . '/' . $ proxyClass . '.php' ; if ( class_exists ( $ proxyClass ) ) { return $ proxyClass ; } if ( file_exists ( $ proxyFile ) ) { require $ proxyFile ; return $ proxyClass ; } $ content = file_get_contents ( dirname ( __DIR__ ) . '/Resources/proxy/template.php' ) ; $ content = str_replace ( '__TPL_CLASS__' , $ proxyClass , $ content ) ; $ content = str_replace ( '__TPL_EXTENDS__' , $ class , $ content ) ; $ this -> checkProxyDirectory ( ) ; file_put_contents ( $ proxyFile , $ content ) ; require $ proxyFile ; return $ proxyClass ; }
Create a proxy that handles data collecting better.

@param string $class
@param string &$proxyFile where we store the proxy class

@return string the name of a much much better class
Create a proxy that handles data collecting better .