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 { // 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): 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:----j7TKYhVGpXfl5AzrhgE2WUa2xTyblRBXfQPSzjKUFgY879MuoBqdKBSEkDKJThUe9V4SIy6cfvAY4BTdLuy7nZmX3F2xKvchc8ioK1zNO3zlIq/UfOCzHq58rnfU7oB5B/1KxylbUBOlkgmxsNBNI9pJZ/6poBjYEJ18WpweDxi2BslO5kopeD91nktP6t2nFkwNCCTeu4XbfBv/ybtYV4eZdy/9t6BPsyMWosJWC1dZGcq1xSAyPWBRvMhPEeN050uKRcEpI8bNPE1wNpf12/emexZJyq6kgsnFP14mPrhn2KmMJL1YtRz9FlbgbJI0HM2jTAoC+X318z4RC20GbR4AgLRCAlUCTMVaRX5Jl8LOrBeVzqE74P4MTUuY435NARAahYbYuucrVirwk/DCdyTxozcg5P9L70Qb+jiPOvEIRl8n5VPXbsG+KEG29DqY1dyZtv7kJOcf17B1snncnmWbGjRUY2yeEsDdk5EZSklVXeVgnifbDGy0BDgpYR2WhkpHIoHto/8o9IG+Z4UnliKC11WGCbbgTcS3zqpKShxtK9NTtNhBWNYhVYImypJ17YVeeak8hDuVPIvNxAUl4NpIhs4JQmqKmayo8oGA9YT/A5+KTdev6C5GTYkTd3GWTVWFr9ZvLGgd+lBzn10mN8vAphq0p/nRHz7GxXPUv5o=----ATTACHMENT:----Njk2MzUzMjg4NTg3MzcwMyA2MzI5OTU1NTkxMDY5MDcwIDE1MzA1OTA2MzYyMTI2NzY=