Update dependencies

This commit is contained in:
Benoit Vianin 2023-01-07 10:54:31 +01:00
parent 4f030b05af
commit c42ebb8062
675 changed files with 26593 additions and 13121 deletions

View File

@ -34,5 +34,11 @@
"allow-plugins": {
"ocramius/package-versions": true
}
},
"archive": {
"exclude": [
"/test",
"/phpunit.xml.dist"
]
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="BaconQrCode Tests">
<directory>./test</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -89,6 +89,9 @@ final class CharacterSetEci extends AbstractEnum
*/
private static $nameToEci;
/**
* @param int[] $values
*/
public function __construct(array $values, string ...$otherEncodingNames)
{
$this->values = $values;

View File

@ -62,7 +62,7 @@ class FormatInformation
/**
* Offset i holds the number of 1 bits in the binary representation of i.
*
* @var array
* @var int[]
*/
private const BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4];

View File

@ -42,6 +42,9 @@ final class Mode extends AbstractEnum
*/
private $bits;
/**
* @param int[] $characterCountBitsForVersions
*/
protected function __construct(array $characterCountBitsForVersions, int $bits)
{
$this->characterCountBitsForVersions = $characterCountBitsForVersions;

View File

@ -37,7 +37,7 @@ final class Encoder
/**
* Codec cache.
*
* @var array
* @var array<string,ReedSolomonCodec>
*/
private static $codecs = [];

View File

@ -334,7 +334,7 @@ final class SvgImageBackEnd implements ImageBackEndInterface
$this->xmlWriter->writeAttribute('stop-color', $this->getColorString($startColor));
if ($startColor instanceof Alpha) {
$this->xmlWriter->writeAttribute('stop-opacity', $startColor->getAlpha());
$this->xmlWriter->writeAttribute('stop-opacity', (string) $startColor->getAlpha());
}
$this->xmlWriter->endElement();
@ -344,7 +344,7 @@ final class SvgImageBackEnd implements ImageBackEndInterface
$this->xmlWriter->writeAttribute('stop-color', $this->getColorString($endColor));
if ($endColor instanceof Alpha) {
$this->xmlWriter->writeAttribute('stop-opacity', $endColor->getAlpha());
$this->xmlWriter->writeAttribute('stop-opacity', (string) $endColor->getAlpha());
}
$this->xmlWriter->endElement();

View File

@ -41,7 +41,7 @@ final class EdgeIterator implements IteratorAggregate
}
/**
* @return Edge[]
* @return Traversable<Edge>
*/
public function getIterator() : Traversable
{

View File

@ -136,7 +136,7 @@ final class EllipticArc implements OperationInterface
/**
* @return Curve[]
*/
private function createCurves(float $fromX, $fromY) : array
private function createCurves(float $fromX, float $fromY) : array
{
$xAngle = deg2rad($this->xAxisAngle);
list($centerX, $centerY, $radiusX, $radiusY, $startAngle, $deltaAngle) =

View File

@ -17,10 +17,16 @@ use BaconQrCode\Writer;
use PHPUnit\Framework\TestCase;
use Spatie\Snapshots\MatchesSnapshots;
/**
* @group integration
*/
final class ImagickRenderingTest extends TestCase
{
use MatchesSnapshots;
/**
* @requires extension imagick
*/
public function testGenericQrCode() : void
{
$renderer = new ImageRenderer(
@ -35,6 +41,9 @@ final class ImagickRenderingTest extends TestCase
unlink($tempName);
}
/**
* @requires extension imagick
*/
public function testIssue79() : void
{
$eye = SquareEye::instance();

View File

@ -16,7 +16,7 @@ return array(
'NumberFormatter' => $vendorDir . '/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php',
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);

View File

@ -174,7 +174,7 @@ class ComposerStaticInit2d2f03c80bad397451a8de89740becf0
'NumberFormatter' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php',
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);

View File

@ -2,17 +2,17 @@
"packages": [
{
"name": "bacon/bacon-qr-code",
"version": "2.0.7",
"version_normalized": "2.0.7.0",
"version": "2.0.8",
"version_normalized": "2.0.8.0",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c"
"reference": "8674e51bb65af933a5ffaf1c308a660387c35c22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22",
"reference": "8674e51bb65af933a5ffaf1c308a660387c35c22",
"shasum": ""
},
"require": {
@ -29,7 +29,7 @@
"suggest": {
"ext-imagick": "to generate QR code images"
},
"time": "2022-03-14T02:02:36+00:00",
"time": "2022-12-07T17:46:57+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -53,7 +53,7 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7"
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8"
},
"install-path": "../bacon/bacon-qr-code"
},
@ -187,26 +187,28 @@
},
{
"name": "khanamiryan/qrcode-detector-decoder",
"version": "1.0.5.2",
"version_normalized": "1.0.5.2",
"version": "1.0.6",
"version_normalized": "1.0.6.0",
"source": {
"type": "git",
"url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git",
"reference": "04fdd58d86a387065f707dc6d3cc304c719910c1"
"reference": "45326fb83a2a375065dbb3a134b5b8a5872da569"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/04fdd58d86a387065f707dc6d3cc304c719910c1",
"reference": "04fdd58d86a387065f707dc6d3cc304c719910c1",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/45326fb83a2a375065dbb3a134b5b8a5872da569",
"reference": "45326fb83a2a375065dbb3a134b5b8a5872da569",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0"
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0",
"rector/rector": "^0.13.6",
"symplify/easy-coding-standard": "^11.0"
},
"time": "2021-07-13T18:46:38+00:00",
"time": "2022-06-29T09:25:13+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -239,7 +241,7 @@
],
"support": {
"issues": "https://github.com/khanamiryan/php-qrcode-detector-decoder/issues",
"source": "https://github.com/khanamiryan/php-qrcode-detector-decoder/tree/1.0.5.2"
"source": "https://github.com/khanamiryan/php-qrcode-detector-decoder/tree/1.0.6"
},
"install-path": "../khanamiryan/qrcode-detector-decoder"
},
@ -297,17 +299,17 @@
},
{
"name": "myclabs/php-enum",
"version": "1.8.3",
"version_normalized": "1.8.3.0",
"version": "1.8.4",
"version_normalized": "1.8.4.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "b942d263c641ddb5190929ff840c68f78713e937"
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937",
"reference": "b942d263c641ddb5190929ff840c68f78713e937",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
"shasum": ""
},
"require": {
@ -319,13 +321,16 @@
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
},
"time": "2021-07-05T08:18:36+00:00",
"time": "2022-08-04T09:53:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"classmap": [
"stubs/Stringable.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -344,7 +349,7 @@
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.3"
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
},
"funding": [
{
@ -425,8 +430,8 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.1",
"version_normalized": "2.5.1.0",
"version": "v2.5.2",
"version_normalized": "2.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
@ -475,7 +480,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
},
"funding": [
{
@ -495,17 +500,17 @@
},
{
"name": "symfony/intl",
"version": "v5.4.8",
"version_normalized": "5.4.8.0",
"version": "v5.4.15",
"version_normalized": "5.4.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
"reference": "b9e17d7ab867ce99f89950ebced0fa91076ba12b"
"reference": "2cb39da7f6e7b7344d7d5317dbee8db9d12cc714"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/b9e17d7ab867ce99f89950ebced0fa91076ba12b",
"reference": "b9e17d7ab867ce99f89950ebced0fa91076ba12b",
"url": "https://api.github.com/repos/symfony/intl/zipball/2cb39da7f6e7b7344d7d5317dbee8db9d12cc714",
"reference": "2cb39da7f6e7b7344d7d5317dbee8db9d12cc714",
"shasum": ""
},
"require": {
@ -516,7 +521,7 @@
"require-dev": {
"symfony/filesystem": "^4.4|^5.0|^6.0"
},
"time": "2022-04-07T09:39:59+00:00",
"time": "2022-10-19T14:28:49+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -566,7 +571,7 @@
"localization"
],
"support": {
"source": "https://github.com/symfony/intl/tree/v5.4.8"
"source": "https://github.com/symfony/intl/tree/v5.4.15"
},
"funding": [
{
@ -586,17 +591,17 @@
},
{
"name": "symfony/options-resolver",
"version": "v5.4.3",
"version_normalized": "5.4.3.0",
"version": "v5.4.11",
"version_normalized": "5.4.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8"
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8",
"reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690",
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690",
"shasum": ""
},
"require": {
@ -605,7 +610,7 @@
"symfony/polyfill-php73": "~1.0",
"symfony/polyfill-php80": "^1.16"
},
"time": "2022-01-02T09:53:40+00:00",
"time": "2022-07-20T13:00:38+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -638,7 +643,7 @@
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v5.4.3"
"source": "https://github.com/symfony/options-resolver/tree/v5.4.11"
},
"funding": [
{
@ -658,17 +663,17 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
"shasum": ""
},
"require": {
@ -680,11 +685,11 @@
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -723,7 +728,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
},
"funding": [
{
@ -743,17 +748,17 @@
},
{
"name": "symfony/polyfill-intl-grapheme",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
"reference": "433d05519ce6990bf3530fba6957499d327395c2"
"reference": "511a08c03c1960e08a883f4cffcacd219b758354"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2",
"reference": "433d05519ce6990bf3530fba6957499d327395c2",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354",
"reference": "511a08c03c1960e08a883f4cffcacd219b758354",
"shasum": ""
},
"require": {
@ -762,11 +767,11 @@
"suggest": {
"ext-intl": "For best performance"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -807,7 +812,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0"
},
"funding": [
{
@ -827,17 +832,17 @@
},
{
"name": "symfony/polyfill-intl-icu",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-icu.git",
"reference": "e407643d610e5f2c8a4b14189150f68934bf5e48"
"reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/e407643d610e5f2c8a4b14189150f68934bf5e48",
"reference": "e407643d610e5f2c8a4b14189150f68934bf5e48",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/a3d9148e2c363588e05abbdd4ee4f971f0a5330c",
"reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c",
"shasum": ""
},
"require": {
@ -846,11 +851,11 @@
"suggest": {
"ext-intl": "For best performance and support of other locales than \"en\""
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -897,7 +902,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.27.0"
},
"funding": [
{
@ -917,17 +922,17 @@
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "219aa369ceff116e673852dce47c3a41794c14bd"
"reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd",
"reference": "219aa369ceff116e673852dce47c3a41794c14bd",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6",
"reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6",
"shasum": ""
},
"require": {
@ -936,11 +941,11 @@
"suggest": {
"ext-intl": "For best performance"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -984,7 +989,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0"
},
"funding": [
{
@ -1004,17 +1009,17 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"shasum": ""
},
"require": {
@ -1026,11 +1031,11 @@
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1070,7 +1075,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
},
"funding": [
{
@ -1090,27 +1095,27 @@
},
{
"name": "symfony/polyfill-php73",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85"
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85",
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1152,7 +1157,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0"
},
"funding": [
{
@ -1172,27 +1177,27 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2022-05-10T07:21:04+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1238,7 +1243,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
},
"funding": [
{
@ -1258,27 +1263,27 @@
},
{
"name": "symfony/polyfill-php81",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"version": "v1.27.0",
"version_normalized": "1.27.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1"
"reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1",
"reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a",
"reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2022-05-24T11:49:31+00:00",
"time": "2022-11-03T14:55:06+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
@ -1320,7 +1325,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0"
},
"funding": [
{
@ -1340,17 +1345,17 @@
},
{
"name": "symfony/property-access",
"version": "v5.4.8",
"version_normalized": "5.4.8.0",
"version": "v5.4.15",
"version_normalized": "5.4.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "fe501d498d6ec7e9efe928c90fabedf629116495"
"reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495",
"reference": "fe501d498d6ec7e9efe928c90fabedf629116495",
"url": "https://api.github.com/repos/symfony/property-access/zipball/0f3e8f40a1d3da90f674b3dd772e4777ccde4273",
"reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273",
"shasum": ""
},
"require": {
@ -1365,7 +1370,7 @@
"suggest": {
"psr/cache-implementation": "To cache access methods."
},
"time": "2022-04-12T15:48:08+00:00",
"time": "2022-10-27T07:55:40+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1404,7 +1409,7 @@
"reflection"
],
"support": {
"source": "https://github.com/symfony/property-access/tree/v5.4.8"
"source": "https://github.com/symfony/property-access/tree/v5.4.15"
},
"funding": [
{
@ -1424,17 +1429,17 @@
},
{
"name": "symfony/property-info",
"version": "v5.4.9",
"version_normalized": "5.4.9.0",
"version": "v5.4.17",
"version_normalized": "5.4.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "6f0a452aaba45e763f89e328df437f73a720e18e"
"reference": "12e1f7b3d73b1f3690aa524b92b5de9937507361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/6f0a452aaba45e763f89e328df437f73a720e18e",
"reference": "6f0a452aaba45e763f89e328df437f73a720e18e",
"url": "https://api.github.com/repos/symfony/property-info/zipball/12e1f7b3d73b1f3690aa524b92b5de9937507361",
"reference": "12e1f7b3d73b1f3690aa524b92b5de9937507361",
"shasum": ""
},
"require": {
@ -1449,7 +1454,7 @@
"symfony/dependency-injection": "<4.4"
},
"require-dev": {
"doctrine/annotations": "^1.10.4",
"doctrine/annotations": "^1.10.4|^2",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"phpstan/phpdoc-parser": "^1.0",
"symfony/cache": "^4.4|^5.0|^6.0",
@ -1462,7 +1467,7 @@
"symfony/doctrine-bridge": "To use Doctrine metadata",
"symfony/serializer": "To use Serializer metadata"
},
"time": "2022-05-17T09:47:20+00:00",
"time": "2022-12-20T11:10:57+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1498,7 +1503,7 @@
"validator"
],
"support": {
"source": "https://github.com/symfony/property-info/tree/v5.4.9"
"source": "https://github.com/symfony/property-info/tree/v5.4.17"
},
"funding": [
{
@ -1518,17 +1523,17 @@
},
{
"name": "symfony/string",
"version": "v5.4.9",
"version_normalized": "5.4.9.0",
"version": "v5.4.17",
"version_normalized": "5.4.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99"
"reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99",
"reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99",
"url": "https://api.github.com/repos/symfony/string/zipball/55733a8664b8853b003e70251c58bc8cb2d82a6b",
"reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b",
"shasum": ""
},
"require": {
@ -1548,7 +1553,7 @@
"symfony/translation-contracts": "^1.1|^2",
"symfony/var-exporter": "^4.4|^5.0|^6.0"
},
"time": "2022-04-19T10:40:37+00:00",
"time": "2022-12-12T15:54:21+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1587,7 +1592,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.4.9"
"source": "https://github.com/symfony/string/tree/v5.4.17"
},
"funding": [
{
@ -1607,17 +1612,17 @@
},
{
"name": "symfony/translation-contracts",
"version": "v2.5.1",
"version_normalized": "2.5.1.0",
"version": "v2.5.2",
"version_normalized": "2.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "1211df0afa701e45a04253110e959d4af4ef0f07"
"reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07",
"reference": "1211df0afa701e45a04253110e959d4af4ef0f07",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe",
"reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe",
"shasum": ""
},
"require": {
@ -1626,7 +1631,7 @@
"suggest": {
"symfony/translation-implementation": ""
},
"time": "2022-01-02T09:53:40+00:00",
"time": "2022-06-27T16:58:25+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1668,7 +1673,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/translation-contracts/tree/v2.5.1"
"source": "https://github.com/symfony/translation-contracts/tree/v2.5.2"
},
"funding": [
{
@ -1688,17 +1693,17 @@
},
{
"name": "symfony/validator",
"version": "v5.4.8",
"version_normalized": "5.4.8.0",
"version": "v5.4.17",
"version_normalized": "5.4.17.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/validator.git",
"reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad"
"reference": "621b820204a238d754f7f60241fcbdb1687641ea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad",
"reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad",
"url": "https://api.github.com/repos/symfony/validator/zipball/621b820204a238d754f7f60241fcbdb1687641ea",
"reference": "621b820204a238d754f7f60241fcbdb1687641ea",
"shasum": ""
},
"require": {
@ -1725,7 +1730,7 @@
"symfony/yaml": "<4.4"
},
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/annotations": "^1.13|^2",
"doctrine/cache": "^1.11|^2.0",
"egulias/email-validator": "^2.1.10|^3",
"symfony/cache": "^4.4|^5.0|^6.0",
@ -1756,7 +1761,7 @@
"symfony/translation": "For translating validation errors.",
"symfony/yaml": ""
},
"time": "2022-04-15T08:07:45+00:00",
"time": "2022-12-21T19:20:17+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1784,7 +1789,7 @@
"description": "Provides tools to validate values",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/validator/tree/v5.4.8"
"source": "https://github.com/symfony/validator/tree/v5.4.17"
},
"funding": [
{
@ -1803,6 +1808,6 @@
"install-path": "../symfony/validator"
}
],
"dev": false,
"dev": true,
"dev-package-names": []
}

View File

@ -1,28 +1,28 @@
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4f030b05af2d8e0e4875c40d35686b88e7924979',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => false,
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4f030b05af2d8e0e4875c40d35686b88e7924979',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'bacon/bacon-qr-code' => array(
'pretty_version' => '2.0.7',
'version' => '2.0.7.0',
'reference' => 'd70c840f68657ce49094b8d91f9ee0cc07fbf66c',
'pretty_version' => '2.0.8',
'version' => '2.0.8.0',
'reference' => '8674e51bb65af933a5ffaf1c308a660387c35c22',
'type' => 'library',
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
'aliases' => array(),
@ -47,9 +47,9 @@
'dev_requirement' => false,
),
'khanamiryan/qrcode-detector-decoder' => array(
'pretty_version' => '1.0.5.2',
'version' => '1.0.5.2',
'reference' => '04fdd58d86a387065f707dc6d3cc304c719910c1',
'pretty_version' => '1.0.6',
'version' => '1.0.6.0',
'reference' => '45326fb83a2a375065dbb3a134b5b8a5872da569',
'type' => 'library',
'install_path' => __DIR__ . '/../khanamiryan/qrcode-detector-decoder',
'aliases' => array(),
@ -65,9 +65,9 @@
'dev_requirement' => false,
),
'myclabs/php-enum' => array(
'pretty_version' => '1.8.3',
'version' => '1.8.3.0',
'reference' => 'b942d263c641ddb5190929ff840c68f78713e937',
'pretty_version' => '1.8.4',
'version' => '1.8.4.0',
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/php-enum',
'aliases' => array(),
@ -83,8 +83,8 @@
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v2.5.1',
'version' => '2.5.1.0',
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
@ -92,135 +92,135 @@
'dev_requirement' => false,
),
'symfony/intl' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => 'b9e17d7ab867ce99f89950ebced0fa91076ba12b',
'pretty_version' => 'v5.4.15',
'version' => '5.4.15.0',
'reference' => '2cb39da7f6e7b7344d7d5317dbee8db9d12cc714',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/intl',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/options-resolver' => array(
'pretty_version' => 'v5.4.3',
'version' => '5.4.3.0',
'reference' => 'cc1147cb11af1b43f503ac18f31aa3bec213aba8',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'reference' => '54f14e36aa73cb8f7261d7686691fd4d75ea2690',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '433d05519ce6990bf3530fba6957499d327395c2',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '511a08c03c1960e08a883f4cffcacd219b758354',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-intl-icu' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => 'e407643d610e5f2c8a4b14189150f68934bf5e48',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => 'a3d9148e2c363588e05abbdd4ee4f971f0a5330c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-icu',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '219aa369ceff116e673852dce47c3a41794c14bd',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '19bd1e4fcd5b91116f14d8533c57831ed00571b6',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php73' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => 'e440d35fa0286f77fb45b79a03fedbeda9307e85',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '9e8ecb5f92152187c4799efd3c96b78ccab18ff9',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php73',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php81' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '13f6d1271c663dc5ae9fb843a8f16521db7687a1',
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '707403074c8ea6e2edaf8794b0157a0bfa52157a',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php81',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/property-access' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => 'fe501d498d6ec7e9efe928c90fabedf629116495',
'pretty_version' => 'v5.4.15',
'version' => '5.4.15.0',
'reference' => '0f3e8f40a1d3da90f674b3dd772e4777ccde4273',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-access',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/property-info' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => '6f0a452aaba45e763f89e328df437f73a720e18e',
'pretty_version' => 'v5.4.17',
'version' => '5.4.17.0',
'reference' => '12e1f7b3d73b1f3690aa524b92b5de9937507361',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-info',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/string' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => '985e6a9703ef5ce32ba617c9c7d97873bb7b2a99',
'pretty_version' => 'v5.4.17',
'version' => '5.4.17.0',
'reference' => '55733a8664b8853b003e70251c58bc8cb2d82a6b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/translation-contracts' => array(
'pretty_version' => 'v2.5.1',
'version' => '2.5.1.0',
'reference' => '1211df0afa701e45a04253110e959d4af4ef0f07',
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/validator' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => 'bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad',
'pretty_version' => 'v5.4.17',
'version' => '5.4.17.0',
'reference' => '621b820204a238d754f7f60241fcbdb1687641ea',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/validator',
'aliases' => array(),

View File

@ -16,6 +16,7 @@ $ composer require khanamiryan/qrcode-detector-decoder
## Usage
```php
require __DIR__ . "/vendor/autoload.php";
use Zxing\QrReader;
$qrcode = new QrReader('path/to_image');
$text = $qrcode->text(); //return decoded text from QR Code
```

View File

@ -24,7 +24,9 @@
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0"
"phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0",
"rector/rector": "^0.13.6",
"symplify/easy-coding-standard": "^11.0"
},
"autoload": {
"psr-4": {
@ -33,5 +35,15 @@
"files": [
"lib/Common/customFunctions.php"
]
},
"scripts": {
"check-cs": "./vendor/bin/ecs check",
"fix-cs": "./vendor/bin/ecs check --fix",
"tests": "./vendor/bin/phpunit"
},
"autoload-dev": {
"psr-4": {
"Khanamiryan\\QrCodeTests\\": "tests/"
}
}
}

View File

@ -0,0 +1,29 @@
<?php
use Rector\Set\ValueObject\LevelSetList;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ECSConfig $configurator): void {
// alternative to CLI arguments, easier to maintain and extend
$configurator->paths([__DIR__ . '/lib', __DIR__ . '/tests']);
// choose
$configurator->sets([
SetList::CLEAN_CODE, SetList::PSR_12//, LevelSetList::UP_TO_PHP_81 //, SymfonySetList::SYMFONY_60
]);
$configurator->ruleWithConfiguration(ConcatSpaceFixer::class, [
'spacing' => 'one'
]);
// indent and tabs/spaces
// [default: spaces]. BUT: tabs are superiour due to accessibility reasons
$configurator->indentation('tab');
};

View File

@ -30,17 +30,14 @@ use Zxing\Common\BitMatrix;
*/
abstract class Binarizer
{
private $source;
protected function __construct($source)
protected function __construct(private $source)
{
$this->source = $source;
}
/**
* @return LuminanceSource
*/
public final function getLuminanceSource()
final public function getLuminanceSource()
{
return $this->source;
}
@ -53,14 +50,14 @@ abstract class Binarizer
* and passed in with each call for performance. However it is legal to keep more than one row
* at a time if needed.
*
* @param y The row to fetch, which must be in [0, bitmap height)
* @param row An optional preallocated array. If null or too small, it will be ignored.
* @param $y The row to fetch, which must be in [0, bitmap height)
* @param An $row optional preallocated array. If null or too small, it will be ignored.
* If used, the Binarizer will call BitArray.clear(). Always use the returned object.
*
* @return array The array of bits for this row (true means black).
* @throws NotFoundException if row can't be binarized
*/
public abstract function getBlackRow($y, $row);
abstract public function getBlackRow($y, $row);
/**
* Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive
@ -71,25 +68,25 @@ abstract class Binarizer
* @return BitMatrix The 2D array of bits for the image (true means black).
* @throws NotFoundException if image can't be binarized to make a matrix
*/
public abstract function getBlackMatrix();
abstract public function getBlackMatrix();
/**
* Creates a new object with the same type as this Binarizer implementation, but with pristine
* state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache
* of 1 bit data. See Effective Java for why we can't use Java's clone() method.
*
* @param source The LuminanceSource this Binarizer will operate on.
* @param $source The LuminanceSource this Binarizer will operate on.
*
* @return Binarizer A new concrete Binarizer implementation object.
*/
public abstract function createBinarizer($source);
abstract public function createBinarizer($source);
public final function getWidth()
final public function getWidth()
{
return $this->source->getWidth();
}
public final function getHeight()
final public function getHeight()
{
return $this->source->getHeight();
}

View File

@ -27,8 +27,8 @@ use Zxing\Common\BitMatrix;
*/
final class BinaryBitmap
{
private $binarizer;
private $matrix;
private readonly \Zxing\Binarizer $binarizer;
private ?\Zxing\Common\BitMatrix $matrix = null;
public function __construct(Binarizer $binarizer)
{
@ -59,8 +59,8 @@ final class BinaryBitmap
* cached data. Callers should assume this method is expensive and call it as seldom as possible.
* This method is intended for decoding 1D barcodes and may choose to apply sharpening.
*
* @param y The row to fetch, which must be in [0, bitmap height)
* @param row An optional preallocated array. If null or too small, it will be ignored.
* @param $y The row to fetch, which must be in [0, bitmap height)
* @param An $row optional preallocated array. If null or too small, it will be ignored.
* If used, the Binarizer will call BitArray.clear(). Always use the returned object.
*
* @return array The array of bits for this row (true means black).
@ -83,14 +83,14 @@ final class BinaryBitmap
* Returns a new object with cropped image data. Implementations may keep a reference to the
* original data rather than a copy. Only callable if isCropSupported() is true.
*
* @param left The left coordinate, which must be in [0,getWidth())
* @param top The top coordinate, which must be in [0,getHeight())
* @param width The width of the rectangle to crop.
* @param height The height of the rectangle to crop.
* @param $left The left coordinate, which must be in [0,getWidth())
* @param $top The top coordinate, which must be in [0,getHeight())
* @param $width The width of the rectangle to crop.
* @param $height The height of the rectangle to crop.
*
* @return BinaryBitmap A cropped version of this object.
*/
public function crop($left, $top, $width, $height)
public function crop($left, $top, $width, $height): \Zxing\BinaryBitmap
{
$newSource = $this->binarizer->getLuminanceSource()->crop($left, $top, $width, $height);
@ -111,7 +111,7 @@ final class BinaryBitmap
*
* @return BinaryBitmap A rotated version of this object.
*/
public function rotateCounterClockwise()
public function rotateCounterClockwise(): \Zxing\BinaryBitmap
{
$newSource = $this->binarizer->getLuminanceSource()->rotateCounterClockwise();
@ -124,7 +124,7 @@ final class BinaryBitmap
*
* @return BinaryBitmap A rotated version of this object.
*/
public function rotateCounterClockwise45()
public function rotateCounterClockwise45(): \Zxing\BinaryBitmap
{
$newSource = $this->binarizer->getLuminanceSource()->rotateCounterClockwise45();
@ -135,7 +135,7 @@ final class BinaryBitmap
{
try {
return $this->getBlackMatrix()->toString();
} catch (NotFoundException $e) {
} catch (NotFoundException) {
}
return '';

View File

@ -25,7 +25,7 @@ namespace Zxing;
*/
final class ChecksumException extends ReaderException
{
private static $instance;
private static ?\Zxing\ChecksumException $instance = null;
public static function getChecksumInstance($cause = null)
{

View File

@ -2,36 +2,29 @@
namespace Zxing\Common;
use \Zxing\NotFoundException;
use ReflectionClass;
/**
* A general enum implementation until we got SplEnum.
*/
final class AbstractEnum
final class AbstractEnum implements \Stringable
{
/**
* Default value.
*/
const __default = null;
public const __default = null;
/**
* Current value.
*
* @var mixed
*/
protected $value;
private $value;
/**
* Cache of constants.
*
* @var array
* @var array<string, mixed>|null
*/
protected $constants;
/**
* Whether to handle values strict or not.
*
* @var boolean
*/
protected $strict;
private ?array $constants = null;
/**
* Creates a new enum.
@ -39,9 +32,8 @@ final class AbstractEnum
* @param mixed $initialValue
* @param boolean $strict
*/
public function __construct($initialValue = null, $strict = false)
public function __construct($initialValue = null, private $strict = false)
{
$this->strict = $strict;
$this->change($initialValue);
}
@ -55,7 +47,7 @@ final class AbstractEnum
public function change($value)
{
if (!in_array($value, $this->getConstList(), $this->strict)) {
throw new \UnexpectedValueException('Value not a const in enum ' . get_class($this));
throw new \UnexpectedValueException('Value not a const in enum ' . $this::class);
}
$this->value = $value;
}
@ -97,7 +89,7 @@ final class AbstractEnum
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return (string)array_search($this->value, $this->getConstList());
}

View File

@ -32,25 +32,28 @@ namespace Zxing\Common;
final class BitArray
{
/**
* @var mixed[]|mixed|int[]|null
*/
private $bits;
/**
* @var mixed|null
*/
private $size;
public function __construct($bits = [], $size = 0)
{
if (!$bits && !$size) {
$this->$size = 0;
$this->bits = [];
} elseif ($bits && !$size) {
$this->size = $bits;
$this->bits = $this->makeArray($bits);
$this->bits = self::makeArray($bits);
} else {
$this->bits = $bits;
$this->size = $size;
}
}
private static function makeArray($size)
@ -71,9 +74,9 @@ final class BitArray
/**
* Sets bit i.
*
* @param i bit to set
* @param bit $i to set
*/
public function set($i)
public function set($i): void
{
$this->bits[(int)($i / 32)] |= 1 << ($i & 0x1F);
$this->bits[(int)($i / 32)] = ($this->bits[(int)($i / 32)]);
@ -82,16 +85,16 @@ final class BitArray
/**
* Flips bit i.
*
* @param i bit to set
* @param bit $i to set
*/
public function flip($i)
public function flip($i): void
{
$this->bits[(int)($i / 32)] ^= 1 << ($i & 0x1F);
$this->bits[(int)($i / 32)] = ($this->bits[(int)($i / 32)]);
}
/**
* @param from first bit to check
* @param first $from bit to check
*
* @return index of first bit that is set, starting from the given index, or size if none are set
* at or beyond this given index
@ -107,7 +110,7 @@ final class BitArray
// mask off lesser bits first
$currentBits &= ~((1 << ($from & 0x1F)) - 1);
while ($currentBits == 0) {
if (++$bitsOffset == count($this->bits)) {
if (++$bitsOffset == (is_countable($this->bits) ? count($this->bits) : 0)) {
return $this->size;
}
$currentBits = $this->bits[$bitsOffset];
@ -118,7 +121,7 @@ final class BitArray
}
/**
* @param from index to start looking for unset bit
* @param index $from to start looking for unset bit
*
* @return index of next unset bit, or {@code size} if none are unset until the end
* @see #getNextSet(int)
@ -133,7 +136,7 @@ final class BitArray
// mask off lesser bits first
$currentBits &= ~((1 << ($from & 0x1F)) - 1);
while ($currentBits == 0) {
if (++$bitsOffset == count($this->bits)) {
if (++$bitsOffset == (is_countable($this->bits) ? count($this->bits) : 0)) {
return $this->size;
}
$currentBits = (~$this->bits[$bitsOffset]);
@ -146,11 +149,11 @@ final class BitArray
/**
* Sets a block of 32 bits, starting at bit i.
*
* @param i first bit to set
* @param newBits the new value of the next 32 bits. Note again that the least-significant bit
* @param first $i bit to set
* @param the $newBits new value of the next 32 bits. Note again that the least-significant bit
* corresponds to bit i, the next-least-significant to i+1, and so on.
*/
public function setBulk($i, $newBits)
public function setBulk($i, $newBits): void
{
$this->bits[(int)($i / 32)] = $newBits;
}
@ -158,8 +161,8 @@ final class BitArray
/**
* Sets a range of bits.
*
* @param start start of range, inclusive.
* @param end end of range, exclusive
* @param start $start of range, inclusive.
* @param end $end of range, exclusive
*/
public function setRange($start, $end)
{
@ -191,9 +194,9 @@ final class BitArray
/**
* Clears all bits (sets to false).
*/
public function clear()
public function clear(): void
{
$max = count($this->bits);
$max = is_countable($this->bits) ? count($this->bits) : 0;
for ($i = 0; $i < $max; $i++) {
$this->bits[$i] = 0;
}
@ -202,9 +205,9 @@ final class BitArray
/**
* Efficient method to check if a range of bits is set, or not set.
*
* @param start start of range, inclusive.
* @param end end of range, exclusive
* @param value if true, checks that bits in range are set, otherwise checks that they are not set
* @param start $start of range, inclusive.
* @param end $end of range, exclusive
* @param if $value true, checks that bits in range are set, otherwise checks that they are not set
*
* @return true iff all bits are set or not set in range, according to value argument
* @throws InvalidArgumentException if end is less than or equal to start
@ -248,8 +251,8 @@ final class BitArray
* least-significant. For example, appending 6 bits from 0x000001E will append the bits
* 0, 1, 1, 1, 1, 0 in that order.
*
* @param value {@code int} containing bits to append
* @param numBits bits from value to append
* @param $value {@code int} containing bits to append
* @param bits $numBits from value to append
*/
public function appendBits($value, $numBits)
{
@ -262,16 +265,16 @@ final class BitArray
}
}
private function ensureCapacity($size)
private function ensureCapacity($size): void
{
if ($size > count($this->bits) * 32) {
$newBits = $this->makeArray($size);
$newBits = arraycopy($this->bits, 0, $newBits, 0, count($this->bits));
if ($size > (is_countable($this->bits) ? count($this->bits) : 0) * 32) {
$newBits = self::makeArray($size);
$newBits = arraycopy($this->bits, 0, $newBits, 0, is_countable($this->bits) ? count($this->bits) : 0);
$this->bits = $newBits;
}
}
public function appendBit($bit)
public function appendBit($bit): void
{
$this->ensureCapacity($this->size + 1);
if ($bit) {
@ -280,7 +283,7 @@ final class BitArray
$this->size++;
}
public function appendBitArray($other)
public function appendBitArray($other): void
{
$otherSize = $other->size;
$this->ensureCapacity($this->size + $otherSize);
@ -291,10 +294,10 @@ final class BitArray
public function _xor($other)
{
if (count($this->bits) !== count($other->bits)) {
if ((is_countable($this->bits) ? count($this->bits) : 0) !== (is_countable($other->bits) ? count($other->bits) : 0)) {
throw new \InvalidArgumentException("Sizes don't match");
}
$count = count($this->bits);
$count = is_countable($this->bits) ? count($this->bits) : 0;
for ($i = 0; $i < $count; $i++) {
// The last byte could be incomplete (i.e. not have 8 bits in
// it) but there is no problem since 0 XOR 0 == 0.
@ -304,13 +307,13 @@ final class BitArray
/**
*
* @param bitOffset first bit to start writing
* @param array array to write into. Bytes are written most-significant byte first. This is the opposite
* @param first $bitOffset bit to start writing
* @param array $array to write into. Bytes are written most-significant byte first. This is the opposite
* of the internal representation, which is exposed by {@link #getBitArray()}
* @param offset position in array to start writing
* @param numBytes how many bytes to write
* @param position $offset in array to start writing
* @param how $numBytes many bytes to write
*/
public function toBytes($bitOffset, &$array, $offset, $numBytes)
public function toBytes($bitOffset, &$array, $offset, $numBytes): void
{
for ($i = 0; $i < $numBytes; $i++) {
$theByte = 0;
@ -348,7 +351,7 @@ final class BitArray
/**
* Reverses all bits in the array.
*/
public function reverse()
public function reverse(): void
{
$newBits = [];
// reverse all int's first
@ -384,7 +387,7 @@ final class BitArray
}
$newBits[(int)($oldBitsLen) - 1] = $currentInt;
}
// $bits = $newBits;
// $bits = $newBits;
}
public function equals($o)
@ -415,7 +418,7 @@ final class BitArray
return (string)$result;
}
public function _clone()
public function _clone(): \Zxing\Common\BitArray
{
return new BitArray($this->bits, $this->size);
}

View File

@ -7,6 +7,9 @@ final class BitMatrix
private $width;
private $height;
private $rowSize;
/**
* @var mixed|int[]
*/
private $bits;
public function __construct($width, $height = false, $rowSize = false, $bits = false)
@ -19,7 +22,7 @@ final class BitMatrix
}
if (!$bits) {
$bits = fill_array(0, $rowSize * $height, 0);
// [];//new int[rowSize * height];
// [];//new int[rowSize * height];
}
$this->width = $width;
$this->height = $height;
@ -38,30 +41,31 @@ final class BitMatrix
$rowLength = -1;
$nRows = 0;
$pos = 0;
while ($pos < strlen($stringRepresentation)) {
while ($pos < strlen((string) $stringRepresentation)) {
if ($stringRepresentation[$pos] == '\n' ||
$stringRepresentation->{$pos} == '\r') {
if ($bitsPos > $rowStartPos) {
if ($rowLength == -1) {
$rowLength = $bitsPos - $rowStartPos;
} else if ($bitsPos - $rowStartPos != $rowLength) {
} elseif ($bitsPos - $rowStartPos != $rowLength) {
throw new \InvalidArgumentException("row lengths do not match");
}
$rowStartPos = $bitsPos;
$nRows++;
}
$pos++;
} else if (substr($stringRepresentation, $pos, strlen($setString)) == $setString) {
$pos += strlen($setString);
} elseif (substr((string) $stringRepresentation, $pos, strlen((string) $setString)) == $setString) {
$pos += strlen((string) $setString);
$bits[$bitsPos] = true;
$bitsPos++;
} else if (substr($stringRepresentation, $pos + strlen($unsetString)) == $unsetString) {
$pos += strlen($unsetString);
} elseif (substr((string) $stringRepresentation, $pos + strlen((string) $unsetString)) == $unsetString) {
$pos += strlen((string) $unsetString);
$bits[$bitsPos] = false;
$bitsPos++;
} else {
throw new \InvalidArgumentException(
"illegal character encountered: " . substr($stringRepresentation, $pos));
"illegal character encountered: " . substr((string) $stringRepresentation, $pos)
);
}
}
@ -69,7 +73,7 @@ final class BitMatrix
if ($bitsPos > $rowStartPos) {
if ($rowLength == -1) {
$rowLength = $bitsPos - $rowStartPos;
} else if ($bitsPos - $rowStartPos != $rowLength) {
} elseif ($bitsPos - $rowStartPos != $rowLength) {
throw new \InvalidArgumentException("row lengths do not match");
}
$nRows++;
@ -91,7 +95,7 @@ final class BitMatrix
* @param $x ; The horizontal component (i.e. which column)
* @param $y ; The vertical component (i.e. which row)
*/
public function set($x, $y)
public function set($x, $y): void
{
$offset = (int)($y * $this->rowSize + ($x / 32));
if (!isset($this->bits[$offset])) {
@ -110,7 +114,7 @@ final class BitMatrix
//16777216
}
public function _unset($x, $y)
public function _unset($x, $y): void
{//было unset, php не позволяет использовать unset
$offset = (int)($y * $this->rowSize + ($x / 32));
$this->bits[$offset] &= ~(1 << ($x & 0x1f));
@ -122,7 +126,7 @@ final class BitMatrix
* @param $x ; The horizontal component (i.e. which column)
* @param $y ; The vertical component (i.e. which row)
*/
public function flip($x, $y)
public function flip($x, $y): void
{
$offset = $y * $this->rowSize + (int)($x / 32);
@ -154,9 +158,9 @@ final class BitMatrix
/**
* Clears all bits (sets to false).
*/
public function clear()
public function clear(): void
{
$max = count($this->bits);
$max = is_countable($this->bits) ? count($this->bits) : 0;
for ($i = 0; $i < $max; $i++) {
$this->bits[$i] = 0;
}
@ -194,7 +198,7 @@ final class BitMatrix
/**
* Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees
*/
public function rotate180()
public function rotate180(): void
{
$width = $this->getWidth();
$height = $this->getHeight();
@ -211,7 +215,7 @@ final class BitMatrix
}
/**
* @return The width of the matrix
* @return float The width of the matrix
*/
public function getWidth()
{
@ -224,7 +228,7 @@ final class BitMatrix
* @param $y ; The row to retrieve
* @param $row ; An optional caller-allocated BitArray, will be allocated if null or too small
*
* @return The resulting BitArray - this reference should always be used even when passing
* @return BitArray The resulting BitArray - this reference should always be used even when passing
* your own row
*/
public function getRow($y, $row)
@ -246,7 +250,7 @@ final class BitMatrix
* @param $y ; row to set
* @param $row ; {@link BitArray} to copy from
*/
public function setRow($y, $row)
public function setRow($y, $row): void
{
$this->bits = arraycopy($row->getBitArray(), 0, $this->bits, $y * $this->rowSize, $this->rowSize);
}
@ -313,10 +317,10 @@ final class BitMatrix
public function getTopLeftOnBit()
{
$bitsOffset = 0;
while ($bitsOffset < count($this->bits) && $this->bits[$bitsOffset] == 0) {
while ($bitsOffset < (is_countable($this->bits) ? count($this->bits) : 0) && $this->bits[$bitsOffset] == 0) {
$bitsOffset++;
}
if ($bitsOffset == count($this->bits)) {
if ($bitsOffset == (is_countable($this->bits) ? count($this->bits) : 0)) {
return null;
}
$y = $bitsOffset / $this->rowSize;
@ -334,7 +338,7 @@ final class BitMatrix
public function getBottomRightOnBit()
{
$bitsOffset = count($this->bits) - 1;
$bitsOffset = (is_countable($this->bits) ? count($this->bits) : 0) - 1;
while ($bitsOffset >= 0 && $this->bits[$bitsOffset] == 0) {
$bitsOffset--;
}
@ -356,7 +360,7 @@ final class BitMatrix
}
/**
* @return The height of the matrix
* @return float The height of the matrix
*/
public function getHeight()
{
@ -364,7 +368,7 @@ final class BitMatrix
}
/**
* @return The row size of the matrix
* @return int The row size of the matrix
*/
public function getRowSize()
{
@ -439,7 +443,6 @@ final class BitMatrix
*/
public function get($x, $y)
{
$offset = (int)($y * $this->rowSize + ($x / 32));
if (!isset($this->bits[$offset])) {
$this->bits[$offset] = 0;
@ -449,9 +452,9 @@ final class BitMatrix
return (uRShift($this->bits[$offset], ($x & 0x1f)) & 1) != 0;//было >>> вместо >>, не знаю как эмулировать беззнаковый сдвиг
}
// @Override
// @Override
public function _clone()
public function _clone(): \Zxing\Common\BitMatrix
{
return new BitMatrix($this->width, $this->height, $this->rowSize, $this->bits);
}

View File

@ -28,18 +28,15 @@ namespace Zxing\Common;
*/
final class BitSource
{
private $bytes;
private $byteOffset = 0;
private $bitOffset = 0;
private int $byteOffset = 0;
private int $bitOffset = 0;
/**
* @param bytes bytes from which this will read bits. Bits will be read from the first byte first.
* @param bytes $bytes from which this will read bits. Bits will be read from the first byte first.
* Bits are read within a byte from most-significant to least-significant bit.
*/
public function __construct($bytes)
public function __construct(private $bytes)
{
$this->bytes = $bytes;
}
/**
@ -59,7 +56,7 @@ final class BitSource
}
/**
* @param numBits number of bits to read
* @param number $numBits of bits to read
*
* @return int representing the bits read. The bits will appear as the least-significant
* bits of the int
@ -113,6 +110,6 @@ final class BitSource
*/
public function available()
{
return 8 * (count($this->bytes) - $this->byteOffset) - $this->bitOffset;
return 8 * ((is_countable($this->bytes) ? count($this->bytes) : 0) - $this->byteOffset) - $this->bitOffset;
}
}

View File

@ -11,40 +11,38 @@ final class CharacterSetECI
/**#@+
* Character set constants.
*/
const CP437 = 0;
const ISO8859_1 = 1;
const ISO8859_2 = 4;
const ISO8859_3 = 5;
const ISO8859_4 = 6;
const ISO8859_5 = 7;
const ISO8859_6 = 8;
const ISO8859_7 = 9;
const ISO8859_8 = 10;
const ISO8859_9 = 11;
const ISO8859_10 = 12;
const ISO8859_11 = 13;
const ISO8859_12 = 14;
const ISO8859_13 = 15;
const ISO8859_14 = 16;
const ISO8859_15 = 17;
const ISO8859_16 = 18;
const SJIS = 20;
const CP1250 = 21;
const CP1251 = 22;
const CP1252 = 23;
const CP1256 = 24;
const UNICODE_BIG_UNMARKED = 25;
const UTF8 = 26;
const ASCII = 27;
const BIG5 = 28;
const GB18030 = 29;
const EUC_KR = 30;
public const CP437 = 0;
public const ISO8859_1 = 1;
public const ISO8859_2 = 4;
public const ISO8859_3 = 5;
public const ISO8859_4 = 6;
public const ISO8859_5 = 7;
public const ISO8859_6 = 8;
public const ISO8859_7 = 9;
public const ISO8859_8 = 10;
public const ISO8859_9 = 11;
public const ISO8859_10 = 12;
public const ISO8859_11 = 13;
public const ISO8859_12 = 14;
public const ISO8859_13 = 15;
public const ISO8859_14 = 16;
public const ISO8859_15 = 17;
public const ISO8859_16 = 18;
public const SJIS = 20;
public const CP1250 = 21;
public const CP1251 = 22;
public const CP1252 = 23;
public const CP1256 = 24;
public const UNICODE_BIG_UNMARKED = 25;
public const UTF8 = 26;
public const ASCII = 27;
public const BIG5 = 28;
public const GB18030 = 29;
public const EUC_KR = 30;
/**
* Map between character names and their ECI values.
*
* @var array
*/
protected static $nameToEci = [
private static array $nameToEci = [
'ISO-8859-1' => self::ISO8859_1,
'ISO-8859-2' => self::ISO8859_2,
'ISO-8859-3' => self::ISO8859_3,
@ -75,19 +73,17 @@ final class CharacterSetECI
/**#@-*/
/**
* Additional possible values for character sets.
*
* @var array
*/
protected static $additionalValues = [
private static array $additionalValues = [
self::CP437 => 2,
self::ASCII => 170,
];
private static $name = null;
private static int|string|null $name = null;
/**
* Gets character set ECI by value.
*
* @param string $name
* @param string $value
*
* @return CharacterSetEci|null
*/
@ -104,7 +100,7 @@ final class CharacterSetECI
self::setName($value);
return new self($value);
} catch (\UnexpectedValueException $e) {
} catch (\UnexpectedValueException) {
return null;
}
}

View File

@ -26,32 +26,22 @@ namespace Zxing\Common;
*/
final class DecoderResult
{
private $rawBytes;
private $text;
private $byteSegments;
private $ecLevel;
/**
* @var mixed|null
*/
private $errorsCorrected;
/**
* @var mixed|null
*/
private $erasures;
/**
* @var mixed|null
*/
private $other;
private $structuredAppendParity;
private $structuredAppendSequenceNumber;
public function __construct(
$rawBytes,
$text,
$byteSegments,
$ecLevel,
$saSequence = -1,
$saParity = -1
) {
$this->rawBytes = $rawBytes;
$this->text = $text;
$this->byteSegments = $byteSegments;
$this->ecLevel = $ecLevel;
$this->structuredAppendParity = $saParity;
$this->structuredAppendSequenceNumber = $saSequence;
public function __construct(private $rawBytes, private $text, private $byteSegments, private $ecLevel, private $structuredAppendSequenceNumber = -1, private $structuredAppendParity = -1)
{
}
public function getRawBytes()
@ -79,7 +69,7 @@ final class DecoderResult
return $this->errorsCorrected;
}
public function setErrorsCorrected($errorsCorrected)
public function setErrorsCorrected($errorsCorrected): void
{
$this->errorsCorrected = $errorsCorrected;
}
@ -89,7 +79,7 @@ final class DecoderResult
return $this->erasures;
}
public function setErasures($erasures)
public function setErasures($erasures): void
{
$this->erasures = $erasures;
}
@ -99,7 +89,7 @@ final class DecoderResult
return $this->other;
}
public function setOther($other)
public function setOther($other): void
{
$this->other = $other;
}
@ -118,5 +108,4 @@ final class DecoderResult
{
return $this->structuredAppendSequenceNumber;
}
}

View File

@ -24,29 +24,51 @@ use Zxing\NotFoundException;
*/
final class DefaultGridSampler extends GridSampler
{
//@Override
//@Override
public function sampleGrid(
$image,
$dimensionX,
$dimensionY,
$p1ToX, $p1ToY,
$p2ToX, $p2ToY,
$p3ToX, $p3ToY,
$p4ToX, $p4ToY,
$p1FromX, $p1FromY,
$p2FromX, $p2FromY,
$p3FromX, $p3FromY,
$p4FromX, $p4FromY
$p1ToX,
$p1ToY,
$p2ToX,
$p2ToY,
$p3ToX,
$p3ToY,
$p4ToX,
$p4ToY,
$p1FromX,
$p1FromY,
$p2FromX,
$p2FromY,
$p3FromX,
$p3FromY,
$p4FromX,
$p4FromY
) {
$transform = PerspectiveTransform::quadrilateralToQuadrilateral(
$p1ToX, $p1ToY, $p2ToX, $p2ToY, $p3ToX, $p3ToY, $p4ToX, $p4ToY,
$p1FromX, $p1FromY, $p2FromX, $p2FromY, $p3FromX, $p3FromY, $p4FromX, $p4FromY);
$p1ToX,
$p1ToY,
$p2ToX,
$p2ToY,
$p3ToX,
$p3ToY,
$p4ToX,
$p4ToY,
$p1FromX,
$p1FromY,
$p2FromX,
$p2FromY,
$p3FromX,
$p3FromY,
$p4FromX,
$p4FromY
);
return $this->sampleGrid_($image, $dimensionX, $dimensionY, $transform);
}
//@Override
//@Override
public function sampleGrid_(
$image,
$dimensionX,
@ -59,31 +81,31 @@ final class DefaultGridSampler extends GridSampler
$bits = new BitMatrix($dimensionX, $dimensionY);
$points = fill_array(0, 2 * $dimensionX, 0.0);
for ($y = 0; $y < $dimensionY; $y++) {
$max = count($points);
$max = is_countable($points) ? count($points) : 0;
$iValue = (float)$y + 0.5;
for ($x = 0; $x < $max; $x += 2) {
$points[$x] = (float)($x / 2) + 0.5;
$points[$x + 1] = $iValue;
}
$transform->transformPoints($points);
// Quick check to see if points transformed to something inside the image;
// sufficient to check the endpoints
$this->checkAndNudgePoints($image, $points);
// Quick check to see if points transformed to something inside the image;
// sufficient to check the endpoints
self::checkAndNudgePoints($image, $points);
try {
for ($x = 0; $x < $max; $x += 2) {
if ($image->get((int)$points[$x], (int)$points[$x + 1])) {
// Black(-ish) pixel
// Black(-ish) pixel
$bits->set($x / 2, $y);
}
}
} catch (\Exception $aioobe) {//ArrayIndexOutOfBoundsException
// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
// transform gets "twisted" such that it maps a straight line of points to a set of points
// whose endpoints are in bounds, but others are not. There is probably some mathematical
// way to detect this about the transformation that I don't know yet.
// This results in an ugly runtime exception despite our clever checks above -- can't have
// that. We could check each point's coordinates but that feels duplicative. We settle for
// catching and wrapping ArrayIndexOutOfBoundsException.
} catch (\Exception) {//ArrayIndexOutOfBoundsException
// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
// transform gets "twisted" such that it maps a straight line of points to a set of points
// whose endpoints are in bounds, but others are not. There is probably some mathematical
// way to detect this about the transformation that I don't know yet.
// This results in an ugly runtime exception despite our clever checks above -- can't have
// that. We could check each point's coordinates but that feels duplicative. We settle for
// catching and wrapping ArrayIndexOutOfBoundsException.
throw NotFoundException::getNotFoundInstance();
}
}

View File

@ -21,7 +21,6 @@ final class MathUtils
{
private function __construct()
{
}
/**
@ -32,7 +31,7 @@ final class MathUtils
*
* @param float $d real value to round
*
* @return int $nearest {@code int}
* @return int {@code int}
*/
public static function round($d)
{

View File

@ -9,8 +9,8 @@
namespace Zxing\Common\Detector;
use Zxing\BinaryBitmap;
use \Zxing\NotFoundException;
use \Zxing\ResultPoint;
use Zxing\NotFoundException;
use Zxing\ResultPoint;
/*
*
@ -35,13 +35,10 @@ import com.google.zxing.common.BitMatrix;
*/
class MonochromeRectangleDetector
{
private static $MAX_MODULES = 32;
private $image;
private static int $MAX_MODULES = 32;
public function __construct(BinaryBitmap $image)
public function __construct(private readonly BinaryBitmap $image)
{
$this->image = $image;
}
/**
@ -54,9 +51,8 @@ class MonochromeRectangleDetector
* third, the rightmost
* @throws NotFoundException if no Data Matrix Code can be found
*/
public function detect()
public function detect(): \Zxing\ResultPoint
{
$height = $this->image->getHeight();
$width = $this->image->getWidth();
$halfHeight = $height / 2;
@ -70,25 +66,69 @@ class MonochromeRectangleDetector
$bottom = $height;
$left = 0;
$right = $width;
$pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right,
$halfHeight, -$deltaY, $top, $bottom, $halfWidth / 2);
$pointA = $this->findCornerFromCenter(
$halfWidth,
0,
$left,
$right,
$halfHeight,
-$deltaY,
$top,
$bottom,
$halfWidth / 2
);
$top = (int)$pointA->getY() - 1;
$pointB = $this->findCornerFromCenter($halfWidth, -$deltaX, $left, $right,
$halfHeight, 0, $top, $bottom, $halfHeight / 2);
$pointB = $this->findCornerFromCenter(
$halfWidth,
-$deltaX,
$left,
$right,
$halfHeight,
0,
$top,
$bottom,
$halfHeight / 2
);
$left = (int)$pointB->getX() - 1;
$pointC = $this->findCornerFromCenter($halfWidth, $deltaX, $left, $right,
$halfHeight, 0, $top, $bottom, $halfHeight / 2);
$pointC = $this->findCornerFromCenter(
$halfWidth,
$deltaX,
$left,
$right,
$halfHeight,
0,
$top,
$bottom,
$halfHeight / 2
);
$right = (int)$pointC->getX() + 1;
$pointD = $this->findCornerFromCenter($halfWidth, 0, $left, $right,
$halfHeight, $deltaY, $top, $bottom, $halfWidth / 2);
$pointD = $this->findCornerFromCenter(
$halfWidth,
0,
$left,
$right,
$halfHeight,
$deltaY,
$top,
$bottom,
$halfWidth / 2
);
$bottom = (int)$pointD->getY() + 1;
// Go try to find po$A again with better information -- might have been off at first.
$pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right,
$halfHeight, -$deltaY, $top, $bottom, $halfWidth / 4);
$pointA = $this->findCornerFromCenter(
$halfWidth,
0,
$left,
$right,
$halfHeight,
-$deltaY,
$top,
$bottom,
$halfWidth / 4
);
return new ResultPoint($pointA, $pointB, $pointC, $pointD);
}
@ -108,10 +148,11 @@ class MonochromeRectangleDetector
* @param float $maxWhiteRun maximum run of white pixels that can still be considered to be within
* the barcode
*
* @return ResultPoint $a {@link com.google.zxing.ResultPoint} encapsulating the corner that was found
* @return ResultPoint {@link com.google.zxing.ResultPoint} encapsulating the corner that was found
* @throws NotFoundException if such a point cannot be found
*/
private function findCornerFromCenter($centerX,
private function findCornerFromCenter(
$centerX,
$deltaX,
$left,
$right,
@ -119,7 +160,8 @@ class MonochromeRectangleDetector
$deltaY,
$top,
$bottom,
$maxWhiteRun)
$maxWhiteRun
): \Zxing\ResultPoint
{
$lastRange = null;
for ($y = $centerY, $x = $centerX;
@ -173,13 +215,13 @@ class MonochromeRectangleDetector
* Computes the start and end of a region of pixels, either horizontally or vertically, that could
* be part of a Data Matrix barcode.
*
* @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location)
* @param if $fixedDimension scanning horizontally, this is the row (the fixed vertical location)
* where we are scanning. If scanning vertically it's the column, the fixed horizontal location
* @param maxWhiteRun largest run of white pixels that can still be considered part of the
* @param largest $maxWhiteRun run of white pixels that can still be considered part of the
* barcode region
* @param minDim minimum pixel location, horizontally or vertically, to consider
* @param maxDim maximum pixel location, horizontally or vertically, to consider
* @param horizontal if true, we're scanning left-right, instead of up-down
* @param minimum $minDim pixel location, horizontally or vertically, to consider
* @param maximum $maxDim pixel location, horizontally or vertically, to consider
* @param if $horizontal true, we're scanning left-right, instead of up-down
*
* @return int[] with start and end of found range, or null if no such range is found
* (e.g. only white was found)

View File

@ -26,21 +26,16 @@ namespace Zxing\Common;
*/
class DetectorResult
{
private $bits;
private $points;
public function __construct($bits, $points)
public function __construct(private $bits, private $points)
{
$this->bits = $bits;
$this->points = $points;
}
public final function getBits()
final public function getBits()
{
return $this->bits;
}
public final function getPoints()
final public function getPoints()
{
return $this->points;
}

View File

@ -18,7 +18,6 @@
namespace Zxing\Common;
use Zxing\Binarizer;
use Zxing\LuminanceSource;
use Zxing\NotFoundException;
/**
@ -34,14 +33,17 @@ use Zxing\NotFoundException;
*/
class GlobalHistogramBinarizer extends Binarizer
{
private static $LUMINANCE_BITS = 5;
private static $LUMINANCE_SHIFT = 3;
private static $LUMINANCE_BUCKETS = 32;
private static int $LUMINANCE_BITS = 5;
private static int $LUMINANCE_SHIFT = 3;
private static int $LUMINANCE_BUCKETS = 32;
private static $EMPTY = [];
private static array $EMPTY = [];
private $luminances = [];
private $buckets = [];
private array $luminances = [];
private array $buckets = [];
/**
* @var mixed|\Zxing\LuminanceSource
*/
private $source = [];
public function __construct($source)
@ -93,7 +95,7 @@ class GlobalHistogramBinarizer extends Binarizer
}
// Does not sharpen the data, as this call is intended to only be used by 2D Readers.
private function initArrays($luminanceSize)
private function initArrays($luminanceSize): void
{
if (count($this->luminances) < $luminanceSize) {
$this->luminances = [];
@ -106,7 +108,7 @@ class GlobalHistogramBinarizer extends Binarizer
private static function estimateBlackPoint($buckets)
{
// Find the tallest peak in the histogram.
$numBuckets = count($buckets);
$numBuckets = is_countable($buckets) ? count($buckets) : 0;
$maxBucketCount = 0;
$firstPeak = 0;
$firstPeakSize = 0;
@ -158,7 +160,7 @@ class GlobalHistogramBinarizer extends Binarizer
}
}
return ($bestValley << self::$LUMINANCE_SHIFT);
return $bestValley << self::$LUMINANCE_SHIFT;
}
public function getBlackMatrix()
@ -200,7 +202,7 @@ class GlobalHistogramBinarizer extends Binarizer
return $matrix;
}
public function createBinarizer($source)
public function createBinarizer($source): \Zxing\Common\GlobalHistogramBinarizer
{
return new GlobalHistogramBinarizer($source);
}

View File

@ -34,6 +34,9 @@ use Zxing\NotFoundException;
*/
abstract class GridSampler
{
/**
* @var mixed|\Zxing\Common\DefaultGridSampler|null
*/
private static $gridSampler;
/**
@ -43,15 +46,15 @@ abstract class GridSampler
* in the whole lifetime of the JVM. For instance, an Android activity can swap in
* an implementation that takes advantage of native platform libraries.
*
* @param newGridSampler The platform-specific object to install.
* @param $newGridSampler The platform-specific object to install.
*/
public static function setGridSampler($newGridSampler)
public static function setGridSampler($newGridSampler): void
{
self::$gridSampler = $newGridSampler;
}
/**
* @return the current implementation of GridSampler
* @return GridSampler the current implementation of GridSampler
*/
public static function getInstance()
{
@ -73,8 +76,8 @@ abstract class GridSampler
* <p>For efficiency, the method will check points from either end of the line until one is found
* to be within the image. Because the set of points are assumed to be linear, this is valid.</p>
*
* @param image image into which the points should map
* @param points actual points in x1,y1,...,xn,yn form
* @param image $image into which the points should map
* @param actual $points points in x1,y1,...,xn,yn form
*
* @throws NotFoundException if an endpoint is lies outside the image boundaries
*/
@ -84,9 +87,9 @@ abstract class GridSampler
) {
$width = $image->getWidth();
$height = $image->getHeight();
// Check and nudge points from start until we see some that are OK:
// Check and nudge points from start until we see some that are OK:
$nudged = true;
for ($offset = 0; $offset < count($points) && $nudged; $offset += 2) {
for ($offset = 0; $offset < (is_countable($points) ? count($points) : 0) && $nudged; $offset += 2) {
$x = (int)$points[$offset];
$y = (int)$points[$offset + 1];
if ($x < -1 || $x > $width || $y < -1 || $y > $height) {
@ -96,21 +99,21 @@ abstract class GridSampler
if ($x == -1) {
$points[$offset] = 0.0;
$nudged = true;
} else if ($x == $width) {
} elseif ($x == $width) {
$points[$offset] = $width - 1;
$nudged = true;
}
if ($y == -1) {
$points[$offset + 1] = 0.0;
$nudged = true;
} else if ($y == $height) {
} elseif ($y == $height) {
$points[$offset + 1] = $height - 1;
$nudged = true;
}
}
// Check and nudge points from end:
// Check and nudge points from end:
$nudged = true;
for ($offset = count($points) - 2; $offset >= 0 && $nudged; $offset -= 2) {
for ($offset = (is_countable($points) ? count($points) : 0) - 2; $offset >= 0 && $nudged; $offset -= 2) {
$x = (int)$points[$offset];
$y = (int)$points[$offset + 1];
if ($x < -1 || $x > $width || $y < -1 || $y > $height) {
@ -120,14 +123,14 @@ abstract class GridSampler
if ($x == -1) {
$points[$offset] = 0.0;
$nudged = true;
} else if ($x == $width) {
} elseif ($x == $width) {
$points[$offset] = $width - 1;
$nudged = true;
}
if ($y == -1) {
$points[$offset + 1] = 0.0;
$nudged = true;
} else if ($y == $height) {
} elseif ($y == $height) {
$points[$offset + 1] = $height - 1;
$nudged = true;
}
@ -139,50 +142,57 @@ abstract class GridSampler
* transformation is determined by the coordinates of 4 points, in the original and transformed
* image space.
*
* @param image image to sample
* @param dimensionX width of {@link BitMatrix} to sample from image
* @param dimensionY height of {@link BitMatrix} to sample from image
* @param p1ToX point 1 preimage X
* @param p1ToY point 1 preimage Y
* @param p2ToX point 2 preimage X
* @param p2ToY point 2 preimage Y
* @param p3ToX point 3 preimage X
* @param p3ToY point 3 preimage Y
* @param p4ToX point 4 preimage X
* @param p4ToY point 4 preimage Y
* @param p1FromX point 1 image X
* @param p1FromY point 1 image Y
* @param p2FromX point 2 image X
* @param p2FromY point 2 image Y
* @param p3FromX point 3 image X
* @param p3FromY point 3 image Y
* @param p4FromX point 4 image X
* @param p4FromY point 4 image Y
* @param image $image to sample
* @param width $dimensionX of {@link BitMatrix} to sample from image
* @param height $dimensionY of {@link BitMatrix} to sample from image
* @param point $p1ToX 1 preimage X
* @param point $p1ToY 1 preimage Y
* @param point $p2ToX 2 preimage X
* @param point $p2ToY 2 preimage Y
* @param point $p3ToX 3 preimage X
* @param point $p3ToY 3 preimage Y
* @param point $p4ToX 4 preimage X
* @param point $p4ToY 4 preimage Y
* @param point $p1FromX 1 image X
* @param point $p1FromY 1 image Y
* @param point $p2FromX 2 image X
* @param point $p2FromY 2 image Y
* @param point $p3FromX 3 image X
* @param point $p3FromY 3 image Y
* @param point $p4FromX 4 image X
* @param point $p4FromY 4 image Y
*
* @return {@link BitMatrix} representing a grid of points sampled from the image within a region
* defined by the "from" parameters
* @throws NotFoundException if image can't be sampled, for example, if the transformation defined
* by the given points is invalid or results in sampling outside the image boundaries
*/
public abstract function sampleGrid(
abstract public function sampleGrid(
$image,
$dimensionX,
$dimensionY,
$p1ToX, $p1ToY,
$p2ToX, $p2ToY,
$p3ToX, $p3ToY,
$p4ToX, $p4ToY,
$p1FromX, $p1FromY,
$p2FromX, $p2FromY,
$p3FromX, $p3FromY,
$p4FromX, $p4FromY
$p1ToX,
$p1ToY,
$p2ToX,
$p2ToY,
$p3ToX,
$p3ToY,
$p4ToX,
$p4ToY,
$p1FromX,
$p1FromY,
$p2FromX,
$p2FromY,
$p3FromX,
$p3FromY,
$p4FromX,
$p4FromY
);
public abstract function sampleGrid_(
abstract public function sampleGrid_(
$image,
$dimensionX,
$dimensionY,
$transform
);
}

View File

@ -18,8 +18,6 @@
namespace Zxing\Common;
use Zxing\Binarizer;
use Zxing\LuminanceSource;
use Zxing\NotFoundException;
/**
* This class implements a local thresholding algorithm, which while slower than the
@ -40,16 +38,15 @@ use Zxing\NotFoundException;
*/
final class HybridBinarizer extends GlobalHistogramBinarizer
{
// This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels.
// So this is the smallest dimension in each axis we can accept.
private static $BLOCK_SIZE_POWER = 3;
private static $BLOCK_SIZE = 8; // ...0100...00
private static $BLOCK_SIZE_MASK = 7; // ...0011...11
private static $MINIMUM_DIMENSION = 40;
private static $MIN_DYNAMIC_RANGE = 24;
private static int $BLOCK_SIZE_POWER = 3;
private static int $BLOCK_SIZE = 8; // ...0100...00
private static int $BLOCK_SIZE_MASK = 7; // ...0011...11
private static int $MINIMUM_DIMENSION = 40;
private static int $MIN_DYNAMIC_RANGE = 24;
private $matrix;
private ?\Zxing\Common\BitMatrix $matrix = null;
public function __construct($source)
{
@ -197,7 +194,7 @@ final class HybridBinarizer extends GlobalHistogramBinarizer
$height,
$blackPoints,
$matrix
) {
): void {
for ($y = 0; $y < $subHeight; $y++) {
$yoffset = ($y << self::$BLOCK_SIZE_POWER);
$maxYOffset = $height - self::$BLOCK_SIZE;
@ -245,8 +242,7 @@ final class HybridBinarizer extends GlobalHistogramBinarizer
$threshold,
$stride,
$matrix
) {
): void {
for ($y = 0, $offset = $yoffset * $stride + $xoffset; $y < self::$BLOCK_SIZE; $y++, $offset += $stride) {
for ($x = 0; $x < self::$BLOCK_SIZE; $x++) {
// Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.
@ -257,7 +253,7 @@ final class HybridBinarizer extends GlobalHistogramBinarizer
}
}
public function createBinarizer($source)
public function createBinarizer($source): \Zxing\Common\HybridBinarizer
{
return new HybridBinarizer($source);
}

View File

@ -26,43 +26,28 @@ namespace Zxing\Common;
*/
final class PerspectiveTransform
{
private $a11;
private $a12;
private $a13;
private $a21;
private $a22;
private $a23;
private $a31;
private $a32;
private $a33;
private function __construct(
$a11, $a21, $a31,
$a12, $a22, $a32,
$a13, $a23, $a33
) {
$this->a11 = $a11;
$this->a12 = $a12;
$this->a13 = $a13;
$this->a21 = $a21;
$this->a22 = $a22;
$this->a23 = $a23;
$this->a31 = $a31;
$this->a32 = $a32;
$this->a33 = $a33;
private function __construct(private $a11, private $a21, private $a31, private $a12, private $a22, private $a32, private $a13, private $a23, private $a33)
{
}
public static function quadrilateralToQuadrilateral(
$x0, $y0,
$x1, $y1,
$x2, $y2,
$x3, $y3,
$x0p, $y0p,
$x1p, $y1p,
$x2p, $y2p,
$x3p, $y3p
$x0,
$y0,
$x1,
$y1,
$x2,
$y2,
$x3,
$y3,
$x0p,
$y0p,
$x1p,
$y1p,
$x2p,
$y2p,
$x3p,
$y3p
) {
$qToS = self::quadrilateralToSquare($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3);
$sToQ = self::squareToQuadrilateral($x0p, $y0p, $x1p, $y1p, $x2p, $y2p, $x3p, $y3p);
@ -70,19 +55,24 @@ final class PerspectiveTransform
}
public static function quadrilateralToSquare(
$x0, $y0,
$x1, $y1,
$x2, $y2,
$x3, $y3
$x0,
$y0,
$x1,
$y1,
$x2,
$y2,
$x3,
$y3
) {
// Here, the adjoint serves as the inverse:
// Here, the adjoint serves as the inverse:
return self::squareToQuadrilateral($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3)->buildAdjoint();
}
public function buildAdjoint()
public function buildAdjoint(): \Zxing\Common\PerspectiveTransform
{
// Adjoint is the transpose of the cofactor matrix:
return new PerspectiveTransform($this->a22 * $this->a33 - $this->a23 * $this->a32,
// Adjoint is the transpose of the cofactor matrix:
return new PerspectiveTransform(
$this->a22 * $this->a33 - $this->a23 * $this->a32,
$this->a23 * $this->a31 - $this->a21 * $this->a33,
$this->a21 * $this->a32 - $this->a22 * $this->a31,
$this->a13 * $this->a32 - $this->a12 * $this->a33,
@ -90,22 +80,35 @@ final class PerspectiveTransform
$this->a12 * $this->a31 - $this->a11 * $this->a32,
$this->a12 * $this->a23 - $this->a13 * $this->a22,
$this->a13 * $this->a21 - $this->a11 * $this->a23,
$this->a11 * $this->a22 - $this->a12 * $this->a21);
$this->a11 * $this->a22 - $this->a12 * $this->a21
);
}
public static function squareToQuadrilateral(
$x0, $y0,
$x1, $y1,
$x2, $y2,
$x3, $y3
) {
$x0,
$y0,
$x1,
$y1,
$x2,
$y2,
$x3,
$y3
): \Zxing\Common\PerspectiveTransform {
$dx3 = $x0 - $x1 + $x2 - $x3;
$dy3 = $y0 - $y1 + $y2 - $y3;
if ($dx3 == 0.0 && $dy3 == 0.0) {
// Affine
return new PerspectiveTransform($x1 - $x0, $x2 - $x1, $x0,
$y1 - $y0, $y2 - $y1, $y0,
0.0, 0.0, 1.0);
// Affine
return new PerspectiveTransform(
$x1 - $x0,
$x2 - $x1,
$x0,
$y1 - $y0,
$y2 - $y1,
$y0,
0.0,
0.0,
1.0
);
} else {
$dx1 = $x1 - $x2;
$dx2 = $x3 - $x2;
@ -115,15 +118,24 @@ final class PerspectiveTransform
$a13 = ($dx3 * $dy2 - $dx2 * $dy3) / $denominator;
$a23 = ($dx1 * $dy3 - $dx3 * $dy1) / $denominator;
return new PerspectiveTransform($x1 - $x0 + $a13 * $x1, $x3 - $x0 + $a23 * $x3, $x0,
$y1 - $y0 + $a13 * $y1, $y3 - $y0 + $a23 * $y3, $y0,
$a13, $a23, 1.0);
return new PerspectiveTransform(
$x1 - $x0 + $a13 * $x1,
$x3 - $x0 + $a23 * $x3,
$x0,
$y1 - $y0 + $a13 * $y1,
$y3 - $y0 + $a23 * $y3,
$y0,
$a13,
$a23,
1.0
);
}
}
public function times($other)
public function times($other): \Zxing\Common\PerspectiveTransform
{
return new PerspectiveTransform($this->a11 * $other->a11 + $this->a21 * $other->a12 + $this->a31 * $other->a13,
return new PerspectiveTransform(
$this->a11 * $other->a11 + $this->a21 * $other->a12 + $this->a31 * $other->a13,
$this->a11 * $other->a21 + $this->a21 * $other->a22 + $this->a31 * $other->a23,
$this->a11 * $other->a31 + $this->a21 * $other->a32 + $this->a31 * $other->a33,
$this->a12 * $other->a11 + $this->a22 * $other->a12 + $this->a32 * $other->a13,
@ -131,18 +143,18 @@ final class PerspectiveTransform
$this->a12 * $other->a31 + $this->a22 * $other->a32 + $this->a32 * $other->a33,
$this->a13 * $other->a11 + $this->a23 * $other->a12 + $this->a33 * $other->a13,
$this->a13 * $other->a21 + $this->a23 * $other->a22 + $this->a33 * $other->a23,
$this->a13 * $other->a31 + $this->a23 * $other->a32 + $this->a33 * $other->a33);
$this->a13 * $other->a31 + $this->a23 * $other->a32 + $this->a33 * $other->a33
);
}
public function transformPoints(&$points, &$yValues = 0)
public function transformPoints(&$points, &$yValues = 0): void
{
if ($yValues) {
$this->transformPoints_($points, $yValues);
return;
}
$max = count($points);
$max = is_countable($points) ? count($points) : 0;
$a11 = $this->a11;
$a12 = $this->a12;
$a13 = $this->a13;
@ -161,9 +173,9 @@ final class PerspectiveTransform
}
}
public function transformPoints_(&$xValues, &$yValues)
public function transformPoints_(&$xValues, &$yValues): void
{
$n = count($xValues);
$n = is_countable($xValues) ? count($xValues) : 0;
for ($i = 0; $i < $n; $i++) {
$x = $xValues[$i];
$y = $yValues[$i];

View File

@ -30,7 +30,6 @@ namespace Zxing\Common\Reedsolomon;
*/
final class GenericGF
{
public static $AZTEC_DATA_12;
public static $AZTEC_DATA_10;
public static $AZTEC_DATA_6;
@ -40,33 +39,24 @@ final class GenericGF
public static $AZTEC_DATA_8;
public static $MAXICODE_FIELD_64;
private $expTable;
private $logTable;
private $zero;
private $one;
private $size;
private $primitive;
private $generatorBase;
private array $expTable = [];
private array $logTable = [];
private readonly \Zxing\Common\Reedsolomon\GenericGFPoly $zero;
private readonly \Zxing\Common\Reedsolomon\GenericGFPoly $one;
/**
* Create a representation of GF(size) using the given primitive polynomial.
*
* @param primitive irreducible polynomial whose coefficients are represented by
* @param irreducible $primitive polynomial whose coefficients are represented by
* the bits of an int, where the least-significant bit represents the constant
* coefficient
* @param size the size of the field
* @param b the factor b in the generator polynomial can be 0- or 1-based
* (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))).
* In most cases it should be 1, but for QR code it is 0.
* @param the $size size of the field
* @param the $generatorBase factor b in the generator polynomial can be 0- or 1-based
(g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))).
In most cases it should be 1, but for QR code it is 0.
*/
public function __construct($primitive, $size, $b)
public function __construct(private $primitive, private $size, private $generatorBase)
{
$this->primitive = $primitive;
$this->size = $size;
$this->generatorBase = $b;
$this->expTable = [];
$this->logTable = [];
$x = 1;
for ($i = 0; $i < $size; $i++) {
$this->expTable[$i] = $x;
@ -84,7 +74,7 @@ final class GenericGF
$this->one = new GenericGFPoly($this, [1]);
}
public static function Init()
public static function Init(): void
{
self::$AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1
self::$AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1
@ -117,7 +107,7 @@ final class GenericGF
}
/**
* @return the monomial representing coefficient * x^degree
* @return GenericGFPoly the monomial representing coefficient * x^degree
*/
public function buildMonomial($degree, $coefficient)
{
@ -192,7 +182,6 @@ final class GenericGF
{
return "GF(0x" . dechex((int)($this->primitive)) . ',' . $this->size . ')';
}
}
GenericGF::Init();

View File

@ -28,26 +28,26 @@ namespace Zxing\Common\Reedsolomon;
*/
final class GenericGFPoly
{
private $field;
/**
* @var int[]|mixed|null
*/
private $coefficients;
/**
* @param field the {@link GenericGF} instance representing the field to use
* @param the $field {@link GenericGF} instance representing the field to use
* to perform computations
* @param coefficients array coefficients as ints representing elements of GF(size), arranged
* @param array $coefficients coefficients as ints representing elements of GF(size), arranged
* from most significant (highest-power term) coefficient to least significant
*
* @throws InvalidArgumentException if argument is null or empty,
* or if leading coefficient is 0 and this is not a
* constant polynomial (that is, it is not the monomial "0")
*/
public function __construct($field, $coefficients)
public function __construct(private $field, $coefficients)
{
if (count($coefficients) == 0) {
throw new \InvalidArgumentException();
}
$this->field = $field;
$coefficientsLength = count($coefficients);
if ($coefficientsLength > 1 && $coefficients[0] == 0) {
// Leading term must be non-zero for anything except the constant polynomial "0"
@ -59,11 +59,13 @@ final class GenericGFPoly
$this->coefficients = [0];
} else {
$this->coefficients = fill_array(0, $coefficientsLength - $firstNonZero, 0);
$this->coefficients = arraycopy($coefficients,
$this->coefficients = arraycopy(
$coefficients,
$firstNonZero,
$this->coefficients,
0,
count($this->coefficients));
is_countable($this->coefficients) ? count($this->coefficients) : 0
);
}
} else {
$this->coefficients = $coefficients;
@ -84,7 +86,7 @@ final class GenericGFPoly
// Just return the x^0 coefficient
return $this->getCoefficient(0);
}
$size = count($this->coefficients);
$size = is_countable($this->coefficients) ? count($this->coefficients) : 0;
if ($a == 1) {
// Just the sum of the coefficients
$result = 0;
@ -107,11 +109,16 @@ final class GenericGFPoly
*/
public function getCoefficient($degree)
{
return $this->coefficients[count($this->coefficients) - 1 - $degree];
return $this->coefficients[(is_countable($this->coefficients) ? count($this->coefficients) : 0) - 1 - $degree];
}
public function multiply($other)
{
$aCoefficients = [];
$bCoefficients = [];
$aLength = null;
$bLength = null;
$product = [];
if (is_int($other)) {
return $this->multiply_($other);
}
@ -129,8 +136,10 @@ final class GenericGFPoly
for ($i = 0; $i < $aLength; $i++) {
$aCoeff = $aCoefficients[$i];
for ($j = 0; $j < $bLength; $j++) {
$product[$i + $j] = GenericGF::addOrSubtract($product[$i + $j],
$this->field->multiply($aCoeff, $bCoefficients[$j]));
$product[$i + $j] = GenericGF::addOrSubtract(
$product[$i + $j],
$this->field->multiply($aCoeff, $bCoefficients[$j])
);
}
}
@ -145,7 +154,7 @@ final class GenericGFPoly
if ($scalar == 1) {
return $this;
}
$size = count($this->coefficients);
$size = is_countable($this->coefficients) ? count($this->coefficients) : 0;
$product = fill_array(0, $size, 0);
for ($i = 0; $i < $size; $i++) {
$product[$i] = $this->field->multiply($this->coefficients[$i], $scalar);
@ -170,7 +179,7 @@ final class GenericGFPoly
if ($coefficient == 0) {
return $this->field->getZero();
}
$size = count($this->coefficients);
$size = is_countable($this->coefficients) ? count($this->coefficients) : 0;
$product = fill_array(0, $size + $degree, 0);
for ($i = 0; $i < $size; $i++) {
$product[$i] = $this->field->multiply($this->coefficients[$i], $coefficient);
@ -211,11 +220,16 @@ final class GenericGFPoly
*/
public function getDegree()
{
return count($this->coefficients) - 1;
return (is_countable($this->coefficients) ? count($this->coefficients) : 0) - 1;
}
public function addOrSubtract($other)
{
$smallerCoefficients = [];
$largerCoefficients = [];
$sumDiff = [];
$lengthDiff = null;
$countLargerCoefficients = null;
if ($this->field !== $other->field) {
throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field");
}
@ -258,7 +272,7 @@ final class GenericGFPoly
$result .= " - ";
$coefficient = -$coefficient;
} else {
if (strlen($result) > 0) {
if (strlen((string) $result) > 0) {
$result .= " + ";
}
}
@ -266,7 +280,7 @@ final class GenericGFPoly
$alphaPower = $this->field->log($coefficient);
if ($alphaPower == 0) {
$result .= '1';
} else if ($alphaPower == 1) {
} elseif ($alphaPower == 1) {
$result .= 'a';
} else {
$result .= "a^";

View File

@ -41,12 +41,8 @@ namespace Zxing\Common\Reedsolomon;
*/
final class ReedSolomonDecoder
{
private $field;
public function __construct($field)
public function __construct(private $field)
{
$this->field = $field;
}
/**
@ -54,8 +50,8 @@ final class ReedSolomonDecoder
* codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
* in the input.</p>
*
* @param received data and error-correction codewords
* @param twoS number of error-correction codewords available
* @param data $received and error-correction codewords
* @param number $twoS of error-correction codewords available
*
* @throws ReedSolomonException if decoding fails for any reason
*/
@ -66,7 +62,7 @@ final class ReedSolomonDecoder
$noError = true;
for ($i = 0; $i < $twoS; $i++) {
$eval = $poly->evaluateAt($this->field->exp($i + $this->field->getGeneratorBase()));
$syndromeCoefficients[count($syndromeCoefficients) - 1 - $i] = $eval;
$syndromeCoefficients[(is_countable($syndromeCoefficients) ? count($syndromeCoefficients) : 0) - 1 - $i] = $eval;
if ($eval != 0) {
$noError = false;
}
@ -81,15 +77,14 @@ final class ReedSolomonDecoder
$omega = $sigmaOmega[1];
$errorLocations = $this->findErrorLocations($sigma);
$errorMagnitudes = $this->findErrorMagnitudes($omega, $errorLocations);
$errorLocationsCount = count($errorLocations);
$errorLocationsCount = is_countable($errorLocations) ? count($errorLocations) : 0;
for ($i = 0; $i < $errorLocationsCount; $i++) {
$position = count($received) - 1 - $this->field->log($errorLocations[$i]);
$position = (is_countable($received) ? count($received) : 0) - 1 - $this->field->log($errorLocations[$i]);
if ($position < 0) {
throw new ReedSolomonException("Bad error location");
}
$received[$position] = GenericGF::addOrSubtract($received[$position], $errorMagnitudes[$i]);
}
}
private function runEuclideanAlgorithm($a, $b, $R)
@ -173,7 +168,7 @@ final class ReedSolomonDecoder
private function findErrorMagnitudes($errorEvaluator, $errorLocations)
{
// This is directly applying Forney's Formula
$s = count($errorLocations);
$s = is_countable($errorLocations) ? count($errorLocations) : 0;
$result = fill_array(0, $s, 0);
for ($i = 0; $i < $s; $i++) {
$xiInverse = $this->field->inverse($errorLocations[$i]);
@ -189,8 +184,10 @@ final class ReedSolomonDecoder
$denominator = $this->field->multiply($denominator, $termPlus1);
}
}
$result[$i] = $this->field->multiply($errorEvaluator->evaluateAt($xiInverse),
$this->field->inverse($denominator));
$result[$i] = $this->field->multiply(
$errorEvaluator->evaluateAt($xiInverse),
$this->field->inverse($denominator)
);
if ($this->field->getGeneratorBase() != 0) {
$result[$i] = $this->field->multiply($result[$i], $xiInverse);
}

View File

@ -14,7 +14,7 @@ if (!function_exists('hashCode')) {
function hashCode($s)
{
$h = 0;
$len = strlen($s);
$len = strlen((string) $s);
for ($i = 0; $i < $len; $i++) {
$h = (31 * $h + ord($s[$i]));
}
@ -26,7 +26,9 @@ if (!function_exists('hashCode')) {
if (!function_exists('numberOfTrailingZeros')) {
function numberOfTrailingZeros($i)
{
if ($i == 0) return 32;
if ($i == 0) {
return 32;
}
$num = 0;
while (($i & 1) == 0) {
$i >>= 1;

View File

@ -26,7 +26,7 @@ namespace Zxing;
*/
final class FormatException extends ReaderException
{
private static $instance;
private static ?\Zxing\FormatException $instance = null;
public function __construct($cause = null)
{

View File

@ -15,8 +15,17 @@ final class GDLuminanceSource extends LuminanceSource
public $luminances;
private $dataWidth;
private $dataHeight;
/**
* @var mixed|int
*/
private $left;
/**
* @var mixed|int
*/
private $top;
/**
* @var mixed|null
*/
private $gdImage;
public function __construct(
@ -44,7 +53,7 @@ final class GDLuminanceSource extends LuminanceSource
$this->top = $top;
}
public function GDLuminanceSource($gdImage, $width, $height)
public function GDLuminanceSource($gdImage, $width, $height): void
{
parent::__construct($width, $height);
@ -55,8 +64,8 @@ final class GDLuminanceSource extends LuminanceSource
$this->gdImage = $gdImage;
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
$this->luminances = [];
//$this->luminances = $this->grayScaleToBitmap($this->grayscale());
@ -71,11 +80,11 @@ final class GDLuminanceSource extends LuminanceSource
$g = $pixel['green'];
$b = $pixel['blue'];
if ($r == $g && $g == $b) {
// Image is already greyscale, so pick any channel.
// Image is already greyscale, so pick any channel.
$this->luminances[] = $r;//(($r + 128) % 256) - 128;
} else {
// Calculate luminance cheaply, favoring green.
// Calculate luminance cheaply, favoring green.
$this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128;
}
}
@ -106,14 +115,14 @@ final class GDLuminanceSource extends LuminanceSource
// $this->luminances = $this->grayScaleToBitmap($this->luminances);
}
//@Override
//@Override
public function getRow($y, $row = null)
{
if ($y < 0 || $y >= $this->getHeight()) {
throw new \InvalidArgumentException('Requested row is outside the image: ' . $y);
}
$width = $this->getWidth();
if ($row == null || count($row) < $width) {
if ($row == null || (is_countable($row) ? count($row) : 0) < $width) {
$row = [];
}
$offset = ($y + $this->top) * $this->dataWidth + $this->left;
@ -122,14 +131,14 @@ final class GDLuminanceSource extends LuminanceSource
return $row;
}
//@Override
//@Override
public function getMatrix()
{
$width = $this->getWidth();
$height = $this->getHeight();
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
if ($width == $this->dataWidth && $height == $this->dataHeight) {
return $this->luminances;
}
@ -138,14 +147,14 @@ final class GDLuminanceSource extends LuminanceSource
$matrix = [];
$inputOffset = $this->top * $this->dataWidth + $this->left;
// If the width matches the full width of the underlying data, perform a single copy.
// If the width matches the full width of the underlying data, perform a single copy.
if ($width == $this->dataWidth) {
$matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area);
return $matrix;
}
// Otherwise copy one cropped row at a time.
// Otherwise copy one cropped row at a time.
$rgb = $this->luminances;
for ($y = 0; $y < $height; $y++) {
$outputOffset = $y * $width;
@ -156,21 +165,23 @@ final class GDLuminanceSource extends LuminanceSource
return $matrix;
}
//@Override
//@Override
public function isCropSupported()
{
return true;
}
//@Override
public function crop($left, $top, $width, $height)
//@Override
public function crop($left, $top, $width, $height): \Zxing\GDLuminanceSource
{
return new GDLuminanceSource($this->luminances,
return new GDLuminanceSource(
$this->luminances,
$this->dataWidth,
$this->dataHeight,
$this->left + $left,
$this->top + $top,
$width,
$height);
$height
);
}
}

View File

@ -11,9 +11,15 @@ final class IMagickLuminanceSource extends LuminanceSource
public $luminances;
private $dataWidth;
private $dataHeight;
/**
* @var mixed|int
*/
private $left;
/**
* @var mixed|int
*/
private $top;
private $image;
private ?\Imagick $image = null;
public function __construct(
\Imagick $image,
@ -40,7 +46,7 @@ final class IMagickLuminanceSource extends LuminanceSource
$this->top = $top;
}
public function _IMagickLuminanceSource(\Imagick $image, $width, $height)
public function _IMagickLuminanceSource(\Imagick $image, $width, $height): void
{
parent::__construct($width, $height);
@ -51,8 +57,8 @@ final class IMagickLuminanceSource extends LuminanceSource
$this->image = $image;
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
$this->luminances = [];
$image->setImageColorspace(\Imagick::COLORSPACE_GRAY);
@ -68,24 +74,24 @@ final class IMagickLuminanceSource extends LuminanceSource
$g = $pixels[$i + 1] & 0xff;
$b = $pixels[$i + 2] & 0xff;
if ($r == $g && $g == $b) {
// Image is already greyscale, so pick any channel.
// Image is already greyscale, so pick any channel.
$this->luminances[] = $r;//(($r + 128) % 256) - 128;
} else {
// Calculate luminance cheaply, favoring green.
// Calculate luminance cheaply, favoring green.
$this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128;
}
}
}
//@Override
//@Override
public function getRow($y, $row = null)
{
if ($y < 0 || $y >= $this->getHeight()) {
throw new \InvalidArgumentException('Requested row is outside the image: ' . $y);
}
$width = $this->getWidth();
if ($row == null || count($row) < $width) {
if ($row == null || (is_countable($row) ? count($row) : 0) < $width) {
$row = [];
}
$offset = ($y + $this->top) * $this->dataWidth + $this->left;
@ -94,14 +100,14 @@ final class IMagickLuminanceSource extends LuminanceSource
return $row;
}
//@Override
//@Override
public function getMatrix()
{
$width = $this->getWidth();
$height = $this->getHeight();
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
if ($width == $this->dataWidth && $height == $this->dataHeight) {
return $this->luminances;
}
@ -110,14 +116,14 @@ final class IMagickLuminanceSource extends LuminanceSource
$matrix = [];
$inputOffset = $this->top * $this->dataWidth + $this->left;
// If the width matches the full width of the underlying data, perform a single copy.
// If the width matches the full width of the underlying data, perform a single copy.
if ($width == $this->dataWidth) {
$matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area);
return $matrix;
}
// Otherwise copy one cropped row at a time.
// Otherwise copy one cropped row at a time.
$rgb = $this->luminances;
for ($y = 0; $y < $height; $y++) {
$outputOffset = $y * $width;
@ -128,23 +134,25 @@ final class IMagickLuminanceSource extends LuminanceSource
return $matrix;
}
//@Override
public function isCropSupported()
//@Override
public function isCropSupported(): bool
{
return true;
}
//@Override
//@Override
public function crop($left, $top, $width, $height)
{
return $this->luminances->cropImage($width, $height, $left, $top);
return new GDLuminanceSource($this->luminances,
return new GDLuminanceSource(
$this->luminances,
$this->dataWidth,
$this->dataHeight,
$this->left + $left,
$this->top + $top,
$width,
$height);
$height
);
}
}

View File

@ -28,14 +28,8 @@ namespace Zxing;
*/
abstract class LuminanceSource
{
private $width;
private $height;
public function __construct($width, $height)
public function __construct(private $width, private $height)
{
$this->width = $width;
$this->height = $height;
}
/**
@ -46,20 +40,20 @@ abstract class LuminanceSource
* larger than width * height bytes on some platforms. Do not modify the contents
* of the result.
*/
public abstract function getMatrix();
abstract public function getMatrix();
/**
* @return The width of the bitmap.
* @return float The width of the bitmap.
*/
public final function getWidth()
final public function getWidth(): float
{
return $this->width;
}
/**
* @return The height of the bitmap.
* @return float The height of the bitmap.
*/
public final function getHeight()
final public function getHeight(): float
{
return $this->height;
}
@ -67,7 +61,7 @@ abstract class LuminanceSource
/**
* @return bool Whether this subclass supports cropping.
*/
public function isCropSupported()
public function isCropSupported(): bool
{
return false;
}
@ -76,12 +70,12 @@ abstract class LuminanceSource
* Returns a new object with cropped image data. Implementations may keep a reference to the
* original data rather than a copy. Only callable if isCropSupported() is true.
*
* @param left The left coordinate, which must be in [0,getWidth())
* @param top The top coordinate, which must be in [0,getHeight())
* @param width The width of the rectangle to crop.
* @param height The height of the rectangle to crop.
* @param $left The left coordinate, which must be in [0,getWidth())
* @param $top The top coordinate, which must be in [0,getHeight())
* @param $width The width of the rectangle to crop.
* @param $height The height of the rectangle to crop.
*
* @return A cropped version of this object.
* @return mixed A cropped version of this object.
*/
public function crop($left, $top, $width, $height)
{
@ -89,9 +83,9 @@ abstract class LuminanceSource
}
/**
* @return Whether this subclass supports counter-clockwise rotation.
* @return bool Whether this subclass supports counter-clockwise rotation.
*/
public function isRotateSupported()
public function isRotateSupported(): bool
{
return false;
}
@ -100,16 +94,16 @@ abstract class LuminanceSource
* @return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns -- black becomes
* white and vice versa, and each value becomes (255-value).
*/
public function invert()
{
return new InvertedLuminanceSource($this);
}
// public function invert()
// {
// return new InvertedLuminanceSource($this);
// }
/**
* Returns a new object with rotated image data by 90 degrees counterclockwise.
* Only callable if {@link #isRotateSupported()} is true.
*
* @return A rotated version of this object.
* @return mixed A rotated version of this object.
*/
public function rotateCounterClockwise()
{
@ -120,14 +114,14 @@ abstract class LuminanceSource
* Returns a new object with rotated image data by 45 degrees counterclockwise.
* Only callable if {@link #isRotateSupported()} is true.
*
* @return A rotated version of this object.
* @return mixed A rotated version of this object.
*/
public function rotateCounterClockwise45()
{
throw new \Exception("This luminance source does not support rotation by 45 degrees.");
}
public final function toString()
final public function toString()
{
$row = [];
$result = '';
@ -138,9 +132,9 @@ abstract class LuminanceSource
$c = '';
if ($luminance < 0x40) {
$c = '#';
} else if ($luminance < 0x80) {
} elseif ($luminance < 0x80) {
$c = '+';
} else if ($luminance < 0xC0) {
} elseif ($luminance < 0xC0) {
$c = '.';
} else {
$c = ' ';
@ -167,5 +161,5 @@ abstract class LuminanceSource
* @return array
* An array containing the luminance data.
*/
public abstract function getRow($y, $row);
abstract public function getRow($y, $row);
}

View File

@ -25,7 +25,7 @@ namespace Zxing;
*/
final class NotFoundException extends ReaderException
{
private static $instance;
private static ?\Zxing\NotFoundException $instance = null;
public static function getNotFoundInstance()
{

View File

@ -29,30 +29,28 @@ namespace Zxing;
*/
final class PlanarYUVLuminanceSource extends LuminanceSource
{
private static $THUMBNAIL_SCALE_FACTOR = 2;
private $yuvData;
private static int $THUMBNAIL_SCALE_FACTOR = 2;
private $dataWidth;
private $dataHeight;
private $left;
private $top;
public function __construct($yuvData,
public function __construct(
private $yuvData,
$dataWidth,
$dataHeight,
$left,
$top,
$width,
$height,
$reverseHorizontal)
$reverseHorizontal
)
{
parent::__construct($width, $height);
if ($left + $width > $dataWidth || $top + $height > $dataHeight) {
throw new \InvalidArgumentException("Crop rectangle does not fit within image data.");
}
$this->yuvData = $yuvData;
$this->dataWidth = $dataWidth;
$this->dataHeight = $dataHeight;
$this->left = $left;
@ -65,11 +63,11 @@ final class PlanarYUVLuminanceSource extends LuminanceSource
//@Override
public function getRow($y, $row = null)
{
if ($y < 0 || $y >= getHeight()) {
throw new \InvalidArgumentException("Requested row is outside the image: " + y);
if ($y < 0 || $y >= $this->getHeight()) {
throw new \InvalidArgumentException("Requested row is outside the image: " + \Y);
}
$width = $this->getWidth();
if ($row == null || count($row) < $width) {
if ($row == null || (is_countable($row) ? count($row) : 0) < $width) {
$row = [];//new byte[width];
}
$offset = ($y + $this->top) * $this->dataWidth + $this->left;
@ -119,16 +117,18 @@ final class PlanarYUVLuminanceSource extends LuminanceSource
}
// @Override
public function crop($left, $top, $width, $height)
public function crop($left, $top, $width, $height): \Zxing\PlanarYUVLuminanceSource
{
return new PlanarYUVLuminanceSource($this->yuvData,
return new PlanarYUVLuminanceSource(
$this->yuvData,
$this->dataWidth,
$this->dataHeight,
$this->left + $left,
$this->top + $top,
$width,
$height,
false);
false
);
}
public function renderThumbnail()

View File

@ -7,13 +7,13 @@ use Zxing\Qrcode\QRCodeReader;
final class QrReader
{
const SOURCE_TYPE_FILE = 'file';
const SOURCE_TYPE_BLOB = 'blob';
const SOURCE_TYPE_RESOURCE = 'resource';
public const SOURCE_TYPE_FILE = 'file';
public const SOURCE_TYPE_BLOB = 'blob';
public const SOURCE_TYPE_RESOURCE = 'resource';
private $bitmap;
private $reader;
private $result;
private readonly \Zxing\BinaryBitmap $bitmap;
private readonly \Zxing\Qrcode\QRCodeReader $reader;
private \Zxing\Result|bool|null $result = null;
public function __construct($imgSource, $sourceType = QrReader::SOURCE_TYPE_FILE, $useImagickIfAvailable = true)
{
@ -62,7 +62,7 @@ final class QrReader
$height = $im->getImageHeight();
$source = new IMagickLuminanceSource($im, $width, $height);
} else {
if (!is_resource($im) && !is_object($im)) {
if (!$im instanceof \GdImage && !is_object($im)) {
throw new \InvalidArgumentException('Invalid image source.');
}
$width = imagesx($im);
@ -74,22 +74,18 @@ final class QrReader
$this->reader = new QRCodeReader();
}
public function decode()
public function decode($hints = null): void
{
try {
$this->result = $this->reader->decode($this->bitmap);
} catch (NotFoundException $er) {
$this->result = false;
} catch (FormatException $er) {
$this->result = false;
} catch (ChecksumException $er) {
$this->result = $this->reader->decode($this->bitmap, $hints);
} catch (NotFoundException|FormatException|ChecksumException) {
$this->result = false;
}
}
public function text()
public function text($hints = null)
{
$this->decode();
$this->decode($hints);
if ($this->result !== false && method_exists($this->result, 'toString')) {
return $this->result->toString();

View File

@ -17,22 +17,24 @@
namespace Zxing\Qrcode\Decoder;
use Zxing\FormatException;
use Zxing\Common\BitMatrix;
use Zxing\FormatException;
/**
* @author Sean Owen
*/
final class BitMatrixParser
{
private $bitMatrix;
/**
* @var mixed|null
*/
private $parsedVersion;
private $parsedFormatInfo;
private $mirror;
/**
* @param bitMatrix {@link BitMatrix} to parse
* @param $bitMatrix {@link BitMatrix} to parse
*
* @throws FormatException if dimension is not >= 21 and 1 mod 4
*/
@ -55,7 +57,6 @@ final class BitMatrixParser
*/
public function readCodewords()
{
$formatInfo = $this->readFormatInformation();
$version = $this->readVersion();
@ -122,7 +123,6 @@ final class BitMatrixParser
*/
public function readFormatInformation()
{
if ($this->parsedFormatInfo != null) {
return $this->parsedFormatInfo;
}
@ -175,7 +175,6 @@ final class BitMatrixParser
*/
public function readVersion()
{
if ($this->parsedVersion != null) {
return $this->parsedVersion;
}
@ -223,7 +222,7 @@ final class BitMatrixParser
/**
* Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
*/
public function remask()
public function remask(): void
{
if ($this->parsedFormatInfo == null) {
return; // We have no format information, and have no data mask
@ -239,9 +238,9 @@ final class BitMatrixParser
* {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
* {@link #mirror()} method should be called.
*
* @param mirror Whether to read version and format information mirrored.
* @param Whether $mirror to read version and format information mirrored.
*/
public function setMirror($mirror)
public function setMirror($mirror): void
{
$parsedVersion = null;
$parsedFormatInfo = null;
@ -249,7 +248,7 @@ final class BitMatrixParser
}
/** Mirror the bit matrix in order to attempt a second reading. */
public function mirror()
public function mirror(): void
{
for ($x = 0; $x < $this->bitMatrix->getWidth(); $x++) {
for ($y = $x + 1; $y < $this->bitMatrix->getHeight(); $y++) {

View File

@ -26,13 +26,10 @@ namespace Zxing\Qrcode\Decoder;
*/
final class DataBlock
{
private $numDataCodewords;
private $codewords; //byte[]
//byte[]
private function __construct($numDataCodewords, $codewords)
private function __construct(private $numDataCodewords, private $codewords)
{
$this->numDataCodewords = $numDataCodewords;
$this->codewords = $codewords;
}
/**
@ -40,19 +37,20 @@ final class DataBlock
* That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This
* method will separate the data into original blocks.</p>
*
* @param rawCodewords bytes as read directly from the QR Code
* @param version version of the QR Code
* @param ecLevel error-correction level of the QR Code
* @param bytes $rawCodewords as read directly from the QR Code
* @param version $version of the QR Code
* @param error $ecLevel-correction level of the QR Code
*
* @return array DataBlocks containing original bytes, "de-interleaved" from representation in the
* QR Code
*/
public static function getDataBlocks($rawCodewords,
public static function getDataBlocks(
$rawCodewords,
$version,
$ecLevel)
$ecLevel
)
{
if (count($rawCodewords) != $version->getTotalCodewords()) {
if ((is_countable($rawCodewords) ? count($rawCodewords) : 0) != $version->getTotalCodewords()) {
throw new \InvalidArgumentException();
}
@ -81,10 +79,10 @@ final class DataBlock
// All blocks have the same amount of data, except that the last n
// (where n may be 0) have 1 more byte. Figure out where these start.
$shorterBlocksTotalCodewords = count($result[0]->codewords);
$shorterBlocksTotalCodewords = is_countable($result[0]->codewords) ? count($result[0]->codewords) : 0;
$longerBlocksStartAt = count($result) - 1;
while ($longerBlocksStartAt >= 0) {
$numCodewords = count($result[$longerBlocksStartAt]->codewords);
$numCodewords = is_countable($result[$longerBlocksStartAt]->codewords) ? count($result[$longerBlocksStartAt]->codewords) : 0;
if ($numCodewords == $shorterBlocksTotalCodewords) {
break;
}
@ -106,7 +104,7 @@ final class DataBlock
$result[$j]->codewords[$shorterBlocksNumDataCodewords] = $rawCodewords[$rawCodewordsOffset++];
}
// Now add in error correction blocks
$max = count($result[0]->codewords);
$max = is_countable($result[0]->codewords) ? count($result[0]->codewords) : 0;
for ($i = $shorterBlocksNumDataCodewords; $i < $max; $i++) {
for ($j = 0; $j < $numResultBlocks; $j++) {
$iOffset = $j < $longerBlocksStartAt ? $i : $i + 1;

View File

@ -32,18 +32,16 @@ use Zxing\Common\BitMatrix;
*/
abstract class DataMask
{
/**
* See ISO 18004:2006 6.8.1
*/
private static $DATA_MASKS = [];
private static array $DATA_MASKS = [];
public function __construct()
{
}
public static function Init()
public static function Init(): void
{
self::$DATA_MASKS = [
new DataMask000(),
@ -58,7 +56,7 @@ abstract class DataMask
}
/**
* @param reference a value between 0 and 7 indicating one of the eight possible
* @param a $reference value between 0 and 7 indicating one of the eight possible
* data mask patterns a QR Code may use
*
* @return DataMask encapsulating the data mask pattern
@ -76,10 +74,10 @@ abstract class DataMask
* <p>Implementations of this method reverse the data masking process applied to a QR Code and
* make its bits ready to read.</p>
*
* @param bits representation of QR Code bits
* @param dimension dimension of QR Code, represented by bits, being unmasked
* @param representation $bits of QR Code bits
* @param dimension $dimension of QR Code, represented by bits, being unmasked
*/
final public function unmaskBitMatrix($bits, $dimension)
final public function unmaskBitMatrix($bits, $dimension): void
{
for ($i = 0; $i < $dimension; $i++) {
for ($j = 0; $j < $dimension; $j++) {

View File

@ -17,13 +17,10 @@
namespace Zxing\Qrcode\Decoder;
use Zxing\DecodeHintType;
use Zxing\FormatException;
use Zxing\Common\BitSource;
use Zxing\Common\CharacterSetECI;
use Zxing\Common\DecoderResult;
use Zxing\Common\StringUtils;
use Zxing\FormatException;
/**
* <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes
@ -35,22 +32,23 @@ use Zxing\Common\StringUtils;
*/
final class DecodedBitStreamParser
{
/**
* See ISO 18004:2006, 6.4.4 Table 5
*/
private static $ALPHANUMERIC_CHARS = [
private static array $ALPHANUMERIC_CHARS = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
' ', '$', '%', '*', '+', '-', '.', '/', ':',
];
private static $GB2312_SUBSET = 1;
private static int $GB2312_SUBSET = 1;
public static function decode($bytes,
public static function decode(
$bytes,
$version,
$ecLevel,
$hints)
$hints
): \Zxing\Common\DecoderResult
{
$bits = new BitSource($bytes);
$result = '';//new StringBuilder(50);
@ -74,7 +72,7 @@ final class DecodedBitStreamParser
if ($mode == Mode::$FNC1_FIRST_POSITION || $mode == Mode::$FNC1_SECOND_POSITION) {
// We do little with FNC1 except alter the parsed result a bit according to the spec
$fc1InEffect = true;
} else if ($mode == Mode::$STRUCTURED_APPEND) {
} elseif ($mode == Mode::$STRUCTURED_APPEND) {
if ($bits->available() < 16) {
throw FormatException::getFormatInstance();
}
@ -82,7 +80,7 @@ final class DecodedBitStreamParser
// Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue
$symbolSequence = $bits->readBits(8);
$parityData = $bits->readBits(8);
} else if ($mode == Mode::$ECI) {
} elseif ($mode == Mode::$ECI) {
// Count doesn't apply to ECI
$value = self::parseECIValue($bits);
$currentCharacterSetECI = CharacterSetECI::getCharacterSetECIByValue($value);
@ -104,11 +102,11 @@ final class DecodedBitStreamParser
$count = $bits->readBits($mode->getCharacterCountBits($version));
if ($mode == Mode::$NUMERIC) {
self::decodeNumericSegment($bits, $result, $count);
} else if ($mode == Mode::$ALPHANUMERIC) {
} elseif ($mode == Mode::$ALPHANUMERIC) {
self::decodeAlphanumericSegment($bits, $result, $count, $fc1InEffect);
} else if ($mode == Mode::$BYTE) {
} elseif ($mode == Mode::$BYTE) {
self::decodeByteSegment($bits, $result, $count, $currentCharacterSetECI, $byteSegments, $hints);
} else if ($mode == Mode::$KANJI) {
} elseif ($mode == Mode::$KANJI) {
self::decodeKanjiSegment($bits, $result, $count);
} else {
throw FormatException::getFormatInstance();
@ -117,17 +115,19 @@ final class DecodedBitStreamParser
}
}
} while ($mode != Mode::$TERMINATOR);
} catch (\InvalidArgumentException $iae) {
} catch (\InvalidArgumentException) {
// from readBits() calls
throw FormatException::getFormatInstance();
}
return new DecoderResult($bytes,
return new DecoderResult(
$bytes,
$result,
empty($byteSegments) ? null : $byteSegments,
$ecLevel == null ? null : 'L',//ErrorCorrectionLevel::toString($ecLevel),
$symbolSequence,
$parityData);
$parityData
);
}
private static function parseECIValue($bits)
@ -155,9 +155,11 @@ final class DecodedBitStreamParser
/**
* See specification GBT 18284-2000
*/
private static function decodeHanziSegment($bits,
private static function decodeHanziSegment(
$bits,
&$result,
$count)
$count
)
{
// Don't crash trying to read more bits than we have available.
if ($count * 13 > $bits->available()) {
@ -187,9 +189,11 @@ final class DecodedBitStreamParser
$result .= iconv('GB2312', 'UTF-8', implode($buffer));
}
private static function decodeNumericSegment($bits,
private static function decodeNumericSegment(
$bits,
&$result,
$count)
$count
)
{
// Read three digits at a time
while ($count >= 3) {
@ -217,7 +221,7 @@ final class DecodedBitStreamParser
}
$result .= (self::toAlphaNumericChar($twoDigitsBits / 10));
$result .= (self::toAlphaNumericChar($twoDigitsBits % 10));
} else if ($count == 1) {
} elseif ($count == 1) {
// One digit left over to read
if ($bits->available() < 4) {
throw FormatException::getFormatInstance();
@ -239,13 +243,15 @@ final class DecodedBitStreamParser
return self::$ALPHANUMERIC_CHARS[$value];
}
private static function decodeAlphanumericSegment($bits,
private static function decodeAlphanumericSegment(
$bits,
&$result,
$count,
$fc1InEffect)
$fc1InEffect
)
{
// Read two characters at a time
$start = strlen($result);
$start = strlen((string) $result);
while ($count > 1) {
if ($bits->available() < 11) {
throw FormatException::getFormatInstance();
@ -265,9 +271,9 @@ final class DecodedBitStreamParser
// See section 6.4.8.1, 6.4.8.2
if ($fc1InEffect) {
// We need to massage the result a bit if in an FNC1 mode:
for ($i = $start; $i < strlen($result); $i++) {
for ($i = $start; $i < strlen((string) $result); $i++) {
if ($result[$i] == '%') {
if ($i < strlen($result) - 1 && $result[$i + 1] == '%') {
if ($i < strlen((string) $result) - 1 && $result[$i + 1] == '%') {
// %% is rendered as %
$result = substr_replace($result, '', $i + 1, 1);//deleteCharAt(i + 1);
} else {
@ -279,12 +285,14 @@ final class DecodedBitStreamParser
}
}
private static function decodeByteSegment($bits,
private static function decodeByteSegment(
$bits,
&$result,
$count,
$currentCharacterSetECI,
&$byteSegments,
$hints)
$hints
)
{
// Don't crash trying to read more bits than we have available.
if (8 * $count > $bits->available()) {
@ -314,9 +322,11 @@ final class DecodedBitStreamParser
$byteSegments = array_merge($byteSegments, $readBytes);
}
private static function decodeKanjiSegment($bits,
private static function decodeKanjiSegment(
$bits,
&$result,
$count)
$count
)
{
// Don't crash trying to read more bits than we have available.
if ($count * 13 > $bits->available()) {
@ -348,8 +358,7 @@ final class DecodedBitStreamParser
$result .= iconv('shift-jis', 'utf-8', implode($buffer));
}
private function DecodedBitStreamParser()
private function DecodedBitStreamParser(): void
{
}
}

View File

@ -18,13 +18,11 @@
namespace Zxing\Qrcode\Decoder;
use Zxing\ChecksumException;
use Zxing\DecodeHintType;
use Zxing\FormatException;
use Zxing\Common\BitMatrix;
use Zxing\Common\DecoderResult;
use Zxing\Common\Reedsolomon\GenericGF;
use Zxing\Common\Reedsolomon\ReedSolomonDecoder;
use Zxing\Common\Reedsolomon\ReedSolomonException;
use Zxing\FormatException;
/**
* <p>The main class which implements QR Code decoding -- as opposed to locating and extracting
@ -34,8 +32,7 @@ use Zxing\Common\Reedsolomon\ReedSolomonException;
*/
final class Decoder
{
private $rsDecoder;
private readonly \Zxing\Common\Reedsolomon\ReedSolomonDecoder $rsDecoder;
public function __construct()
{
@ -59,7 +56,7 @@ final class Decoder
* "true" is taken to mean a black module.</p>
*
* @param array $image booleans representing white/black QR Code modules
* @param hints decoding hints that should be used to influence decoding
* @param decoding $hints hints that should be used to influence decoding
*
* @return text and bytes encoded within the QR Code
* @throws FormatException if the QR Code cannot be decoded
@ -85,7 +82,7 @@ final class Decoder
* <p>Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.</p>
*
* @param BitMatrix $bits booleans representing white/black QR Code modules
* @param hints decoding hints that should be used to influence decoding
* @param decoding $hints hints that should be used to influence decoding
*
* @return text and bytes encoded within the QR Code
* @throws FormatException if the QR Code cannot be decoded
@ -135,7 +132,6 @@ final class Decoder
$result->setOther(new QRCodeDecoderMetaData(true));
return $result;
} catch (FormatException $e) {// catch (FormatException | ChecksumException e) {
// Throw the exception from the original reading
if ($fe != null) {
@ -145,7 +141,6 @@ final class Decoder
throw $ce;
}
throw $e;
}
}
@ -154,12 +149,12 @@ final class Decoder
$version = $parser->readVersion();
$ecLevel = $parser->readFormatInformation()->getErrorCorrectionLevel();
// Read codewords
// Read codewords
$codewords = $parser->readCodewords();
// Separate into data blocks
// Separate into data blocks
$dataBlocks = DataBlock::getDataBlocks($codewords, $version, $ecLevel);
// Count total number of data bytes
// Count total number of data bytes
$totalBytes = 0;
foreach ($dataBlocks as $dataBlock) {
$totalBytes += $dataBlock->getNumDataCodewords();
@ -167,7 +162,7 @@ final class Decoder
$resultBytes = fill_array(0, $totalBytes, 0);
$resultOffset = 0;
// Error-correct and copy data blocks together into a stream of bytes
// Error-correct and copy data blocks together into a stream of bytes
foreach ($dataBlocks as $dataBlock) {
$codewordBytes = $dataBlock->getCodewords();
$numDataCodewords = $dataBlock->getNumDataCodewords();
@ -177,7 +172,7 @@ final class Decoder
}
}
// Decode the contents of that stream of bytes
// Decode the contents of that stream of bytes
return DecodedBitStreamParser::decode($resultBytes, $version, $ecLevel, $hints);
}
@ -185,27 +180,27 @@ final class Decoder
* <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
* correct the errors in-place using Reed-Solomon error correction.</p>
*
* @param codewordBytes data and error correction codewords
* @param numDataCodewords number of codewords that are data bytes
* @param data $codewordBytes and error correction codewords
* @param number $numDataCodewords of codewords that are data bytes
*
* @throws ChecksumException if error correction fails
*/
private function correctErrors(&$codewordBytes, $numDataCodewords)
{
$numCodewords = count($codewordBytes);
// First read into an array of ints
$numCodewords = is_countable($codewordBytes) ? count($codewordBytes) : 0;
// First read into an array of ints
$codewordsInts = fill_array(0, $numCodewords, 0);
for ($i = 0; $i < $numCodewords; $i++) {
$codewordsInts[$i] = $codewordBytes[$i] & 0xFF;
}
$numECCodewords = count($codewordBytes) - $numDataCodewords;
$numECCodewords = (is_countable($codewordBytes) ? count($codewordBytes) : 0) - $numDataCodewords;
try {
$this->rsDecoder->decode($codewordsInts, $numECCodewords);
} catch (ReedSolomonException $ignored) {
} catch (ReedSolomonException) {
throw ChecksumException::getChecksumInstance();
}
// Copy back into array of bytes -- only need to worry about the bytes that were data
// We don't care about errors in the error-correction codewords
// Copy back into array of bytes -- only need to worry about the bytes that were data
// We don't care about errors in the error-correction codewords
for ($i = 0; $i < $numDataCodewords; $i++) {
$codewordBytes[$i] = $codewordsInts[$i];
}

View File

@ -25,17 +25,16 @@ namespace Zxing\Qrcode\Decoder;
*/
class ErrorCorrectionLevel
{
private static $FOR_BITS;
private $bits;
private $ordinal;
/**
* @var \Zxing\Qrcode\Decoder\ErrorCorrectionLevel[]|null
*/
private static ?array $FOR_BITS = null;
public function __construct($bits, $ordinal = 0)
public function __construct(private $bits, private $ordinal = 0)
{
$this->bits = $bits;
$this->ordinal = $ordinal;
}
public static function Init()
public static function Init(): void
{
self::$FOR_BITS = [
@ -56,13 +55,13 @@ class ErrorCorrectionLevel
/** H = ~30% correction */
//self::$H = new ErrorCorrectionLevel(0x02);
/**
* @param bits int containing the two bits encoding a QR Code's error correction level
* @param int $bits containing the two bits encoding a QR Code's error correction level
*
* @return ErrorCorrectionLevel representing the encoded error correction level
*/
public static function forBits($bits)
{
if ($bits < 0 || $bits >= count(self::$FOR_BITS)) {
if ($bits < 0 || $bits >= (is_countable(self::$FOR_BITS) ? count(self::$FOR_BITS) : 0)) {
throw new \InvalidArgumentException();
}
$level = self::$FOR_BITS[$bits];

View File

@ -35,11 +35,12 @@ final class FormatInformation
public static $FORMAT_INFO_DECODE_LOOKUP;
/**
* Offset i holds the number of 1 bits in the binary representation of i
* @var int[]|null
*/
private static $BITS_SET_IN_HALF_BYTE;
private static ?array $BITS_SET_IN_HALF_BYTE = null;
private $errorCorrectionLevel;
private $dataMask;
private readonly \Zxing\Qrcode\Decoder\ErrorCorrectionLevel $errorCorrectionLevel;
private readonly int $dataMask;
private function __construct($formatInfo)
{
@ -49,7 +50,7 @@ final class FormatInformation
$this->dataMask = ($formatInfo & 0x07);//(byte)
}
public static function Init()
public static function Init(): void
{
self::$FORMAT_INFO_MASK_QR = 0x5412;
self::$BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4];
@ -90,8 +91,8 @@ final class FormatInformation
}
/**
* @param maskedFormatInfo1 ; format info indicator, with mask still applied
* @param maskedFormatInfo2 ; second copy of same info; both are checked at the same time
* @param $maskedFormatInfo1 ; format info indicator, with mask still applied
* @param $maskedFormatInfo2 ; second copy of same info; both are checked at the same time
* to establish best match
*
* @return information about the format it specifies, or {@code null}
@ -106,8 +107,10 @@ final class FormatInformation
// Should return null, but, some QR codes apparently
// do not mask this info. Try again by actually masking the pattern
// first
return self::doDecodeFormatInformation($maskedFormatInfo1 ^ self::$FORMAT_INFO_MASK_QR,
$maskedFormatInfo2 ^ self::$FORMAT_INFO_MASK_QR);
return self::doDecodeFormatInformation(
$maskedFormatInfo1 ^ self::$FORMAT_INFO_MASK_QR,
$maskedFormatInfo2 ^ self::$FORMAT_INFO_MASK_QR
);
}
private static function doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2)

View File

@ -36,19 +36,12 @@ class Mode
public static $FNC1_SECOND_POSITION;
public static $HANZI;
private $characterCountBitsForVersions;
private $bits;
public function __construct($characterCountBitsForVersions, $bits)
public function __construct(private $characterCountBitsForVersions, private $bits)
{
$this->characterCountBitsForVersions = $characterCountBitsForVersions;
$this->bits = $bits;
}
public static function Init()
public static function Init(): void
{
self::$TERMINATOR = new Mode([0, 0, 0], 0x00); // Not really a mode...
self::$NUMERIC = new Mode([10, 12, 14], 0x01);
self::$ALPHANUMERIC = new Mode([9, 11, 13], 0x02);
@ -63,42 +56,30 @@ class Mode
}
/**
* @param bits four bits encoding a QR Code data mode
* @param four $bits bits encoding a QR Code data mode
*
* @return Mode encoded by these bits
* @throws InvalidArgumentException if bits do not correspond to a known mode
*/
public static function forBits($bits)
{
switch ($bits) {
case 0x0:
return self::$TERMINATOR;
case 0x1:
return self::$NUMERIC;
case 0x2:
return self::$ALPHANUMERIC;
case 0x3:
return self::$STRUCTURED_APPEND;
case 0x4:
return self::$BYTE;
case 0x5:
return self::$FNC1_FIRST_POSITION;
case 0x7:
return self::$ECI;
case 0x8:
return self::$KANJI;
case 0x9:
return self::$FNC1_SECOND_POSITION;
case 0xD:
// 0xD is defined in GBT 18284-2000, may not be supported in foreign country
return self::$HANZI;
default:
throw new \InvalidArgumentException();
}
return match ($bits) {
0x0 => self::$TERMINATOR,
0x1 => self::$NUMERIC,
0x2 => self::$ALPHANUMERIC,
0x3 => self::$STRUCTURED_APPEND,
0x4 => self::$BYTE,
0x5 => self::$FNC1_FIRST_POSITION,
0x7 => self::$ECI,
0x8 => self::$KANJI,
0x9 => self::$FNC1_SECOND_POSITION,
0xD => self::$HANZI,
default => throw new \InvalidArgumentException(),
};
}
/**
* @param version version in question
* @param version $version in question
*
* @return number of bits used, in this QR Code symbol {@link Version}, to encode the
* count of characters that will follow encoded in this Mode
@ -109,7 +90,7 @@ class Mode
$offset = 0;
if ($number <= 9) {
$offset = 0;
} else if ($number <= 26) {
} elseif ($number <= 26) {
$offset = 1;
} else {
$offset = 2;
@ -122,7 +103,6 @@ class Mode
{
return $this->bits;
}
}
Mode::Init();

View File

@ -4,16 +4,12 @@ namespace Zxing\Qrcode\Decoder;
class QRCodeDecoderMetaData
{
/** @var bool */
private $mirrored;
/**
* QRCodeDecoderMetaData constructor.
* @param bool $mirrored
*/
public function __construct($mirrored)
public function __construct(private $mirrored)
{
$this->mirrored = $mirrored;
}
public function isMirrored()

View File

@ -27,12 +27,9 @@ use Zxing\ResultPoint;
*/
final class AlignmentPattern extends ResultPoint
{
private $estimatedModuleSize;
public function __construct($posX, $posY, $estimatedModuleSize)
public function __construct($posX, $posY, private $estimatedModuleSize)
{
parent::__construct($posX, $posY);
$this->estimatedModuleSize = $estimatedModuleSize;
}
/**
@ -54,7 +51,7 @@ final class AlignmentPattern extends ResultPoint
* Combines this object's current estimate of a finder pattern position and module size
* with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
*/
public function combineEstimate($i, $j, $newModuleSize)
public function combineEstimate($i, $j, $newModuleSize): \Zxing\Qrcode\Detector\AlignmentPattern
{
$combinedX = ($this->getX() + $j) / 2.0;
$combinedY = ($this->getY() + $i) / 2.0;

View File

@ -18,8 +18,6 @@
namespace Zxing\Qrcode\Detector;
use Zxing\NotFoundException;
use Zxing\ResultPointCallback;
use Zxing\Common\BitMatrix;
/**
* <p>This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
@ -37,43 +35,21 @@ use Zxing\Common\BitMatrix;
*/
final class AlignmentPatternFinder
{
private $image;
private $possibleCenters;
private $startX;
private $startY;
private $width;
private $height;
private $moduleSize;
private $crossCheckStateCount;
private $resultPointCallback;
private array $possibleCenters = [];
private array $crossCheckStateCount = [];
/**
* <p>Creates a finder that will look in a portion of the whole image.</p>
*
* @param image image to search
* @param startX left column from which to start searching
* @param startY top row from which to start searching
* @param width width of region to search
* @param height height of region to search
* @param moduleSize estimated module size so far
* @param \Imagick image $image to search
* @param int left $startX column from which to start searching
* @param int top $startY row from which to start searching
* @param float width $width of region to search
* @param float height $height of region to search
* @param float estimated $moduleSize module size so far
*/
public function __construct($image,
$startX,
$startY,
$width,
$height,
$moduleSize,
$resultPointCallback)
public function __construct(private $image, private $startX, private $startY, private $width, private $height, private $moduleSize, private $resultPointCallback)
{
$this->image = $image;
$this->possibleCenters = [];
$this->startX = $startX;
$this->startY = $startY;
$this->width = $width;
$this->height = $height;
$this->moduleSize = $moduleSize;
$this->crossCheckStateCount = [];
$this->resultPointCallback = $resultPointCallback;
}
/**
@ -142,7 +118,6 @@ final class AlignmentPatternFinder
return $confirmed;
}
}
}
// Hmm, nothing we saw was observed and confirmed twice. If we had
@ -155,7 +130,7 @@ final class AlignmentPatternFinder
}
/**
* @param stateCount count of black/white/black pixels just read
* @param count $stateCount of black/white/black pixels just read
*
* @return true iff the proportions of the counts is close enough to the 1/1/1 ratios
* used by alignment patterns to be considered a match
@ -179,16 +154,16 @@ final class AlignmentPatternFinder
* found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
* found the alignment pattern.</p>
*
* @param stateCount reading state module counts from horizontal scan
* @param i row where alignment pattern may be found
* @param j end of possible alignment pattern in row
* @param reading $stateCount state module counts from horizontal scan
* @param row $i where alignment pattern may be found
* @param end $j of possible alignment pattern in row
*
* @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not
*/
private function handlePossibleCenter($stateCount, $i, $j)
{
$stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2];
$centerJ = $this->centerFromEnd($stateCount, $j);
$centerJ = self::centerFromEnd($stateCount, $j);
$centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal);
if (!is_nan($centerI)) {
$estimatedModuleSize = (float)($stateCount[0] + $stateCount[1] + $stateCount[2]) / 3.0;
@ -223,15 +198,19 @@ final class AlignmentPatternFinder
* "cross-checks" by scanning down vertically through the center of the possible
* alignment pattern to see if the same proportion is detected.</p>
*
* @param startI row where an alignment pattern was detected
* @param centerJ center of the section that appears to cross an alignment pattern
* @param maxCount maximum reasonable number of modules that should be
* @param int row $startI where an alignment pattern was detected
* @param float center $centerJ of the section that appears to cross an alignment pattern
* @param int maximum $maxCount reasonable number of modules that should be
* observed in any reading state, based on the results of the horizontal scan
*
* @return vertical center of alignment pattern, or {@link Float#NaN} if not found
* @return float vertical center of alignment pattern, or {@link Float#NaN} if not found
*/
private function crossCheckVertical($startI, $centerJ, $maxCount,
$originalStateCountTotal)
private function crossCheckVertical(
$startI,
$centerJ,
$maxCount,
$originalStateCountTotal
)
{
$image = $this->image;
@ -281,6 +260,6 @@ final class AlignmentPatternFinder
return NAN;
}
return $this->foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $i) : NAN;
return $this->foundPatternCross($stateCount) ? self::centerFromEnd($stateCount, $i) : NAN;
}
}

View File

@ -17,18 +17,16 @@
namespace Zxing\Qrcode\Detector;
use Zxing\DecodeHintType;
use Zxing\FormatException;
use Zxing\NotFoundException;
use Zxing\ResultPoint;
use Zxing\ResultPointCallback;
use Zxing\Common\BitMatrix;
use Zxing\Common\Detector\MathUtils;
use Zxing\Common\DetectorResult;
use Zxing\Common\GridSampler;
use Zxing\Common\PerspectiveTransform;
use Zxing\Common\Detector\MathUtils;
use Zxing\DecodeHintType;
use Zxing\FormatException;
use Zxing\NotFoundException;
use Zxing\Qrcode\Decoder\Version;
use Zxing\ResultPoint;
use Zxing\ResultPointCallback;
/**
* <p>Encapsulates logic that can detect a QR Code in an image, even if the QR Code
@ -38,25 +36,22 @@ use Zxing\Qrcode\Decoder\Version;
*/
class Detector
{
private $image;
private $resultPointCallback;
public function __construct($image)
public function __construct(private $image)
{
$this->image = $image;
}
/**
* <p>Detects a QR Code in an image.</p>
*
* @param hints optional hints to detector
* @param array|null optional $hints hints to detector
*
* @return {@link DetectorResult} encapsulating results of detecting a QR Code
* @throws NotFoundException if QR Code cannot be found
* @throws FormatException if a QR Code cannot be decoded
*/
public final function detect($hints = null)
final public function detect($hints = null)
{/*Map<DecodeHintType,?>*/
$resultPointCallback = $hints == null ? null :
@ -69,9 +64,8 @@ class Detector
return $this->processFinderPatternInfo($info);
}
protected final function processFinderPatternInfo($info)
final protected function processFinderPatternInfo($info): \Zxing\Common\DetectorResult
{
$topLeft = $info->getTopLeft();
$topRight = $info->getTopRight();
$bottomLeft = $info->getBottomLeft();
@ -85,20 +79,20 @@ class Detector
$modulesBetweenFPCenters = $provisionalVersion->getDimensionForVersion() - 7;
$alignmentPattern = null;
// Anything above version 1 has an alignment pattern
if (count($provisionalVersion->getAlignmentPatternCenters()) > 0) {
// Anything above version 1 has an alignment pattern
if ((is_countable($provisionalVersion->getAlignmentPatternCenters()) ? count($provisionalVersion->getAlignmentPatternCenters()) : 0) > 0) {
// Guess where a "bottom right" finder pattern would have been
$bottomRightX = $topRight->getX() - $topLeft->getX() + $bottomLeft->getX();
$bottomRightY = $topRight->getY() - $topLeft->getY() + $bottomLeft->getY();
// Estimate that alignment pattern is closer by 3 modules
// from "bottom right" to known top left location
// Estimate that alignment pattern is closer by 3 modules
// from "bottom right" to known top left location
$correctionToTopLeft = 1.0 - 3.0 / (float)$modulesBetweenFPCenters;
$estAlignmentX = (int)($topLeft->getX() + $correctionToTopLeft * ($bottomRightX - $topLeft->getX()));
$estAlignmentY = (int)($topLeft->getY() + $correctionToTopLeft * ($bottomRightY - $topLeft->getY()));
// Kind of arbitrary -- expand search radius before giving up
// Kind of arbitrary -- expand search radius before giving up
for ($i = 4; $i <= 16; $i <<= 1) {//??????????
try {
$alignmentPattern = $this->findAlignmentInRegion(
@ -108,11 +102,11 @@ class Detector
(float)$i
);
break;
} catch (NotFoundException $re) {
// try next round
} catch (NotFoundException) {
// try next round
}
}
// If we didn't find alignment pattern... well try anyway without it
// If we didn't find alignment pattern... well try anyway without it
}
$transform = self::createTransform($topLeft, $topRight, $bottomLeft, $alignmentPattern, $dimension);
@ -142,15 +136,15 @@ class Detector
* <p>Computes an average estimated module size based on estimated derived from the positions
* of the three finder patterns.</p>
*
* @param topLeft detected top-left finder pattern center
* @param topRight detected top-right finder pattern center
* @param bottomLeft detected bottom-left finder pattern center
* @param detected $topLeft top-left finder pattern center
* @param detected $topRight top-right finder pattern center
* @param detected $bottomLeft bottom-left finder pattern center
*
* @return estimated module size
*/
protected final function calculateModuleSize($topLeft, $topRight, $bottomLeft)
final protected function calculateModuleSize($topLeft, $topRight, $bottomLeft)
{
// Take the average
// Take the average
return ($this->calculateModuleSizeOneWay($topLeft, $topRight) +
$this->calculateModuleSizeOneWay($topLeft, $bottomLeft)) / 2.0;
}
@ -162,22 +156,26 @@ class Detector
*/
private function calculateModuleSizeOneWay($pattern, $otherPattern)
{
$moduleSizeEst1 = $this->sizeOfBlackWhiteBlackRunBothWays($pattern->getX(),
$moduleSizeEst1 = $this->sizeOfBlackWhiteBlackRunBothWays(
$pattern->getX(),
(int)$pattern->getY(),
(int)$otherPattern->getX(),
(int)$otherPattern->getY());
$moduleSizeEst2 = $this->sizeOfBlackWhiteBlackRunBothWays((int)$otherPattern->getX(),
(int)$otherPattern->getY()
);
$moduleSizeEst2 = $this->sizeOfBlackWhiteBlackRunBothWays(
(int)$otherPattern->getX(),
(int)$otherPattern->getY(),
(int)$pattern->getX(),
(int)$pattern->getY());
(int)$pattern->getY()
);
if (is_nan($moduleSizeEst1)) {
return $moduleSizeEst2 / 7.0;
}
if (is_nan($moduleSizeEst2)) {
return $moduleSizeEst1 / 7.0;
}
// Average them, and divide by 7 since we've counted the width of 3 black modules,
// and 1 white and 1 black module on either side. Ergo, divide sum by 14.
// Average them, and divide by 7 since we've counted the width of 3 black modules,
// and 1 white and 1 black module on either side. Ergo, divide sum by 14.
return ($moduleSizeEst1 + $moduleSizeEst2) / 14.0;
}
@ -188,16 +186,15 @@ class Detector
*/
private function sizeOfBlackWhiteBlackRunBothWays($fromX, $fromY, $toX, $toY)
{
$result = $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY);
// Now count other way -- don't run off image though of course
// Now count other way -- don't run off image though of course
$scale = 1.0;
$otherToX = $fromX - ($toX - $fromX);
if ($otherToX < 0) {
$scale = (float)$fromX / (float)($fromX - $otherToX);
$otherToX = 0;
} else if ($otherToX >= $this->image->getWidth()) {
} elseif ($otherToX >= $this->image->getWidth()) {
$scale = (float)($this->image->getWidth() - 1 - $fromX) / (float)($otherToX - $fromX);
$otherToX = $this->image->getWidth() - 1;
}
@ -207,7 +204,7 @@ class Detector
if ($otherToY < 0) {
$scale = (float)$fromY / (float)($fromY - $otherToY);
$otherToY = 0;
} else if ($otherToY >= $this->image->getHeight()) {
} elseif ($otherToY >= $this->image->getHeight()) {
$scale = (float)($this->image->getHeight() - 1 - $fromY) / (float)($otherToY - $fromY);
$otherToY = $this->image->getHeight() - 1;
}
@ -215,7 +212,7 @@ class Detector
$result += $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $otherToX, $otherToY);
// Middle pixel is double-counted this way; subtract 1
// Middle pixel is double-counted this way; subtract 1
return $result - 1.0;
}
@ -229,8 +226,8 @@ class Detector
*/
private function sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY)
{
// Mild variant of Bresenham's algorithm;
// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
// Mild variant of Bresenham's algorithm;
// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
$steep = abs($toY - $fromY) > abs($toX - $fromX);
if ($steep) {
$temp = $fromX;
@ -247,17 +244,17 @@ class Detector
$xstep = $fromX < $toX ? 1 : -1;
$ystep = $fromY < $toY ? 1 : -1;
// In black pixels, looking for white, first or second time.
// In black pixels, looking for white, first or second time.
$state = 0;
// Loop up until x == toX, but not beyond
// Loop up until x == toX, but not beyond
$xLimit = $toX + $xstep;
for ($x = $fromX, $y = $fromY; $x != $xLimit; $x += $xstep) {
$realX = $steep ? $y : $x;
$realY = $steep ? $x : $y;
// Does current pixel mean we have moved white to black or vice versa?
// Scanning black in state 0,2 and white in state 1, so if we find the wrong
// color, advance to next state or end if we are in state 2 already
// Does current pixel mean we have moved white to black or vice versa?
// Scanning black in state 0,2 and white in state 1, so if we find the wrong
// color, advance to next state or end if we are in state 2 already
if (($state == 1) == $this->image->get($realX, $realY)) {
if ($state == 2) {
return MathUtils::distance($x, $y, $fromX, $fromY);
@ -274,14 +271,14 @@ class Detector
$error -= $dx;
}
}
// Found black-white-black; give the benefit of the doubt that the next pixel outside the image
// is "white" so this last po$at (toX+xStep,toY) is the right ending. This is really a
// small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.
// Found black-white-black; give the benefit of the doubt that the next pixel outside the image
// is "white" so this last po$at (toX+xStep,toY) is the right ending. This is really a
// small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.
if ($state == 2) {
return MathUtils::distance($toX + $xstep, $toY, $fromX, $fromY);
}
// else we didn't find even black-white-black; no estimate is really possible
// else we didn't find even black-white-black; no estimate is really possible
return NAN;
}
@ -289,10 +286,12 @@ class Detector
* <p>Computes the dimension (number of modules on a size) of the QR Code based on the position
* of the finder patterns and estimated module size.</p>
*/
private static function computeDimension($topLeft,
private static function computeDimension(
$topLeft,
$topRight,
$bottomLeft,
$moduleSize)
$moduleSize
)
{
$tltrCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $topRight) / $moduleSize);
$tlblCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $bottomLeft) / $moduleSize);
@ -316,21 +315,23 @@ class Detector
* <p>Attempts to locate an alignment pattern in a limited region of the image, which is
* guessed to contain it. This method uses {@link AlignmentPattern}.</p>
*
* @param overallEstModuleSize estimated module size so far
* @param estAlignmentX x coordinate of center of area probably containing alignment pattern
* @param estAlignmentY y coordinate of above
* @param allowanceFactor number of pixels in all directions to search from the center
* @param estimated $overallEstModuleSize module size so far
* @param x $estAlignmentX coordinate of center of area probably containing alignment pattern
* @param y $estAlignmentY coordinate of above
* @param number $allowanceFactor of pixels in all directions to search from the center
*
* @return {@link AlignmentPattern} if found, or null otherwise
* @throws NotFoundException if an unexpected error occurs during detection
*/
protected final function findAlignmentInRegion($overallEstModuleSize,
final protected function findAlignmentInRegion(
$overallEstModuleSize,
$estAlignmentX,
$estAlignmentY,
$allowanceFactor)
$allowanceFactor
)
{
// Look for an alignment pattern (3 modules in size) around where it
// should be
// Look for an alignment pattern (3 modules in size) around where it
// should be
$allowance = (int)($allowanceFactor * $overallEstModuleSize);
$alignmentAreaLeftX = max(0, $estAlignmentX - $allowance);
$alignmentAreaRightX = min($this->image->getWidth() - 1, $estAlignmentX + $allowance);
@ -352,16 +353,19 @@ class Detector
$alignmentAreaRightX - $alignmentAreaLeftX,
$alignmentAreaBottomY - $alignmentAreaTopY,
$overallEstModuleSize,
$this->resultPointCallback);
$this->resultPointCallback
);
return $alignmentFinder->find();
}
private static function createTransform($topLeft,
private static function createTransform(
$topLeft,
$topRight,
$bottomLeft,
$alignmentPattern,
$dimension)
$dimension
)
{
$dimMinusThree = (float)$dimension - 3.5;
$bottomRightX = 0.0;
@ -374,7 +378,7 @@ class Detector
$sourceBottomRightX = $dimMinusThree - 3.0;
$sourceBottomRightY = $sourceBottomRightX;
} else {
// Don't have an alignment pattern, just make up the bottom-right point
// Don't have an alignment pattern, just make up the bottom-right point
$bottomRightX = ($topRight->getX() - $topLeft->getX()) + $bottomLeft->getX();
$bottomRightY = ($topRight->getY() - $topLeft->getY()) + $bottomLeft->getY();
$sourceBottomRightX = $dimMinusThree;
@ -397,23 +401,27 @@ class Detector
$bottomRightX,
$bottomRightY,
$bottomLeft->getX(),
$bottomLeft->getY());
$bottomLeft->getY()
);
}
private static function sampleGrid($image, $transform,
$dimension)
private static function sampleGrid(
$image,
$transform,
$dimension
)
{
$sampler = GridSampler::getInstance();
return $sampler->sampleGrid_($image, $dimension, $dimension, $transform);
}
protected final function getImage()
final protected function getImage()
{
return $this->image;
}
protected final function getResultPointCallback()
final protected function getResultPointCallback()
{
return $this->resultPointCallback;
}

View File

@ -28,14 +28,9 @@ use Zxing\ResultPoint;
*/
final class FinderPattern extends ResultPoint
{
private $estimatedModuleSize;
private $count;
public function __construct($posX, $posY, $estimatedModuleSize, $count = 1)
public function __construct($posX, $posY, private $estimatedModuleSize, private $count = 1)
{
parent::__construct($posX, $posY);
$this->estimatedModuleSize = $estimatedModuleSize;
$this->count = $count;
}
public function getEstimatedModuleSize()
@ -74,7 +69,7 @@ final class FinderPattern extends ResultPoint
* with a new estimate. It returns a new {@code FinderPattern} containing a weighted average
* based on count.
*/
public function combineEstimate($i, $j, $newModuleSize)
public function combineEstimate($i, $j, $newModuleSize): \Zxing\Qrcode\Detector\FinderPattern
{
$combinedCount = $this->count + 1;
$combinedX = ($this->count * $this->getX() + $j) / $combinedCount;

View File

@ -17,7 +17,6 @@
namespace Zxing\Qrcode\Detector;
use Zxing\BinaryBitmap;
use Zxing\Common\BitMatrix;
use Zxing\NotFoundException;
use Zxing\ResultPoint;
@ -32,34 +31,31 @@ use Zxing\ResultPoint;
*/
class FinderPatternFinder
{
protected static $MIN_SKIP = 3;
protected static $MAX_MODULES = 57; // 1 pixel/module times 3 modules/center
private static $CENTER_QUORUM = 2; // support up to version 10 for mobile clients
private $image;
private $average;
private $possibleCenters; //private final List<FinderPattern> possibleCenters;
private $hasSkipped = false;
protected static int $MIN_SKIP = 3;
protected static int $MAX_MODULES = 57; // 1 pixel/module times 3 modules/center
private static int $CENTER_QUORUM = 2;
private ?float $average = null;
private array $possibleCenters = []; //private final List<FinderPattern> possibleCenters;
private bool $hasSkipped = false;
/**
* @var mixed|int[]
*/
private $crossCheckStateCount;
private $resultPointCallback;
/**
* <p>Creates a finder that will search the image for three finder patterns.</p>
*
* @param BitMatrix $image image to search
*/
public function __construct($image, $resultPointCallback = null)
public function __construct(private $image, private $resultPointCallback = null)
{
$this->image = $image;
$this->possibleCenters = [];//new ArrayList<>();
//new ArrayList<>();
$this->crossCheckStateCount = fill_array(0, 5, 0);
$this->resultPointCallback = $resultPointCallback;
}
final public function find($hints)
final public function find($hints): \Zxing\Qrcode\Detector\FinderPatternInfo
{/*final FinderPatternInfo find(Map<DecodeHintType,?> hints) throws NotFoundException {*/
$tryHarder = true;//$hints != null && $hints['TRY_HARDER'];
$tryHarder = $hints != null && $hints['TRY_HARDER'];
$pureBarcode = $hints != null && $hints['PURE_BARCODE'];
$maxI = $this->image->getHeight();
$maxJ = $this->image->getWidth();
@ -211,18 +207,18 @@ class FinderPatternFinder
* Each additional find is more evidence that the location is in fact a finder
* pattern center
*
* @param $stateCount reading state module counts from horizontal scan
* @param i row where finder pattern may be found
* @param j end of possible finder pattern in row
* @param pureBarcode true if in "pure barcode" mode
* @param reading $stateCount state module counts from horizontal scan
* @param row $i where finder pattern may be found
* @param end $j of possible finder pattern in row
* @param true $pureBarcode if in "pure barcode" mode
*
* @return true if a finder pattern candidate was found this time
*/
protected final function handlePossibleCenter($stateCount, $i, $j, $pureBarcode)
final protected function handlePossibleCenter($stateCount, $i, $j, $pureBarcode)
{
$stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] +
$stateCount[4];
$centerJ = $this->centerFromEnd($stateCount, $j);
$centerJ = self::centerFromEnd($stateCount, $j);
$centerI = $this->crossCheckVertical($i, (int)($centerJ), $stateCount[2], $stateCountTotal);
if (!is_nan($centerI)) {
// Re-cross check
@ -271,14 +267,18 @@ class FinderPatternFinder
* finder pattern to see if the same proportion is detected.</p>
*
* @param $startI ; row where a finder pattern was detected
* @param centerJ ; center of the section that appears to cross a finder pattern
* @param $centerJ ; center of the section that appears to cross a finder pattern
* @param $maxCount ; maximum reasonable number of modules that should be
* observed in any reading state, based on the results of the horizontal scan
*
* @return vertical center of finder pattern, or {@link Float#NaN} if not found
* @return float vertical center of finder pattern, or {@link Float#NaN} if not found
*/
private function crossCheckVertical($startI, $centerJ, $maxCount,
$originalStateCountTotal)
private function crossCheckVertical(
$startI,
$centerJ,
$maxCount,
$originalStateCountTotal
)
{
$image = $this->image;
@ -342,7 +342,7 @@ class FinderPatternFinder
return NAN;
}
return self::foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $i) : NAN;
return self::foundPatternCross($stateCount) ? self::centerFromEnd($stateCount, $i) : NAN;
}
private function getCrossCheckStateCount()
@ -361,8 +361,12 @@ class FinderPatternFinder
* except it reads horizontally instead of vertically. This is used to cross-cross
* check a vertical cross check and locate the real center of the alignment pattern.</p>
*/
private function crossCheckHorizontal($startJ, $centerI, $maxCount,
$originalStateCountTotal)
private function crossCheckHorizontal(
$startJ,
$centerI,
$maxCount,
$originalStateCountTotal
)
{
$image = $this->image;
@ -423,7 +427,7 @@ class FinderPatternFinder
return NAN;
}
return $this->foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $j) : NAN;
return static::foundPatternCross($stateCount) ? self::centerFromEnd($stateCount, $j) : NAN;
}
/**
@ -432,10 +436,10 @@ class FinderPatternFinder
* finder pattern to see if the same proportion is detected.
*
* @param $startI ; row where a finder pattern was detected
* @param centerJ ; center of the section that appears to cross a finder pattern
* @param $centerJ ; center of the section that appears to cross a finder pattern
* @param $maxCount ; maximum reasonable number of modules that should be
* observed in any reading state, based on the results of the horizontal scan
* @param originalStateCountTotal ; The original state count total.
* @param $originalStateCountTotal ; The original state count total.
*
* @return true if proportions are withing expected limits
*/
@ -555,7 +559,7 @@ class FinderPatternFinder
}
/**
* @return number of rows we could safely skip during scanning, based on the first
* @return int number of rows we could safely skip during scanning, based on the first
* two finder patterns that have been located. In some cases their position will
* allow us to infer that the third pattern must lie below a certain point farther
* down in the image.
@ -568,8 +572,6 @@ class FinderPatternFinder
}
$firstConfirmedCenter = null;
foreach ($this->possibleCenters as $center) {
if ($center->getCount() >= self::$CENTER_QUORUM) {
if ($firstConfirmedCenter == null) {
$firstConfirmedCenter = $center;
@ -601,7 +603,7 @@ class FinderPatternFinder
$startSize = count($this->possibleCenters);
if ($startSize < 3) {
// Couldn't find enough finder patterns
throw new NotFoundException;
throw new NotFoundException();
}
// Filter outlier possibilities whose module size is too different
@ -617,7 +619,7 @@ class FinderPatternFinder
$this->average = $totalModuleSize / (float)$startSize;
$stdDev = (float)sqrt($square / $startSize - $this->average * $this->average);
usort($this->possibleCenters, [$this, 'FurthestFromAverageComparator']);
usort($this->possibleCenters, $this->FurthestFromAverageComparator(...));
$limit = max(0.2 * $this->average, $stdDev);
@ -641,7 +643,7 @@ class FinderPatternFinder
$this->average = $totalModuleSize / (float)count($this->possibleCenters);
usort($this->possibleCenters, [$this, 'CenterComparator']);
usort($this->possibleCenters, $this->CenterComparator(...));
array_slice($this->possibleCenters, 3, count($this->possibleCenters) - 3);
}
@ -654,7 +656,6 @@ class FinderPatternFinder
*/
public function FurthestFromAverageComparator($center1, $center2)
{
$dA = abs($center2->getEstimatedModuleSize() - $this->average);
$dB = abs($center1->getEstimatedModuleSize() - $this->average);
if ($dA < $dB) {
@ -683,7 +684,7 @@ class FinderPatternFinder
}
}
protected final function getImage()
final protected function getImage()
{
return $this->image;
}
@ -692,7 +693,7 @@ class FinderPatternFinder
*/
//@Override
protected final function getPossibleCenters()
final protected function getPossibleCenters()
{ //List<FinderPattern> getPossibleCenters()
return $this->possibleCenters;
}

View File

@ -19,13 +19,13 @@ namespace Zxing\Qrcode;
use Zxing\BinaryBitmap;
use Zxing\ChecksumException;
use Zxing\Common\BitMatrix;
use Zxing\FormatException;
use Zxing\NotFoundException;
use Zxing\Reader;
use Zxing\Result;
use Zxing\Common\BitMatrix;
use Zxing\Qrcode\Decoder\Decoder;
use Zxing\Qrcode\Detector\Detector;
use Zxing\Reader;
use Zxing\Result;
/**
* This implementation can detect and decode QR Codes in an image.
@ -34,8 +34,8 @@ use Zxing\Qrcode\Detector\Detector;
*/
class QRCodeReader implements Reader
{
private static $NO_POINTS = [];
private $decoder;
private static array $NO_POINTS = [];
private readonly \Zxing\Qrcode\Decoder\Decoder $decoder;
public function __construct()
{
@ -43,7 +43,6 @@ class QRCodeReader implements Reader
}
/**
* @param BinaryBitmap $image
* @param null $hints
*
* @return Result
@ -210,12 +209,12 @@ class QRCodeReader implements Reader
return ($x - $leftTopBlack[0]) / 7.0; //return ($x - $leftTopBlack[0]) / 7.0f;
}
public function reset()
public function reset(): void
{
// do nothing
}
protected final function getDecoder()
final protected function getDecoder()
{
return $this->decoder;
}

View File

@ -29,8 +29,17 @@ final class RGBLuminanceSource extends LuminanceSource
public $luminances;
private $dataWidth;
private $dataHeight;
/**
* @var mixed|int
*/
private $left;
/**
* @var mixed|int
*/
private $top;
/**
* @var mixed|null
*/
private $pixels;
@ -59,7 +68,7 @@ final class RGBLuminanceSource extends LuminanceSource
$this->top = $top;
}
public function RGBLuminanceSource_($width, $height, $pixels)
public function RGBLuminanceSource_($width, $height, $pixels): void
{
parent::__construct($width, $height);
@ -70,8 +79,8 @@ final class RGBLuminanceSource extends LuminanceSource
$this->pixels = $pixels;
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
// In order to measure pure decoding speed, we convert the entire image to a greyscale array
// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.
$this->luminances = [];
//$this->luminances = $this->grayScaleToBitmap($this->grayscale());
@ -97,14 +106,13 @@ final class RGBLuminanceSource extends LuminanceSource
//$g = ($pixel >> 8) & 0xff;
//$b = $pixel & 0xff;
if ($r == $g && $g == $b) {
// Image is already greyscale, so pick any channel.
// Image is already greyscale, so pick any channel.
$this->luminances[$key] = $r;//(($r + 128) % 256) - 128;
} else {
// Calculate luminance cheaply, favoring green.
// Calculate luminance cheaply, favoring green.
$this->luminances[$key] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128;
}
}
/*
@ -131,7 +139,6 @@ final class RGBLuminanceSource extends LuminanceSource
*/
//}
// $this->luminances = $this->grayScaleToBitmap($this->luminances);
}
public function grayscale()
@ -170,13 +177,12 @@ final class RGBLuminanceSource extends LuminanceSource
return $p;
}
public function grayScaleToBitmap($grayScale)
{
$middle = $this->getMiddleBrightnessPerArea($grayScale);
$sqrtNumArea = count($middle);
$sqrtNumArea = is_countable($middle) ? count($middle) : 0;
$areaWidth = floor($this->dataWidth / $sqrtNumArea);
$areaHeight = floor($this->dataHeight / $sqrtNumArea);
$bitmap = fill_array(0, $this->dataWidth * $this->dataHeight, 0);
@ -213,12 +219,14 @@ final class RGBLuminanceSource extends LuminanceSource
for ($dy = 0; $dy < $areaHeight; $dy++) {
for ($dx = 0; $dx < $areaWidth; $dx++) {
$target = $image[(int)($areaWidth * $ax + $dx + ($areaHeight * $ay + $dy) * $this->dataWidth)];
if ($target < $minmax[$ax][$ay][0])
if ($target < $minmax[$ax][$ay][0]) {
$minmax[$ax][$ay][0] = $target;
if ($target > $minmax[$ax][$ay][1])
}
if ($target > $minmax[$ax][$ay][1]) {
$minmax[$ax][$ay][1] = $target;
}
}
}
//minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;
}
}
@ -239,14 +247,14 @@ final class RGBLuminanceSource extends LuminanceSource
return $middle;
}
//@Override
//@Override
public function getRow($y, $row = null)
{
if ($y < 0 || $y >= $this->getHeight()) {
throw new \InvalidArgumentException("Requested row is outside the image: " + y);
throw new \InvalidArgumentException("Requested row is outside the image: " + \Y);
}
$width = $this->getWidth();
if ($row == null || count($row) < $width) {
if ($row == null || (is_countable($row) ? count($row) : 0) < $width) {
$row = [];
}
$offset = ($y + $this->top) * $this->dataWidth + $this->left;
@ -255,14 +263,14 @@ final class RGBLuminanceSource extends LuminanceSource
return $row;
}
//@Override
//@Override
public function getMatrix()
{
$width = $this->getWidth();
$height = $this->getHeight();
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
// If the caller asks for the entire underlying image, save the copy and give them the
// original data. The docs specifically warn that result.length must be ignored.
if ($width == $this->dataWidth && $height == $this->dataHeight) {
return $this->luminances;
}
@ -271,14 +279,14 @@ final class RGBLuminanceSource extends LuminanceSource
$matrix = [];
$inputOffset = $this->top * $this->dataWidth + $this->left;
// If the width matches the full width of the underlying data, perform a single copy.
// If the width matches the full width of the underlying data, perform a single copy.
if ($width == $this->dataWidth) {
$matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area);
return $matrix;
}
// Otherwise copy one cropped row at a time.
// Otherwise copy one cropped row at a time.
$rgb = $this->luminances;
for ($y = 0; $y < $height; $y++) {
$outputOffset = $y * $width;
@ -289,21 +297,23 @@ final class RGBLuminanceSource extends LuminanceSource
return $matrix;
}
//@Override
//@Override
public function isCropSupported()
{
return true;
}
//@Override
public function crop($left, $top, $width, $height)
//@Override
public function crop($left, $top, $width, $height): \Zxing\RGBLuminanceSource
{
return new RGBLuminanceSource($this->luminances,
return new RGBLuminanceSource(
$this->luminances,
$this->dataWidth,
$this->dataHeight,
$this->left + $left,
$this->top + $top,
$width,
$height);
$height
);
}
}

View File

@ -26,12 +26,11 @@ namespace Zxing;
*/
abstract class ReaderException extends \Exception
{
// disable stack traces when not running inside test units
//protected static $isStackTrace = System.getProperty("surefire.test.class.path") != null;
protected static $isStackTrace = false;
protected static bool $isStackTrace = false;
function ReaderException($cause = null)
public function ReaderException($cause = null): void
{
if ($cause) {
parent::__construct($cause);
@ -39,11 +38,11 @@ abstract class ReaderException extends \Exception
}
// Prevent stack traces from being taken
// srowen says: huh, my IDE is saying this is not an override. native methods can't be overridden?
// This, at least, does not hurt. Because we use a singleton pattern here, it doesn't matter anyhow.
//@Override
public final function fillInStackTrace()
// Prevent stack traces from being taken
// srowen says: huh, my IDE is saying this is not an override. native methods can't be overridden?
// This, at least, does not hurt. Because we use a singleton pattern here, it doesn't matter anyhow.
//@Override
final public function fillInStackTrace()
{
return null;
}

View File

@ -24,26 +24,19 @@ namespace Zxing;
*/
final class Result
{
private $text;
private $rawBytes;
private $resultPoints;
private $format;
private $resultMetadata;
/**
* @var mixed[]|mixed
*/
private $resultMetadata = null;
private $timestamp;
public function __construct(
$text,
$rawBytes,
$resultPoints,
$format,
private $text,
private $rawBytes,
private $resultPoints,
private $format,
$timestamp = ''
) {
$this->text = $text;
$this->rawBytes = $rawBytes;
$this->resultPoints = $resultPoints;
$this->format = $format;
$this->resultMetadata = null;
$this->timestamp = $timestamp ?: time();
}
@ -91,15 +84,16 @@ final class Result
return $this->resultMetadata;
}
public function putMetadata($type, $value)
public function putMetadata($type, $value): void
{
$resultMetadata = [];
if ($this->resultMetadata === null) {
$this->resultMetadata = [];
}
$resultMetadata[$type] = $value;
}
public function putAllMetadata($metadata)
public function putAllMetadata($metadata): void
{
if ($metadata !== null) {
if ($this->resultMetadata === null) {
@ -110,15 +104,15 @@ final class Result
}
}
public function addResultPoints($newPoints)
public function addResultPoints($newPoints): void
{
$oldPoints = $this->resultPoints;
if ($oldPoints === null) {
$this->resultPoints = $newPoints;
} else if ($newPoints !== null && count($newPoints) > 0) {
$allPoints = fill_array(0, count($oldPoints) + count($newPoints), 0);
$allPoints = arraycopy($oldPoints, 0, $allPoints, 0, count($oldPoints));
$allPoints = arraycopy($newPoints, 0, $allPoints, count($oldPoints), count($newPoints));
} elseif ($newPoints !== null && (is_countable($newPoints) ? count($newPoints) : 0) > 0) {
$allPoints = fill_array(0, (is_countable($oldPoints) ? count($oldPoints) : 0) + (is_countable($newPoints) ? count($newPoints) : 0), 0);
$allPoints = arraycopy($oldPoints, 0, $allPoints, 0, is_countable($oldPoints) ? count($oldPoints) : 0);
$allPoints = arraycopy($newPoints, 0, $allPoints, is_countable($oldPoints) ? count($oldPoints) : 0, is_countable($newPoints) ? count($newPoints) : 0);
$this->resultPoints = $allPoints;
}
}

View File

@ -27,8 +27,8 @@ use Zxing\Common\Detector\MathUtils;
*/
class ResultPoint
{
private $x;
private $y;
private float $x;
private float $y;
public function __construct($x, $y)
{
@ -40,7 +40,7 @@ class ResultPoint
* Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
* and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
*
* @param patterns array of three {@code ResultPoint} to order
* @param array $patterns of three {@code ResultPoint} to order
*/
public static function orderBestPatterns($patterns)
{
@ -53,12 +53,12 @@ class ResultPoint
$pointA = '';
$pointB = '';
$pointC = '';
// Assume one closest to other two is B; A and C will just be guesses at first
// Assume one closest to other two is B; A and C will just be guesses at first
if ($oneTwoDistance >= $zeroOneDistance && $oneTwoDistance >= $zeroTwoDistance) {
$pointB = $patterns[0];
$pointA = $patterns[1];
$pointC = $patterns[2];
} else if ($zeroTwoDistance >= $oneTwoDistance && $zeroTwoDistance >= $zeroOneDistance) {
} elseif ($zeroTwoDistance >= $oneTwoDistance && $zeroTwoDistance >= $zeroOneDistance) {
$pointB = $patterns[1];
$pointA = $patterns[0];
$pointC = $patterns[2];
@ -68,10 +68,10 @@ class ResultPoint
$pointC = $patterns[1];
}
// Use cross product to figure out whether A and C are correct or flipped.
// This asks whether BC x BA has a positive z component, which is the arrangement
// we want for A, B, C. If it's negative, then we've got it flipped around and
// should swap A and C.
// Use cross product to figure out whether A and C are correct or flipped.
// This asks whether BC x BA has a positive z component, which is the arrangement
// we want for A, B, C. If it's negative, then we've got it flipped around and
// should swap A and C.
if (self::crossProductZ($pointA, $pointB, $pointC) < 0.0) {
$temp = $pointA;
$pointA = $pointC;
@ -86,8 +86,8 @@ class ResultPoint
}
/**
* @param pattern1 first pattern
* @param pattern2 second pattern
* @param first $pattern1 pattern
* @param second $pattern2 pattern
*
* @return distance between two points
*/
@ -96,14 +96,16 @@ class ResultPoint
return MathUtils::distance($pattern1->x, $pattern1->y, $pattern2->x, $pattern2->y);
}
//@Override
//@Override
/**
* Returns the z component of the cross product between vectors BC and BA.
*/
private static function crossProductZ($pointA,
private static function crossProductZ(
$pointA,
$pointB,
$pointC)
$pointC
)
{
$bX = $pointB->x;
$bY = $pointB->y;
@ -111,21 +113,21 @@ class ResultPoint
return (($pointC->x - $bX) * ($pointA->y - $bY)) - (($pointC->y - $bY) * ($pointA->x - $bX));
}
//@Override
//@Override
public final function getX()
final public function getX()
{
return (float)($this->x);
}
//@Override
//@Override
public final function getY()
final public function getY()
{
return (float)($this->y);
}
public final function equals($other)
final public function equals($other)
{
if ($other instanceof ResultPoint) {
$otherPoint = $other;
@ -136,12 +138,12 @@ class ResultPoint
return false;
}
public final function hashCode()
final public function hashCode()
{
return 31 * floatToIntBits($this->x) + floatToIntBits($this->y);
}
public final function toString()
final public function toString()
{
$result = '';
$result .= ('(');

View File

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">tests/</directory>
<directory suffix=".php">lib</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory>tests</directory>
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Nette\Set\NetteSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Core\Configuration\Option;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SensiolabsSetList;
use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/lib'
]);
$parameters = $rectorConfig->parameters();
$parameters->set(
Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER,
__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'
);
$rectorConfig->sets([
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
NetteSetList::ANNOTATIONS_TO_ATTRIBUTES,
SensiolabsSetList::FRAMEWORK_EXTRA_61,
SymfonySetList::SYMFONY_60,
LevelSetList::UP_TO_PHP_81
]);
// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rule(AddReturnTypeDeclarationRector::class);
$rectorConfig->rules([
AddVoidReturnTypeWhereNoReturnRector::class,
ArrayShapeFromConstantArrayReturnRector::class,
ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class,
PropertyTypeDeclarationRector::class,
ReturnTypeFromReturnNewRector::class,
// ReturnTypeFromStrictBoolReturnExprRector::class,
// ReturnTypeFromStrictNativeFuncCallRector::class,
// ReturnTypeFromStrictNewArrayRector::class,
TypedPropertyFromAssignsRector::class
]);
// define sets of rules
// $rectorConfig->sets([
// LevelSetList::UP_TO_PHP_80
// ]);
};

View File

@ -7,7 +7,6 @@ use Zxing\QrReader;
class QrReaderTest extends TestCase
{
public function testText1()
{
$image = __DIR__ . "/qrcodes/hello_world.png";
@ -15,4 +14,11 @@ class QrReaderTest extends TestCase
$qrcode = new QrReader($image);
$this->assertSame("Hello world!", $qrcode->text());
}
public function testNoText()
{
$image = __DIR__ . "/qrcodes/empty.png";
$qrcode = new QrReader($image);
$this->assertSame(false, $qrcode->text());
}
}

View File

@ -1,15 +0,0 @@
<?php
require_once __DIR__ . '/../lib/common/customFunctions.php';
spl_autoload_register(function (string $class) {
$path = explode('\\', $class);
$className = array_pop($path);
array_shift($path);
$path = strtolower(implode('/', $path));
$path = __DIR__ . '/../lib/' . $path . '/' . $className . '.php';
if (file_exists($path)) {
require_once $path;
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,9 +1,9 @@
# PHP Enum implementation inspired from SplEnum
[![Build Status](https://travis-ci.org/myclabs/php-enum.png?branch=master)](https://travis-ci.org/myclabs/php-enum)
[![GitHub Actions][GA Image]][GA Link]
[![Latest Stable Version](https://poser.pugx.org/myclabs/php-enum/version.png)](https://packagist.org/packages/myclabs/php-enum)
[![Total Downloads](https://poser.pugx.org/myclabs/php-enum/downloads.png)](https://packagist.org/packages/myclabs/php-enum)
[![psalm](https://shepherd.dev/github/myclabs/php-enum/coverage.svg)](https://shepherd.dev/github/myclabs/php-enum)
[![Psalm Shepherd][Shepherd Image]][Shepherd Link]
Maintenance for this project is [supported via Tidelift](https://tidelift.com/subscription/pkg/packagist-myclabs-php-enum?utm_source=packagist-myclabs-php-enum&utm_medium=referral&utm_campaign=readme).
@ -130,9 +130,65 @@ final class Action extends Enum
}
```
## Native enums and migration
Native enum arrived to PHP in version 8.1: https://www.php.net/enumerations
If your project is running PHP 8.1+ or your library has it as a minimum requirement you should use it instead of this library.
When migrating from `myclabs/php-enum`, the effort should be small if the usage was in the recommended way:
- private constants
- final classes
- no method overridden
Changes for migration:
- Class definition should be changed from
```php
/**
* @method static Action VIEW()
* @method static Action EDIT()
*/
final class Action extends Enum
{
private const VIEW = 'view';
private const EDIT = 'edit';
}
```
to
```php
enum Action: string
{
case VIEW = 'view';
case EDIT = 'edit';
}
```
All places where the class was used as a type will continue to work.
Usages and the change needed:
| Operation | myclabs/php-enum | native enum |
|----------------------------------------------------------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Obtain an instance will change from | `$enumCase = Action::VIEW()` | `$enumCase = Action::VIEW` |
| Create an enum from a backed value | `$enumCase = new Action('view')` | `$enumCase = Action::from('view')` |
| Get the backed value of the enum instance | `$enumCase->getValue()` | `$enumCase->value` |
| Compare two enum instances | `$enumCase1 == $enumCase2` <br/> or <br/> `$enumCase1->equals($enumCase2)` | `$enumCase1 === $enumCase2` |
| Get the key/name of the enum instance | `$enumCase->getKey()` | `$enumCase->name` |
| Get a list of all the possible instances of the enum | `Action::values()` | `Action::cases()` |
| Get a map of possible instances of the enum mapped by name | `Action::values()` | `array_combine(array_map(fn($case) => $case->name, Action::cases()), Action::cases())` <br/> or <br/> `(new ReflectionEnum(Action::class))->getConstants()` |
| Get a list of all possible names of the enum | `Action::keys()` | `array_map(fn($case) => $case->name, Action::cases())` |
| Get a list of all possible backed values of the enum | `Action::toArray()` | `array_map(fn($case) => $case->value, Action::cases())` |
| Get a map of possible backed values of the enum mapped by name | `Action::toArray()` | `array_combine(array_map(fn($case) => $case->name, Action::cases()), array_map(fn($case) => $case->value, Action::cases()))` <br/> or <br/> `array_map(fn($case) => $case->value, (new ReflectionEnum(Action::class))->getConstants()))` |
## Related projects
- [PHP 8.1+ native enum](https://www.php.net/enumerations)
- [Doctrine enum mapping](https://github.com/acelaya/doctrine-enum-type)
- [Symfony ParamConverter integration](https://github.com/Ex3v/MyCLabsEnumParamConverter)
- [PHPStan integration](https://github.com/timeweb/phpstan-enum)
- [Yii2 enum mapping](https://github.com/KartaviK/yii2-enum)
[GA Image]: https://github.com/myclabs/php-enum/workflows/CI/badge.svg
[GA Link]: https://github.com/myclabs/php-enum/actions?query=workflow%3A%22CI%22+branch%3Amaster
[Shepherd Image]: https://shepherd.dev/github/myclabs/php-enum/coverage.svg
[Shepherd Link]: https://shepherd.dev/github/myclabs/php-enum

View File

@ -14,7 +14,10 @@
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"classmap": [
"stubs/Stringable.php"
]
},
"autoload-dev": {
"psr-4": {

View File

@ -1,35 +0,0 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<directory name="static-analysis" />
<ignoreFiles>
<directory name="vendor" />
<directory name="src/PHPUnit" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="info" />
<ImpureStaticProperty>
<!-- self::$... usages in Enum are used to populate an internal cache, and cause no side-effects -->
<errorLevel type="suppress">
<file name="src/Enum.php"/>
</errorLevel>
</ImpureStaticProperty>
<ImpureVariable>
<!-- $this usages in Enum point themselves to an immutable instance -->
<errorLevel type="suppress">
<file name="src/Enum.php"/>
</errorLevel>
</ImpureVariable>
</issueHandlers>
</psalm>

View File

@ -19,7 +19,7 @@ namespace MyCLabs\Enum;
* @psalm-immutable
* @psalm-consistent-constructor
*/
abstract class Enum implements \JsonSerializable
abstract class Enum implements \JsonSerializable, \Stringable
{
/**
* Enum value

View File

@ -0,0 +1,11 @@
<?php
if (\PHP_VERSION_ID < 80000 && !interface_exists('Stringable')) {
interface Stringable
{
/**
* @return string
*/
public function __toString();
}
}

View File

@ -59,7 +59,7 @@ class TimezoneTransformer extends Transformer
return $dateTime->format('\G\M\TP');
}
return sprintf('GMT%s%d', ($offset >= 0 ? '+' : ''), $offset / 100);
return sprintf('GMT%s%d', $offset >= 0 ? '+' : '', $offset / 100);
}
/**

View File

@ -244,7 +244,7 @@ abstract class IntlDateFormatter
*
* @throws MethodNotImplementedException
*/
public function formatObject(object $object, $format = null, string $locale = null)
public static function formatObject(object $object, $format = null, string $locale = null)
{
throw new MethodNotImplementedException(__METHOD__);
}

View File

@ -117,7 +117,7 @@ final class Intl
*/
public static function getIcuStubVersion(): string
{
return '71.1';
return '72.1';
}
/**

View File

@ -9,6 +9,10 @@
* file that was distributed with this source code.
*/
if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}
define('LINE_WIDTH', 75);
define('LINE', str_repeat('-', LINE_WIDTH)."\n");

View File

@ -23,6 +23,10 @@ use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\Locale;
use Symfony\Component\Intl\Util\GitRepository;
if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}
require_once __DIR__.'/common.php';
require_once __DIR__.'/autoload.php';

View File

@ -68,7 +68,7 @@ return [
],
'AWG' => [
0 => 'AWG',
1 => 'আরুবা গিল্ডার',
1 => 'আরুবা ফ্লোরিন',
],
'AZM' => [
0 => 'AZM',
@ -132,7 +132,7 @@ return [
],
'BOB' => [
0 => 'BOB',
1 => 'বলিভিয়ানো',
1 => 'বলিভিয়ান বলিভিয়ানো',
],
'BOP' => [
0 => 'BOP',
@ -412,7 +412,7 @@ return [
],
'GYD' => [
0 => 'GYD',
1 => 'গায়েনা ডলার',
1 => 'গায়ানিজ ডলার',
],
'HKD' => [
0 => 'HK$',
@ -452,7 +452,7 @@ return [
],
'ILS' => [
0 => '₪',
1 => 'ইস্রাইলি নতুন শেকেল',
1 => 'ইসরায়েলি নতুন শেকেল',
],
'INR' => [
0 => '₹',
@ -500,7 +500,7 @@ return [
],
'KMF' => [
0 => 'KMF',
1 => 'কম্বোরো ফ্রাঙ্ক',
1 => 'কমোরিয়ান ফ্রাঙ্ক',
],
'KPW' => [
0 => 'KPW',
@ -640,7 +640,7 @@ return [
],
'MWK' => [
0 => 'MWK',
1 => 'মালাউইয়ান কওয়াচ',
1 => 'মালাউইয়ান কোয়াচা',
],
'MXN' => [
0 => 'MX$',
@ -708,7 +708,7 @@ return [
],
'PAB' => [
0 => 'PAB',
1 => 'পানামা বেলবোয়া',
1 => 'পানামানিয়ান বালবোয়া',
],
'PEI' => [
0 => 'PEI',
@ -836,7 +836,7 @@ return [
],
'SRD' => [
0 => 'SRD',
1 => 'সুরিনাম ডলার',
1 => 'সুরিনামিজ ডলার',
],
'SRG' => [
0 => 'SRG',

View File

@ -0,0 +1,42 @@
<?php
return [
'Names' => [
'ANG' => [
0 => 'ANG',
1 => 'নেদারল্যান্ডস অ্যান্টিলিয়ান গিল্ডার',
],
'AWG' => [
0 => 'AWG',
1 => 'আরুবান গিল্ডার',
],
'BMD' => [
0 => 'BMD',
1 => 'বারমুডান ডলার',
],
'GTQ' => [
0 => 'GTQ',
1 => 'গুয়াতেমালান কেৎসাল',
],
'HNL' => [
0 => 'HNL',
1 => 'হন্ডুরান লেম্পিরা',
],
'HTG' => [
0 => 'HTG',
1 => 'হাইতিয়ান গুর্দ',
],
'MXN' => [
0 => 'MX$',
1 => 'মেক্সিকান পেসো',
],
'USD' => [
0 => '$',
1 => 'মার্কিন ডলার',
],
'XCD' => [
0 => 'EC$',
1 => 'পূর্ব ক্যারিবিয়ান ডলার',
],
],
];

View File

@ -0,0 +1,630 @@
<?php
return [
'Names' => [
'AED' => [
0 => 'AED',
1 => 'АПЭ дирхамӗ',
],
'AFN' => [
0 => 'AFN',
1 => 'афганийӗ',
],
'ALL' => [
0 => 'ALL',
1 => 'Албани лекӗ',
],
'AMD' => [
0 => 'AMD',
1 => 'Армяни драмӗ',
],
'ANG' => [
0 => 'ANG',
1 => 'Нидерланд Антиллиан гульденӗ',
],
'AOA' => [
0 => 'AOA',
1 => 'Ангола кванзӗ',
],
'ARS' => [
0 => 'ARS',
1 => 'Аргентина песийӗ',
],
'AUD' => [
0 => 'A$',
1 => 'Австрали долларӗ',
],
'AWG' => [
0 => 'AWG',
1 => 'Аруба флоринӗ',
],
'AZN' => [
0 => 'AZN',
1 => 'Азербайджан маначӗ',
],
'BAM' => [
0 => 'BAM',
1 => 'Боснипе Герцеговина конвертланакан марки',
],
'BBD' => [
0 => 'BBD',
1 => 'Барбадос долларӗ',
],
'BDT' => [
0 => 'BDT',
1 => 'Бангладеш таки',
],
'BGN' => [
0 => 'BGN',
1 => 'Болгари левӗ',
],
'BHD' => [
0 => 'BHD',
1 => 'Бахрейн динарӗ',
],
'BIF' => [
0 => 'BIF',
1 => 'Бурунди франкӗ',
],
'BMD' => [
0 => 'BMD',
1 => 'Бермуд долларӗ',
],
'BND' => [
0 => 'BND',
1 => 'Бруней долларӗ',
],
'BOB' => [
0 => 'BOB',
1 => 'Боливи боливианӗ',
],
'BRL' => [
0 => 'R$',
1 => 'Бразили реалӗ',
],
'BSD' => [
0 => 'BSD',
1 => 'Багам долларӗ',
],
'BTN' => [
0 => 'BTN',
1 => 'Бутан нгултрумӗ',
],
'BWP' => [
0 => 'BWP',
1 => 'Ботсвана пули',
],
'BYN' => [
0 => 'BYN',
1 => 'Беларуҫ тенкӗ',
],
'BZD' => [
0 => 'BZD',
1 => 'Белиз долларӗ',
],
'CAD' => [
0 => 'CA$',
1 => 'Канада долларӗ',
],
'CDF' => [
0 => 'CDF',
1 => 'Конголези франкӗ',
],
'CHF' => [
0 => 'CHF',
1 => 'Швейцари франкӗ',
],
'CLP' => [
0 => 'CLP',
1 => 'Чили песийӗ',
],
'CNH' => [
0 => 'CNH',
1 => 'Китай офшор юанӗ',
],
'CNY' => [
0 => 'CN¥',
1 => 'Китай юанӗ',
],
'COP' => [
0 => 'COP',
1 => 'Колумби песийӗ',
],
'CRC' => [
0 => 'CRC',
1 => 'Коста-Рика колонӗ',
],
'CUC' => [
0 => 'CUC',
1 => 'Куба конвертланакан песийӗ',
],
'CUP' => [
0 => 'CUP',
1 => 'Куба песийӗ',
],
'CVE' => [
0 => 'CVE',
1 => 'Кабо-Верде эскудӗ',
],
'CZK' => [
0 => 'CZK',
1 => 'Чехи кронӗ',
],
'DJF' => [
0 => 'DJF',
1 => 'Джибути франкӗ',
],
'DKK' => [
0 => 'DKK',
1 => 'Дани кронӗ',
],
'DOP' => [
0 => 'DOP',
1 => 'Доминикан песийӗ',
],
'DZD' => [
0 => 'DZD',
1 => 'Алжир динарӗ',
],
'EGP' => [
0 => 'EGP',
1 => 'Египет фунчӗ',
],
'ERN' => [
0 => 'ERN',
1 => 'Эритрей накфӗ',
],
'ETB' => [
0 => 'ETB',
1 => 'Эфиопи бырӗ',
],
'EUR' => [
0 => '€',
1 => 'евро',
],
'FJD' => [
0 => 'FJD',
1 => 'Фиджи долларӗ',
],
'FKP' => [
0 => 'FKP',
1 => 'Факланд утравӗсен фунчӗ',
],
'GBP' => [
0 => '£',
1 => 'Британи фунчӗ',
],
'GEL' => [
0 => 'GEL',
1 => 'Грузи ларийӗ',
],
'GHS' => [
0 => 'GHS',
1 => 'Гана седийӗ',
],
'GIP' => [
0 => 'GIP',
1 => 'Гибралтар фунчӗ',
],
'GMD' => [
0 => 'GMD',
1 => 'Гамби даласийӗ',
],
'GNF' => [
0 => 'GNF',
1 => 'Гвиней франкӗ',
],
'GTQ' => [
0 => 'GTQ',
1 => 'Гватемала кетсалӗ',
],
'GYD' => [
0 => 'GYD',
1 => 'Гайана долларӗ',
],
'HKD' => [
0 => 'HK$',
1 => 'Гонконг долларӗ',
],
'HNL' => [
0 => 'HNL',
1 => 'Гондурас лемпирӗ',
],
'HRK' => [
0 => 'HRK',
1 => 'Хорвати куни',
],
'HTG' => [
0 => 'HTG',
1 => 'Гаити гурдӗ',
],
'HUF' => [
0 => 'HUF',
1 => 'Венгри форинчӗ',
],
'IDR' => [
0 => 'IDR',
1 => 'Индонези рупийӗ',
],
'ILS' => [
0 => '₪',
1 => 'Ҫӗнӗ Израиль шекелӗ',
],
'INR' => [
0 => '₹',
1 => 'Инди рупийӗ',
],
'IQD' => [
0 => 'IQD',
1 => 'Ирак динарӗ',
],
'IRR' => [
0 => 'IRR',
1 => 'Иран риалӗ',
],
'ISK' => [
0 => 'ISK',
1 => 'Исланди кронӗ',
],
'JMD' => [
0 => 'JMD',
1 => 'Ямайка долларӗ',
],
'JOD' => [
0 => 'JOD',
1 => 'Иордан динарӗ',
],
'JPY' => [
0 => 'JP¥',
1 => 'Япони иени',
],
'KES' => [
0 => 'KES',
1 => 'Кени шиллингӗ',
],
'KGS' => [
0 => 'KGS',
1 => 'Киргиз сомӗ',
],
'KHR' => [
0 => 'KHR',
1 => 'Камбоджа риелӗ',
],
'KMF' => [
0 => 'KMF',
1 => 'Комора франкӗ',
],
'KPW' => [
0 => 'KPW',
1 => 'КХДР вони',
],
'KRW' => [
0 => '₩',
1 => 'Корей вони',
],
'KWD' => [
0 => 'KWD',
1 => 'Кувейт динарӗ',
],
'KYD' => [
0 => 'KYD',
1 => 'Кайман утравӗсен долларӗ',
],
'KZT' => [
0 => 'KZT',
1 => 'Казах тенгейӗ',
],
'LAK' => [
0 => 'LAK',
1 => 'Лаос кипӗ',
],
'LBP' => [
0 => 'LBP',
1 => 'Ливан фунчӗ',
],
'LKR' => [
0 => 'LKR',
1 => 'Шри-ланка рупийӗ',
],
'LRD' => [
0 => 'LRD',
1 => 'Либери долларӗ',
],
'LSL' => [
0 => 'LSL',
1 => 'Лесото лотийӗ',
],
'LYD' => [
0 => 'LYD',
1 => 'Ливи динарӗ',
],
'MAD' => [
0 => 'MAD',
1 => 'Марокко дирхамӗ',
],
'MDL' => [
0 => 'MDL',
1 => 'Молдова лайӗ',
],
'MGA' => [
0 => 'MGA',
1 => 'Малагаси ариарийӗ',
],
'MKD' => [
0 => 'MKD',
1 => 'Македони денарӗ',
],
'MMK' => [
0 => 'MMK',
1 => 'Мьянман кьятӗ',
],
'MNT' => [
0 => 'MNT',
1 => 'Монголи тугрикӗ',
],
'MOP' => [
0 => 'MOP',
1 => 'Макао патаки',
],
'MRU' => [
0 => 'MRU',
1 => 'Мавритани угийӗ',
],
'MUR' => [
0 => 'MUR',
1 => 'Маврики рупийӗ',
],
'MVR' => [
0 => 'MVR',
1 => 'Мальдивсен руфийӗ',
],
'MWK' => [
0 => 'MWK',
1 => 'Малави квачӗ',
],
'MXN' => [
0 => 'MX$',
1 => 'Мексика песийӗ',
],
'MYR' => [
0 => 'MYR',
1 => 'Малайзи ринггичӗ',
],
'MZN' => [
0 => 'MZN',
1 => 'Мозамбик метикалӗ',
],
'NAD' => [
0 => 'NAD',
1 => 'Намиби долларӗ',
],
'NGN' => [
0 => 'NGN',
1 => 'Нигери найрӗ',
],
'NIO' => [
0 => 'NIO',
1 => 'Никарагуа кордобӗ',
],
'NOK' => [
0 => 'NOK',
1 => 'Норвеги кронӗ',
],
'NPR' => [
0 => 'NPR',
1 => 'Непал рупийӗ',
],
'NZD' => [
0 => 'NZ$',
1 => 'Ҫӗнӗ Зеланди долларӗ',
],
'OMR' => [
0 => 'OMR',
1 => 'Оман риалӗ',
],
'PAB' => [
0 => 'PAB',
1 => 'Панама бальбоа',
],
'PEN' => [
0 => 'PEN',
1 => 'Перу солӗ',
],
'PGK' => [
0 => 'PGK',
1 => 'Папуа Ҫӗнӗ Гвиней кини',
],
'PHP' => [
0 => '₱',
1 => 'Филиппин песийӗ',
],
'PKR' => [
0 => 'PKR',
1 => 'пакистан рупийӗ',
],
'PLN' => [
0 => 'PLN',
1 => 'Польша злотыйӗ',
],
'PYG' => [
0 => 'PYG',
1 => 'Парагвай гуаранӗ',
],
'QAR' => [
0 => 'QAR',
1 => 'Катар риалӗ',
],
'RON' => [
0 => 'RON',
1 => 'Румыни лейӗ',
],
'RSD' => [
0 => 'RSD',
1 => 'Серби динарӗ',
],
'RUB' => [
0 => '₽',
1 => 'Раҫҫей тенкӗ',
],
'RWF' => [
0 => 'RWF',
1 => 'Руанда франкӗ',
],
'SAR' => [
0 => 'SAR',
1 => 'Сауд риялӗ',
],
'SBD' => [
0 => 'SBD',
1 => 'Соломон утравӗсен долларӗ',
],
'SCR' => [
0 => 'SCR',
1 => 'Сейшел рупийӗ',
],
'SDG' => [
0 => 'SDG',
1 => 'Судан фунчӗ',
],
'SEK' => [
0 => 'SEK',
1 => 'Швеци кронӗ',
],
'SGD' => [
0 => 'SGD',
1 => 'Сингапур долларӗ',
],
'SHP' => [
0 => 'SHP',
1 => 'Сӑваплӑ Елена утравӗн фунчӗ',
],
'SLL' => [
0 => 'SLL',
1 => 'леонӗ',
],
'SOS' => [
0 => 'SOS',
1 => 'Сомали шиллингӗ',
],
'SRD' => [
0 => 'SRD',
1 => 'Суринам долларӗ',
],
'SSP' => [
0 => 'SSP',
1 => 'Кӑнтӑр Судан фунчӗ',
],
'STN' => [
0 => 'STN',
1 => 'Сан-Томе тата Принсипи добрӗ',
],
'SYP' => [
0 => 'SYP',
1 => 'Сири фунчӗ',
],
'SZL' => [
0 => 'SZL',
1 => 'Свази лилангенийӗ',
],
'THB' => [
0 => 'THB',
1 => 'Таиланд барӗ',
],
'TJS' => [
0 => 'TJS',
1 => 'Таджик сомонийӗ',
],
'TMT' => [
0 => 'TMT',
1 => 'Туркмен маначӗ',
],
'TND' => [
0 => 'TND',
1 => 'Тунези динарӗ',
],
'TOP' => [
0 => 'TOP',
1 => 'Тонган паанги',
],
'TRY' => [
0 => 'TRY',
1 => 'Турци лири',
],
'TTD' => [
0 => 'TTD',
1 => 'Тринидад тата Тобаго долларӗ',
],
'TWD' => [
0 => 'NT$',
1 => 'Ҫӗнӗ Тайван долларӗ',
],
'TZS' => [
0 => 'TZS',
1 => 'Танзани шиллингӗ',
],
'UAH' => [
0 => 'UAH',
1 => 'Украина гривни',
],
'UGX' => [
0 => 'UGX',
1 => 'Уганда шиллингӗ',
],
'USD' => [
0 => '$',
1 => 'АПШ долларӗ',
],
'UYU' => [
0 => 'UYU',
1 => 'Уругвай песийӗ',
],
'UZS' => [
0 => 'UZS',
1 => 'Узбек сумӗ',
],
'VES' => [
0 => 'VES',
1 => 'Венесуэла боливарӗ',
],
'VND' => [
0 => '₫',
1 => 'Вьетнам донгӗ',
],
'VUV' => [
0 => 'VUV',
1 => 'Вануату ватуйӗ',
],
'WST' => [
0 => 'WST',
1 => 'Самоа тали',
],
'XAF' => [
0 => 'FCFA',
1 => 'Тӗп Африка КФА франкӗ',
],
'XCD' => [
0 => 'EC$',
1 => 'Хӗвелтухӑҫ Карибсем долларӗ',
],
'XOF' => [
0 => 'FCFA',
1 => 'КФА ВСЕАО франкӗ',
],
'XPF' => [
0 => 'CFPF',
1 => 'Франци Лӑпкӑ океан франкӗ',
],
'YER' => [
0 => 'YER',
1 => 'Йемен риалӗ',
],
'ZAR' => [
0 => 'ZAR',
1 => 'Кӑнтӑр Африка рэндӗ',
],
'ZMW' => [
0 => 'ZMW',
1 => 'Замби квачи',
],
],
];

View File

@ -824,7 +824,7 @@ return [
],
'QAR' => [
0 => 'QAR',
1 => 'Qatari Rial',
1 => 'Qatari Riyal',
],
'RHD' => [
0 => 'RHD',
@ -900,11 +900,11 @@ return [
],
'SLE' => [
0 => 'SLE',
1 => 'Sierra Leonean New Leone',
1 => 'Sierra Leonean Leone',
],
'SLL' => [
0 => 'SLL',
1 => 'Sierra Leonean Leone',
1 => 'Sierra Leonean Leone (1964—2022)',
],
'SOS' => [
0 => 'SOS',

View File

@ -68,7 +68,7 @@ return [
],
'BOB' => [
0 => 'BOB',
1 => 'Boliviano',
1 => 'Bolivian boliviano',
],
'BRL' => [
0 => 'BRL',
@ -98,10 +98,6 @@ return [
0 => 'CLP',
1 => 'Chilean Peso',
],
'CNH' => [
0 => 'CNH',
1 => 'CNH',
],
'CNY' => [
0 => 'CNY',
1 => 'Chinese Yuan',
@ -430,10 +426,6 @@ return [
0 => 'SHP',
1 => 'St Helena Pound',
],
'SLL' => [
0 => 'SLL',
1 => 'Sierra Leonean Leone',
],
'SOS' => [
0 => 'SOS',
1 => 'Somali Shilling',
@ -508,7 +500,7 @@ return [
],
'VES' => [
0 => 'VES',
1 => 'VES',
1 => 'Venezuelan bolívar',
],
'VND' => [
0 => 'VND',

View File

@ -40,7 +40,7 @@ return [
],
'SHP' => [
0 => 'SHP',
1 => 'St Helena Pound',
1 => 'Saint Helena Pound',
],
'STN' => [
0 => 'STN',
@ -56,7 +56,7 @@ return [
],
'USD' => [
0 => 'US$',
1 => 'U.S. Dollar',
1 => 'US Dollar',
],
],
];

View File

@ -2,7 +2,7 @@
return [
'Names' => [
'SLL' => [
'SLE' => [
0 => 'Le',
1 => 'Sierra Leonean Leone',
],

View File

@ -898,6 +898,10 @@ return [
0 => 'SKK',
1 => 'koroa eslovakiarra',
],
'SLE' => [
0 => 'SLE',
1 => 'leone sierraleonar berria',
],
'SLL' => [
0 => 'SLL',
1 => 'leone sierraleonarra',
@ -1046,6 +1050,10 @@ return [
0 => 'VEB',
1 => 'Venezuelako bolivarra (18712008)',
],
'VED' => [
0 => 'VED',
1 => 'bolivar subiraua',
],
'VEF' => [
0 => 'VEF',
1 => 'Venezuelako bolivarra (20082018)',

View File

@ -6,6 +6,10 @@ return [
0 => 'AED',
1 => '𞤁𞤭𞤪𞤸𞤢𞤥𞤵 𞤋𞤥𞤢𞥄𞤪𞤢𞤼𞤭𞤲𞤳𞤮',
],
'AFA' => [
0 => '𞤀𞤊𞤀',
1 => '𞤀𞤬𞤺𞤢𞥄𞤲 𞤀𞤬𞤺𞤢𞥄𞤲𞤭 (𞥑𞥙𞥒𞥗-𞥒𞥐𞥐𞥒)',
],
'AFN' => [
0 => 'AFN',
1 => '𞤀𞤬𞤿𞤢𞤲𞤭 𞤀𞤬𞤿𞤢𞤲𞤭𞤴𞤢𞤲𞤳𞤮',
@ -26,9 +30,25 @@ return [
0 => 'AOA',
1 => '𞤑𞤵𞤱𞤢𞤲𞥁𞤢 𞤀𞤲𞤺𞤮𞤤𞤢𞤲𞤳𞤮',
],
'ARA' => [
0 => 'ARA',
1 => '𞤌𞤧𞤼𞤪𞤢𞤤 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢𞤲𞤳𞤮',
],
'ARL' => [
0 => 'ARL',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤂𞤫𞤴 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢𞤲𞤳𞤮 (𞥑𞥙𞥗𞥐-𞥑𞥙𞥘𞥓)',
],
'ARM' => [
0 => 'ARM',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢𞤲𞤳𞤮 (𞥑𞥘𞥘𞥑-𞥑𞥙𞥗𞥐)',
],
'ARP' => [
0 => 'ARP',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢𞤲𞤳𞤮 (𞥑𞥙𞥘𞥓-𞥑𞥙𞥘𞥕)',
],
'ARS' => [
0 => 'ARS',
1 => '𞤆𞤫𞤧𞤮 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤀𞤪𞤶𞤢𞤲𞤼𞤭𞤲𞤢𞤲𞤳𞤮',
],
'AUD' => [
0 => 'A$',
@ -68,7 +88,7 @@ return [
],
'BMD' => [
0 => 'BMD',
1 => '𞤁𞤢𞤤𞤢 𞤄𞤫𞤪𞤥𞤵𞤣𞤢𞥄𞤲',
1 => '𞤁𞤢𞤤𞤢 𞤄𞤵𞤪𞤥𞤵𞤣𞤢𞤲𞤳𞤮',
],
'BND' => [
0 => 'BND',
@ -78,10 +98,46 @@ return [
0 => 'BOB',
1 => '𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤮 𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤳𞤮',
],
'BOL' => [
0 => 'BOL',
1 => '𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤮 𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤳𞤮 (𞥑𞥘𞥖𞥓-𞥑𞥙𞥖𞥓)',
],
'BOP' => [
0 => 'BOP',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤳𞤮',
],
'BOV' => [
0 => 'BOV',
1 => '𞤃𞤾𞤣𞤮𞤤 𞤄𞤮𞤤𞤭𞤾𞤭𞤴𞤢𞤲𞤳𞤮',
],
'BRB' => [
0 => 'BRB',
1 => '𞤑𞤫𞤪𞤮𞤧𞤫𞤪𞤮 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 𞤑𞤫𞤧𞤮 (𞥑𞥙𞥖𞥗-𞥑𞥙𞥘𞥖)',
],
'BRC' => [
0 => 'BRC',
1 => '𞤑𞤵𞤪𞥁𞤢𞤣𞤮𞥅 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥘𞥖-𞥑𞥙𞥘𞥙)',
],
'BRE' => [
0 => 'BRE',
1 => '𞤑𞤵𞤪𞥁𞤫𞤴𞤪𞤮 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥙𞥐-𞥑𞥙𞥙𞥓)',
],
'BRL' => [
0 => 'R$',
1 => '𞤈𞤭𞤴𞤢𞤤 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮',
],
'BRN' => [
0 => 'BRN',
1 => '𞤑𞤵𞤪𞥁𞤢𞤣𞤮𞥅 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥘𞥙-𞥑𞥙𞥙𞥐)',
],
'BRR' => [
0 => 'BRR',
1 => '𞤑𞤵𞤪𞥁𞤫𞤴𞤪𞤮 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥙𞥓-𞥑𞥙𞥙𞥔)',
],
'BRZ' => [
0 => 'BRZ',
1 => '𞤑𞤵𞤪𞥁𞤫𞤴𞤪𞤮 𞤄𞤪𞤢𞤧𞤭𞤤𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥔𞥒-𞥑𞥙𞥖𞥗)',
],
'BSD' => [
0 => 'BSD',
1 => '𞤁𞤢𞤤𞤢 𞤄𞤢𞤸𞤢𞤥𞤭𞤴𞤢𞤲𞤳𞤮',
@ -100,7 +156,7 @@ return [
],
'BZD' => [
0 => 'BZD',
1 => '𞤁𞤢𞤤𞤢 𞤄𞤫𞤤𞤭𞥅𞤧',
1 => '𞤁𞤢𞤤𞤢 𞤄𞤫𞤤𞤭𞥅𞤧𞤴𞤢𞤲𞤳𞤮',
],
'CAD' => [
0 => 'CA$',
@ -114,9 +170,17 @@ return [
0 => 'CHF',
1 => '𞤊𞤢𞤪𞤢𞤲 𞤅𞤵𞤱𞤭𞥅𞤧',
],
'CLE' => [
0 => 'CLE',
1 => '𞤉𞤧𞤳𞤵𞤣𞤮𞥅 𞤕𞤭𞤤𞤫𞥊𞤴𞤢𞤲𞤳𞤮',
],
'CLF' => [
0 => 'CLF',
1 => '𞤅𞤢𞤤𞤲𞤣𞤵 𞤂𞤭𞤥𞤮𞥅𞤪𞤫 𞤕𞤭𞤤𞤫𞥊𞤴𞤢𞤲𞤳𞤮',
],
'CLP' => [
0 => 'CLP',
1 => '𞤆𞤫𞤧𞤮 𞤕𞤭𞤤𞤭𞤴𞤢𞤲𞤳𞤮',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤕𞤭𞤤𞤫𞥊𞤴𞤢𞤲𞤳𞤮',
],
'CNH' => [
0 => 'CNH',
@ -128,11 +192,15 @@ return [
],
'COP' => [
0 => 'COP',
1 => '𞤆𞤫𞤧𞤮 𞤑𞤮𞤤𞤮𞤥𞤦𞤭𞤴𞤢𞤲𞤳𞤮',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤑𞤮𞤤𞤮𞤥𞤦𞤭𞤴𞤢𞤲𞤳𞤮',
],
'COU' => [
0 => 'COU',
1 => '𞤅𞤢𞤤𞤲𞤣𞤵 𞤔𞤢𞤪𞤮 𞤳𞤮𞤤𞤮𞤥𞤦𞤭𞤴𞤢𞤲𞤳𞤮',
],
'CRC' => [
0 => 'CRC',
1 => '𞤑𞤮𞤤𞤮𞥅𞤲 𞤑𞤮𞤧𞤼𞤢 𞤈𞤭𞤳𞤢𞤲',
1 => '𞤑𞤮𞤤𞤮𞥅𞤲 𞤑𞤮𞤧𞤼𞤢𞤪𞤭𞤴𞤢𞤲𞤳𞤮',
],
'CUC' => [
0 => 'CUC',
@ -140,7 +208,7 @@ return [
],
'CUP' => [
0 => 'CUP',
1 => '𞤆𞤫𞤧𞤮 𞤑𞤵𞤦𞤢𞤲𞤳𞤮',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤑𞤵𞤦𞤢𞤲𞤳𞤮',
],
'CVE' => [
0 => 'CVE',
@ -166,6 +234,14 @@ return [
0 => 'DZD',
1 => '𞤁𞤭𞤲𞤢𞥄𞤪 𞤀𞤤𞤶𞤢𞤪𞤭𞤲𞤳𞤮',
],
'ECS' => [
0 => 'ECS',
1 => '𞤅𞤵𞥅𞤳𞤵𞤪𞤫𞥊𞥅 𞤉𞤳𞤵𞤱𞤢𞤣𞤮𞥅𞤪𞤴𞤢𞤲𞤳𞤮',
],
'ECV' => [
0 => 'ECV',
1 => '𞤅𞤢𞤤𞤲𞤣𞤵 𞤔𞤮𞤪𞤮 𞤉𞤳𞤵𞤱𞤢𞤣𞤮𞥅𞤪𞤴𞤢𞤲𞤳𞤮 𞤚𞤢𞤦𞤭𞤼𞤵𞤲𞥋𞤺𞤮',
],
'EGP' => [
0 => 'EGP',
1 => '𞤆𞤢𞤱𞤲𞤣𞤵 𞤃𞤭𞤧𞤭𞤪𞤢𞤲𞤳𞤮',
@ -374,6 +450,10 @@ return [
0 => 'MUR',
1 => '𞤈𞤵𞤨𞤭𞥅 𞤃𞤮𞤪𞤭𞤧𞤭𞤴𞤢𞤲𞤳𞤮',
],
'MVP' => [
0 => 'MVP',
1 => '𞤈𞤵𞥅𞤨𞤭𞥅 𞤃𞤢𞤤𞤣𞤭𞥅𞤬 (𞥑𞥙𞥔𞥗-𞥑𞥙𞥘𞥑)',
],
'MVR' => [
0 => 'MVR',
1 => '𞤈𞤵𞤬𞤭𞤴𞤢𞥄 𞤃𞤢𞤤𞤣𞤭𞤾𞤭𞤴𞤢𞤲𞤳𞤮',
@ -384,7 +464,15 @@ return [
],
'MXN' => [
0 => 'MX$',
1 => '𞤆𞤫𞤧𞤮 𞤃𞤫𞤳𞤧𞤭𞤴𞤢𞤲𞤳𞤮',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤃𞤫𞤳𞤧𞤭𞤳𞤮𞤴𞤢𞤲𞤳𞤮',
],
'MXP' => [
0 => 'MXP',
1 => '𞤑𞤢𞥄𞤤𞤭𞤧𞤫 𞤆𞤫𞥅𞤧𞤮𞥅 𞤃𞤫𞤳𞤧𞤭𞤳𞤮𞤴𞤢𞤲𞤳𞤮 (𞥑𞥘𞥖𞥑-𞥑𞥙𞥙𞥒)',
],
'MXV' => [
0 => 'MXV',
1 => '𞤅𞤢𞤤𞤲𞤣𞤵 𞤊𞤭𞤤𞤮 𞤃𞤫𞤳𞤧𞤭𞤳𞤮𞤴𞤢𞤲𞤳𞤮𞥅𞤪𞤵',
],
'MYR' => [
0 => 'MYR',
@ -402,6 +490,10 @@ return [
0 => '𞤐𞤐𞤘',
1 => '𞤐𞤢𞤴𞤪𞤢 𞤐𞤢𞤶𞤭𞤪𞤢𞤴𞤢𞤲𞤳𞤮',
],
'NIC' => [
0 => 'NIC',
1 => '𞤑𞤮𞥅𞤪𞤣𞤮𞤦𞤢 𞤐𞤭𞤳𞤢𞤪𞤢𞤺𞤵𞤱𞤢𞤲𞤳𞤮 (𞥑𞥙𞥘𞥘-𞥑𞥙𞥙𞥑)',
],
'NIO' => [
0 => 'NIO',
1 => '𞤑𞤮𞥅𞤪𞤣𞤮𞤦𞤢 𞤐𞤭𞤳𞤢𞤪𞤢𞤺𞤵𞤱𞤢𞤲𞤳𞤮',
@ -426,10 +518,18 @@ return [
0 => 'PAB',
1 => '𞤄𞤢𞤤𞤦𞤮𞤱𞤢 𞤆𞤢𞤲𞤢𞤥𞤢𞤴𞤢𞤲𞤳𞤮',
],
'PEI' => [
0 => 'PEI',
1 => '𞤋𞤲𞤼𞤭 𞤨𞤫𞤪𞤵𞤴𞤢𞤲𞤳𞤮',
],
'PEN' => [
0 => 'PEN',
1 => '𞤅𞤮𞤤 𞤆𞤫𞤪𞤵𞤲𞤳𞤮',
],
'PES' => [
0 => 'PES',
1 => '𞤅𞤮𞤤 𞤆𞤫𞤪𞤵𞤴𞤢𞤲𞤳𞤮 (𞥑𞥘𞥖𞥓-𞥑𞥙𞥖𞥕)',
],
'PGK' => [
0 => '𞤑𞤆𞤘',
1 => '𞤑𞤭𞤲𞤢 𞤆𞤢𞤨𞤵𞤱𞤢 𞤐𞤫𞤱-𞤘𞤭𞤲𞤫𞤲𞤳𞤮',
@ -510,6 +610,10 @@ return [
0 => 'SRD',
1 => '𞤁𞤢𞤤𞤢 𞤅𞤵𞤪𞤵𞤲𞤢𞤥𞤭𞤲𞤳𞤮',
],
'SRG' => [
0 => 'SRG',
1 => '𞤘𞤭𞤤𞤣𞤮𞥅 𞤅𞤵𞤪𞤵𞤲𞤢𞤥𞤭𞤲𞤳𞤮',
],
'SSP' => [
0 => 'SSP',
1 => '𞤆𞤢𞤱𞤲𞤣𞤵 𞤂𞤫𞤴𞤤𞤫𞤴𞤪𞤭 𞤅𞤵𞤣𞤢𞤲𞤭𞤲𞤳𞤮',
@ -518,6 +622,10 @@ return [
0 => 'STN',
1 => '𞤁𞤮𞤦𞤢𞤪𞤢 𞤅𞤢𞤱𞤮-𞤚𞤮𞤥𞤫 & 𞤆𞤫𞤪𞤫𞤲𞤧𞤭𞤨',
],
'SVC' => [
0 => 'SVC',
1 => '𞤑𞤮𞤤𞤮𞥅𞤲 𞤅𞤢𞤤𞤾𞤢𞤣𞤮𞤪𞤢𞤲𞤳𞤮',
],
'SYP' => [
0 => 'SYP',
1 => '𞤆𞤢𞤱𞤲𞥋𞤣𞤵 𞤅𞤭𞤪𞤢𞤴𞤢𞤲𞤳𞤮',
@ -574,14 +682,42 @@ return [
0 => 'US$',
1 => '𞤁𞤢𞤤𞤢 𞤁𞤫𞤲𞤼𞤢𞤤 𞤂𞤢𞤪𞤫 𞤀𞤥𞤫𞤪𞤭𞤳',
],
'USN' => [
0 => 'USN',
1 => '𞤣𞤢𞤤𞤢 𞤁𞤂𞤀 (𞤶𞤢𞤲𞤺𞤮 𞤥𞤵𞥅𞤯𞤵𞤲)',
],
'USS' => [
0 => 'USS',
1 => '𞤣𞤢𞤤𞤢 𞤁𞤂𞤀 (𞤸𞤢𞤲𞤣𞤫 𞤥𞤵𞥅𞤯𞤵𞤲)',
],
'UYI' => [
0 => 'UYI',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤒𞤵𞤪𞤺𞤮𞤴𞤢𞤲𞤳𞤮 (𞤕𞤢𞤤𞤯𞤭 𞤔𞤮𞥅𞤨𞤢𞥄𞤯𞤭)',
],
'UYP' => [
0 => 'UYP',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤒𞤵𞤪𞤺𞤮𞤴𞤢𞤲𞤳𞤮 (𞥑𞥙𞥗𞥕-𞥑𞥙𞥙𞥓)',
],
'UYU' => [
0 => 'UYU',
1 => '𞤆𞤫𞤧𞤮 𞤓𞤪𞤵𞤺𞤵𞤪𞤭𞤲𞤳𞤮',
1 => '𞤆𞤫𞥅𞤧𞤮𞥅 𞤒𞤵𞤪𞤺𞤮𞤴𞤢𞤲𞤳𞤮',
],
'UYW' => [
0 => 'UYW',
1 => '𞤅𞤢𞤤𞤲𞤣𞤵 𞤐𞤶𞤮𞤩𞤣𞤭 𞤒𞤵𞤪𞤺𞤮𞤴𞤢𞤲𞤳𞤮 𞤔𞤮𞥅𞤨𞤢𞥄𞤲𞤣𞤭',
],
'UZS' => [
0 => 'UZS',
1 => '𞤅𞤮𞤥𞤵 𞤓𞥁𞤦𞤫𞤳𞤭𞤧𞤼𞤢𞤲𞤳𞤮',
],
'VEB' => [
0 => 'VEB',
1 => '𞤄𞤮𞤤𞤭𞤾𞤢𞥄𞤪 𞤜𞤫𞤲𞤭𞥅𞤧𞤫𞤤𞤢𞤲𞤳𞤮 (𞥑𞥘𞥗𞥑-𞥒𞥐𞥐𞥘)',
],
'VED' => [
0 => 'VED',
1 => '𞤄𞤮𞤤𞤭𞤾𞤢𞥄𞤪 𞤅𞤮𞤦𞤫𞥊𞤪𞤢𞤲𞤮',
],
'VEF' => [
0 => 'VEF',
1 => '𞤄𞤮𞤤𞤭𞤾𞤢𞥄𞤪 𞤜𞤫𞤲𞤭𞥅𞤧𞤫𞤤𞤢𞤲𞤳𞤮 (𞥒𞥐𞥐𞥘 - 𞥒𞥐𞥑𞥘)',

View File

@ -6,9 +6,9 @@ return [
0 => 'GNF',
1 => '𞤊𞤢𞤪𞤢𞤲 𞤘𞤭𞤲𞤫𞤲𞤳𞤮',
],
'SLL' => [
'SLE' => [
0 => 'Le',
1 => '𞤂𞤫𞤴𞤮𞤲 𞤅𞤫𞤪𞤢𞤤𞤭𞤴𞤢𞤲𞤳𞤮',
1 => 'SLE',
],
],
];

View File

@ -2,9 +2,9 @@
return [
'Names' => [
'SLL' => [
'SLE' => [
0 => 'Le',
1 => 'Lewoon Seraa Liyon',
1 => 'SLE',
],
],
];

View File

@ -898,6 +898,10 @@ return [
0 => 'SKK',
1 => 'Koruna Slòbhacach',
],
'SLE' => [
0 => 'SLE',
1 => 'Leone Siarra Leòmhannach ùr',
],
'SLL' => [
0 => 'SLL',
1 => 'Leone Siarra Leòmhannach',
@ -1046,6 +1050,10 @@ return [
0 => 'VEB',
1 => 'Bolívar Bheinisealach (18712008)',
],
'VED' => [
0 => 'VED',
1 => 'Bolívar Soberano',
],
'VEF' => [
0 => 'VEF',
1 => 'Bolívar Bheinisealach (20082018)',

View File

@ -352,7 +352,7 @@ return [
],
'MDL' => [
0 => 'MDL',
1 => 'kuɗaɗen Moldova',
1 => 'Kuɗaɗen Moldova',
],
'MGA' => [
0 => 'MGA',

View File

@ -600,7 +600,7 @@ return [
],
'PHP' => [
0 => 'PHP',
1 => זו פיליפיני',
1 => סו פיליפיני',
],
'PKR' => [
0 => 'PKR',

View File

@ -0,0 +1,30 @@
<?php
return [
'Names' => [
'CRC' => [
0 => 'CRC',
1 => 'Costa Rican colon',
],
'ISK' => [
0 => 'ISK',
1 => 'Icelandic krona',
],
'NIO' => [
0 => 'NIO',
1 => 'Nicaraguan cordoba',
],
'RUB' => [
0 => 'RUB',
1 => 'Russian ruble',
],
'STN' => [
0 => 'STN',
1 => 'Sao Tome & Principe Dobra',
],
'VES' => [
0 => 'VES',
1 => 'Venezuelan bolivar',
],
],
];

View File

@ -375,7 +375,7 @@ return [
1 => 'etiopski bir',
],
'EUR' => [
0 => 'EUR',
0 => '',
1 => 'euro',
],
'FIM' => [

View File

@ -332,7 +332,7 @@ return [
],
'LSL' => [
0 => 'LSL',
1 => 'This is not a translation',
1 => 'Ego loti obodo Lesotho',
],
'LYD' => [
0 => 'LYD',

View File

@ -260,7 +260,7 @@ return [
],
'FJD' => [
0 => 'FJD',
1 => 'fidjeyskur dalur',
1 => 'fídjískur dalur',
],
'FKP' => [
0 => 'FKP',
@ -359,7 +359,7 @@ return [
1 => 'íranskt ríal',
],
'ISK' => [
0 => 'ISK',
0 => 'kr.',
1 => 'íslensk króna',
],
'ITL' => [
@ -760,7 +760,7 @@ return [
],
'TND' => [
0 => 'TND',
1 => 'túnískur denari',
1 => 'túniskur denari',
],
'TOP' => [
0 => 'TOP',

View File

@ -724,7 +724,7 @@ return [
],
'PLN' => [
0 => 'PLN',
1 => 'złoty polacco',
1 => 'zloty polacco',
],
'PLZ' => [
0 => 'PLZ',

View File

@ -600,7 +600,7 @@ return [
],
'PHP' => [
0 => 'PHP',
1 => זו פיליפיני',
1 => סו פיליפיני',
],
'PKR' => [
0 => 'PKR',

Some files were not shown because too many files have changed in this diff Show More