AnnotationMarkup.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Services;
  3. /**
  4. * {@see AnnotationLayout} 在插入点写什么。
  5. *
  6. * 布局算法只决定「在哪里」插;「插什么」由策略给:
  7. * - {@see HtmlAnnotationMarkup}:直接写 HTML(默认,单元测试与旧口径)
  8. * - {@see Markup\Annotation\AnnotationSet}:写结构化标记的占位符,交给 App\Services\Markup 解析成模板节点,
  9. * 能渲染成任意格式
  10. */
  11. interface AnnotationMarkup
  12. {
  13. /**
  14. * issue 高亮开头。
  15. *
  16. * @param array{start: int, end: int, ids: list<string>, severity: string|null} $span
  17. */
  18. public function issueOpen(array $span): string;
  19. /**
  20. * issue 高亮结尾(与同一个 $span 的 issueOpen 配对)。
  21. *
  22. * @param array{start: int, end: int, ids: list<string>, severity: string|null} $span
  23. */
  24. public function issueClose(array $span): string;
  25. /**
  26. * 没有位置的 issue:句尾的三角叹号。
  27. *
  28. * @param list<string> $ids
  29. */
  30. public function issueMark(array $ids, ?string $severity): string;
  31. /**
  32. * 评估:句尾的对勾。
  33. */
  34. public function assessmentMark(string $id, int $score): string;
  35. }