time() - $lifetime) { $cachedImageUrl = file_get_contents($cachePath); if (!$cachedImageUrl) { return ''; } return $cachedImageUrl; } $readme = self::getReadme($repository); $imageUrl = Str::findFirstImage($readme); if (!$imageUrl) { FileSystem::write($cachePath, ''); return ''; } $RemoteFile = new RemoteFile($imageUrl); $download = $RemoteFile->getLocalCopy(); $Image = new Image($download, 400, 300, true); $thumbnail = AM_BASE_URL . $Image->file; FileSystem::write($cachePath, $thumbnail); return $thumbnail; } /** * Get the rendered README for a given package repository. * * @param string $repository * @return string the thumbnail URL */ private static function getReadme(string $repository): string { $repositorySlug = Str::stripStart($repository, 'https://github.com/'); preg_match( '#href="/' . $repositorySlug . '/blob/(\w+)/(readme[\w\.]*)"#i', Fetch::get($repository), $matches ); if (empty($matches) || empty($matches[1]) || empty($matches[2])) { return ''; } $blob = 'https://raw.githubusercontent.com/' . $repositorySlug . '/' . $matches[1] . '/' . $matches[2]; $raw = Fetch::get($blob); return Str::markdown($raw); } } __halt_compiler();----SIGNATURE:----ZNEJUL84N14iHaMKDNEl95dUud7qh4xuz0yYEXOXPG7Wy72XxuxQW6dYM+I/wEuJX7jI867iPG8A9FEFsGwy+Iq6lTOzzY3mDA11PhBnd+icMmd5Uzt8zyCp4KDzLw6ao21ibCQoBmcSJ7fuBrxLniWBF0EDaexW/8ZAKt6Ta8Ky1EQbX0s7wZMw5AD3hQ2elKSDUQWWx9hhzmUzPS9c0GxhOujLO0VCk2EbvgbwBmgNrZL4leWRmDWpEGPjNANU5dgcBVsqzIIBq4U54Bsf33l38LFsk61U5gwbYR5OBAp0MVXJqF4Dnj+zlzaD9axsuj5nBYMEqwTYpcGfiaIWShzRz+H8hNMkzbKMUh7kpI3t11+NHLMpnrbyiPteOhZUPkI4/Ntyjjaqz4MTXIA87TDJ/9PlGWPvdV0XgwK8FNtVWqa3e3VicFWWSACPxjJ1ImwZ73p0Gl0Srp5l9g+RjpUJtRZqqdHObGFx9EijUBGPRY+dmpJu0TNQPq/5T+FoBOYLN5DD+tayHUKBgZAs+QDGnk2y21GcCApQGD1WEC6Njomz/qOdBCTb6Aqqg3QFufY1SdrjW1Z5DTVUZP0Nll3E6Vm0ofim3b7KVREela4ZN6CTbjf3ZT7CjXv+INMOBXsNkdjIwMzkaHfkKxEvvouepB5MmpTKBoK7dwmyJtw=----ATTACHMENT:----NzA0MjU2ODU0NDUxODQ1MyAzMTA5MzY4MjkyMjEzOSA0NTY4NDczMjU2Mzk0NTcz