Statistics   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A ABtest() 0 16 5
1
<?php
2
/**
3
 *
4
 * (c) Ruben Dorado <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
namespace SiteAnalyzer;
10
11
12
/**
13
 * class Statistics
14
 *
15
 * @package   SiteAnalyzer
16
 * @author    Ruben Dorado <[email protected]>
17
 * @copyright 2018 Ruben Dorado
18
 * @license   http://www.opensource.org/licenses/MIT The MIT License
19
 */
20
class Statistics
21
{
22
    
23
    /*
24
     * @param
25
     */
26
    public static function ABtest($testCounts, $targetCounts)
27
    {
28
        $ntotal = 0;
29
        $resp  = [];
30
        foreach($testCounts as $testCount) {
31
            $ntotal += $testCount[1];
32
        }
33
        foreach($testCounts as $testCount) {
34
            foreach ($targetCounts as $targetCount) {
35
                if ($testCount[0] === $targetCount[1]) {
36
                    $resp[] = [$testCount[0], $testCount[1], $testCount[1]/$ntotal, $targetCount[2], $targetCount[2]/$testCount[1],$targetCount[2]/$ntotal];
37
                }                
38
            }
39
            
40
        }
41
        return $resp;
42
    }
43
    
44
}
45