C:\xampp\phpMyAdmin\vendor\bacon\bacon-qr-code\src\BaconQrCode\Common\EcBlocks.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
 * BaconQrCode
 *
 * @link      http://github.com/Bacon/BaconQrCode For the canonical source repository
 * @copyright 2013 Ben 'DASPRiD' Scholzen
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
 */

namespace BaconQrCode\Common;

use 
SplFixedArray;

/**
 * Encapsulates a set of error-correction blocks in one symbol version. Most
 * versions will use blocks of differing sizes within one version, so, this
 * encapsulates the parameters for each set of blocks. It also holds the number
 * of error-correction codewords per block since it will be the same across all
 * blocks within one version.
 */
class EcBlocks
{
    
/**
     * Number of EC codewords per block.
     *
     * @var integer
     */
    
protected $ecCodewordsPerBlock;

    
/**
     * List of EC blocks.
     *
     * @var SplFixedArray
     */
    
protected $ecBlocks;

    
/**
     * Creates a new EC blocks instance.
     *
     * @param integer      $ecCodewordsPerBlock
     * @param EcBlock      $ecb1
     * @param EcBlock|null $ecb2
     */
    
public function __construct($ecCodewordsPerBlockEcBlock $ecb1EcBlock $ecb2 null)
    {
        
$this->ecCodewordsPerBlock $ecCodewordsPerBlock;

        
$this->ecBlocks = new SplFixedArray($ecb2 === null 2);
        
$this->ecBlocks[0] = $ecb1;

        if (
$ecb2 !== null) {
            
$this->ecBlocks[1] = $ecb2;
        }
    }

    
/**
     * Gets the number of EC codewords per block.
     *
     * @return integer
     */
    
public function getEcCodewordsPerBlock()
    {
        return 
$this->ecCodewordsPerBlock;
    }

    
/**
     * Gets the total number of EC block appearances.
     *
     * @return integer
     */
    
public function getNumBlocks()
    {
        
$total 0;

        foreach (
$this->ecBlocks as $ecBlock) {
            
$total += $ecBlock->getCount();
        }

        return 
$total;
    }

    
/**
     * Gets the total count of EC codewords.
     *
     * @return integer
     */
    
public function getTotalEcCodewords()
    {
        return 
$this->ecCodewordsPerBlock $this->getNumBlocks();
    }

    
/**
     * Gets the EC blocks included in this collection.
     *
     * @return SplFixedArray
     */
    
public function getEcBlocks()
    {
        return 
$this->ecBlocks;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586