Passed
Push — v5 ( 93618e...84eb31 )
by smiley
01:52
created

AlignmentPattern   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A combineEstimate() 0 5 1
1
<?php
2
/**
3
 * Class AlignmentPattern
4
 *
5
 * @created      17.01.2021
6
 * @author       ZXing Authors
7
 * @author       Smiley <[email protected]>
8
 * @copyright    2021 Smiley
9
 * @license      Apache-2.0
10
 */
11
12
namespace chillerlan\QRCode\Detector;
13
14
/**
15
 * <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
16
 * all but the simplest QR Codes.</p>
17
 *
18
 * @author Sean Owen
19
 */
20
final class AlignmentPattern extends ResultPoint{
21
22
	/**
23
	 * Combines this object's current estimate of a finder pattern position and module size
24
	 * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
25
	 */
26
	public function combineEstimate(float $i, float $j, float $newModuleSize):AlignmentPattern{
27
		return new self(
28
			($this->x + $j) / 2.0,
29
			($this->y + $i) / 2.0,
30
			($this->estimatedModuleSize + $newModuleSize) / 2.0
31
		);
32
	}
33
34
}
35