• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mattiabasone / minepic / 4104800262

pending completion
4104800262

push

github

Mattia Basone
update coveralls directive in github actions

739 of 865 relevant lines covered (85.43%)

4.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/app/Http/Controllers/Api/DownloadTextureController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Minepic\Http\Controllers\Api;
6

7
use Illuminate\Http\Response;
8
use Laravel\Lumen\Http\ResponseFactory;
9
use Laravel\Lumen\Routing\Controller as BaseController;
10
use Minepic\Helpers\Storage\Files\SkinsStorage;
11
use Minepic\Image\Sections\Raw;
12
use Minepic\Minecraft\MinecraftDefaults;
13
use Minepic\Resolvers\UuidResolver;
14

15
class DownloadTextureController extends BaseController
16
{
17
    public function __construct(
18
        protected UuidResolver $uuidResolver,
19
        protected ResponseFactory $responseFactory
20
    ) {
21
    }
1✔
22

23
    /**
24
     * Download user texture.
25
     *
26
     * @param string $uuid User UUID or Username
27
     *
28
     * @throws \Minepic\Image\Exceptions\ImageCreateFromPngFailedException
29
     */
30
    public function serve(string $uuid = ''): Response
31
    {
32
        $headers = [
1✔
33
            'Content-Disposition' => 'Attachment;filename='.$uuid.'.png',
1✔
34
            'Content-Type' => 'image/png',
1✔
35
        ];
1✔
36

37
        $skinPath = $this->uuidResolver->resolve($uuid) ?
1✔
38
            SkinsStorage::getPath($this->uuidResolver->getUuid()) :
×
39
            SkinsStorage::getPath(MinecraftDefaults::STEVE_DEFAULT_SKIN_NAME);
1✔
40

41
        $rawSkin = new Raw($skinPath);
1✔
42
        $rawSkin->render();
1✔
43

44
        return $this->responseFactory->make((string) $rawSkin, 200, $headers);
1✔
45
    }
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc