PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 4.0.0
WP 2FA – Two-factor authentication for WordPress v4.0.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Common / EcBlocks.php
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Common Last commit date
BitArray.php 1 week ago BitMatrix.php 1 week ago BitUtils.php 1 week ago CharacterSetEci.php 1 week ago EcBlock.php 1 week ago EcBlocks.php 1 week ago ErrorCorrectionLevel.php 1 week ago FormatInformation.php 1 week ago Mode.php 1 week ago ReedSolomonCodec.php 1 week ago Version.php 1 week ago index.php 1 week ago
EcBlocks.php
67 lines
1 <?php
2
3 declare (strict_types=1);
4 namespace WP2FA_Vendor\BaconQrCode\Common;
5
6 /**
7 * Encapsulates a set of error-correction blocks in one symbol version.
8 *
9 * Most versions will use blocks of differing sizes within one version, so, this encapsulates the parameters for each
10 * set of blocks. It also holds the number of error-correction codewords per block since it will be the same across all
11 * blocks within one version.
12 */
13 final class EcBlocks
14 {
15 /**
16 * Number of EC codewords per block.
17 *
18 * @var int
19 */
20 private $ecCodewordsPerBlock;
21 /**
22 * List of EC blocks.
23 *
24 * @var EcBlock[]
25 */
26 private $ecBlocks;
27 public function __construct(int $ecCodewordsPerBlock, EcBlock ...$ecBlocks)
28 {
29 $this->ecCodewordsPerBlock = $ecCodewordsPerBlock;
30 $this->ecBlocks = $ecBlocks;
31 }
32 /**
33 * Returns the number of EC codewords per block.
34 */
35 public function getEcCodewordsPerBlock() : int
36 {
37 return $this->ecCodewordsPerBlock;
38 }
39 /**
40 * Returns the total number of EC block appearances.
41 */
42 public function getNumBlocks() : int
43 {
44 $total = 0;
45 foreach ($this->ecBlocks as $ecBlock) {
46 $total += $ecBlock->getCount();
47 }
48 return $total;
49 }
50 /**
51 * Returns the total count of EC codewords.
52 */
53 public function getTotalEcCodewords() : int
54 {
55 return $this->ecCodewordsPerBlock * $this->getNumBlocks();
56 }
57 /**
58 * Returns the EC blocks included in this collection.
59 *
60 * @return EcBlock[]
61 */
62 public function getEcBlocks() : array
63 {
64 return $this->ecBlocks;
65 }
66 }
67