Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
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 8
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 Greenplugin\TelegramBot\Type;
6
7
/**
8
 * Class MaskPositionType.
9
 *
10
 * @see https://core.telegram.org/bots/api#maskposition
11
 */
12
class MaskPositionType
13
{
14
    /**
15
     * The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
16
     *
17
     * @var string
18
     */
19
    public $point;
20
21
    /**
22
     * Shift by X-axis measured in widths of the mask scaled to the face size, from left to right.
23
     * For example, choosing -1.0 will place mask just to the left of the default mask position.
24
     *
25
     * @var float
26
     */
27
    public $xShift;
28
29
    /**
30
     * Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom.
31
     * For example, 1.0 will place the mask just below the default mask position.
32
     *
33
     * @var float
34
     */
35
    public $yShift;
36
37
    /**
38
     * Mask scaling coefficient. For example, 2.0 means double size.
39
     *
40
     * @var float
41
     */
42
    public $scale;
43
44
    /**
45
     * @param string $point
46
     * @param float  $xShift
47
     * @param float  $yShift
48
     * @param float  $scale
49
     *
50
     * @return MaskPositionType
51
     */
52
    public static function create(string $point, float $xShift, float $yShift, float $scale): MaskPositionType
53
    {
54
        $instance = new self();
55
        $instance->point = $point;
56
        $instance->xShift = $xShift;
57
        $instance->yShift = $yShift;
58
        $instance->$scale = $scale;
59
60
        return $instance;
61
    }
62
}
63