For teaching purposes, I am trying to create a PHP implementation of a conceptual example of Builder Pattern:

First of all, some products:

```
class Product1 {
    private string $attribute1;
    private string $attribute2;
    function getAttribute1(): string {
        return $this->attribute1;
    }
    function getAttribute2(): string {
        return $this->attribute2;
    }
    function setAttribute1(string $attribute1): void {
        $this->attribute1 = $attribute1;
    }
    function setAttribute2(string $attribute2): void {
        $this->attribute2 = $attribute2;
    }
}

class Product2 {
    private string $attribute1;
    private string $attribute2;
    function getAttribute1(): string {
        return $this->attribute1;
    }
    function getAttribute2(): string {
        return $this->attribute2;
    }
    function setAttribute1(string $attribute1): void {
        $this->attribute1 = $attribute1;
    }
    function setAttribute2(string $attribute2): void {
        $this->attribute2 = $attribute2;
    }
}

```

The Builder interface:

```
interface Builder {
    public function createNewProduct();
    public function makePart1($value);
    public function makePart2($value);
    public function getProduct();
}

```

The concrete Builders:

```
class ConcreteBuilder1 implements Builder {
    private Product1 $product;

    function __construct() {
        $this->product = $this->createNewProduct();
    }
    public function createNewProduct() {
        return new Product1();
    }
    public function makePart1($value) {
        $this->product->setAttribute1("variation $value a1"); 
    }
    public function makePart2($value) {
        $this->product->setAttribute2("variation $value a2");
    }
    public function getProduct() {
        return $this->product;
    }

}

class ConcreteBuilder2 implements Builder {
    private Product2 $product;

    function __construct() {
        $this->product = $this->createNewProduct();
    }
    public function createNewProduct() {
        return new Product2();
    }
    public function makePart1($value) {
        $this->product->setAttribute1("variation $value b1");
    }
    public function makePart2($value) {
        $this->product->setAttribute2("variation $value b2");
    }
    public function getProduct() {
        return $this->product;
    }

}

```

And the Director receiving builder instances by references:

```
class Director {
    public function createVariation1(Builder &$builder){
        $builder->makePart1(1);
        $builder->makePart2(2);
    }
    public function createVariation2(Builder &$builder){
        $builder->makePart1(3);
        $builder->makePart2(4);
    }
}

```

Using it:

```
$builder = new ConcreteBuilder2();
$director = new Director();
$director->createVariation1($builder);
var_dump($builder->getProduct());

```

So, Is it acceptable this approach? Still a valid GoF Builder?

If not, how would it be a correct conceptual Builder in PHP?