Code Duplication    Length = 18-19 lines in 2 locations

Moss/Storage/Query/ReadQuery.php 1 location

@@ 79-97 (lines=19) @@
76
     *
77
     * @return $this
78
     */
79
    public function fields($fields = [])
80
    {
81
        $this->builder->select([]);
82
        $this->casts = [];
83
84
        if (empty($fields)) {
85
            foreach ($this->model->fields() as $field) {
86
                $this->assignField($field);
87
            }
88
89
            return $this;
90
        }
91
92
        foreach ($fields as $field) {
93
            $this->assignField($this->model->field($field));
94
        }
95
96
        return $this;
97
    }
98
99
    /**
100
     * Adds field to query

Moss/Storage/Query/WriteQuery.php 1 location

@@ 41-58 (lines=18) @@
38
     *
39
     * @return $this
40
     */
41
    public function values($fields = [])
42
    {
43
        $this->values = [];
44
45
        if (empty($fields)) {
46
            foreach ($this->model->fields() as $field) {
47
                $this->assignValue($field);
48
            }
49
50
            return $this;
51
        }
52
53
        foreach ($fields as $field) {
54
            $this->assignValue($this->model->field($field));
55
        }
56
57
        return $this;
58
    }
59
60
    /**
61
     * Adds field which value will be written