Completed
Push — master ( b22c70...b1922d )
by Dariusz
01:37
created

Converter::fahrenheitToKelvin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Dwr\OpenWeather\Converter;
4
5
class Converter
6
{
7
    public static function kelvinToCelsius($temp)
8
    {
9
        return (float) $temp - 273.15;
10
    }
11
12
    public static function celsiusToKelvin($temp)
13
    {
14
        return (float) $temp + 273.15;
15
    }
16
17
    public static function kelvinToFahrenheit($temp)
18
    {
19
        return (float) $temp * 9/5 - 459.67;
20
    }
21
22
    public static function fahrenheitToKelvin($temp)
23
    {
24
        return ((float) $temp + 459.67) * 5/9;
25
    }
26
27
    public static function intToDate($int, $format = null)
28
    {
29
        if($format) {
30
            return date($format, $int);
31
        }
32
33
        return date("Y-m-d H:i:s", $int);
34
    }
35
}