public function build()
    {
        $value = $this->getValue();

        $this->uppercaseComparator();

        // Check for IS/IS NOT and set the value to NULL if it is.
        if ($this->isComparatorIsNotNullIsNull()) {
            $value = null;
        }

        // Check for IN/NOT IN and build a nice comma-separated list.
        if (!$this->isComparatorIsNotNullIsNull() && $this->isComparatorInNotIn() && is_array($value)) {
            $this->uppercaseComparator();
            $valueArray = [];
            foreach ($value as $valueItem) {
                if ($this->shouldQuoteValues()) {
                    $valueArray[] = $this->query->quote($valueItem);
                } else {
                    $valueArray[] = $valueItem;
                }
            }
            $value = '(' . implode(',', $valueArray) . ')';
        }

        // Now check if we need to still quote the value.
        if (!$this->isComparatorIsNotNullIsNull() && !$this->isComparatorInNotIn() && $this->shouldQuoteValues()) {
            $value = $this->query->quote($value);
        }

        // If we don't have IN/NOT IN, IS/NOT IS, and we shouldn't quote, we assume we're checking fields.
        if ($this->shouldCompareFields()) {
            $valueBuild = [
                $this->query->quoteIdentifier($this->getTableName()),
                '.',
                $this->query->quoteIdentifier($value),
            ];
            $value = implode($valueBuild);
        }

        $tableName = $this->getTableName();
        if ($this->getJoinTableName()) {
            $tableName = $this->getJoinTableName();
        }
        $tableName = $this->query->quoteIdentifier($tableName);

        $returnArray = [
            $tableName . '.' . $this->query->quoteIdentifier($this->getKey()),
            $this->getComparator(),
            $value,
        ];
        $returnString = implode(' ', $returnArray);

        return trim($returnString);
    }