19 declare(strict_types=1);
    29     public function addObserver(
object $class, 
string $method, 
string $element): void
    31         $this->observers[$element][] = [
    39         foreach ($this->observers[$element] ?? [] as $observer) {
    40             $class = $observer[
'class'];
    41             $method = $observer[
'method'];
    43             $class->$method($element);
    50             'general' => 
'General',
    51             'lifecycle' => 
'Lifecycle',
    52             'metametadata' => 
'MetaMetaData',
    53             'technical' => 
'Technical',
    54             'educational' => 
'Educational',
    56             'relation' => 
'Relation',
    57             'annotation' => 
'Annotation',
    58             'classification' => 
'Classification'    60         $category = strtolower($path->
steps()->current()?->name() ?? 
'');
    61         if ($path->
isRelative() || !isset($category) || !isset($categories[$category])) {
    62             throw new \ilMDEditorException(
    63                 'Cannot call observers via relative or invalid path.'