src/Proxy/Generator/ProxyFileGenerator.php
public function generate(): string
    {
        $namespace = $this->reflectionClass->getNamespaceName();
        $fileDirectory = \rtrim($this->directory, '/') . '/Proxy/' . \str_replace('\\', '/', $namespace);
        $fileName = $this->reflectionClass->getShortName() . 'Proxy.php';
        $filePath = $fileDirectory . '/' . $fileName;

        if (!\is_dir($fileDirectory)) {
            // Try create directory
            if (false === @\mkdir($fileDirectory, 0777, true)) {
                throw new \RuntimeException(sprintf(
                    'Could not create directory "%s" for proxy file. Maybe not rights?',
                    $fileDirectory
                ));
            }
        } else if (!\is_writable($fileDirectory)) {
            throw new \RuntimeException(sprintf(
                'Cannot write to "%s" directory for save proxy file.',
                $fileDirectory
            ));
        }

        // Create file
        if (false === @\touch($filePath)) {
            throw new \RuntimeException(sprintf(
                'Could not create file "%s" for proxy class. Maybe not rights?',
                $filePath
            ));
        }

        \file_put_contents($filePath, $this->codeGenerator->generate());

        return $filePath;
    }
public function generate(): string
    {
        $namespace = $this->reflectionClass->getNamespaceName();
        $fileDirectory = \rtrim($this->directory, '/') . '/Proxy/' . \str_replace('\\', '/', $namespace);
        $fileName = $this->reflectionClass->getShortName() . 'Proxy.php';
        $filePath = $fileDirectory . '/' . $fileName;

        if (!\is_dir($fileDirectory)) {
            // Try create directory
            if (false === @\mkdir($fileDirectory, 0777, true)) {
                throw new \RuntimeException(sprintf(
                    'Could not create directory "%s" for proxy file. Maybe not rights?',
                    $fileDirectory
                ));
            }
        } else if (!\is_writable($fileDirectory)) {
            throw new \RuntimeException(sprintf(
                'Cannot write to "%s" directory for save proxy file.',
                $fileDirectory
            ));
        }

        // Create file
        if (false === @\touch($filePath)) {
            throw new \RuntimeException(sprintf(
                'Could not create file "%s" for proxy class. Maybe not rights?',
                $filePath
            ));
        }

        \file_put_contents($filePath, $this->codeGenerator->generate());

        return $filePath;
    }
public function generate ( ) : string { $ namespace = $ this -> reflectionClass -> getNamespaceName ( ) ; $ fileDirectory = \ rtrim ( $ this -> directory , '/' ) . '/Proxy/' . \ str_replace ( '\\' , '/' , $ namespace ) ; $ fileName = $ this -> reflectionClass -> getShortName ( ) . 'Proxy.php' ; $ filePath = $ fileDirectory . '/' . $ fileName ; if ( ! \ is_dir ( $ fileDirectory ) ) { // Try create directory if ( false === @ \ mkdir ( $ fileDirectory , 0777 , true ) ) { throw new \ RuntimeException ( sprintf ( 'Could not create directory "%s" for proxy file. Maybe not rights?' , $ fileDirectory ) ) ; } } else if ( ! \ is_writable ( $ fileDirectory ) ) { throw new \ RuntimeException ( sprintf ( 'Cannot write to "%s" directory for save proxy file.' , $ fileDirectory ) ) ; } // Create file if ( false === @ \ touch ( $ filePath ) ) { throw new \ RuntimeException ( sprintf ( 'Could not create file "%s" for proxy class. Maybe not rights?' , $ filePath ) ) ; } \ file_put_contents ( $ filePath , $ this -> codeGenerator -> generate ( ) ) ; return $ filePath ; }
Generate proxy file

@return string
Generate proxy file