ReviewHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getStarsFromValues() 0 9 2
1
<?php
2
3
namespace ilateral\SilverStripe\Reviews\Helpers;
4
5
use SilverStripe\Core\Injector\Injectable;
6
7
8
class ReviewHelper
9
{
10
    /**
11
     * Create a html string from the min and max values, using
12
     * the provided HTML string
13
     * 
14
     * @param int    $min  Initial variable
15
     * @param int    $max  Final value
16
     * @param string $html The html to use
17
     * 
18
     * @return string
19
     */
20
    public static function getStarsFromValues($min, $max, $html = "&#9733;", $divider = " ")
21
    {
22
        $return = [];
23
24
        for ($i = $min; $i <= $max; $i++) {
25
            $return[] = $html;
26
        }
27
28
        return implode($divider, $return);
29
    }
30
}