Code Duplication    Length = 12-15 lines in 2 locations

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

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

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

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