Passed
Push — master ( 998eef...fb3ec1 )
by y
01:58
created

External::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Helix\Asana\Task;
4
5
use Helix\Asana\Base\Data;
6
use Helix\Asana\Task;
7
8
/**
9
 * Custom task data.
10
 *
11
 * @see https://developers.asana.com/docs/custom-external-data
12
 *
13
 * @method null|string  getGid  ()
14
 * @method bool         hasGid  ()
15
 * @method $this        setGid  (null|string $gid) 1024 chars max.
16
 * @method null|string  getData ()
17
 * @method bool         hasData ()
18
 * @method $this        setData (null|string $data) 32768 chars max.
19
 */
20
class External extends Data {
21
22
    /**
23
     * @var Task
24
     */
25
    protected $task;
26
27
    public function __construct (Task $task, array $data = []) {
28
        parent::__construct($task, $data);
29
        $this->task = $task;
30
    }
31
32
    /**
33
     * Marks the task's `external` diff.
34
     *
35
     * @param string $key
36
     * @param mixed $value
37
     * @return $this
38
     */
39
    protected function _set (string $key, $value) {
40
        $this->task->diff['external'] = true;
41
        return parent::_set($key, $value);
42
    }
43
44
}