Code Duplication    Length = 43-43 lines in 2 locations

src/Objects/PulseColumnNumericValue.php 1 location

@@ 11-53 (lines=43) @@
8
 * @package allejo\DaPulse\Objects
9
 * @since   0.2.0
10
 */
11
class PulseColumnNumericValue extends PulseColumnValue
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
}

src/Objects/PulseColumnTextValue.php 1 location

@@ 11-53 (lines=43) @@
8
 * @package allejo\DaPulse\Objects
9
 * @since   0.1.0
10
 */
11
class PulseColumnTextValue extends PulseColumnValue
12
{
13
    /**
14
     * Get a text column's content
15
     *
16
     * @api
17
     *
18
     * @since  0.1.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 string $text
38
     *
39
     * @since 0.1.0
40
     */
41
    public function updateValue ($text)
42
    {
43
        $url        = sprintf("%s/%d/columns/%s/text.json", self::apiEndpoint(), $this->board_id, $this->column_id);
44
        $postParams = array(
45
            "pulse_id" => $this->pulse_id,
46
            "text"     => $text
47
        );
48
49
        self::sendPut($url, $postParams);
50
51
        $this->column_value = $text;
52
    }
53
}