private function generateFunctionDocMarkdown($function) { $eol = PHP_EOL . PHP_EOL; $buffer = ''; // If this function is missing docs if ($function instanceof FunctionDocEmpty) { $buffer .= '## ' . $function->properName() . $eol; $buffer .= $function->emptyDocMessage() . $eol; } else { $buffer .= '## ' . $function->properName(); $buffer .= '[Source](' . $function->githubSource() . ')' . $eol; $buffer .= '__' . $function->name() . '__ :: ' . Either::extract($function->type()) . $eol; $buffer .= $function->description() . $eol; $buffer .= Either::extract(Functor::fmap(function ($examples) use($eol) { $exampleBuffer = ""; $exampleBuffer .= '```' . PHP_EOL; foreach ($examples as $example) { $exampleBuffer .= $example->getDescription() . PHP_EOL; } $exampleBuffer .= '```' . $eol; return $exampleBuffer; }, $function->examples())); } $buffer .= '---' . $eol; return $buffer; }
protected static function __fromMaybe($leftValue, $maybeValue) { return Maybe::isJust($maybeValue) ? Either::right(Maybe::extract($maybeValue)) : Either::left($leftValue); }