/**
* Generate the create service method
*
* @param string $className
* @param string $managerName
*/
protected function addCreateServiceMethod($className, $managerName)
{
// set action body
$body = array('/** @var ServiceLocatorAwareInterface $' . $managerName . ' */', '$serviceLocator = $' . $managerName . '->getServiceLocator();', '', '$instance = new ' . $className . '();', '', 'return $instance;');
$body = implode(AbstractGenerator::LINE_FEED, $body);
// create method
$method = new MethodGenerator();
$method->setName('createService');
$method->setBody($body);
$method->setParameters(array(new ParameterGenerator($managerName, 'ServiceLocatorInterface')));
// check for api docs
if ($this->config['flagAddDocBlocks']) {
$method->setDocBlock(new DocBlockGenerator('Create service', null, array(new ParamTag($managerName, array('ServiceLocatorInterface')), new ReturnTag(array($className)))));
}
// add method
$this->addMethodFromGenerator($method);
}