Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

MaskPositionType::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type;
6
7
/**
8
 * Class MaskPositionType.
9
 *
10
 * @see https://core.telegram.org/bots/api#maskposition
11
 */
12
class MaskPositionType
13
{
14
    const MASK_POINT_FOREHEAD = 'forehead';
15
    const MASK_POINT_EYES = 'eyes';
16
    const MASK_POINT_MOUTH = 'mouth';
17
    const MASK_POINT_CHIN = 'chin';
18
19
    /**
20
     * The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
21
     *
22
     * @var string
23
     */
24
    public $point;
25
26
    /**
27
     * Shift by X-axis measured in widths of the mask scaled to the face size, from left to right.
28
     * For example, choosing -1.0 will place mask just to the left of the default mask position.
29
     *
30
     * @var float
31
     */
32
    public $xShift;
33
34
    /**
35
     * Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom.
36
     * For example, 1.0 will place the mask just below the default mask position.
37
     *
38
     * @var float
39
     */
40
    public $yShift;
41
42
    /**
43
     * Mask scaling coefficient. For example, 2.0 means double size.
44
     *
45
     * @var float
46
     */
47
    public $scale;
48
49
    /**
50
     * @param string $point
51
     * @param float  $xShift
52
     * @param float  $yShift
53
     * @param float  $scale
54
     *
55
     * @return MaskPositionType
56
     */
57
    public static function create(string $point, float $xShift, float $yShift, float $scale): MaskPositionType
58
    {
59
        $instance = new static();
60
        $instance->point = $point;
61
        $instance->xShift = $xShift;
62
        $instance->yShift = $yShift;
63
        $instance->scale = $scale;
64
65
        return $instance;
66
    }
67
}
68