Code Duplication    Length = 17-17 lines in 2 locations

src/Value.php 2 locations

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