public static function fromReflectionMethod(\ReflectionMethod $method) { $methodName = $method->getName(); $docComment = $method->getDocComment(); $reactivexId = extract_doc_annotation($docComment, '@reactivex'); $demoFiles = extract_doc_annotations($docComment, '@demo'); $description = extract_doc_description($docComment); $isObservable = Str::contains($docComment, '@observable'); $demos = array_map(function ($path) { return Demo::fromPath($path); }, $demoFiles); return new DocumentedMethod($methodName, $reactivexId, $description, $demos, $isObservable); }