Skip to content

Commit bac7e86

Browse files
committed
Update dependencies
1 parent e6ba1a0 commit bac7e86

File tree

7 files changed

+53
-22
lines changed

7 files changed

+53
-22
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,8 @@ test:
268268
uninstall:
269269
rm -rf $(PATHINSTBIN)
270270
rm -rf $(PATHINSTDOC)
271+
272+
# Increase the version patch number
273+
.PHONY: versionup
274+
versionup:
275+
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d\n",$$1,$$2,(($$3+1)));}' > VERSION

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.2
1+
2.4.0

resources/debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
1010
Package: ~#PKGNAME#~
1111
Provides: php-~#PROJECT#~
1212
Architecture: all
13-
Depends: php (>= 8.0.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.2.4), ${misc:Depends}
13+
Depends: php (>= 8.0.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.2.5), ${misc:Depends}
1414
Description: PHP Barcode library
1515
This library includes PHP classes to generate linear
1616
and bidimensional barcodes:

resources/rpm/rpm.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BuildArch: noarch
1818

1919
Requires: php(language) >= 8.0.0
2020
Requires: php-composer(%{c_vendor}/tc-lib-color) < 3.0.0
21-
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.2.4
21+
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.2.5
2222
Requires: php-bcmath
2323
Requires: php-date
2424
Requires: php-gd

src/Model.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,14 @@ public function getExtendedCode(): string;
112112
public function getSvg(?string $filename = null): void;
113113

114114
/**
115-
* Get the barcode as SVG code
115+
* Get the barcode as inline SVG code.
116+
*
117+
* @return string Inline SVG code.
118+
*/
119+
public function getInlineSvgCode(): string;
120+
121+
/**
122+
* Get the barcode as SVG code, including the XML declaration.
116123
*
117124
* @return string SVG code
118125
*/

src/Type.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ protected function getHTTPFile(
305305
}
306306

307307
/**
308-
* Get the barcode as SVG image object
308+
* Get the barcode as SVG image object.
309309
*
310310
* @param string|null $filename The file name without extension (optional).
311311
* Only allows alphanumeric characters, underscores and hyphens.
@@ -318,11 +318,11 @@ public function getSvg(?string $filename = null): void
318318
}
319319

320320
/**
321-
* Get the barcode as SVG code
321+
* Get the barcode as inline SVG code.
322322
*
323-
* @return string SVG code
323+
* @return string Inline SVG code.
324324
*/
325-
public function getSvgCode(): string
325+
public function getInlineSvgCode(): string
326326
{
327327
// flags for htmlspecialchars
328328
$hflag = ENT_NOQUOTES;
@@ -332,15 +332,16 @@ public function getSvgCode(): string
332332

333333
$width = sprintf('%F', ($this->width + $this->padding['L'] + $this->padding['R']));
334334
$height = sprintf('%F', ($this->height + $this->padding['T'] + $this->padding['B']));
335-
$svg = '<?xml version="1.0" standalone="no" ?>' . "\n"
336-
. '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'
337-
. "\n"
338-
. '<svg'
335+
336+
$svg = '<svg'
337+
. ' version="1.2"'
338+
. ' baseProfile="full"'
339+
. ' xmlns="http://www.w3.org/2000/svg"'
340+
. ' xmlns:xlink="http://www.w3.org/1999/xlink"'
341+
. ' xmlns:ev="http://www.w3.org/2001/xml-events"'
339342
. ' width="' . $width . '"'
340343
. ' height="' . $height . '"'
341344
. ' viewBox="0 0 ' . $width . ' ' . $height . '"'
342-
. ' version="1.1"'
343-
. ' xmlns="http://www.w3.org/2000/svg"'
344345
. '>' . "\n"
345346
. "\t" . '<desc>' . htmlspecialchars($this->code, $hflag, 'UTF-8') . '</desc>' . "\n";
346347
if ($this->bg_color_obj instanceof \Com\Tecnick\Color\Model\Rgb) {
@@ -371,6 +372,18 @@ public function getSvgCode(): string
371372
. '</svg>' . "\n");
372373
}
373374

375+
/**
376+
* Get the barcode as SVG code, including the XML declaration.
377+
*
378+
* @return string SVG code
379+
*/
380+
public function getSvgCode(): string
381+
{
382+
return '<?xml version="1.0" standalone="no" ?>'
383+
. "\n"
384+
. $this->getInlineSvgCode();
385+
}
386+
374387
/**
375388
* Get an HTML representation of the barcode.
376389
*

test/BarcodeTest.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,15 @@ public function testExportMethods(): void
175175

176176
$svg = $type->setBackgroundColor('yellow')->getSvgCode();
177177
$expected = '<?xml version="1.0" standalone="no" ?>
178-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
179-
<svg width="44.000000" height="8.000000"'
180-
. ' viewBox="0 0 44.000000 8.000000" version="1.1" xmlns="http://www.w3.org/2000/svg">
178+
<svg'
179+
. ' version="1.2"'
180+
. ' baseProfile="full"'
181+
. ' xmlns="http://www.w3.org/2000/svg"'
182+
. ' xmlns:xlink="http://www.w3.org/1999/xlink"'
183+
. ' xmlns:ev="http://www.w3.org/2001/xml-events"'
184+
. ' width="44.000000"'
185+
. ' height="8.000000"'
186+
. ' viewBox="0 0 44.000000 8.000000">
181187
<desc>01001100011100001111,10110011100011110000</desc>
182188
<rect x="0" y="0" width="44.000000" height="8.000000" fill="#ffff00"'
183189
. ' stroke="none" stroke-width="0" stroke-linecap="square" />
@@ -306,10 +312,10 @@ public function testGetSvg(): void
306312
$type->getSvg();
307313
$svg = ob_get_clean();
308314
$this->assertNotFalse($svg);
309-
$this->assertEquals('86e0362768e8b1b26032381232c0367f', md5($svg));
315+
$this->assertEquals('114f33435c265345f7c6cdf673922292', md5($svg));
310316
$headers = xdebug_get_headers();
311317
$this->assertEquals(
312-
'Content-Disposition: inline; filename="86e0362768e8b1b26032381232c0367f.svg";',
318+
'Content-Disposition: inline; filename="114f33435c265345f7c6cdf673922292.svg";',
313319
$headers[5]
314320
);
315321

@@ -318,10 +324,10 @@ public function testGetSvg(): void
318324
$type->getSvg('#~');
319325
$svg = ob_get_clean();
320326
$this->assertNotFalse($svg);
321-
$this->assertEquals('86e0362768e8b1b26032381232c0367f', md5($svg));
327+
$this->assertEquals('114f33435c265345f7c6cdf673922292', md5($svg));
322328
$headers = xdebug_get_headers();
323329
$this->assertEquals(
324-
'Content-Disposition: inline; filename="86e0362768e8b1b26032381232c0367f.svg";',
330+
'Content-Disposition: inline; filename="114f33435c265345f7c6cdf673922292.svg";',
325331
$headers[5]
326332
);
327333

@@ -330,7 +336,7 @@ public function testGetSvg(): void
330336
$type->getSvg('test_SVG_filename-001');
331337
$svg = ob_get_clean();
332338
$this->assertNotFalse($svg);
333-
$this->assertEquals('86e0362768e8b1b26032381232c0367f', md5($svg));
339+
$this->assertEquals('114f33435c265345f7c6cdf673922292', md5($svg));
334340
$headers = xdebug_get_headers();
335341
$this->assertEquals(
336342
'Content-Disposition: inline; filename="test_SVG_filename-001.svg";',

0 commit comments

Comments
 (0)