wp/wp-includes/rest-api/class-wp-rest-response.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
   191 	public function get_matched_handler() {
   191 	public function get_matched_handler() {
   192 		return $this->matched_handler;
   192 		return $this->matched_handler;
   193 	}
   193 	}
   194 
   194 
   195 	/**
   195 	/**
   196 	 * Retrieves the handler that was responsible for generating the response.
   196 	 * Sets the handler that was responsible for generating the response.
   197 	 *
   197 	 *
   198 	 * @since 4.4.0
   198 	 * @since 4.4.0
   199 	 *
   199 	 *
   200 	 * @param array $handler The matched handler.
   200 	 * @param array $handler The matched handler.
   201 	 */
   201 	 */
   230 
   230 
   231 		if ( is_array( $this->get_data() ) ) {
   231 		if ( is_array( $this->get_data() ) ) {
   232 			$data = $this->get_data();
   232 			$data = $this->get_data();
   233 			$error->add( $data['code'], $data['message'], $data['data'] );
   233 			$error->add( $data['code'], $data['message'], $data['data'] );
   234 			if ( ! empty( $data['additional_errors'] ) ) {
   234 			if ( ! empty( $data['additional_errors'] ) ) {
   235 				foreach( $data['additional_errors'] as $err ) {
   235 				foreach ( $data['additional_errors'] as $err ) {
   236 					$error->add( $err['code'], $err['message'], $err['data'] );
   236 					$error->add( $err['code'], $err['message'], $err['data'] );
   237 				}
   237 				}
   238 			}
   238 			}
   239 		} else {
   239 		} else {
   240 			$error->add( $this->get_status(), '', array( 'status' => $this->get_status() ) );
   240 			$error->add( $this->get_status(), '', array( 'status' => $this->get_status() ) );
   251 	 * @return array Compact URIs.
   251 	 * @return array Compact URIs.
   252 	 */
   252 	 */
   253 	public function get_curies() {
   253 	public function get_curies() {
   254 		$curies = array(
   254 		$curies = array(
   255 			array(
   255 			array(
   256 				'name' => 'wp',
   256 				'name'      => 'wp',
   257 				'href' => 'https://api.w.org/{rel}',
   257 				'href'      => 'https://api.w.org/{rel}',
   258 				'templated' => true,
   258 				'templated' => true,
   259 			),
   259 			),
   260 		);
   260 		);
   261 
   261 
   262 		/**
   262 		/**