Difference   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 17 3
1
<?php
2
3
namespace Undemanding\Difference\Transformation;
4
5
class Difference
6
{
7
    /**
8
     * Difference between all pixels of two images.
9
     *
10
     * @param array $bitmap1
11
     * @param array $bitmap2
12
     * @param int $width
13
     * @param int $height
14
     * @param callable $method
15
     *
16
     * @return array
17
     */
18 1
    public function __invoke(array $bitmap1, array $bitmap2, $width, $height, callable $method)
19
    {
20 1
        $new = [];
21
22 1
        for ($y = 0; $y < $height; $y++) {
23 1
            $new[$y] = [];
24
25 1
            for ($x = 0; $x < $width; $x++) {
26 1
                $new[$y][$x] = $method(
27 1
                    $bitmap1[$y][$x],
28 1
                    $bitmap2[$y][$x]
29 1
                );
30 1
            }
31 1
        }
32
33 1
        return $new;
34
    }
35
}
36