1 | <?php |
||
7 | class PageTitle implements Countable |
||
8 | { |
||
9 | /** |
||
10 | * Collection of page title parts |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $collection = []; |
||
15 | |||
16 | /** |
||
17 | * Delimeter string for seperate the page title parts |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | private $delimeter; |
||
22 | |||
23 | /** |
||
24 | * The page name to append or prepend to the page title parts |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $page_name; |
||
29 | |||
30 | /** |
||
31 | * The default text when no page title is set |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | private $default; |
||
36 | |||
37 | /** |
||
38 | * @param string $delimeter |
||
39 | * @param string $page_name |
||
40 | * @param string $default |
||
41 | */ |
||
42 | public function __construct($delimeter = ' | ', $page_name = '', $default = '') |
||
48 | |||
49 | /** |
||
50 | * Add an item to the collection |
||
51 | * |
||
52 | * @param $item |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function add($item) |
||
67 | |||
68 | /** |
||
69 | * Count the collection |
||
70 | * |
||
71 | * @return int |
||
72 | */ |
||
73 | public function count() |
||
77 | |||
78 | /** |
||
79 | * Get the page title |
||
80 | * |
||
81 | * @param bool|string $direction |
||
82 | * @return string |
||
83 | */ |
||
84 | public function get($direction = 'regular') |
||
102 | |||
103 | /** |
||
104 | * Add the page name to the collection |
||
105 | * |
||
106 | */ |
||
107 | protected function addPageName() |
||
113 | } |