Code Duplication    Length = 12-15 lines in 2 locations

json-endpoints/jetpack/class.jetpack-json-api-themes-endpoint.php 1 location

@@ 162-176 (lines=15) @@
159
	 * @uses   WPCOM_JSON_API_Endpoint::query_args()
160
	 * @return array         Public API theme objects
161
	 */
162
	protected function get_themes() {
163
		// ditch keys
164
		$themes = array_values( $this->themes );
165
		// do offset & limit - we've already returned a 400 error if they're bad numbers
166
		$args = $this->query_args();
167
168
		if ( isset( $args['offset'] ) )
169
			$themes = array_slice( $themes, (int) $args['offset'] );
170
		if ( isset( $args['limit'] ) )
171
			$themes = array_slice( $themes, 0, (int) $args['limit'] );
172
173
		$this->current_theme_id = wp_get_theme()->get_stylesheet();
174
175
		return array_map( array( $this, 'format_theme' ), $themes );
176
	}
177
178
}
179

json-endpoints/jetpack/class.jetpack-json-api-modules-endpoint.php 1 location

@@ 112-123 (lines=12) @@
109
	 * @uses   WPCOM_JSON_API_Endpoint::query_args()
110
	 * @return array         Public API modules objects
111
	 */
112
	protected function get_modules() {
113
		$modules = array_values( $this->modules );
114
		// do offset & limit - we've already returned a 400 error if they're bad numbers
115
		$args = $this->query_args();
116
117
		if ( isset( $args['offset'] ) )
118
			$modules = array_slice( $modules, (int) $args['offset'] );
119
		if ( isset( $args['limit'] ) )
120
			$modules = array_slice( $modules, 0, (int) $args['limit'] );
121
122
		return array_map( array( $this, 'format_module' ), $modules );
123
	}
124
125
}
126