PHP Class PhpSpec\CodeGenerator\Generator\PromptingGenerator

Inheritance: implements PhpSpec\CodeGenerator\Generator\Generator
Show file Open project: phpspec/phpspec

Public Methods

Method Description
__construct ( ConsoleIO $io, TemplateRenderer $templates, Filesystem $filesystem, PhpSpec\Process\Context\ExecutionContext $executionContext )
generate ( PhpSpec\Locator\Resource $resource, array $data = [] )

Protected Methods

Method Description
getFilePath ( PhpSpec\Locator\Resource $resource ) : string
getGeneratedMessage ( PhpSpec\Locator\Resource $resource, string $filepath ) : string
getTemplateRenderer ( ) : TemplateRenderer
renderTemplate ( PhpSpec\Locator\Resource $resource, string $filepath ) : string

Private Methods

Method Description
createDirectoryIfItDoesExist ( string $filepath )
fileAlreadyExists ( string $filepath ) : boolean
generateFileAndRenderTemplate ( PhpSpec\Locator\Resource $resource, string $filepath )
userAborts ( string $filepath ) : boolean

Method Details

__construct() public method

public __construct ( ConsoleIO $io, TemplateRenderer $templates, Filesystem $filesystem, PhpSpec\Process\Context\ExecutionContext $executionContext )
$io PhpSpec\Console\ConsoleIO
$templates PhpSpec\CodeGenerator\TemplateRenderer
$filesystem PhpSpec\Util\Filesystem
$executionContext PhpSpec\Process\Context\ExecutionContext

generate() public method

public generate ( PhpSpec\Locator\Resource $resource, array $data = [] )
$resource PhpSpec\Locator\Resource
$data array

getFilePath() abstract protected method

abstract protected getFilePath ( PhpSpec\Locator\Resource $resource ) : string
$resource PhpSpec\Locator\Resource
return string

getGeneratedMessage() abstract protected method

abstract protected getGeneratedMessage ( PhpSpec\Locator\Resource $resource, string $filepath ) : string
$resource PhpSpec\Locator\Resource
$filepath string
return string

getTemplateRenderer() protected method

protected getTemplateRenderer ( ) : TemplateRenderer
return PhpSpec\CodeGenerator\TemplateRenderer

renderTemplate() abstract protected method

abstract protected renderTemplate ( PhpSpec\Locator\Resource $resource, string $filepath ) : string
$resource PhpSpec\Locator\Resource
$filepath string
return string