Code Duplication    Length = 5-5 lines in 4 locations

src/Traits/HasRivetsTrait.php 4 locations

@@ 96-100 (lines=5) @@
93
94
    public function __call($name, $arguments)
95
    {
96
        if (preg_match('/^set(\w+)/', $name, $matches)
97
            && in_array($property = lcfirst($matches[1]), array_keys($this->getRivetsConfig()))
98
        ) {
99
            array_unshift($arguments, $property);
100
            return call_user_func_array([$this, 'attach'], $arguments);
101
        }
102
103
        if (preg_match('/^add(\w+)/', $name, $matches)
@@ 103-107 (lines=5) @@
100
            return call_user_func_array([$this, 'attach'], $arguments);
101
        }
102
103
        if (preg_match('/^add(\w+)/', $name, $matches)
104
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))
105
        ) {
106
            array_unshift($arguments, $collection);
107
            return call_user_func_array([$this, 'attach'], $arguments);
108
        }
109
110
        if (preg_match('/^unset(\w+)/', $name, $matches)
@@ 110-114 (lines=5) @@
107
            return call_user_func_array([$this, 'attach'], $arguments);
108
        }
109
110
        if (preg_match('/^unset(\w+)/', $name, $matches)
111
            && in_array($property = lcfirst($matches[1]), array_keys($this->getRivetsConfig()))
112
        ) {
113
            array_unshift($arguments, $property);
114
            return call_user_func_array([$this, 'removeRivet'], $arguments);
115
        }
116
117
        if (preg_match('/^remove(\w+)/', $name, $matches)
@@ 117-121 (lines=5) @@
114
            return call_user_func_array([$this, 'removeRivet'], $arguments);
115
        }
116
117
        if (preg_match('/^remove(\w+)/', $name, $matches)
118
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))
119
        ) {
120
            array_unshift($arguments, $collection);
121
            return call_user_func_array([$this, 'removeRivet'], $arguments);
122
        }
123
124
        if ( ! in_array($name, array_keys($this->getRivetsConfig()))) {