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

CourseHandicap::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
crap 2
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
}