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