-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathChapter.php
More file actions
53 lines (44 loc) · 1.25 KB
/
Chapter.php
File metadata and controls
53 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
namespace App\Web\Documentation;
use App\Web\Meta\MetaImageController;
use function Tempest\uri;
final class Chapter
{
public function __construct(
public Version $version,
public string $category,
public string $slug,
public string $body,
public string $title,
public string $path,
public bool $hidden = false,
public ?string $description = null,
) {}
public function getUri(): string
{
return uri(
DocumentationController::class,
version: $this->version,
category: $this->category,
slug: $this->slug,
);
}
public function getCanonicalUri(): string
{
return uri(
DocumentationController::class,
version: $this->version->default(),
category: $this->category,
slug: $this->slug,
);
}
public function getMetaUri(): string
{
return uri([MetaImageController::class, 'documentation'], version: $this->version, category: $this->category, slug: $this->slug);
}
public function getEditPageUri(): string
{
return "https://github.com/tempestphp/tempest-docs/edit/main/{$this->path}";
}
}