Code Duplication    Length = 13-13 lines in 2 locations

src/Charcoal/Loader/CollectionLoader.php 1 location

@@ 140-152 (lines=13) @@
137
     * @param  array $data Data to assign to the loader.
138
     * @return self
139
     */
140
    public function setData(array $data)
141
    {
142
        foreach ($data as $key => $val) {
143
            $setter = $this->setter($key);
144
            if (is_callable([ $this, $setter ])) {
145
                $this->{$setter}($val);
146
            } else {
147
                $this->{$key} = $val;
148
            }
149
        }
150
151
        return $this;
152
    }
153
154
    /**
155
     * Retrieve the source to load objects from.

src/Charcoal/Source/AbstractSource.php 1 location

@@ 98-110 (lines=13) @@
95
     * @param  array $data Data to assign to the source.
96
     * @return self
97
     */
98
    public function setData(array $data)
99
    {
100
        foreach ($data as $key => $val) {
101
            $setter = $this->setter($key);
102
            if (is_callable([ $this, $setter ])) {
103
                $this->{$setter}($val);
104
            } else {
105
                $this->{$key} = $val;
106
            }
107
        }
108
109
        return $this;
110
    }
111
112
    /**
113
     * Set the properties of the source to fetch.