コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: Either.php プロジェクト: joseph-walker/vector
 protected static function __fromMaybe($leftValue, $maybeValue)
 {
     return Maybe::isJust($maybeValue) ? Either::right(Maybe::extract($maybeValue)) : Either::left($leftValue);
 }