src/ArrayValue.php
public function add_filter_by_key( FilterInterface $filter, $key ) {

		if ( ! is_scalar( $key ) ) {
			throw new Exception\InvalidArgumentException( 'key should be a scalar value.' );
		}

		$key = (string) $key;

		if ( ! isset ( $this->filters_by_key[ $key ] ) ) {
			$this->filters_by_key[ $key ] = [ ];
		}

		$this->filters_by_key[ $key ][] = $filter;

		return $this;
	}
public function add_filter_by_key( FilterInterface $filter, $key ) {

		if ( ! is_scalar( $key ) ) {
			throw new Exception\InvalidArgumentException( 'key should be a scalar value.' );
		}

		$key = (string) $key;

		if ( ! isset ( $this->filters_by_key[ $key ] ) ) {
			$this->filters_by_key[ $key ] = [ ];
		}

		$this->filters_by_key[ $key ][] = $filter;

		return $this;
	}
public function add_filter_by_key ( FilterInterface $ filter , $ key ) { if ( ! is_scalar ( $ key ) ) { throw new Exception \ InvalidArgumentException ( 'key should be a scalar value.' ) ; } $ key = ( string ) $ key ; if ( ! isset ( $ this -> filters_by_key [ $ key ] ) ) { $ this -> filters_by_key [ $ key ] = [ ] ; } $ this -> filters_by_key [ $ key ] [ ] = $ filter ; return $ this ; }
Adding a filter grouped by array key.

@throws Exception\InvalidArgumentException if type of $key is not scalar.

@param FilterInterface    $filter
@param                    $key

@return ArrayValue
Adding a filter grouped by array key .