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

Convert   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 23
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toFahrenheit() 0 4 1
A toCelsius() 0 4 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