Completed
Push — master ( e64d7a...236403 )
by Michael
03:31
created

CourseHandicap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 18
ccs 0
cts 6
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A get() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: mschmidt
5
 * Date: 8/24/2016
6
 * Time: 3:11 PM
7
 */
8
9
namespace GLsoftware\Golf;
10
11
12
class CourseHandicap
13
{
14
    const SLOPE = 113;
15
    private $handicap;
16
    private $courseSlope;
17
18
    public function __construct($handicap, $courseSlope)
19
    {
20
        $this->handicap = $handicap;
21
        $this->courseSlope = $courseSlope;
22
    }
23
24
    public function get()
25
    {
26
        // course handicaps are rounded to the nearest whole number
27
        return round((($this->handicap * $this->courseSlope) / self::SLOPE),0);
28
    }
29
}