PluginProbe
Simple Analytics / 1.83
Simple Analytics v1.83
1.109 1.108 1.107 1.106 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.8 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.9 1.90 1.91 All 98 releases
simpleanalytics / src / Settings / Page.php

Page.php in Simple Analytics 1.83, at src/Settings/Page.php

67 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SimpleAnalytics\Settings;
4
5 use SimpleAnalytics\Settings\Concerns\WordPressPageIntegration;
6 use SimpleAnalytics\Support\Str;
7
8 class Page
9 {
10 use WordPressPageIntegration;
11
12 /**
13 * @var string
14 */
15 protected $title;
16
17 /**
18 * @var string
19 */
20 protected $slug;
21
22 /** @var Tab[] */
23 protected $tabs = [];
24
25 public function __construct(string $title)
26 {
27 $this->title = $title;
28 }
29
30 public static function title(string $title): self
31 {
32 return new self($title);
33 }
34
35 public function slug(string $slug): self
36 {
37 $this->slug = $slug;
38
39 return $this;
40 }
41
42 public function tab(string $title, callable $callback): self
43 {
44 $tab = new Tab($title, Str::slug($title));
45 $callback($tab);
46
47 $this->tabs[] = $tab;
48
49 return $this;
50 }
51
52 public function getTitle(): string
53 {
54 return $this->title;
55 }
56
57 public function getSlug(): string
58 {
59 return $this->slug;
60 }
61
62 public function getTabs(): array
63 {
64 return $this->tabs;
65 }
66 }
67