Passed
Push — master ( bebbb3...38c082 )
by Mattia
03:32
created

SkinFrontController::serveUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Http\Controllers\Api;
6
7
use App\Image\ImageSection;
8
use Illuminate\Http\Request;
9
use Illuminate\Http\Response;
10
11
/**
12
 * Class BaseApiController.
13
 */
14
class SkinFrontController extends BaseApiController
15
{
16
    /**
17
     * Serve Avatar.
18
     *
19
     * @param \Illuminate\Http\Request
20
     * @param string $uuid User UUID or Username
21
     * @param int    $size
22
     *
23
     * @throws \Throwable
24
     *
25
     * @return \Illuminate\Http\Response
26
     */
27
    public function serveUuid(Request $request, $uuid, $size = 0): Response
28
    {
29
        $size = (int) $size;
30
        $this->minepic->initialize($uuid);
31
        $this->minepic->updateStats();
32
33
        return $this->pngResponse(
34
            (string) $this->minepic->renderSkinCurrentUser($size, ImageSection::FRONT)
35
        );
36
    }
37
}
38