| 1 | <?php |
||
| 19 | class SectionService implements SingletonInterface |
||
| 20 | { |
||
| 21 | use FacadeInstanceTrait; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Contains the closures which will render the registered sections. The keys |
||
| 25 | * of this array are the names of the sections. |
||
| 26 | * |
||
| 27 | * @var callable[] |
||
| 28 | */ |
||
| 29 | private $sections = []; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Adds a closure - which will render the section with the given name - to |
||
| 33 | * the private storage in this class. |
||
| 34 | * |
||
| 35 | * @param string $name |
||
| 36 | * @param callable $closure |
||
| 37 | */ |
||
| 38 | public function addSectionClosure($name, $closure) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Returns the closure which will render the section with the given name. If |
||
| 45 | * nothing is found, `null` is returned. |
||
| 46 | * |
||
| 47 | * @param string $name |
||
| 48 | * @return callable|null |
||
| 49 | */ |
||
| 50 | public function getSectionClosure($name) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Resets the list of closures. |
||
| 59 | */ |
||
| 60 | public function resetSectionClosures() |
||
| 64 | } |
||
| 65 |