This example gives a basic knowledge of what are classes, interfaces, OOP design patterns and exception handling in PHP.
Press the function or a class name to see the code.
–°lick here to browse code.
<?php
$params = ["width" => 100, "height" => 200, "type" => "front", "material" => Door::$DOOR_MATERIAL_WOOD];
$door = DoorFactory::makeDoor($params);

Dump:

WoodenDoor Object
(
    [material:protected] => wood
    [width:protected] => 100
    [height:protected] => 200
    [type:protected] => front
    [price:protected] => 120
)

<?php
$params = ["width" => 100, "height" => 200, "type" => "interior", "material" => Door::$DOOR_MATERIAL_WOOD];
$order = DoorFactory::makeOrder($params);
Creating Order causes automatical actions:

Dump:

Order Object
(
    [door:Order:private] => WoodenDoor Object
        (
            [material:protected] => wood
            [width:protected] => 100
            [height:protected] => 200
            [type:protected] => interior
            [price:protected] => 120
        )

    [master:Order:private] => Mark
    [workPrice:Order:private] => 200
    [createDate:Order:private] => 26.08.2019 02:32:21
    [workDate:Order:private] => 31.08.2019 02:32:21
    [fullPrice:Order:private] => 320
    [id:Order:private] => 1345
)

<?php
$params = ["width" => 100, "height" => 200, "type" => "front", "material" => Door::$DOOR_MATERIAL_IRON];
$order = DoorFactory::makeOrder($params);
Creating Order with Iron material will create a new Order with a master, that fits iron doors, attached to it.
As you can see below: the master is other and door price is other too.

Dump:

Order Object
(
    [door:Order:private] => IronDoor Object
        (
            [material:protected] => iron
            [width:protected] => 100
            [height:protected] => 200
            [type:protected] => front
            [price:protected] => 300
        )

    [master:Order:private] => Ti
    [workPrice:Order:private] => 200
    [createDate:Order:private] => 26.08.2019 02:32:21
    [workDate:Order:private] => 31.08.2019 02:32:21
    [fullPrice:Order:private] => 500
    [id:Order:private] => 1347
)

<?php
$orderId = $order->getId();
$customer = Customer::getInstance();
$customer->attachOrder($orderId);

Dump:

Customer's last order id is 1347

<?php
$params["material"] = "plastic";
$door = DoorFactory::makeDoor($params); //New material, that is not supported yet

Exception

Exception Caught: "Not supported door material: plastic!
We've sent your request to the manager. He will contact you soon!"