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(): void { 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 */ public static function add(string $name, string $class, bool $load = true): void { 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): void { $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): void { self::$loaded = array_filter( self::$loaded, static function ($value) use ($name): bool { return $value !== $name && $dialect !== '*'; } ); Dialect::unload($name); } } __halt_compiler();----SIGNATURE:----PPv/V2euceIym13sq5Ewti0RzubRv9f//kEuFp+hP7mWCtxXQ0L05LjNhEbUcJaQDAswVHXTCMOBrUmt7vg7oBagKRUojjNnTgHJw2YakyJgdgaHk15HGlETmt8SW7dvzKk9Adlbg3qH8wPpYqzGGKB1LYYfbCXXUmL3vcDaq7065W4RUomuWJSz8k3vtDx0mYQTQQVIV5J8iXQK9TJ6kct9B42+iAeJcuv7LLnz9Yl8vqFX+Dm2mAb+R0QyoXJ9TyPBiCRh66pf8ooCBw8iZqtm4xemzdqsFjBtkSbnGNG+0cUSGUTVUY8OjSmV3qfWJ24OVlXbLmEQtx6Ve5wCfrSBFTHqfm78Sbj8MGTZ1TCsXZhAImiQ6b0J1n6vkPfQMY90F5IbYEJUSL9iB7nX2dm0U0gZz8vUszj0dDQ5HS2qBgSi3x+gQtJswKSI7eX2IoSR+CNMh4T8pt3xC4+zgq16xKk7c2K6kJDw3ISE1xEty4WWdVYzBlbaymjC7nF8wz2njebXYnj4cVvWd26P1lChhSDSpeg5e8fQwGOHuUxhDE/GWxO0HaMC1T3vcmee4N7tYOfbaxt/Vvcxq0Ao9+vvTLL7Esw43pUJMp0ntbs419OUJDu9g6ekj4LWIPYQMJzVMzUmcKl4ZTGJsoOsNhVGCodNOINOO8j9NssrlzY=----ATTACHMENT:----NTgxNTc0MzQyMjU4NzY3NyA2ODA4Njc1MjE5ODYyMTY3IDYzMDMyMDA1ODEyNDU2NzE=