homepage ?? $ret; } return $ret; } /** * Returns the package name as found in the composer.json file. * @return string * @throws \ReflectionException */ public static function get_composer_package_name(): string { $ret = ''; $composer_file = self::get_composer_file(); if ($composer_file) { $ret = self::get_composer_json_object($composer_file)->name ?? $ret; } return $ret; } /** * Returns the path to the composer.json file of the component. * @return string * @throws \ReflectionException */ public static function get_composer_file(): string { $ret = ''; //todo improve this //go up until composer.json is found $called_class = get_called_class(); $component_file = (new \ReflectionClass($called_class))->getFileName(); //remove the protocol if there is such preg_match("#^(.*)\://#", $component_file, $matches); if (!empty($matches[1])) { $protocol = $matches[1]; $component_file = str_replace($protocol.'://', '', $component_file); } $path = $component_file; do { $path = dirname($path); $file = $path.'/composer.json'; if (file_exists($file) && is_readable($file)) { $ret = $file; break; } } while ($path !== '/'); return $ret; } private static function get_composer_json_object(string $composer_file): object { $json = json_decode(file_get_contents($composer_file)); if ($json === NULL) { //print sprintf('The %s contains invalid json: %s.', $composer_file, json_last_error_msg() ); throw new \RuntimeException(sprintf('The %1$s contains invalid json: %2$s.', $composer_file, json_last_error_msg() ) ); } return $json; } }__halt_compiler();----SIGNATURE:----I8j6RMzt2mi1r9xJXuoIS2yryMW/m0q2m9r+3/no7gzTIuLD+czxkokExqsh3/V5hhDjC3Re5brGR6o/g7KgWufj0DNV29kqQLFrxLnfioN+Q70/rGMSsgHMaLMBssNNUKrgKHZ72YqT6WRJutYZvuDBpPYql6IqPb+LoeCASHIvwS77tBXXWSxRT4uhy32jofCQNMzN0ZsZ0CjyhB/zOhVlWWsV41k/BTtIif8UU0RvWUeWEd6XZW47NRqqWN7UU3lqMTwD3eEUiJ2Suj2yN/VhgmNjUTsUruf4lFc0E2nX0ZDOCrTrZC3KeY11zJqscLyrPmpz8rQ9EOLnvdtY9P/wpdWwo/FolFqlFEyrJqysn37ZoOCsjXGOVn7mPbTLxIMtYf8dVRp/lRt93IVRxgBIWyH0qGoEVyBA2cj3HxZzyTSYwnq8Na6ILQD0sKs60W9EtLyMME4kp122wUw3qN2BSKKKgAfdtQKmZFCW1kTfMPj2w0avFreCQ+X8s0y9zxqU+Ia+vGXoGhCXGirVsQDEGDv7N41faHNS63EZL/CVfWQAUA5KnWnK1LyD4yEnVstWff5tuy/F+xJOt4kgSRv+vqPKgYEP3MvSqcuztM/2Krz1xtQS+tc4YNzkgBWoi8zkxHDANdR9s2yZCo2jUqsfBdbh8wR5LGHIyTFlmSQ=----ATTACHMENT:----NjE2MTYyMTIyMzE3NDI0MiA3NTI2MjY5NDc1ODI5ODc4IDk0NDIwNzE4NzIzNjE0MA==