protected function compileJoins(array $joinTokens): string
    {
        $statement = '';
        foreach ($joinTokens as $join) {
            $statement .= "\n{$join['type']} JOIN {$this->quote($join['outer'], true)}";

            if (!empty($join['alias'])) {
                $this->quoter->registerAlias($join['alias'], (string)$join['outer']);
                $statement .= " AS " . $this->quote($join['alias']);
            }

            $statement .= $this->optional("\n    ON", $this->compileWhere($join['on']));
        }

        return $statement;
    }