Completed
Push — master ( b37349...2c4b7d )
by Oliver
04:15
created

DoubleType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 44
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A set() 0 4 1
A isType() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Mailable.
5
 *
6
 * (c) Oliver Green <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace BoxedCode\Eloquent\Meta\Types;
13
14
class DoubleType extends Type
15
{
16
    /**
17
     * Parse & return the meta item value.
18
     *
19
     * @return int
20
     */
21
    public function get()
22
    {
23
        return doubleval(parent::get());
24
    }
25
26
    /**
27
     * Parse & set the meta item value.
28
     *
29
     * @param int $value
30
     */
31
    public function set($value)
32
    {
33
        parent::set(doubleval($value));
34
    }
35
36
    /**
37
     * Ascertain whether we can handle the
38
     * type of variable passed.
39
     *
40
     * @param  mixed  $value
41
     * @return boolean
42
     */
43
    public function isType($value)
44
    {
45
        return is_double($value);
46
    }
47
48
    /**
49
     * Output value to string.
50
     *
51
     * @return string
52
     */
53
    public function __toString()
54
    {
55
        return (string) $this->get();
56
    }
57
}
58