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
            array_unshift($arguments, $property);
99
            return call_user_func_array([$this, 'attach'], $arguments);
100
        }
101
        
102
        if (preg_match('/^add(\w+)/', $name, $matches)
103
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))) {
@@ 102-106 (lines=5) @@
99
            return call_user_func_array([$this, 'attach'], $arguments);
100
        }
101
        
102
        if (preg_match('/^add(\w+)/', $name, $matches)
103
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))) {
104
            array_unshift($arguments, $collection);
105
            return call_user_func_array([$this, 'attach'], $arguments);
106
        }
107
        
108
        if (preg_match('/^unset(\w+)/', $name, $matches)
109
            && in_array($property = lcfirst($matches[1]), array_keys($this->getRivetsConfig()))) {
@@ 108-112 (lines=5) @@
105
            return call_user_func_array([$this, 'attach'], $arguments);
106
        }
107
        
108
        if (preg_match('/^unset(\w+)/', $name, $matches)
109
            && in_array($property = lcfirst($matches[1]), array_keys($this->getRivetsConfig()))) {
110
            array_unshift($arguments, $property);
111
            return call_user_func_array([$this, 'removeRivet'], $arguments);
112
        }
113
        
114
        if (preg_match('/^remove(\w+)/', $name, $matches)
115
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))) {
@@ 114-118 (lines=5) @@
111
            return call_user_func_array([$this, 'removeRivet'], $arguments);
112
        }
113
        
114
        if (preg_match('/^remove(\w+)/', $name, $matches)
115
            && in_array($collection = str_plural(lcfirst($matches[1])), array_keys($this->getRivetsConfig()))) {
116
            array_unshift($arguments, $collection);
117
            return call_user_func_array([$this, 'removeRivet'], $arguments);
118
        }
119
        
120
        if ( ! in_array($name, array_keys($this->getRivetsConfig()))) {
121
            return parent::__call($name, $arguments);