Skip to content

Commit 7708385

Browse files
committed
Implement deprecated tag
1 parent 4655bf2 commit 7708385

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Docs/RouteDocumentation.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class RouteDocumentation {
1717
protected $description;
1818
protected $params;
1919
protected $return;
20+
protected $deprecated;
2021

2122
public $resource;
2223

@@ -64,6 +65,13 @@ public function __construct(Route $route) {
6465
} else {
6566
$this->return = new ReturnValue(ReturnValue::$OTHER, '');
6667
}
68+
69+
$deprecation = $docBlock->getTagsByName('deprecated');
70+
if (count($deprecation) > 0) {
71+
$tag = $deprecation[0];
72+
$notice = $tag->getContent();
73+
$this->deprecated = empty($notice) ? true : $notice;
74+
}
6775
}
6876

6977
/**
@@ -150,5 +158,13 @@ public function getReturn() {
150158
public function getResource() {
151159
return $this->resource;
152160
}
161+
162+
public function isDeprecated() {
163+
return isset($this->deprecated);
164+
}
165+
166+
public function getDeprecationMessage() {
167+
return ($this->deprecated === true) ? false : $this->deprecated;
168+
}
153169
}
154170

src/views/endpoint.blade.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
{!! $endpoint->getDescription() !!}
66

7+
@if ($endpoint->isDeprecated())
8+
@if ($message = $endpoint->getDeprecationMessage())
9+
<aside class="warning"><strong>Deprecated:</strong> {{$message}}</aside>
10+
@else
11+
<aside class="warning"><strong>Deprecated</strong></aside>
12+
@endif
13+
@endif
14+
715
@if (count($endpoint->getParams()) > 0)
816
### Parameters
917

0 commit comments

Comments
 (0)