Code Duplication    Length = 17-17 lines in 2 locations

src/Value.php 2 locations

@@ 160-176 (lines=17) @@
157
     *
158
     * @todo add some checking for $values to be an array of xmlrpc values?
159
     */
160
    public function addArray($values)
161
    {
162
        if ($this->mytype == 0) {
163
            $this->mytype = static::$xmlrpcTypes['array'];
164
            $this->me['array'] = $values;
165
166
            return 1;
167
        } elseif ($this->mytype == 2) {
168
            // we're adding to an array here
169
            $this->me['array'] = array_merge($this->me['array'], $values);
170
171
            return 1;
172
        } else {
173
            error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
174
            return 0;
175
        }
176
    }
177
178
    /**
179
     * Merges an array of named xmlrpc value objects into an xmlrpc value.
@@ 191-207 (lines=17) @@
188
     *
189
     * @todo add some checking for $values to be an array?
190
     */
191
    public function addStruct($values)
192
    {
193
        if ($this->mytype == 0) {
194
            $this->mytype = static::$xmlrpcTypes['struct'];
195
            $this->me['struct'] = $values;
196
197
            return 1;
198
        } elseif ($this->mytype == 3) {
199
            // we're adding to a struct here
200
            $this->me['struct'] = array_merge($this->me['struct'], $values);
201
202
            return 1;
203
        } else {
204
            error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
205
            return 0;
206
        }
207
    }
208
209
    /**
210
     * Returns a string containing either "struct", "array", "scalar" or "undef", describing the base type of the value.