This repository has been archived by the owner on Jun 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormatterInterface.php
69 lines (62 loc) · 2.15 KB
/
FormatterInterface.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* The WordCrumbs FormatterInterface
*
* @author bjoluc <25661029+bjoluc@users.noreply.github.com>
* @version 1.0.0
*
* @license GPL-3.0-or-later
*/
namespace bjoluc\WordCrumbs\Formatters;
/**
* Specifies the methods of a Formatter. Formatters are used by the WordCrumb
* `format()` method to convert a list of Breadcrumb objects into a string.
*/
interface FormatterInterface
{
/**
* Is called by the WordCrumbs class before using the formatter.
*
* @param Symfony\Component\Translation\Translator $translator The Symfony
* Translator instance used for translations
* @return void
*/
public function setTranslator($translator);
/**
* Is called before the breadcrumbs are formatted.
*
* @return string A string to be prepended, e.g. an opening HTML list tag
*/
public function getPre();
/**
* Is called after the breadcrumbs have been formatted.
*
* @return string A string to be appended, e.g. a closing HTML list tag
*/
public function getPost();
/**
* Is called when a breadcrumb is formatted, before its name is added.
*
* @param Breadcrumb $breadcrumb The breadcrumb that is being formatted.
* @param boolean $isLast Whether the current breadcrumb is the last breadcrumb
*
* @return string A string to be prepended to the breadcrumb's name, e.g. an opening HTML anchor tag
*/
public function getPreBreadcrumb($breadcrumb, $isLast);
/**
* Is called when a breadcrumb is formatted, after its name has been added.
*
* @param Breadcrumb $breadcrumb The breadcrumb that is being formatted.
* @param boolean $isLast Whether the current breadcrumb is the last breadcrumb
*
* @return string A string to be appended to the breadcrumb's name, e.g. a closing HTML anchor tag
*/
public function getPostBreadcrumb($breadcrumb, $isLast);
/**
* Is called to format a breadcrumb.
*
* @param Breadcrumb $breadcrumb The Breadcrumb to be formatted
* @return string The string resulting from the provided Breadcrumb object
*/
public function getBreadcrumb($breadcrumb);
}