| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 43 | 3 | public function applyQueryFilter( $request, $query_vars ) { |
|
| 44 | 3 | $query = $this->getAttribute( 'query' ); |
|
| 45 | 3 | $condition = $this->getAttribute( 'condition' ); |
|
| 46 | |||
| 47 | 3 | if ( $query === null ) { |
|
| 48 | 1 | return $query_vars; |
|
| 49 | } |
||
| 50 | |||
| 51 | 2 | if ( ! $condition instanceof UrlCondition ) { |
|
| 52 | 1 | throw new ConfigurationException( |
|
| 53 | 'Only routes with a URL condition can use queries. ' . |
||
| 54 | 1 | 'Make sure your route has a URL condition and it is not in a non-URL route group.' |
|
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | 1 | return call_user_func_array( |
|
| 59 | 1 | $query, |
|
| 60 | 1 | array_merge( |
|
| 61 | 1 | [$query_vars], |
|
| 62 | 1 | array_values( $condition->getArguments( $request ) ) |
|
| 63 | ) |
||
| 67 |