Builder::wordSpaceVariance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
4
namespace Nickcheek\Handwriting;
5
6
7
class Builder
8
{
9
    protected string $url;
10
    protected string $text;
11
    protected string $font;
12
    protected string $size;
13
    protected string $color;
14
    protected string $width;
15
    protected string $height;
16
    protected string $lineSpace;
17
    protected string $randomSeed;
18
    protected string $lineSpaceVariance;
19
    protected string $wordSpaceVariance;
20
21
    public function __construct()
22
    {
23
        $this->font = 'handwriting_id=2D5QW0F80001';
24
        $this->text ??= '&text=test';
25
        $this->height = '&height=auto';
26
        $this->width = '';
27
        $this->size = '';
28
        $this->lineSpace = '';
29
        $this->lineSpaceVariance='';
30
        $this->wordSpaceVariance = '';
31
        $this->randomSeed = '';
32
        $this->color = '';
33
    }
34
35
    public function build(): string
36
    {
37
        $this->url = $this->font.$this->text.$this->width.$this->height.$this->size.$this->lineSpace.$this->lineSpaceVariance.$this->wordSpaceVariance.$this->randomSeed.$this->color;
38
        return $this->url;
39
    }
40
41
    public function font($handwriting_id='2D5QW0F80001'): object
42
    {
43
        $this->font = 'handwriting_id='.$handwriting_id;
44
        return $this;
45
    }
46
47
    public function text($text): object
48
    {
49
        $this->text = '&text=' . $text;
50
        return $this;
51
    }
52
53
    public function width($width): object
54
    {
55
        $this->width = '&width=' . $width;
56
        return $this;
57
    }
58
59
    public function height($height): object
60
    {
61
        $this->height = '&height=' . $height;
62
        return $this;
63
    }
64
65
    public function size($size): object
66
    {
67
        $this->size = '&handwriting_size=' . $size;
68
        return $this;
69
    }
70
71
    public function lineSpace($lineSpace): object
72
    {
73
        $this->lineSpace = '&line_spacing=' . $lineSpace;
74
        return $this;
75
    }
76
77
    public function lineSpaceVariance($lineSpaceVariance): object
78
    {
79
        $this->lineSpaceVariance = '&line_spacing_variance=' . $lineSpaceVariance;
80
        return $this;
81
    }
82
83
    public function wordSpaceVariance($wordSpace): object
84
    {
85
        $this->wordSpaceVariance = '&word_spacing_variance=' . $wordSpace;
86
        return $this;
87
    }
88
89
    public function randomSeed($seed): object
90
    {
91
        $this->randomSeed = '&random_seed=' . $seed;
92
        return $this;
93
    }
94
95
    public function color($color): object
96
    {
97
        $this->color = '&handwriting_color=' . $color;
98
        return $this;
99
    }
100
101
}
102