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

Coordinates   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 19
dl 0
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHelmSection() 0 5 1
A getAvatarSection() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Minepic\Image\Sections\Avatar;
6
7
use Minepic\Image\ImageSection;
8
use Minepic\Image\Point;
9
10
/**
11
 * Class Coordinates.
12
 *
13
 * Stores Avatar coordinates in array, first X second Y
14
 */
15
final class Coordinates
16
{
17
    public const FACE = [
18
        ImageSection::TOP => [8, 0],
19
        ImageSection::BOTTOM => [16, 0],
20
        ImageSection::FRONT => [8, 8],
21
        ImageSection::BACK => [24, 8],
22
        ImageSection::RIGHT => [0, 8],
23
        ImageSection::LEFT => [16, 8],
24
    ];
25
26
    public const HELM = [
27
        ImageSection::TOP => [40, 0],
28
        ImageSection::BOTTOM => [48, 8],
29
        ImageSection::FRONT => [40, 8],
30
        ImageSection::BACK => [56, 8],
31
        ImageSection::RIGHT => [32, 8],
32
        ImageSection::LEFT => [48, 8],
33
    ];
34
35
    /**
36
     * @param string $section
37
     *
38
     * @return Point
39
     */
40
    public static function getAvatarSection(string $section): Point
41
    {
42
        [$x, $y] = self::FACE[$section];
43
44
        return new Point($x, $y);
45
    }
46
47
    /**
48
     * @param string $section
49
     *
50
     * @return Point
51
     */
52
    public static function getHelmSection(string $section): Point
53
    {
54
        [$x, $y] = self::HELM[$section];
55
56
        return new Point($x, $y);
57
    }
58
}
59