<?php
namespace SabaiApps\Framework\Criteria;

/**
 * IsNotNullCriteria class for representing a "not null" condition in criteria evaluation.
 * Checks if a field's value is not null.
 */
class IsNotNullCriteria extends AbstractCriteria {

	/**
	 * @var string The field name to check.
	 */
	private $_field;

	/**
	 * Constructor.
	 *
	 * @param string $field The field name.
	 */
	public function __construct( $field ) {
		$this->_field = $field;
	}

	/**
	 * Gets the field name.
	 *
	 * @return string
	 */
	public function getField() {
		return $this->_field;
	}

	/**
	 * Accepts a Visitor object for traversing or evaluating the "not null" criteria.
	 *
	 * @param IVisitor $visitor Visitor object.
	 * @param mixed    $valuePassed Value to pass to the visitor.
	 * @return mixed
	 */
	public function acceptVisitor( IVisitor $visitor, &$valuePassed ) {
		return $visitor->visitCriteriaIsNotNull( $this, $valuePassed );
	}
}
