Return a unique key for the current comparison, which can be used to
avoid recursion issues.

@param object $left  The left value.
@param object $right The right value.

@return string The unique comparison key.
493843
protected function objectComparisonStackKey($left, $right)
    {
        $ids = array(
            spl_object_hash($left),
            spl_object_hash($right)
        );
        sort($ids);

        return implode('.', $ids);
    }
652491
public function getKey($offset = null)
    {
        if (null === $offset) {
            $offset = $this->offset;
        }

        if ((null !== ($op = $this->getId(--$offset)))
            && ((DocLexer::T_COLON === $op)
                || (DocLexer::T_EQUALS === $op))) {
            return $this->getValue(--$offset);
        }

        return null;
    }
416850
public static int compare(String left, double right) {
	if (Decision.isNumber(left)) {
	    if (left.length() > 9) {
		try {
		    return new BigDecimal(left).compareTo(new BigDecimal(Caster.toString(right)));
		}
		catch (Exception e) {}
	    }
	    return compare(Caster.toDoubleValue(left, Double.NaN), right);
	}
	if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false), right);

	if (left.length() == 0) return -1;
	char leftFirst = left.charAt(0);
	if (leftFirst >= '0' && leftFirst <= '9') return left.compareToIgnoreCase(Caster.toString(right));
	return leftFirst - '0';
    }
943607
public function getMesasForRoom($nombre_mesa_id, $left, $right) {
		$this->recursive = 0;
		$options = array('conditions' => array(
					'Mesa.checkin <=' => $right . ' 00:00:00',
					'Mesa.checkout >=' => $left . ' 23:59:59',
					'Mesa.nombre_mesa_id' => $nombre_mesa_id
		));
		// print_r($this->find('all', $options));die;
		return $this->find('all', $options);
	}
1178821
public function getSibling($right = true)
	{
		if (!$this->_allChildrenloaded)
		{
			$temp = $this->_constructor->get($this->id, true);
			$this->_children = $temp->getChildren();
			$this->_leftSibling = $temp->getSibling(false);
			$this->_rightSibling = $temp->getSibling(true);
			$this->setAllLoaded();
		}

		if ($right)
		{
			return $this->_rightSibling;
		}
		else
		{
			return $this->_leftSibling;
		}
	}
294935
public static function equal(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::EQUAL, $right);
    }
479902
public function checkCompare($left, $operator, $right, $strict=false)
    {

        if ($strict || in_array($operator, ['is', 'is not', '=', '!=', '<>'])) {
            return $this->isComparable($left, $right) ? $this->compare($left, $operator, $right) : false;
        }

        if (!$comparable = $this->makeComparable($left, $right)) {
            return false;
        }

        list($left, $right) = $comparable;

        return $this->compare($left, $operator, $right);
    }
1145419
private function getCommonPrefixString($left, $right)
    {
        for ($i = 1; $i < strlen($left); $i++) {
            if (substr_compare($left, $right, 0, $i) !== 0) {
                return substr($left, 0, $i - 1);
            }
        }
        return substr($left, 0, $i);
    }
929207
protected function opCmpNumberNumber($left, $right)
    {
        $n = $left[1] - $right[1];

        return new Node\Number($n ? $n / abs($n) : 0, '');
    }
517008
protected function isArrayReference(array &$left, array &$right)
    {
        $id = uniqid('schemer-', true);
        $left[$id] = true;
        $isArrayReference = array_key_exists($id, $right);
        unset($left[$id]);

        return $isArrayReference;
    }
503003
protected function addBinary($left, $right) {
        $len    = max(strlen($left), strlen($right));
        $left   = str_pad($left, $len, chr(0), STR_PAD_LEFT);
        $right  = str_pad($right, $len, chr(0), STR_PAD_LEFT);
        $result = '';
        $carry  = 0;
        for ($i = 0; $i < $len; $i++) {
            $sum     = ord($left[$len - $i - 1])
                 + ord($right[$len - $i - 1])
                 + $carry;
            $result .= chr($sum % 256);
            $carry   = $sum >> 8;
        }
        while ($carry) {
            $result .= chr($carry % 256);
            $carry >>= 8;
        }
        return strrev($result);
    }
173358
public static function xorStrings(string $left, string $right): string
    {
        $length = Binary::safeStrlen($left);
        if ($length !== Binary::safeStrlen($right)) {
            throw new InvalidType(
                'Both strings must be the same length'
            );
        }
        if ($length < 1) {
            return '';
        }
        return (string) ($left ^ $right);
    }
627438
public function search( $array, $key, $left = FALSE, $right = FALSE )
	{
		if( !$right )
		{
			$left	= 0;
			$right	= sizeof( $array ) - 1;
			$this->counter = 0;
		}
		$this->counter++;
		$index1	= round( $left + ( $right - $left ) / 3, 0 );
		$index2	= round( $left + ( ( $right-$left ) / 3 ) * 2, 0 );
		//echo "searching from $left to $right [$index1 - $index2]<br>";
		if( $key == $array[$index1] )
			return ":".$index1;
		if( $key == $array[$index2] )
			return ":".$index2;
		if( $left == $right )
			return false;
		if( $key < $array[$index1] )
			return $this->search( $array, $key, $left, $index1 );
		else if( $key >= $array[$index2] )
			return $this->search( $array, $key, $index2, $right );
		else
			return $this->search( $array, $key, $index1 + 1, $index2 - 1 );
	}
63066
protected function _merge( array $left, array $right )
	{
		foreach( $right as $key => $value )
		{
			if( isset( $left[$key] ) && is_array( $left[$key] ) && is_array( $value ) ) {
				$left[$key] = $this->_merge( $left[$key], $value );
			} else {
				$left[$key] = $value;
			}
		}

		return $left;
	}
432828
public function leftJoin($table, $leftKey, $rightKey)
	{
		$this->syntax->setJoin($table, $leftKey, $rightKey, 'left');
		return $this;
	}
561339
protected function valueEquals($left, $right)
    {
        if ($left instanceof EqualityComparable) {
            return $left->isEqualTo($right, $this);
        } elseif ($right instanceof EqualityComparable) {
            return $right->isEqualTo($left, $this);
        }

        switch (gettype($left)) {
            case 'array':
                return $this->arrayEquals($left, $right);
            case 'object':
                return $this->objectEquals($left, $right);
        }

        return $left === $right;
    }
657077
protected function getRightFieldValue($rightField, $comparison): array
    {
        if ($comparison == 'in' || $comparison == 'not in') {
            $rightField = '(' . implode(', ', $this->quoter->quoteArray((array)$rightField)) . ')';
        } elseif ($comparison == 'greatest' ||
            $comparison == 'least' ||
            $comparison == 'coalesce' ||
            $comparison == 'interval' ||
            $comparison === 'strcmp') {
            $comparison = '= ' . $comparison;
            $rightField = '(' . implode(', ', $this->quoter->quoteArray((array)$rightField)) . ')';
        } elseif ($comparison === '=' && $rightField === null) {
            $comparison = 'IS';
            $rightField = $this->quoter->quoteValue($rightField);
        } elseif (($comparison === '<>' || $comparison === '!=') && $rightField === null) {
            $comparison = 'IS NOT';
            $rightField = $this->quoter->quoteValue($rightField);
        } elseif ($comparison === 'between' || $comparison === 'not between') {
            $between1 = $this->quoter->quoteValue($rightField[0]);
            $between2 = $this->quoter->quoteValue($rightField[1]);
            $rightField = sprintf('%s AND %s', $between1, $between2);
        } elseif ($rightField instanceof RawExp) {
            $rightField = $rightField->getValue();
        } else {
            $rightField = $this->quoter->quoteValue($rightField);
        }

        return [$rightField, strtoupper($comparison)];
    }