public function join($table, $key = null, $operator = null, $value = null, $type = ''): IQueryBuilderHandler
    {
        $joinBuilder = null;

        if ($key !== null) {
            $joinBuilder = new JoinBuilder($this->connection);

            /**
             * Build a new JoinBuilder class, keep it by reference so any changes made
             * in the closure should reflect here
             */
            if ($key instanceof \Closure === false) {
                $key = function (JoinBuilder $joinBuilder) use ($key, $operator, $value) {
                    $joinBuilder->on($key, $operator, $value);
                };
            }

            // Call the closure with our new joinBuilder object
            $key($joinBuilder);
        }

        $table = $this->addTablePrefix($table, false);

        // Get the criteria only query from the joinBuilder object
        $this->statements['joins'][] = [
            'type'        => $type,
            'table'       => $table,
            'joinBuilder' => $joinBuilder,
        ];

        return $this;
    }