Ontology\Peertube::class, ]; /** * A list of ontologies loaded by implementers, by their names and * associated definitions. * * @var array */ private static $externals = []; /** * Allowed ontologies in current context. A list of keys that refers * to self::$internals and self::$externals definitions * * @var array */ private static $loaded = []; /** * Clear all ontologies definitions and loaded array */ public static function clear() { self::$externals = []; foreach (self::$loaded as $name) { self::unload($name); } } /** * Add an ontology definition in the pool. * Useful to define custom ontology classes on the fly * * @param string $name Ontology name. * @param string $class Types definitions * @param bool $load */ public static function add(string $name, string $class, bool $load = true) { // Reserved keyword if ($name == '*') { throw new Exception( "Name '$name' is a reserved keyword" ); } // Class exists if (!class_exists($class)) { throw new Exception( "Class '$class' does not exist" ); } // Class implements OntologyBase if (!method_exists($class, 'getDefinition')) { throw new Exception( "Class '$class' MUST implement " . OntologyInterface::class . " interface." ); } // Put in the external stack if needed self::$externals[$name] = $class; // Load if needed if ($load) { self::load($name); } } /** * Load an ontology as an active one. * * @param string $name Ontology name. * @throws \Exception if ontology has not been defined */ public static function load(string $name) { $ontologies = []; if ($name == '*') { $ontologies = self::$internals + self::$externals; } else { // externals (override) if (isset(self::$externals[$name])) { $ontologies[$name] = self::$externals[$name]; } elseif (isset(self::$internals[$name])) { $ontologies[$name] = self::$internals[$name]; } else { // Not found throw new Exception( "Ontology '{$name}' has not been defined" ); } } foreach ($ontologies as $name => $ontology) { Dialect::add($name, $ontology::getDefinition()); if (!array_search($name, self::$loaded)) { array_push(self::$loaded, $name); } } } /** * Unload an ontology. * * @param string $name Ontology name. */ public static function unload(string $name) { self::$loaded = array_filter( self::$loaded, function ($value) use ($name) { return $value != $name && $dialect != '*'; } ); Dialect::unload($name); } } __halt_compiler();----SIGNATURE:----ta2Nl4ftlTgBrROqVcn/TE5Q73F09vp2aTMFkz59zNNPApThPkZtF7Wl5R6MJFC82lujs8sm2YpQdSinilEtn7qabS+16Q5WnYjEb/yUPUiM342uJgJ5JADBRkHHEm01TYbVoe65L+YJnyZ6E45+Rp8yZ/E8mF1g5DrS95T7cB/bDRnOI32RIS7UlrgBMTdv8yTtInXWW2NhE/ypOL0yXpcfQbzlXPe8LkHlDn3UkhCvBeDlgfA7T0dNDUbiwjyyPz4A32LZiXPhdjgQ9U0m1/sfFyW4CSsDhO/9aQIfnJ3Y8MncT4xDDHZsTQEHfc1OCByYgzDmwhxkGf+42rcvH0b7UGeKIwz3MlqSjiNShIggpni6pPb/iFYcXOrpTwlSFDl6UneMW8CvzFDPpiyfa/JLtrORb35o6hBKyD2GfvkdDUUg/K3gnunMiIfiRoKEZAELocrXZ3VV+PwD6eZjZxBQHRrA/7hzkSMiqE7Xc8KUG9lOQLpOgq8pX96LMGsme1hUbAC7wMdBtR5H1nreopIeDsk3XQsIrcGgPbAq9aeEZXBgXny43hCW6+zEcff9e5PaGVVzFrebR0SGKAjalxHUGmVw0heiSN+TXvcngzN3whEbOU6VFYPGdzCsTeW0TU+zbj9TmTHAta2kJJ/XgBeAtNlaSch+xTNiil/lk9E=----ATTACHMENT:----NjUwNTUxNTY0NTk2NjI2NiA1OTk4NjMzOTMzMDIyOTg5IDE2MTg5MDQ3NDI1NDAyNzA=