# depicter/1.2.0/vendor/htmlburger/wpemerge/src/Routing/Conditions/QueryVarCondition.php

Depicter — Popup &amp; Slider Builder, version 1.2.0. 70 lines.

- Page: https://pluginprobe.com/plugins/depicter/1.2.0/code/vendor/htmlburger/wpemerge/src/Routing/Conditions/QueryVarCondition.php
- Raw: https://pluginprobe.com/plugins/depicter/1.2.0/raw/vendor/htmlburger/wpemerge/src/Routing/Conditions/QueryVarCondition.php
- Modified: 2022-06-01T06:26:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/1.2.0/code/vendor/htmlburger/wpemerge/src/Routing/Conditions/QueryVarCondition.php#L10-L20`.

```php
<?php
/**
 * @package   WPEmerge
 * @author    Atanas Angelov <hi@atanas.dev>
 * @copyright 2017-2019 Atanas Angelov
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
 * @link      https://wpemerge.com/
 */

namespace WPEmerge\Routing\Conditions;

use WPEmerge\Requests\RequestInterface;

/**
 * Check against a query var value.
 *
 * @codeCoverageIgnore
 */
class QueryVarCondition implements ConditionInterface {
	/**
	 * Query var name to check against.
	 *
	 * @var string|null
	 */
	protected $query_var = null;

	/**
	 * Query var value to check against.
	 *
	 * @var string|null
	 */
	protected $value = '';

	/**
	 * Constructor.
	 *
	 * @codeCoverageIgnore
	 * @param string      $query_var
	 * @param string|null $value
	 */
	public function __construct( $query_var, $value = null ) {
		$this->query_var = $query_var;
		$this->value = $value;
	}

	/**
	 * {@inheritDoc}
	 */
	public function isSatisfied( RequestInterface $request ) {
		$query_var_value = get_query_var( $this->query_var, null );

		if ( $query_var_value === null ) {
			return false;
		}

		if ( $this->value === null ) {
			return true;
		}

		return (string) $this->value === $query_var_value;
	}

	/**
	 * {@inheritDoc}
	 */
	public function getArguments( RequestInterface $request ) {
		return ['query_var' => $this->query_var, 'value' => $this->value];
	}
}

```
