Code Duplication    Length = 15-15 lines in 3 locations

src/entities/CustomizableEntity.php 1 location

@@ 27-41 (lines=15) @@
24
    /**
25
     * @return array
26
     */
27
    public function get()
28
    {
29
        $custom_fields = [];
30
        foreach ($this->custom_fields as $custom_field) {
31
            $custom_fields[] = $custom_field->get();
32
        }
33
34
        $fields = $this->getExistedValues($this->fieldList);
35
36
        if (count($custom_fields)) {
37
            $fields['custom_fields'] = $custom_fields;
38
        }
39
40
        return $fields;
41
    }
42
}

src/entities/CustomField.php 1 location

@@ 66-80 (lines=15) @@
63
    /**
64
     * @return array
65
     */
66
    public function get()
67
    {
68
        $fields = $this->getExistedValues($this->fieldList);
69
70
        $values = [];
71
        foreach ($this->values as $value) {
72
            $values[] = $value->get();
73
        }
74
75
        if (count($values)) {
76
            $fields['values'] = $values;
77
        }
78
79
        return $fields;
80
    }
81
}

src/entities/Pipeline.php 1 location

@@ 38-52 (lines=15) @@
35
    /**
36
     * @return array
37
     */
38
    public function get()
39
    {
40
        $statuses = [];
41
        foreach ($this->statuses as $status) {
42
            $statuses[] = $status->get();
43
        }
44
45
        $fields = $this->getExistedValues($this->fieldList);
46
47
        if (count($statuses)) {
48
            $fields['statuses'] = $statuses;
49
        }
50
51
        return $fields;
52
    }
53
}