Completed
Pull Request — master (#4)
by ARCANEDEV
06:24
created

Duration   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 150
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 36.36%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 150
ccs 8
cts 22
cp 0.3636
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A text() 0 4 1
A getText() 0 4 1
A value() 0 4 1
A getValue() 0 4 1
A make() 0 4 1
A makeFromArray() 0 4 1
A toArray() 0 4 1
A toJson() 0 4 1
A jsonSerialize() 0 4 1
1
<?php namespace Arcanedev\GeoLocation\Entities;
2
3
use Illuminate\Contracts\Support\Arrayable;
4
use Illuminate\Contracts\Support\Jsonable;
5
use JsonSerializable;
6
7
/**
8
 * Class     Duration
9
 *
10
 * @package  Arcanedev\GeoLocation\Entities
11
 * @author   ARCANEDEV <[email protected]>
12
 *
13
 * @todo: Refactor this with Distance class ?
14
 */
15
class Duration implements Arrayable, Jsonable, JsonSerializable
16
{
17
    /* -----------------------------------------------------------------
18
     |  Properties
19
     | -----------------------------------------------------------------
20
     */
21
22
    /**
23
     * The text value.
24
     *
25
     * @var string
26
     */
27
    protected $text;
28
29
    /**
30
     * The numeric value.
31
     *
32
     * @var int
33
     */
34
    protected $value;
35
36
    /* -----------------------------------------------------------------
37
     |  Main Methods
38
     | -----------------------------------------------------------------
39
     */
40
41
    /**
42
     * Distance constructor.
43
     *
44
     * @param  string  $text
45
     * @param  int     $value
46
     */
47 3
    public function __construct($text, $value)
48
    {
49 3
        $this->text  = $text;
50 3
        $this->value = $value;
51 3
    }
52
53
    /* -----------------------------------------------------------------
54
     |  Getters & Setters
55
     | -----------------------------------------------------------------
56
     */
57
58
    /**
59
     * Get the text (alias).
60
     *
61
     * @see getText
62
     *
63
     * @return string
64
     */
65
    public function text()
66
    {
67
        return $this->getText();
68
    }
69
70
    /**
71
     * Get the text.
72
     *
73
     * @return string
74
     */
75
    public function getText()
76
    {
77
        return $this->text;
78
    }
79
80
    /**
81
     * Get the value (alias).
82
     *
83
     * @see getValue
84
     *
85
     * @return int
86
     */
87
    public function value()
88
    {
89
        return $this->value;
90
    }
91
92
    /**
93
     * Get the value.
94
     *
95
     * @return int
96
     */
97
    public function getValue()
98
    {
99
        return $this->value;
100
    }
101
102
    /* -----------------------------------------------------------------
103
     |  Main Methods
104
     | -----------------------------------------------------------------
105
     */
106
107
    /**
108
     * Make a distance instance.
109
     *
110
     * @param  string  $text
111
     * @param  int     $value
112
     *
113
     * @return self
114
     */
115 3
    public static function make($text, $value)
116
    {
117 3
        return new static($text, $value);
118
    }
119
120
    /**
121
     * Make a distance instance from array.
122
     *
123
     * @param  array  $data
124
     *
125
     * @return self
126
     */
127 3
    public static function makeFromArray(array $data)
128
    {
129 3
        return static::make($data['text'], $data['value']);
130
    }
131
132
    /**
133
     * Get the instance as an array.
134
     *
135
     * @return array
136
     */
137
    public function toArray()
138
    {
139
        // TODO: Implement toArray() method.
140
    }
141
142
    /**
143
     * Convert the object to its JSON representation.
144
     *
145
     * @param  int $options
146
     * @return string
147
     */
148
    public function toJson($options = 0)
149
    {
150
        // TODO: Implement toJson() method.
151
    }
152
153
    /**
154
     * Specify data which should be serialized to JSON
155
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
156
     * @return mixed data which can be serialized by <b>json_encode</b>,
157
     * which is a value of any type other than a resource.
158
     * @since 5.4.0
159
     */
160
    function jsonSerialize()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
161
    {
162
        // TODO: Implement jsonSerialize() method.
163
    }
164
}
165