🚿 removed html tags and javadoc remnants from docblocks

This commit is contained in:
codemasher
2021-12-01 22:49:32 +01:00
parent 5c2c92667a
commit 05917f7286
13 changed files with 95 additions and 95 deletions
+4 -4
View File
@@ -16,12 +16,12 @@ use InvalidArgumentException;
use function array_fill;
/**
* <p>This class contains utility methods for performing mathematical operations over
* the Galois Fields. Operations use a given primitive polynomial in calculations.</p>
* This class contains utility methods for performing mathematical operations over
* the Galois Fields. Operations use a given primitive polynomial in calculations.
*
* <p>Throughout this package, elements of the GF are represented as an {@code int}
* Throughout this package, elements of the GF are represented as an int
* for convenience and speed (but at the cost of memory).
* </p>
*
*
* @author Sean Owen
* @author David Olivier
+7 -7
View File
@@ -15,10 +15,10 @@ use RuntimeException;
use function array_fill, count;
/**
* <p>Implements Reed-Solomon decoding, as the name implies.</p>
* Implements Reed-Solomon decoding, as the name implies.
*
* <p>The algorithm will not be explained here, but the following references were helpful
* in creating this implementation:</p>
* The algorithm will not be explained here, but the following references were helpful
* in creating this implementation:
*
* <ul>
* <li>Bruce Maggs.
@@ -29,8 +29,8 @@ use function array_fill, count;
* (see discussion of Euclidean algorithm)</li>
* </ul>
*
* <p>Much credit is due to William Rucklidge since portions of this code are an indirect
* port of his C++ Reed-Solomon implementation.</p>
* Much credit is due to William Rucklidge since portions of this code are an indirect
* port of his C++ Reed-Solomon implementation.
*
* @author Sean Owen
* @author William Rucklidge
@@ -39,9 +39,9 @@ use function array_fill, count;
final class ReedSolomonDecoder{
/**
* <p>Decodes given set of received codewords, which include both data and error-correction
* Decodes given set of received codewords, which include both data and error-correction
* codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
* in the input.</p>
* in the input.
*
* @param array $received data and error-correction codewords
* @param int $numEccCodewords number of error-correction codewords available
+11 -11
View File
@@ -38,7 +38,7 @@ final class BitMatrix{
}
/**
* <p>Sets the given bit to true.</p>
* Sets the given bit to true.
*
* @param int $x ; The horizontal component (i.e. which column)
* @param int $y ; The vertical component (i.e. which row)
@@ -53,7 +53,7 @@ final class BitMatrix{
}
/**
* <p>Flips the given bit. 1 << (0xf9 & 0x1f)</p>
* Flips the given bit. 1 << (0xf9 & 0x1f)
*
* @param int $x ; The horizontal component (i.e. which column)
* @param int $y ; The vertical component (i.e. which row)
@@ -67,7 +67,7 @@ final class BitMatrix{
}
/**
* <p>Sets a square region of the bit matrix to true.</p>
* Sets a square region of the bit matrix to true.
*
* @param int $left ; The horizontal position to begin at (inclusive)
* @param int $top ; The vertical position to begin at (inclusive)
@@ -127,7 +127,7 @@ final class BitMatrix{
}
/**
* <p>Gets the requested bit, where true means black.</p>
* Gets the requested bit, where true means black.
*
* @param int $x The horizontal component (i.e. which column)
* @param int $y The vertical component (i.e. which row)
@@ -224,9 +224,9 @@ final class BitMatrix{
/**
* Prepare the parser for a mirrored operation.
* This flag has effect only on the {@link #readFormatInformation()} and the
* {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
* {@link #mirror()} method should be called.
* This flag has effect only on the #readFormatInformation() and the
* #readVersion(). Before proceeding with #readCodewords() the
* #mirror() method should be called.
*
* @param bool $mirror Whether to read version and format information mirrored.
*/
@@ -251,9 +251,9 @@ final class BitMatrix{
}
/**
* <p>Reads the bits in the {@link BitMatrix} representing the finder pattern in the
* Reads the bits in the BitMatrix representing the finder pattern in the
* correct order in order to reconstruct the codewords bytes contained within the
* QR Code.</p>
* QR Code.
*
* @return array bytes encoded within the QR Code
* @throws \RuntimeException if the exact number of bytes expected is not read
@@ -315,7 +315,7 @@ final class BitMatrix{
}
/**
* <p>Reads format information from one of its two locations within the QR Code.</p>
* Reads format information from one of its two locations within the QR Code.
*
* @return \chillerlan\QRCode\Common\FormatInformation encapsulating the QR Code's format info
* @throws \RuntimeException if both format information locations cannot be parsed as
@@ -422,7 +422,7 @@ final class BitMatrix{
}
/**
* <p>Reads version information from one of its two locations within the QR Code.</p>
* Reads version information from one of its two locations within the QR Code.
*
* @return \chillerlan\QRCode\Common\Version encapsulating the QR Code's version
* @throws \RuntimeException if both version information locations cannot be parsed as
+8 -8
View File
@@ -18,8 +18,8 @@ use chillerlan\QRCode\Detector\Detector;
use function count, array_fill, mb_convert_encoding, mb_detect_encoding;
/**
* <p>The main class which implements QR Code decoding -- as opposed to locating and extracting
* the QR Code from an image.</p>
* The main class which implements QR Code decoding -- as opposed to locating and extracting
* the QR Code from an image.
*
* @author Sean Owen
*/
@@ -28,8 +28,8 @@ final class Decoder{
# private const GB2312_SUBSET = 1;
/**
* <p>Decodes a QR Code represented as a {@link \chillerlan\QRCode\Decoder\BitMatrix}.
* A 1 or "true" is taken to mean a black module.</p>
* Decodes a QR Code represented as a BitMatrix.
* A 1 or "true" is taken to mean a black module.
*
* @param \chillerlan\QRCode\Decoder\LuminanceSourceInterface $source
*
@@ -105,9 +105,9 @@ final class Decoder{
}
/**
* <p>When QR Codes use multiple data blocks, they are actually interleaved.
* When QR Codes use multiple data blocks, they are actually interleaved.
* 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>
* method will separate the data into original blocks.
*
* @param array $rawCodewords bytes as read directly from the QR Code
* @param \chillerlan\QRCode\Common\Version $version version of the QR Code
@@ -187,8 +187,8 @@ 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>
* Given data and error-correction codewords received, possibly corrupted by errors, attempts to
* correct the errors in-place using Reed-Solomon error correction.
*/
private function correctErrors(array $codewordBytes, int $numDataCodewords):array{
// First read into an array of ints
+1 -1
View File
@@ -16,7 +16,7 @@ interface LuminanceSourceInterface{
/**
* Fetches luminance data for the underlying bitmap. Values should be fetched using:
* {@code int luminance = array[y * width + x] & 0xff}
* `int luminance = array[y * width + x] & 0xff`
*
* @return array A row-major 2D array of luminance values. Do not use result.length as it may be
* larger than width * height bytes on some platforms. Do not modify the contents
+3 -3
View File
@@ -12,8 +12,8 @@
namespace chillerlan\QRCode\Detector;
/**
* <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
* all but the simplest QR Codes.</p>
* Encapsulates an alignment pattern, which are the smaller square patterns found in
* all but the simplest QR Codes.
*
* @author Sean Owen
*/
@@ -21,7 +21,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.
* with a new estimate. It returns a new FinderPattern containing an average of the two.
*/
public function combineEstimate(float $i, float $j, float $newModuleSize):self{
return new self(
+13 -13
View File
@@ -15,16 +15,16 @@ use chillerlan\QRCode\Decoder\BitMatrix;
use function abs, count;
/**
* <p>This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
* patterns but are smaller and appear at regular intervals throughout the image.</p>
* This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
* patterns but are smaller and appear at regular intervals throughout the image.
*
* <p>At the moment this only looks for the bottom-right alignment pattern.</p>
* At the moment this only looks for the bottom-right alignment pattern.
*
* <p>This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied,
* This is mostly a simplified copy of FinderPatternFinder. It is copied,
* pasted and stripped down here for maximum performance but does unfortunately duplicate
* some code.</p>
* some code.
*
* <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.</p>
* This class is thread-safe but not reentrant. Each thread must allocate its own object.
*
* @author Sean Owen
*/
@@ -36,7 +36,7 @@ final class AlignmentPatternFinder{
private array $possibleCenters;
/**
* <p>Creates a finder that will look in a portion of the whole image.</p>
* Creates a finder that will look in a portion of the whole image.
*
* @param \chillerlan\QRCode\Decoder\BitMatrix $image image to search
* @param float $moduleSize estimated module size so far
@@ -48,8 +48,8 @@ final class AlignmentPatternFinder{
}
/**
* <p>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
* it's pretty performance-critical and so is written to be fast foremost.</p>
* This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
* it's pretty performance-critical and so is written to be fast foremost.
*
* @param int $startX left column from which to start searching
* @param int $startY top row from which to start searching
@@ -163,10 +163,10 @@ final class AlignmentPatternFinder{
}
/**
* <p>This is called when a horizontal scan finds a possible alignment pattern. It will
* This is called when a horizontal scan finds a possible alignment pattern. It will
* cross check with a vertical scan, and if successful, will see if this pattern had been
* found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
* found the alignment pattern.</p>
* found the alignment pattern.
*
* @param int[] $stateCount reading state module counts from horizontal scan
* @param int $i row where alignment pattern may be found
@@ -211,9 +211,9 @@ final class AlignmentPatternFinder{
}
/**
* <p>After a horizontal scan finds a potential alignment pattern, this method
* After a horizontal scan finds a potential alignment pattern, this method
* "cross-checks" by scanning down vertically through the center of the possible
* alignment pattern to see if the same proportion is detected.</p>
* alignment pattern to see if the same proportion is detected.
*
* @param int $startI row where an alignment pattern was detected
* @param int $centerJ center of the section that appears to cross an alignment pattern
+18 -18
View File
@@ -19,8 +19,8 @@ use function abs, is_nan, max, min, round;
use const NAN;
/**
* <p>Encapsulates logic that can detect a QR Code in an image, even if the QR Code
* is rotated or skewed, or partially obscured.</p>
* Encapsulates logic that can detect a QR Code in an image, even if the QR Code
* is rotated or skewed, or partially obscured.
*
* @author Sean Owen
*/
@@ -36,7 +36,7 @@ final class Detector{
}
/**
* <p>Detects a QR Code in an image.</p>
* Detects a QR Code in an image.
*/
public function detect():BitMatrix{
[$bottomLeft, $topLeft, $topRight] = (new FinderPatternFinder($this->bitMatrix))->find();
@@ -75,8 +75,8 @@ final class Detector{
}
/**
* <p>Computes an average estimated module size based on estimated derived from the positions
* of the three finder patterns.</p>
* Computes an average estimated module size based on estimated derived from the positions
* of the three finder patterns.
*
* @throws \RuntimeException
*/
@@ -95,9 +95,9 @@ final class Detector{
}
/**
* <p>Estimates module size based on two finder patterns -- it uses
* {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
* width of each, measuring along the axis between their centers.</p>
* Estimates module size based on two finder patterns -- it uses
* #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int) to figure the
* width of each, measuring along the axis between their centers.
*/
private function calculateModuleSizeOneWay(FinderPattern $pattern, FinderPattern $otherPattern):float{
@@ -128,9 +128,9 @@ final class Detector{
}
/**
* See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of
* See #sizeOfBlackWhiteBlackRun(int, int, int, int); computes the total width of
* a finder pattern by looking for a black-white-black run from the center in the direction
* of another po$(another finder pattern center), and in the opposite direction too.</p>
* of another po$(another finder pattern center), and in the opposite direction too.
*/
private function sizeOfBlackWhiteBlackRunBothWays(float $fromX, float $fromY, float $toX, float $toY):float{
$result = $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$toX, (int)$toY);
@@ -168,12 +168,12 @@ final class Detector{
}
/**
* <p>This method traces a line from a po$in the image, in the direction towards another point.
* This method traces a line from a po$in the image, in the direction towards another point.
* It begins in a black region, and keeps going until it finds white, then black, then white again.
* It reports the distance from the start to this point.</p>
* It reports the distance from the start to this point.
*
* <p>This is used when figuring out how wide a finder pattern is, when the finder pattern
* may be skewed or rotated.</p>
* This is used when figuring out how wide a finder pattern is, when the finder pattern
* may be skewed or rotated.
*/
private function sizeOfBlackWhiteBlackRun(int $fromX, int $fromY, int $toX, int $toY):float{
// Mild variant of Bresenham's algorithm;
@@ -241,8 +241,8 @@ final 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>
* 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.
*
* @throws \RuntimeException
*/
@@ -276,8 +276,8 @@ final class Detector{
}
/**
* <p>Attempts to locate an alignment pattern in a limited region of the image, which is
* guessed to contain it.</p>
* Attempts to locate an alignment pattern in a limited region of the image, which is
* guessed to contain it.
*
* @param float $overallEstModuleSize estimated module size so far
* @param int $estAlignmentX x coordinate of center of area probably containing alignment pattern
+3 -3
View File
@@ -14,9 +14,9 @@ namespace chillerlan\QRCode\Detector;
use function sqrt;
/**
* <p>Encapsulates a finder pattern, which are the three square patterns found in
* Encapsulates a finder pattern, which are the three square patterns found in
* the corners of QR Codes. It also encapsulates a count of similar finder patterns,
* as a convenience to the finder's bookkeeping.</p>
* as a convenience to the finder's bookkeeping.
*
* @author Sean Owen
*/
@@ -58,7 +58,7 @@ final class FinderPattern 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 a weighted average
* with a new estimate. It returns a new FinderPattern containing a weighted average
* based on count.
*/
public function combineEstimate(float $i, float $j, float $newModuleSize):self{
+14 -14
View File
@@ -19,10 +19,10 @@ use function abs, count, usort;
use const PHP_FLOAT_MAX;
/**
* <p>This class attempts to find finder patterns in a QR Code. Finder patterns are the square
* markers at three corners of a QR Code.</p>
* This class attempts to find finder patterns in a QR Code. Finder patterns are the square
* markers at three corners of a QR Code.
*
* <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.
* This class is thread-safe but not reentrant. Each thread must allocate its own object.
*
* @author Sean Owen
*/
@@ -37,7 +37,7 @@ final class FinderPatternFinder{
private bool $hasSkipped = false;
/**
* <p>Creates a finder that will search the image for three finder patterns.</p>
* Creates a finder that will search the image for three finder patterns.
*
* @param BitMatrix $bitMatrix image to search
*/
@@ -318,9 +318,9 @@ final class FinderPatternFinder{
}
/**
* <p>After a horizontal scan finds a potential finder pattern, this method
* After a horizontal scan finds a potential finder pattern, this method
* "cross-checks" by scanning down vertically through the center of the possible
* finder pattern to see if the same proportion is detected.</p>
* finder pattern to see if the same proportion is detected.
*
* @param int $startI ; row where a finder pattern was detected
* @param int $centerJ ; center of the section that appears to cross a finder pattern
@@ -409,9 +409,9 @@ final class FinderPatternFinder{
}
/**
* <p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
* Like #crossCheckVertical(int, int, int, int), and in fact is basically identical,
* 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>
* check a vertical cross check and locate the real center of the alignment pattern.
*/
private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):?float{
$maxJ = $this->bitMatrix->getDimension();
@@ -489,13 +489,13 @@ final class FinderPatternFinder{
}
/**
* <p>This is called when a horizontal scan finds a possible alignment pattern. It will
* This is called when a horizontal scan finds a possible alignment pattern. It will
* cross check with a vertical scan, and if successful, will, ah, cross-cross-check
* with another horizontal scan. This is needed primarily to locate the real horizontal
* center of the pattern in cases of extreme skew.
* And then we cross-cross-cross check with another diagonal scan.</p>
* And then we cross-cross-cross check with another diagonal scan.
*
* <p>If that succeeds the finder pattern location is added to a list that tracks
* If that succeeds the finder pattern location is added to a list that tracks
* the number of times each location has been nearly-matched as a finder pattern.
* Each additional find is more evidence that the location is in fact a finder
* pattern center
@@ -581,7 +581,7 @@ final class FinderPatternFinder{
/**
* @return bool true if we have found at least 3 finder patterns that have been detected
* at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the
* at least #CENTER_QUORUM times each, and, the estimated module size of the
* candidates is "pretty similar"
*/
private function haveMultiplyConfirmedCenters():bool{
@@ -614,8 +614,8 @@ final class FinderPatternFinder{
}
/**
* @return \chillerlan\QRCode\Detector\FinderPattern[] the 3 best {@link FinderPattern}s from our list of candidates. The "best" are
* those that have been detected at least {@link #CENTER_QUORUM} times, and whose module
* @return \chillerlan\QRCode\Detector\FinderPattern[] the 3 best FinderPatterns from our list of candidates. The "best" are
* those that have been detected at least #CENTER_QUORUM times, and whose module
* size differs from the average among those patterns the least
* @throws \RuntimeException if 3 such finder patterns do not exist
*/
+7 -7
View File
@@ -23,7 +23,7 @@ use function array_fill, count, sprintf;
* Imaging library, but which may not be available in other environments such as J2ME, and vice
* versa.
*
* The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)}
* The implementation used can be controlled by calling #setGridSampler(GridSampler)
* with an instance of a class which implements this interface.
*
* @author Sean Owen
@@ -31,15 +31,15 @@ use function array_fill, count, sprintf;
final class GridSampler{
/**
* <p>Checks a set of points that have been transformed to sample points on an image against
* the image's dimensions to see if the point are even within the image.</p>
* Checks a set of points that have been transformed to sample points on an image against
* the image's dimensions to see if the point are even within the image.
*
* <p>This method will actually "nudge" the endpoints back onto the image if they are found to be
* This method will actually "nudge" the endpoints back onto the image if they are found to be
* barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder
* patterns in an image where the QR Code runs all the way to the image border.</p>
* patterns in an image where the QR Code runs all the way to the image border.
*
* <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>
* 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.
*
* @param \chillerlan\QRCode\Decoder\BitMatrix $bitMatrix image into which the points should map
* @param float[] $points actual points in x1,y1,...,xn,yn form
+2 -2
View File
@@ -14,9 +14,9 @@ namespace chillerlan\QRCode\Detector;
use function count;
/**
* <p>This class implements a perspective transform in two dimensions. Given four source and four
* This class implements a perspective transform in two dimensions. Given four source and four
* destination points, it will compute the transformation implied between them. The code is based
* directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.</p>
* directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.
*
* @author Sean Owen
*/
+4 -4
View File
@@ -14,8 +14,8 @@ namespace chillerlan\QRCode\Detector;
use function abs;
/**
* <p>Encapsulates a point of interest in an image containing a barcode. Typically, this
* would be the location of a finder pattern or the corner of the barcode, for example.</p>
* Encapsulates a point of interest in an image containing a barcode. Typically, this
* would be the location of a finder pattern or the corner of the barcode, for example.
*
* @author Sean Owen
*/
@@ -56,8 +56,8 @@ abstract class ResultPoint{
}
/**
* <p>Determines if this finder pattern "about equals" a finder pattern at the stated
* position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
* Determines if this finder pattern "about equals" a finder pattern at the stated
* position and size -- meaning, it is at nearly the same center with nearly the same size.
*/
public function aboutEquals(float $moduleSize, float $i, float $j):bool{