wp/wp-includes/rest-api/class-wp-rest-request.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   376 		 * The order affects which parameters are checked when using WP_REST_Request::get_param()
   376 		 * The order affects which parameters are checked when using WP_REST_Request::get_param()
   377 		 * and family. This acts similarly to PHP's `request_order` setting.
   377 		 * and family. This acts similarly to PHP's `request_order` setting.
   378 		 *
   378 		 *
   379 		 * @since 4.4.0
   379 		 * @since 4.4.0
   380 		 *
   380 		 *
   381 		 * @param string[]        $order Array of types to check, in order of priority.
   381 		 * @param string[]        $order   Array of types to check, in order of priority.
   382 		 * @param WP_REST_Request $this  The request object.
   382 		 * @param WP_REST_Request $request The request object.
   383 		 */
   383 		 */
   384 		return apply_filters( 'rest_request_parameter_order', $order, $this );
   384 		return apply_filters( 'rest_request_parameter_order', $order, $this );
   385 	}
   385 	}
   386 
   386 
   387 	/**
   387 	/**
   955 	 * @since 4.4.0
   955 	 * @since 4.4.0
   956 	 *
   956 	 *
   957 	 * @param string $offset Parameter name.
   957 	 * @param string $offset Parameter name.
   958 	 * @return bool Whether the parameter is set.
   958 	 * @return bool Whether the parameter is set.
   959 	 */
   959 	 */
       
   960 	#[ReturnTypeWillChange]
   960 	public function offsetExists( $offset ) {
   961 	public function offsetExists( $offset ) {
   961 		$order = $this->get_parameter_order();
   962 		$order = $this->get_parameter_order();
   962 
   963 
   963 		foreach ( $order as $type ) {
   964 		foreach ( $order as $type ) {
   964 			if ( isset( $this->params[ $type ][ $offset ] ) ) {
   965 			if ( isset( $this->params[ $type ][ $offset ] ) ) {
   975 	 * @since 4.4.0
   976 	 * @since 4.4.0
   976 	 *
   977 	 *
   977 	 * @param string $offset Parameter name.
   978 	 * @param string $offset Parameter name.
   978 	 * @return mixed|null Value if set, null otherwise.
   979 	 * @return mixed|null Value if set, null otherwise.
   979 	 */
   980 	 */
       
   981 	#[ReturnTypeWillChange]
   980 	public function offsetGet( $offset ) {
   982 	public function offsetGet( $offset ) {
   981 		return $this->get_param( $offset );
   983 		return $this->get_param( $offset );
   982 	}
   984 	}
   983 
   985 
   984 	/**
   986 	/**
   987 	 * @since 4.4.0
   989 	 * @since 4.4.0
   988 	 *
   990 	 *
   989 	 * @param string $offset Parameter name.
   991 	 * @param string $offset Parameter name.
   990 	 * @param mixed  $value  Parameter value.
   992 	 * @param mixed  $value  Parameter value.
   991 	 */
   993 	 */
       
   994 	#[ReturnTypeWillChange]
   992 	public function offsetSet( $offset, $value ) {
   995 	public function offsetSet( $offset, $value ) {
   993 		$this->set_param( $offset, $value );
   996 		$this->set_param( $offset, $value );
   994 	}
   997 	}
   995 
   998 
   996 	/**
   999 	/**
   998 	 *
  1001 	 *
   999 	 * @since 4.4.0
  1002 	 * @since 4.4.0
  1000 	 *
  1003 	 *
  1001 	 * @param string $offset Parameter name.
  1004 	 * @param string $offset Parameter name.
  1002 	 */
  1005 	 */
       
  1006 	#[ReturnTypeWillChange]
  1003 	public function offsetUnset( $offset ) {
  1007 	public function offsetUnset( $offset ) {
  1004 		$order = $this->get_parameter_order();
  1008 		$order = $this->get_parameter_order();
  1005 
  1009 
  1006 		// Remove the offset from every group.
  1010 		// Remove the offset from every group.
  1007 		foreach ( $order as $type ) {
  1011 		foreach ( $order as $type ) {