Temperature   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toKelvin() 0 3 1
A toDegreeCelsius() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Shobi\Weatherapp\Weather\Units;
4
5
class Temperature
6
{
7
    /**
8
     * the temperature stored as kelvin
9
     */
10
    private $kelvin;
11
12
    /**
13
     * Temperature constructor.
14
     * @param $kelvin
15
     */
16
    public function __construct($kelvin)
17
    {
18
        $this->kelvin = $kelvin;
19
    }
20
21
    /**
22
     * converts the temperature to degree celsius
23
     * @return float
24
     */
25
    public function toDegreeCelsius()
26
    {
27
        return $this->kelvin - 273.15;
28
    }
29
30
    /**
31
     * converts the temperature to kelvin
32
     * @return float
33
     */
34
    public function toKelvin()
35
    {
36
        return $this->kelvin;
37
    }
38
}