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:----sH/XZuE/K910TnPAoOjKsVfIgXo7IPBvDtAYyV6iOwFrqnOS5x3L2iuu+tbHuUqQbdHjjBbcTIDigWYC3LN8ERj5AJvZg1G8RNbsfqY+WSLrXqd6BkR/TMxi9NTxmh6f/ZO0SsvO/TnBaqy1Bbjb17V1+mda9mlSztJKOtraMnmg3Sp2xVYNs1XnKMyBcadFwfzsmkz5UrrKltS0XWoC66BnuQgomcPA23yeVtpvY3PlJ9Jyg5684OprqFvb60kfaUlhiBncMEYMVMmKCh5P75Jz4rjy7ytBTH8O2kQ/8T8C35IMFUwKa27vMhkqFMSM+/XY9R6f2hPZLIx3p0aYmL8YR77c46x2+nTWl2I9pkn9GAc8lwQyHnB7R8X+BDMskCT0076lsQP0Le5lLCwNeG2vfC122AQWF53sCdAcjA2gbzHlxNfep0DBenLw4l///QqITsCzhE9xeNFexfGDxqGIP8xRENjUT2O+5cxsWSwaoSvuNfRBOvMVabCyOao0VHQ1/H2pwGYBkyLoEz0MIcYt1to+H5NvG6rIZjG0FhXiWsALEL8XP00rdFozrqU8+XIkXtI24YNsd70D6quEsIQU5t4pWcEVsGqZCq2NLIMb7A5UtbtQ0QnwwzJ1eQ2eF69HSJKAc5wNbwlByZ/R5PAv2+ZMoW1Ex5AQWHkkdPY=----ATTACHMENT:----NTk2Nzg4NDc5NjY5MjczMCAxODkyNjcwMTg2MzgwNzgyIDc3NTAwMjcwNTEwNzIxMTU=