Code Duplication    Length = 11-12 lines in 2 locations

includes/libs/objectcache/RESTBagOStuff.php 2 locations

@@ 107-118 (lines=12) @@
104
	 * @param int    $flags Bitfield of BagOStuff::WRITE_* constants
105
	 * @return bool Success
106
	 */
107
	public function set( $key, $value, $exptime = 0, $flags = 0 ) {
108
		$req = [
109
			'method' => 'PUT',
110
			'url' => $this->url . rawurlencode( $key ),
111
			'body' => serialize( $value )
112
		];
113
		list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req );
114
		if ( $rcode === 200 || $rcode === 201 ) {
115
			return true;
116
		}
117
		return $this->handleError( "Failed to store $key", $rcode, $rerr );
118
	}
119
120
	/**
121
	 * Delete an item.
@@ 126-136 (lines=11) @@
123
	 * @param string $key
124
	 * @return bool True if the item was deleted or not found, false on failure
125
	 */
126
	public function delete( $key ) {
127
		$req = [
128
			'method' => 'DELETE',
129
			'url' => $this->url . rawurlencode( $key ),
130
		];
131
		list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req );
132
		if ( $rcode === 200 || $rcode === 204 || $rcode === 205 ) {
133
			return true;
134
		}
135
		return $this->handleError( "Failed to delete $key", $rcode, $rerr );
136
	}
137
}
138