1 | <?php |
||
7 | class LabelsCollection extends Collection |
||
8 | { |
||
9 | /** |
||
10 | * The label form (singular, plural, or otherwise) |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $form; |
||
14 | |||
15 | /** |
||
16 | * Set the form. |
||
17 | * |
||
18 | * @param string $label The label form to use for this collection |
||
19 | */ |
||
20 | public function setForm($label) |
||
26 | |||
27 | /** |
||
28 | * Get a new collection with replaced placeholders in items using the provided form. |
||
29 | * |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function replaced() |
||
38 | |||
39 | /** |
||
40 | * Replace all placeholders in the label with the given label form. |
||
41 | * |
||
42 | * @param string $label The label to make replacements in |
||
43 | * |
||
44 | * @return string The label after replacements have been made |
||
45 | */ |
||
46 | protected function replaceWithForm($label) |
||
50 | |||
51 | /** |
||
52 | * Get a specific label, after replacements have been made. |
||
53 | * |
||
54 | * @param string $key The label key |
||
55 | * @param string $default The default value, if no label if found for key |
||
56 | * |
||
57 | * @return string The label after replacements have been made |
||
58 | */ |
||
59 | public function get($key, $default = null) |
||
65 | |||
66 | /** |
||
67 | * Make replacements and return the collection as an array. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function toArray() |
||
75 | } |
||
76 |