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:----AOn6w2pBGO6K9JcAHYEYD2YeCo2hK1YQW8wn/SJ0W08WaRlxwNPwYUa3Umnb5Ty849pQMhLYn9OmYwe7+lcD4HDuK3qW2lTOkwfzfyKQij0mqiBlsZTgGU257SKhzbQlyFUpixzyTwQVifKg7fGsjpbqvno1KtMn8EyuBRrNF0fGOye1s9UOs2d433s6E1dZvdMRRKzyswR/H17pRfcjPCTutkV9WmlpQZnAHzQ2dGf4WSKaN1EJlDTvjEh3S8x5adp/n/nxivWOpYtRpaCfTzJzpRUCzvaBLv8OducTgXs9jNmKDej/VjWHNpFvUn3Q5V7x4uUqL/o0jzXRfQ6SSj+arx3OID5cUcFQ4JIyMDVo3qywyqhFpY+zOe6cU5eGjVAM/r8Kpfiez3W/rkHVIcwCSy1ntfL5mGwk+RsvEaLt8pvzksjb20jeJ3MByDyOsx1iYPj1uaxEbvCM7IL8XfCZ2IJNuevUDVsnythB6JFhh9qR6QPhCFxaihUBBfclTfcn/g0QYedkXoYVX8g5/SxoFA9OYw8EK3TwopfgAp2vT0emcyZ31qTQyXms9AdFojQ5+6I9Wv9sfz0rr+A9yg1CWbnrHN5je95EV7EH/WyXRK4ty4EITVw9N8huBTaJXAQkfzElTfEnMpzDLFXM2uABKpAxMz/OzV4nJYbfWcs=----ATTACHMENT:----OTIxNjczNDc1NTQxNTg2MiA2MzE3NDQ3Nzk2NjI0OTA1IDI3MDc5NDk4Nzk4NDg2OTg=