1 | <?php |
||
8 | class Title implements TitleContract |
||
|
|||
9 | { |
||
10 | use HasLimit; |
||
11 | |||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $segments = []; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $separator; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $siteName; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $maxSegment; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $maxTitle; |
||
36 | |||
37 | /** |
||
38 | * @var bool |
||
39 | */ |
||
40 | protected $reverse; |
||
41 | |||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | protected $siteNameVisibility; |
||
46 | |||
47 | /** |
||
48 | * Create a new title instance. |
||
49 | * |
||
50 | * @param array $config |
||
51 | */ |
||
52 | public function __construct(array $config = []) |
||
56 | |||
57 | /** |
||
58 | * Init config. |
||
59 | * |
||
60 | * @param array $config |
||
61 | * @return void |
||
62 | */ |
||
63 | protected function initConfig(array $config) |
||
72 | |||
73 | /** |
||
74 | * Set title separator. |
||
75 | * |
||
76 | * @param string $separator |
||
77 | * @return \LaraComponents\Seo\Title |
||
78 | */ |
||
79 | public function setSeparator($separator) |
||
87 | |||
88 | /** |
||
89 | * Get title separator. |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getSeparator() |
||
97 | |||
98 | /** |
||
99 | * Set site name. |
||
100 | * |
||
101 | * @param string $siteName |
||
102 | * @return \LaraComponents\Seo\Title |
||
103 | */ |
||
104 | public function setSiteName($siteName) |
||
112 | |||
113 | /** |
||
114 | * Get site name. |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getSiteName() |
||
122 | |||
123 | /** |
||
124 | * Set segment max length. |
||
125 | * |
||
126 | * @param int $max |
||
127 | * @return \LaraComponents\Seo\Title |
||
128 | */ |
||
129 | public function setMaxSegemnt($max) |
||
135 | |||
136 | /** |
||
137 | * Get segment max length. |
||
138 | * |
||
139 | * @return int |
||
140 | */ |
||
141 | public function getMaxSegment() |
||
145 | |||
146 | /** |
||
147 | * Set title max length. |
||
148 | * |
||
149 | * @param int $max |
||
150 | * @return \LaraComponents\Seo\Title |
||
151 | */ |
||
152 | public function setMaxTitle($max) |
||
158 | |||
159 | /** |
||
160 | * Get title max length. |
||
161 | * |
||
162 | * @return int |
||
163 | */ |
||
164 | public function getMaxTitle() |
||
168 | |||
169 | /** |
||
170 | * Set reverse title position. |
||
171 | * |
||
172 | * @param bool $reverse |
||
173 | * @return \LaraComponents\Seo\Title |
||
174 | */ |
||
175 | public function setReverse($reverse = true) |
||
181 | |||
182 | /** |
||
183 | * Check reverse title position. |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | public function isReverse() |
||
191 | |||
192 | /** |
||
193 | * Set the site name visibility. |
||
194 | * |
||
195 | * @param bool $visible |
||
196 | */ |
||
197 | public function setSiteNameVisibility($visible) |
||
203 | |||
204 | /** |
||
205 | * Check if site name exists and visible. |
||
206 | * |
||
207 | * @return bool |
||
208 | */ |
||
209 | public function isSiteNameVisible() |
||
213 | |||
214 | /** |
||
215 | * Appent title to segments. |
||
216 | * |
||
217 | * @return \LaraComponents\Seo\Title |
||
218 | */ |
||
219 | public function add() |
||
229 | |||
230 | /** |
||
231 | * Set title segments. |
||
232 | * |
||
233 | * @return \LaraComponents\Seo\Title |
||
234 | */ |
||
235 | public function set() |
||
243 | |||
244 | /** |
||
245 | * Get title segments. |
||
246 | * |
||
247 | * @return array |
||
248 | */ |
||
249 | public function get() |
||
253 | |||
254 | /** |
||
255 | * Make the title string. |
||
256 | * |
||
257 | * @return string |
||
258 | */ |
||
259 | public function toString() |
||
277 | |||
278 | /** |
||
279 | * Normalize the get segments. |
||
280 | * |
||
281 | * @param array $segments |
||
282 | * @return array |
||
283 | */ |
||
284 | protected function normalizeSegments($segments) |
||
302 | |||
303 | /** |
||
304 | * Convert object to string. |
||
305 | * |
||
306 | * @return string |
||
307 | */ |
||
308 | public function __toString() |
||
312 | } |
||
313 |