vendor/khanamiryan/qrcode-detector-decoder/lib/common/BitMatrix.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
namespace Zxing\Common;


final class BitMatrix {
    private $width;
    private $height;
    private $rowSize;
    private $bits;

    public function __construct($width, $height=false, $rowSize=false, $bits=false) {
        if(!$height){
            $height = $width;
        }
        if(!$rowSize){
            $rowSize = intval(($width + 31) / 32);
        }
        if(!$bits){
            $bits = fill_array(0,$rowSize*$height,0);array();//new int[rowSize * height];
        }
        $this->width = $width;
        $this->height = $height;
        $this->rowSize = $rowSize;
        $this->bits = $bits;
    }
    public static  function parse($stringRepresentation, $setString, $unsetString){
        if (!$stringRepresentation) {
            throw new \InvalidArgumentException();
        }
        $bits = array();
        $bitsPos = 0;
        $rowStartPos = 0;
        $rowLength = -1;
        $nRows = 0;
        $pos = 0;
        while ($pos < strlen($stringRepresentation)) {
            if ($stringRepresentation{$pos} == '\n' ||
                $stringRepresentation->{$pos} == '\r') {
                if ($bitsPos > $rowStartPos) {
                    if($rowLength == -1) {
                        $rowLength = $bitsPos - $rowStartPos;
                    }
                    else if ($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);
                $bits[$bitsPos] = true;
                $bitsPos++;
            }
            else if (substr($stringRepresentation, $pos + strlen($unsetString))==$unsetString) {
                $pos += strlen($unsetString);
                $bits[$bitsPos] = false;
                $bitsPos++;
            } else {

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。