@param array &$left
@param array &$right

@return boolean
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;
    }
274443
public function or ($left, $right, $comparator = Cmp::EQ)
    {
        $this->getWhereStatement()->where($left, $right, $comparator, Cmp::VEL);
        
        return $this;
    }
143500
public static function isLessThan(Version $left, Version $right)
    {
        return (self::LESS_THAN === self::compareTo($left, $right));
    }
571745
protected function op_number_number($op, $left, $right)
    {
        $unit = empty($left[2]) ? $right[2] : $left[2];

        $value = 0;
        switch ($op) {
        case '+':
            $value = $left[1] + $right[1];
            break;
        case '*':
            $value = $left[1] * $right[1];
            break;
        case '-':
            $value = $left[1] - $right[1];
            break;
        case '%':
            $value = $left[1] % $right[1];
            break;
        case '/':
            if ($right[1] == 0) {
                $this->throwError('parse error: divide by zero');
            }
            $value = $left[1] / $right[1];
            break;
        case '<':
            return $this->toBool($left[1] < $right[1]);
        case '>':
            return $this->toBool($left[1] > $right[1]);
        case '>=':
            return $this->toBool($left[1] >= $right[1]);
        case '=<':
            return $this->toBool($left[1] <= $right[1]);
        default:
            $this->throwError('parse error: unknown number operator: '.$op);
        }

        return array('number', $value, $unit);
    }
143345
public function match(array $left, array $collected = []) {
        foreach ($this->children as $pattern) {
            list($m, $left, $collected) = $pattern->match($left, $collected);
        }
        return [true, $left, $collected];
    }
294935
public static function equal(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::EQUAL, $right);
    }
1095020
public function match(array $left, array $collected = []) {
        if (sizeof($this->children) != 1)
            throw new \UnexpectedValueException();

        $l = $left;
        $c = $collected;

        $lnew = [];
        $matched = true;
        $times = 0;

        while ($matched) {
            # could it be that something didn't match but changed l or c?
            list ($matched, $l, $c) = $this->children[0]->match($l, $c);
            if ($matched) $times += 1;
            if ($lnew == $l)
                break;
            $lnew = $l;
        }

        if ($times >= 1)
            return [true, $l, $c];
        return [false, $left, $collected];
    }
40058
private Boolean compareValues(Session session, Object left, Object right) {
        if (left == null) {
            if (opType == OpTypes.NOT_DISTINCT) {
                return right == null;
            }
            return null;
        }

        if (right == null) {
            return (opType == OpTypes.NOT_DISTINCT) ? Boolean.FALSE : null;
        }

        int result = nodes[LEFT].dataType.compare(left, right);

        switch (opType) {

            case OpTypes.EQUAL :
            case OpTypes.NOT_DISTINCT :
                return result == 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.NOT_EQUAL :
                return result != 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.GREATER :
                return result > 0 ? Boolean.TRUE
                                  : Boolean.FALSE;

            case OpTypes.GREATER_EQUAL :
                return result >= 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.SMALLER_EQUAL :
                return result <= 0 ? Boolean.TRUE
                                   : Boolean.FALSE;

            case OpTypes.SMALLER :
                return result < 0 ? Boolean.TRUE
                                  : Boolean.FALSE;

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "Expression");
        }
    }
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;
	}
636869
protected function mergeOutput(array $left, array $right)
	{
		if (empty($left))
		{
			return $right;
		}

		if (empty($right))
		{
			return $left;
		}

		// Test whether we can merge the last expression on the left with the first expression on
		// the right
		$k = count($left) - 1;

		if (substr($left[$k], -1) === "'" && $right[0][0] === "'")
		{
			$right[0] = substr($left[$k], 0, -1) . substr($right[0], 1);
			unset($left[$k]);
		}

		return array_merge($left, $right);
	}
232694
public function match(array $left, array $collected = []) {
        $l = $left;
        $c = $collected;

        foreach ($this->children as $pattern) {
            list ($matched, $l, $c) = $pattern->match($l, $c);
            if (!$matched) {
                return [false, $left, $collected];
            }
        }
        return [true, $l, $c];
    }
1250447
public static <T> boolean listEquals(List<T> left, List<T> right) {
        if (left == null) {
            return right == null;
        } else {
            if (right == null) {
                return false;
            }
            if (left.size() != right.size()) {
                return false;
            }

            List<T> ltmp = new ArrayList<T>(left);
            List<T> rtmp = new ArrayList<T>(right);
            for (T t : ltmp) {
                rtmp.remove(t);
            }
            return rtmp.isEmpty();
        }
    }
1219025
public function match(array $left, array $collected = []) {
        $outcomes = [];
        foreach ($this->children as $pattern) {
            list ($matched, $dump1, $dump2) = $outcome = $pattern->match($left, $collected);
            if ($matched) {
                $outcomes[] = $outcome;
            }
        }
        if ($outcomes) {
            // return min(outcomes, key=lambda outcome: len(outcome[1]))
            $min = $result = null;
            foreach ($outcomes as $o) {
                $size = sizeof($o[1]);
                if ($min === null || $size < $min) {
                   $min    = $size;
                   $result = $o;
                }
            }
            return $result;
        }
        return [false, $left, $collected];
    }
1247084
protected function opAnd($left, $right, $shouldEval)
    {
        if (! $shouldEval) {
            return null;
        }

        if ($left !== static::$false and $left !== static::$null) {
            return $this->reduce($right, true);
        }

        return $left;
    }
1315559
private function isArrayAndInstanceOfCountable($left, $right): Bool
    {
        if (!($left instanceof Node && $right instanceof Node)) {
            return false;
        }

        if (!$this->isFunctionCall($left, 'is_array')) {
            return false;
        }
        $args = $left->children['args'];

        if ($args->kind !== \ast\AST_ARG_LIST) {
            return false;
        }
        $arg = $args->children[0];

        if ($right->kind !== \ast\AST_INSTANCEOF) {
            return false;
        }
        $expr = $right->children['expr'];
        $class = $right->children['class'];

        if ($class->kind === \ast\AST_NAME
              && $class->children['name'] === "Countable"
              && $this->isEqualsWithoutLineno($arg, $expr)) {
            return true;
        }

        return false;
    }
267300
public function trim( $left = TRUE, $right = TRUE )
	{
		$length			= $this->getLength();
		if( $left && $right )
			$this->string	= trim( $this->string );
		else if( $left )
			$this->string	= ltrim( $this->string );
		else if( $right )
			$this->string	= rtrim( $this->string );
		return $length - $this->getLength();
	}
1228203
private static function merge($left, $right): array
    {
        $result = [];
        $i = $j = 0;

        $leftCount = count($left);
        $rightCount = count($right);

        while ($i < $leftCount && $j < $rightCount) {
            if ($left[$i] > $right[$j]) {
                $result[] = $right[$j];
                $j++;
            } else {
                $result[] = $left[$i];
                $i++;
            }
        }
        while ($i < $leftCount) {
            $result[] = $left[$i];
            $i++;
        }
        while ($j < $rightCount) {
            $result[] = $right[$j];
            $j++;
        }

        return $result;
    }