PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / bacon / bacon-qr-code / src / Common / EcBlocks.php
ameliabooking / vendor / bacon / bacon-qr-code / src / Common Last commit date
BitArray.php 9 months ago BitMatrix.php 9 months ago BitUtils.php 9 months ago CharacterSetEci.php 9 months ago EcBlock.php 9 months ago EcBlocks.php 9 months ago ErrorCorrectionLevel.php 9 months ago FormatInformation.php 9 months ago Mode.php 9 months ago ReedSolomonCodec.php 9 months ago Version.php 9 months ago
EcBlocks.php
75 lines
1 <?php
2 declare(strict_types = 1);
3
4 namespace 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 /**
23 * List of EC blocks.
24 *
25 * @var EcBlock[]
26 */
27 private $ecBlocks;
28
29 public function __construct(int $ecCodewordsPerBlock, EcBlock ...$ecBlocks)
30 {
31 $this->ecCodewordsPerBlock = $ecCodewordsPerBlock;
32 $this->ecBlocks = $ecBlocks;
33 }
34
35 /**
36 * Returns the number of EC codewords per block.
37 */
38 public function getEcCodewordsPerBlock() : int
39 {
40 return $this->ecCodewordsPerBlock;
41 }
42
43 /**
44 * Returns the total number of EC block appearances.
45 */
46 public function getNumBlocks() : int
47 {
48 $total = 0;
49
50 foreach ($this->ecBlocks as $ecBlock) {
51 $total += $ecBlock->getCount();
52 }
53
54 return $total;
55 }
56
57 /**
58 * Returns the total count of EC codewords.
59 */
60 public function getTotalEcCodewords() : int
61 {
62 return $this->ecCodewordsPerBlock * $this->getNumBlocks();
63 }
64
65 /**
66 * Returns the EC blocks included in this collection.
67 *
68 * @return EcBlock[]
69 */
70 public function getEcBlocks() : array
71 {
72 return $this->ecBlocks;
73 }
74 }
75