%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/knwn/wp-content/plugins/admin-columns-pro/classes/Search/Helper/MetaQuery/
Upload File :
Create Path :
Current File : /var/www/knwn/wp-content/plugins/admin-columns-pro/classes/Search/Helper/MetaQuery/Comparison.php

<?php

namespace ACP\Search\Helper\MetaQuery;

use ACP\Search\Value;

class Comparison {

	/**
	 * @var string
	 */
	protected $key;

	/**
	 * @var string
	 */
	protected $operator;

	/**
	 * @var mixed
	 */
	protected $value;

	/**
	 * @param string $key
	 * @param string $operator
	 * @param Value  $value
	 */
	public function __construct( $key, $operator, Value $value ) {
		$this->key = $key;
		$this->operator = $operator;
		$this->value = $value;
	}

	/**
	 * @return array
	 */
	public function __invoke() {
		switch ( $this->value->get_type() ) {
			case Value::INT:
				$type = 'NUMERIC';

				break;
			case Value::DECIMAL:
				$type = 'DECIMAL';

				break;
			case Value::DATE:
				$type = 'DATE';

				break;
			default:
				$type = 'CHAR';
		}

		return [
			'key'     => $this->key,
			'value'   => $this->value->get_value(),
			'compare' => $this->operator,
			'type'    => $type,
		];
	}

}

Zerion Mini Shell 1.0