Code Duplication    Length = 10-12 lines in 4 locations

lib/Payone/Api/Request/Abstract.php 1 location

@@ 114-125 (lines=12) @@
111
    /**
112
     * @param array $data
113
     */
114
    public function init(array $data = array())
115
    {
116
        foreach ($data as $key => $value)
117
        {
118
            $key = ucwords(str_replace('_', ' ', $key));
119
            $method = 'set' . str_replace(' ', '', $key);
120
121
            if (method_exists($this, $method)) {
122
                $this->{$method}($value);
123
            }
124
        }
125
    }
126
127
    /**
128
     * @return array

lib/Payone/Api/Request/Parameter/Abstract.php 1 location

@@ 49-60 (lines=12) @@
46
    /**
47
     * @param array $data
48
     */
49
    public function init(array $data = array())
50
    {
51
        foreach ($data as $key => $value)
52
        {
53
            $key = ucwords(str_replace('_', ' ', $key));
54
            $method = 'set' . str_replace(' ', '', $key);
55
56
            if (method_exists($this, $method)) {
57
                $this->{$method}($value);
58
            }
59
        }
60
    }
61
62
    /**
63
     * @return array

lib/Payone/ClientApi/Request/Abstract.php 1 location

@@ 122-132 (lines=11) @@
119
    /**
120
     * @param array $data
121
     */
122
    public function init(array $data = array())
123
    {
124
        foreach ($data as $key => $value) {
125
            $key = ucwords(str_replace('_', ' ', $key));
126
            $method = 'set' . str_replace(' ', '', $key);
127
128
            if (method_exists($this, $method)) {
129
                $this->{$method}($value);
130
            }
131
        }
132
    }
133
134
    /**
135
     * @return array

lib/Payone/Api/Response/Parameter/Abstract.php 1 location

@@ 37-46 (lines=10) @@
34
    /**
35
     * @param array $data
36
     */
37
    public function init(array $data = array()) 
38
    {
39
        foreach ($data as $key => $value) {
40
            $key = ucwords(str_replace('_', ' ', $key));
41
            $method = 'set' . str_replace(' ', '', $key);
42
43
            if (method_exists($this, $method)) {
44
                $this->{$method}($value);
45
            }
46
        }
47
    }
48
49
    /**