<?php

class Tree
{
    public $height;


    public function __construct(int $height)
    {
        if ($height <= 3) {
            throw new InvalidArgumentException("Your christmas tree is too small, try again!");
        }
        $this->height = $height;
    }

    public function drawTree(): void
    {
        $width = 2 * $this->height - 1;
        for ($i = 1; $i <= $this->height; $i++) {
            $stars = 2 * $i - 1;
            $spaces = ($width - $stars);
            echo str_repeat("&nbsp;", $spaces) . str_repeat("*", $stars) . "</br>";
        }
    }
}