src/CommandBus/Repository/CreateHandler.php
protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
    {
        $className = $class->getName();
        $file = new FileGenerator([
            'fileName' => $className.'.php',
            'classes' => [$class],
        ]);
        $contents = $file->generate();

        $relativePath = $destinationDir.DIRECTORY_SEPARATOR.$file->getFilename();
        if ($filesystem->has($relativePath)) {
            throw new CliException(sprintf(
                'Could not generate migration. File already exists: %s',
                $relativePath
            ));
        }

        $result = $filesystem->write($relativePath, $contents);

        return $result ? $relativePath : false;
    }
protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
    {
        $className = $class->getName();
        $file = new FileGenerator([
            'fileName' => $className.'.php',
            'classes' => [$class],
        ]);
        $contents = $file->generate();

        $relativePath = $destinationDir.DIRECTORY_SEPARATOR.$file->getFilename();
        if ($filesystem->has($relativePath)) {
            throw new CliException(sprintf(
                'Could not generate migration. File already exists: %s',
                $relativePath
            ));
        }

        $result = $filesystem->write($relativePath, $contents);

        return $result ? $relativePath : false;
    }
protected function writeClass ( ClassGenerator $ class , Filesystem $ filesystem , $ destinationDir ) { $ className = $ class -> getName ( ) ; $ file = new FileGenerator ( [ 'fileName' => $ className . '.php' , 'classes' => [ $ class ] , ] ) ; $ contents = $ file -> generate ( ) ; $ relativePath = $ destinationDir . DIRECTORY_SEPARATOR . $ file -> getFilename ( ) ; if ( $ filesystem -> has ( $ relativePath ) ) { throw new CliException ( sprintf ( 'Could not generate migration. File already exists: %s' , $ relativePath ) ) ; } $ result = $ filesystem -> write ( $ relativePath , $ contents ) ; return $ result ? $ relativePath : false ; }
Function writeClass.

@param ClassGenerator $class
@param Filesystem     $filesystem
@param $destinationDir

@return string|false

@throws CliException
Function writeClass .