Completed
Push — master ( 725043...fc3a8f )
by Vladimir
07:42
created

PulseColumnNumericValue::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
c 0
b 0
f 0
rs 9.6666
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace allejo\DaPulse\Objects;
4
5
/**
6
 * Class PulseColumnTextValue
7
 *
8
 * @package allejo\DaPulse\Objects
9
 * @since   0.2.0
10
 */
11 View Code Duplication
class PulseColumnNumericValue extends PulseColumnValue
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * Get a text column's content
15
     *
16
     * @api
17
     *
18
     * @since  0.2.0
19
     *
20
     * @return string The column's content
21
     */
22
    public function getValue ()
23
    {
24
        if (!isset($this->column_value))
25
        {
26
            $this->column_value = $this->jsonResponse["value"];
27
        }
28
29
        return $this->column_value;
30
    }
31
32
    /**
33
     * Update the text of a text column
34
     *
35
     * @api
36
     *
37
     * @param int|double $text
38
     *
39
     * @since 0.2.0
40
     */
41
    public function updateValue ($text)
42
    {
43
        $url        = sprintf("%s/%d/columns/%s/numeric.json", self::apiEndpoint(), $this->board_id, $this->column_id);
44
        $postParams = array(
45
            "pulse_id" => $this->pulse_id,
46
            "value"    => $text
47
        );
48
49
        self::sendPut($url, $postParams);
50
51
        $this->column_value = $text;
52
    }
53
}