Code Duplication    Length = 10-12 lines in 2 locations

src/Mutable.php 1 location

@@ 52-61 (lines=10) @@
49
     * @param  array $attributes
50
     * @return array
51
     */
52
    protected function mutableAttributesToArray(array $attributes)
53
    {
54
        foreach ($attributes as $key => $value) {
55
            if ($this->hasGetterMutator($key)) {
56
                $attributes[$key] = $this->mutableMutate($key, $value, 'getter');
57
            }
58
        }
59
60
        return $attributes;
61
    }
62
63
    /**
64
     * 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.