mirror of
https://github.com/Karaka-Management/oms-Labeling.git
synced 2026-01-11 09:08:42 +00:00
fix tests
This commit is contained in:
parent
25a81b7101
commit
a06c6c8c6d
|
|
@ -550,6 +550,13 @@ class GS1Datamatrix
|
|||
|
||||
public array $data = [];
|
||||
|
||||
/**
|
||||
* Validate GS1 data
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function validate() : bool
|
||||
{
|
||||
if (empty($this->data['01'] ?? '')) {
|
||||
|
|
@ -565,6 +572,13 @@ class GS1Datamatrix
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render GS1 string representation
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderString() : string
|
||||
{
|
||||
$text = '';
|
||||
|
|
@ -576,6 +590,13 @@ class GS1Datamatrix
|
|||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render internal GS1 string used for datamatrix etc.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderCodeString() : string
|
||||
{
|
||||
// 232 = FNC1 = ]C1
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ class Label
|
|||
|
||||
public array $elements = [];
|
||||
|
||||
/**
|
||||
* Render label
|
||||
*
|
||||
* @return null|\GdImage
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function render() : ?\GdImage
|
||||
{
|
||||
$im = \imagecreatetruecolor((int) (37.8 * $this->width), (int) (37.8 * $this->height));
|
||||
|
|
@ -58,6 +65,7 @@ class Label
|
|||
foreach ($this->elements as $element) {
|
||||
$color = 0;
|
||||
|
||||
// @todo: replace int type with enum
|
||||
if ($element instanceof Shape) {
|
||||
if ($element->type === 1) {
|
||||
// Line
|
||||
|
|
@ -88,9 +96,9 @@ class Label
|
|||
$bg
|
||||
);
|
||||
}
|
||||
} elseif ($element->type === 3) {
|
||||
} elseif ($element->type === 4) {
|
||||
}
|
||||
|
||||
// @todo: implement circle + elipse
|
||||
} elseif ($element instanceof Text) {
|
||||
\imagettftext($im, $element->size, 0, $element->x, $element->y, $color, $element->font, $element->text);
|
||||
} elseif ($element instanceof Image) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user