Code Duplication    Length = 10-12 lines in 2 locations

src/Mutable.php 1 location

@@ 36-45 (lines=10) @@
33
     * @param  array $attributes
34
     * @return array
35
     */
36
    protected function mutableAttributesToArray(array $attributes)
37
    {
38
        foreach ($attributes as $key => $value) {
39
            if ($this->hasGetterMutator($key)) {
40
                $attributes[$key] = $this->mutableMutate($key, $value, 'getter');
41
            }
42
        }
43
44
        return $attributes;
45
    }
46
47
    /**
48
     * Determine whether an attribute has getter mutators defined.

src/Mutable/Hooks.php 1 location

@@ 16-27 (lines=12) @@
13
     *
14
     * @return \Closure
15
     */
16
    public function getAttribute()
17
    {
18
        return function ($next, $value, $args) {
19
            $key = $args->get('key');
20
21
            if ($this->hasGetterMutator($key)) {
22
                $value = $this->mutableMutate($key, $value, 'getter');
23
            }
24
25
            return $next($value, $args);
26
        };
27
    }
28
29
    /**
30
     * Register hook on setAttribute method.