TexturesPropertyValueSkin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 28
ccs 11
cts 11
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromTextures() 0 3 1
A getUrl() 0 2 1
A __construct() 0 3 1
A isSlim() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ely\Mojang\Response\Properties;
5
6
class TexturesPropertyValueSkin {
7
8
    /**
9
     * @var string
10
     */
11
    private $url;
12
13
    /**
14
     * @var bool
15
     */
16
    private $isSlim;
17
18 3
    public function __construct(string $skinUrl, bool $isSlim = false) {
19 3
        $this->url = $skinUrl;
20 3
        $this->isSlim = $isSlim;
21 3
    }
22
23 3
    public static function createFromTextures(array $textures): self {
24 3
        $model = &$textures['metainfo']['model']; // ampersand to avoid notice about unexpected key
25 3
        return new static($textures['url'], $model === 'slim');
26
    }
27
28 3
    public function getUrl(): string {
29 3
        return $this->url;
30
    }
31
32 3
    public function isSlim(): bool {
33 3
        return $this->isSlim;
34
    }
35
36
}
37