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