Skip to content

Commit

Permalink
:octocat: this was possible all the time???
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jun 21, 2023
1 parent 12d0edf commit cf92e49
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
5 changes: 2 additions & 3 deletions examples/svgWithLogoAndCustomShapes.php
Expand Up @@ -93,9 +93,8 @@ protected function getFinderPatterns():string{
'q0,1 1,1 h3 q1,0 1,-1 v-3 q0,-1 -1,-1z m0,2.5 a1.5,1.5 0 1 0 3,0 a1.5,1.5 0 1 0 -3,0Z';
$finder = [];

foreach($pos as $coord){
[$ix, $iy] = $coord;
$finder[] = sprintf($path, $ix, $iy);
foreach($pos as [$ix, $iy]){
$finder[] = sprintf($path, $ix, $iy);
}

return implode(' ', $finder);
Expand Down
8 changes: 2 additions & 6 deletions src/Common/ReedSolomonDecoder.php
Expand Up @@ -52,9 +52,7 @@ public function decode(array $rawCodewords):BitBuffer{
$dataBlocks = $this->deinterleaveRawBytes($rawCodewords);
$dataBytes = [];

foreach($dataBlocks as $dataBlock){
[$numDataCodewords, $codewordBytes] = $dataBlock;

foreach($dataBlocks as [$numDataCodewords, $codewordBytes]){
$corrected = $this->correctErrors($codewordBytes, $numDataCodewords);

for($i = 0; $i < $numDataCodewords; $i++){
Expand All @@ -81,9 +79,7 @@ private function deinterleaveRawBytes(array $rawCodewords):array{
$result = [];//new DataBlock[$totalBlocks];
$numResultBlocks = 0;

foreach($eccBlocks as $blockData){
[$numEccBlocks, $eccPerBlock] = $blockData;

foreach($eccBlocks as [$numEccBlocks, $eccPerBlock]){
for($i = 0; $i < $numEccBlocks; $i++, $numResultBlocks++){
$result[$numResultBlocks] = [$eccPerBlock, array_fill(0, ($numEccCodewords + $eccPerBlock), 0)];
}
Expand Down
4 changes: 1 addition & 3 deletions src/Common/ReedSolomonEncoder.php
Expand Up @@ -54,9 +54,7 @@ public function interleaveEcBytes(BitBuffer $bitBuffer):array{
$maxEcBytes = 0;
$dataByteOffset = 0;

foreach($rsBlocks as $key => $block){
[$rsBlockTotal, $dataByteCount] = $block;

foreach($rsBlocks as $key => [$rsBlockTotal, $dataByteCount]){
$dataBytes[$key] = [];

for($i = 0; $i < $dataByteCount; $i++){
Expand Down
4 changes: 1 addition & 3 deletions src/Data/QRMatrix.php
Expand Up @@ -339,9 +339,7 @@ public function check(int $x, int $y):bool{
public function checkNeighbours(int $x, int $y, int $M_TYPE = null):int{
$bits = 0;

foreach($this::neighbours as $bit => $coord){
[$ix, $iy] = $coord;

foreach($this::neighbours as $bit => [$ix, $iy]){
$ix += $x;
$iy += $y;

Expand Down

0 comments on commit cf92e49

Please sign in to comment.