1 | <?php |
||
12 | class PageTitle implements Countable |
||
13 | { |
||
14 | /** |
||
15 | * Collection of page title parts. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $collection = []; |
||
20 | |||
21 | /** |
||
22 | * Delimeter string for seperate the page title parts. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $delimeter; |
||
27 | |||
28 | /** |
||
29 | * The page name to append or prepend to the page title parts. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $page_name; |
||
34 | |||
35 | /** |
||
36 | * The default text when no page title is set. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $default; |
||
41 | |||
42 | /** |
||
43 | * @param string $delimeter |
||
44 | * @param string $page_name |
||
45 | * @param string $default |
||
46 | */ |
||
47 | 30 | public function __construct($delimeter = ' | ', $page_name = '', $default = '') |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 18 | public function getDelimeter() |
|
61 | |||
62 | /** |
||
63 | * @param string $delimeter |
||
64 | * |
||
65 | * @return $this |
||
66 | */ |
||
67 | 3 | public function setDelimeter($delimeter) |
|
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | 18 | public function getPageName() |
|
81 | |||
82 | /** |
||
83 | * @param string $page_name |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | 3 | public function setPageName($page_name) |
|
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | 3 | public function getDefault() |
|
101 | |||
102 | /** |
||
103 | * @param string $default |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 3 | public function setDefault($default) |
|
113 | |||
114 | /** |
||
115 | * Add an item to the collection. |
||
116 | * |
||
117 | * @param $item |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 18 | public function add($item) |
|
133 | |||
134 | /** |
||
135 | * Count the collection. |
||
136 | * |
||
137 | * @return int |
||
138 | */ |
||
139 | 21 | public function count() |
|
143 | |||
144 | /** |
||
145 | * Get the page title. |
||
146 | * |
||
147 | * @param bool|string $direction |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | 18 | public function get($direction = 'regular') |
|
169 | |||
170 | /** |
||
171 | * Add the page name to the collection. |
||
172 | */ |
||
173 | 15 | protected function addPageName() |
|
179 | } |
||
180 |