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

IsometricAvatarController::serveUsername()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
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 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 $uuidOrName User UUID or Username
17
     * @param int    $size
18
     *
19
     * @throws \Throwable
20
     *
21
     * @return \Illuminate\Http\Response
22
     */
23
    public function serveUuid(Request $request, $uuidOrName, $size = 0): Response
24
    {
25
        $size = (int) $size;
26
27
        $this->minepic->initialize($uuidOrName);
28
        $this->minepic->updateStats();
29
30
        return $this->pngResponse((string) $this->minepic->isometricAvatarCurrentUser($size));
31
    }
32
}
33