public function methodExample($class, $method, $index = 0)
{
$examples = $this->examplesFromMethod($class, $method);
$result = array_filter($examples, function ($example) use($index) {
return $example->index() === $index;
});
if (empty($result)) {
throw new \Exception(sprintf('Given snippet index %d does not exist for method %s::%s', $index, $class, $method));
}
return current($result);
}