/**
* creates a Command based on an Api Method.
*
* @param string $name
* @param \ReflectionMethod $method
* @param string $token
*
* @return Command
*/
private function generateCommand($name, \ReflectionMethod $method, $token = null)
{
$methodName = $this->transformer->transform($method->getName());
$command = new Command(strtolower($name . ':' . $methodName));
$docBlock = DocBlockFactory::createInstance()->create($method->getDocComment());
$command->setDefinition($this->buildDefinition($method, $token));
$command->setDescription($docBlock->getSummary());
$command->setCode($this->createCode($name, $method));
return $command;
}