Code Duplication    Length = 12-15 lines in 2 locations

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

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

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