public function __invoke(Route $route, Console $console) : int
{
$message = 'Creating tag cloud';
$length = strlen($message);
$width = $console->getWidth();
$console->write($message, Color::BLUE);
if (!$route->matchedParam('output')) {
return $this->reportError($console, $width, $length, 'Missing output file');
}
$output = $route->getMatchedParam('output');
$cloud = $this->mapper->fetchTagCloud();
$markup = sprintf("<h4>Tag Cloud</h4>\n<div class=\"cloud\">%s</div>", $cloud->render());
file_put_contents($output, $markup);
return $this->reportSuccess($console, $width, $length);
}