private function saveProxyToCache(ReflectionClass $class, string $childCode): string
    {
        static $cacheDirSuffix = '/_proxies/';

        $cacheDir          = $this->cachePathManager->getCacheDir() . $cacheDirSuffix;
        $relativePath      = str_replace($this->options['appDir'] . DIRECTORY_SEPARATOR, '', $class->getFileName());
        $proxyRelativePath = str_replace('\\', '/', $relativePath . '/' . $class->getName() . '.php');
        $proxyFileName     = $cacheDir . $proxyRelativePath;
        $dirname           = dirname($proxyFileName);
        if (!file_exists($dirname)) {
            mkdir($dirname, $this->options['cacheFileMode'], true);
        }

        $body = '<?php' . PHP_EOL . $childCode;

        $isVirtualSystem = strpos($proxyFileName, 'vfs') === 0;
        file_put_contents($proxyFileName, $body, $isVirtualSystem ? 0 : LOCK_EX);
        // For cache files we don't want executable bits by default
        chmod($proxyFileName, $this->options['cacheFileMode'] & (~0111));

        return 'include_once AOP_CACHE_DIR . ' . var_export($cacheDirSuffix . $proxyRelativePath, true) . ';';
    }
private function saveProxyToCache(ReflectionClass $class, string $childCode): string
    {
        static $cacheDirSuffix = '/_proxies/';

        $cacheDir          = $this->cachePathManager->getCacheDir() . $cacheDirSuffix;
        $relativePath      = str_replace($this->options['appDir'] . DIRECTORY_SEPARATOR, '', $class->getFileName());
        $proxyRelativePath = str_replace('\\', '/', $relativePath . '/' . $class->getName() . '.php');
        $proxyFileName     = $cacheDir . $proxyRelativePath;
        $dirname           = dirname($proxyFileName);
        if (!file_exists($dirname)) {
            mkdir($dirname, $this->options['cacheFileMode'], true);
        }

        $body = '<?php' . PHP_EOL . $childCode;

        $isVirtualSystem = strpos($proxyFileName, 'vfs') === 0;
        file_put_contents($proxyFileName, $body, $isVirtualSystem ? 0 : LOCK_EX);
        // For cache files we don't want executable bits by default
        chmod($proxyFileName, $this->options['cacheFileMode'] & (~0111));

        return 'include_once AOP_CACHE_DIR . ' . var_export($cacheDirSuffix . $proxyRelativePath, true) . ';';
    }
private function saveProxyToCache ( ReflectionClass $ class , string $ childCode ) : string { static $ cacheDirSuffix = '/_proxies/' ; $ cacheDir = $ this -> cachePathManager -> getCacheDir ( ) . $ cacheDirSuffix ; $ relativePath = str_replace ( $ this -> options [ 'appDir' ] . DIRECTORY_SEPARATOR , '' , $ class -> getFileName ( ) ) ; $ proxyRelativePath = str_replace ( '\\' , '/' , $ relativePath . '/' . $ class -> getName ( ) . '.php' ) ; $ proxyFileName = $ cacheDir . $ proxyRelativePath ; $ dirname = dirname ( $ proxyFileName ) ; if ( ! file_exists ( $ dirname ) ) { mkdir ( $ dirname , $ this -> options [ 'cacheFileMode' ] , true ) ; } $ body = '<?php' . PHP_EOL . $ childCode ; $ isVirtualSystem = strpos ( $ proxyFileName , 'vfs' ) === 0 ; file_put_contents ( $ proxyFileName , $ body , $ isVirtualSystem ? 0 : LOCK_EX ) ; // For cache files we don't want executable bits by default chmod ( $ proxyFileName , $ this -> options [ 'cacheFileMode' ] & ( ~ 0111 ) ) ; return 'include_once AOP_CACHE_DIR . ' . var_export ( $ cacheDirSuffix . $ proxyRelativePath , true ) . ';' ; }
Save AOP proxy to the separate file anr returns the php source code for inclusion
Save AOP proxy to the separate file anr returns the php source code for inclusion