public function afterSuite(SuiteEvent $event)
{
if (!$this->io->isCodeGenerationEnabled()) {
return;
}
foreach ($this->methods as $call => $arguments) {
list($classname, $method) = explode('::', $call);
$message = sprintf('Do you want me to create `%s()` for you?', $call);
try {
$resource = $this->resources->createResource($classname);
} catch (\RuntimeException $e) {
continue;
}
if ($this->io->askConfirmation($message)) {
$this->generator->generate($resource, 'named_constructor', array('name' => $method, 'arguments' => $arguments));
$event->markAsWorthRerunning();
if (!method_exists($classname, '__construct')) {
$message = sprintf('Do you want me to make the constructor of %s private for you?', $classname);
if ($this->io->askConfirmation($message)) {
$this->generator->generate($resource, 'private-constructor', array('name' => $method, 'arguments' => $arguments));
}
}
}
}
}