Completed
Push — master ( 1f27f3...7c792b )
by Bryan
01:24
created

Convert::toFahrenheit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace Bhhaskin\WeatherBee\Util;
3
4
/**
5
 * Class for converting values
6
 */
7
class Convert
8
{
9
10
    /**
11
     * Converts celsius to fahrenheit.
12
     * @param  float $celsius Value to convert.
13
     * @return float          Converted value.
14
     */
15 1
    public static function toFahrenheit(float $celsius): float
16
    {
17 1
        return ($celsius * 1.8) + 32;
18
    }
19
20
    /**
21
     * Converts fahrenheit to celsius.
22
     * @param  float $fahrenheit Value to convert.
23
     * @return float             Converted value.
24
     */
25 1
    public static function toCelsius(float $fahrenheit): float
26
    {
27 1
        return ($fahrenheit - 32) / 1.8;
28
    }
29
}
30