Scale   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
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 28
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 14 3
1
<?php
2
3
namespace Undemanding\Difference\Transformation;
4
5
class Scale
6
{
7
    /**
8
     * New map of pixels scaled by a constant factor.
9
     *
10
     * @param array $bitmap
11
     * @param int $width
12
     * @param int $height
13
     * @param float $maximum
14
     * @param float $factor
15
     *
16
     * @return array
17
     */
18 1
    public function __invoke(array $bitmap, $width, $height, $maximum, $factor)
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] = ($bitmap[$y][$x] / $maximum) * $factor;
27 1
            }
28 1
        }
29
30 1
        return $new;
31
    }
32
}
33