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:----wW+JlKAiv3Q6mVvaOqvGmsY3/euiOdDstNQ1ydx0EPTTHuYGhZDBHaqpKd+EaNZ/OCCzfytKpIlfIViZ2aP1l0ptYzSTfOnL5mdNgAoM29RtAODjCy6yPeDCBtAttFH/HMnMW8xBQRrx29RGYUv9hL5q5StcAgtzj+Hh8u3wzQTeLU7zn6BeKYoT7PG6rTbYpvbplsE9wKcmLZhnq3l/mCXdFxhqvrijJiBNKufHW9t1o+ARBWSTLH6jtbmI2/DXvBI9zAY5b27LIGEvsfHoTFIuZhjsj8rMs58O7tUqjEbuptz/ztcIetj7AOp5nCIrehLmcWAqbPvPha4SkA41Xbkrxy7cvrtH363Bh9CFL639T/I79ri5bBV+pL0rJ+9/uT+iNXeFTmfwavhknXi7YtdgcBVfCSR4YHTg97XUSMG3mH+C6s1vkF/ShfKN/AnG7ca1MMhndt/I6lm/J44a7XMi8PUJRy2NY31VUNc1iWLA4ZuQSsIRNv+zV6oVwn81EP6WEd9d2xWj1vylKf7LnlSDH5esMjCMD2GiogZyZ9E1z2fp1klUcl134MHdvfk6cysUHDqY2ee4ibWQUdTKlCbTWZT/qiAee2ucBVnTYsl5vhi5gwknJGQXoCXQTR1u9QDV3GHP3FyADwppYvx+jnBwUgAlbOvXAAU0wdPzEgk=----ATTACHMENT:----MTk0NDMzNTY0NDE0NDkxNCA3Mjk1MDY2OTE2MTAxOTkxIDg0ODA4OTQ3MTE5OTcyMjk=