Passed
Push — master ( 9aa048...898b5e )
by Mattia
04:05
created

IsometricAvatarController::serveUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Minepic\Http\Controllers\Api;
6
7
use Illuminate\Http\Request;
8
use Illuminate\Http\Response;
9
10
class IsometricAvatarController extends BaseApiController
11
{
12
    /**
13
     * Serve isometric avatar.
14
     *
15
     * @param \Illuminate\Http\Request
16
     * @param string $uuid User UUID
17
     * @param int    $size
18
     *
19
     * @throws \Throwable
20
     *
21
     * @return \Illuminate\Http\Response
22
     */
23
    public function serveUuid(Request $request, $uuid, $size = 0): Response
24
    {
25
        $this->uuidResolver->resolve($uuid);
26
        $this->dispatchAccountImageServedEvent();
27
28
        return $this->pngResponse(
29
            (string) $this->rendering->isometricAvatar($this->uuidResolver->getUuid(), (int) $size)
30
        );
31
    }
32
33
    /**
34
     * @param int $size
35
     *
36
     * @throws \Minepic\Image\Exceptions\SkinNotFountException
37
     * @throws \Throwable
38
     *
39
     * @return Response
40
     */
41
    public function serveDefault($size = 0): Response
42
    {
43
        return $this->pngResponse(
44
            (string) $this->rendering->isometricAvatar(null, (int) $size)
45
        );
46
    }
47
}
48