public static function fromFunction(FunctionDeclarationNode $function_node) {
    $method_name = $function_node->getName()->getText();
    $parameters = $function_node->getParameterList()->getText();
    $body = $function_node->getBody()->getText();
    /** @var ClassNode $class_node */
    $class_node = Parser::parseSnippet("class Method {public function {$method_name}($parameters) $body}");
    FormatterFactory::format($class_node);
    $method_node = $class_node->getStatements()[0]->remove();
    return $method_node;
  }