-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathElement.php
115 lines (102 loc) · 3.2 KB
/
Element.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* This file is part of PhpAidc LabelPrinter package.
*
* © Appwilio (https://appwilio.com)
* © JhaoDa (https://github.com/jhaoda)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace PhpAidc\LabelPrinter\Label;
use PhpAidc\LabelPrinter\Command\Raw;
use PhpAidc\LabelPrinter\Command\Clear;
use PhpAidc\LabelPrinter\Command\Bitmap;
use PhpAidc\LabelPrinter\Command\Barcode;
use PhpAidc\LabelPrinter\Command\QRCode;
use PhpAidc\LabelPrinter\Command\TextLine;
use PhpAidc\LabelPrinter\Command\TextBlock;
use PhpAidc\LabelPrinter\Command\ExternalImage;
use PhpAidc\LabelPrinter\Command\InternalImage;
final class Element
{
/**
* Sends raw command to the printer.
*
* @param iterable|string $data
*
* @return Raw
*/
public static function raw($data): Raw
{
return new Raw($data);
}
/**
* Partially or completely clears the print image buffer.
*
* @param string|null $field the field from which the print image buffer
* should be cleared (Fingerprint only)
*
* @return Clear
*/
public static function clear(?string $field = null): Clear
{
return new Clear($field);
}
public static function bitmap(int $x, int $y, \Imagick $canvas): Bitmap
{
return new Bitmap(...\func_get_args());
}
/**
* Prints an image from host's filesystem.
*
* @param int $x
* @param int $y
* @param \SplFileInfo|string $source
*
* @return ExternalImage
*/
public static function extImage(int $x, int $y, $source): ExternalImage
{
return new ExternalImage(...\func_get_args());
}
/**
* Prints an image stored in the printer's memory.
*
* @param int $x
* @param int $y
* @param string $name full name of the image
*
* @return InternalImage
*/
public static function intImage(int $x, int $y, string $name): InternalImage
{
return new InternalImage(...\func_get_args());
}
public static function barcode(int $x, int $y, string $data, string $type): Barcode
{
return new Barcode(...\func_get_args());
}
public static function textLine(int $x, int $y, string $text, string $font, $size = null): TextLine
{
return new TextLine(...\func_get_args());
}
public static function textBlock(int $x, int $y, string $text, string $font, float $size = null): TextBlock
{
return new TextBlock(...\func_get_args());
}
/**
* Print a qr code in the label
* @param int $x
* @param int $y
* @param string $data
* @param string $eccLevel Error correction recovery level (L: 7% / M: 15% / Q: 25% / H: 30%)
* @param int $cellWidth Width of a single cell (1~N)
* @param string $mode Encode mode (A: auto / M: manual)
*/
public static function qrcode(int $x, int $y, string $data, string $eccLevel, int $cellWidth, string $mode): QRCode
{
return new QRCode(...\func_get_args());
}
}