What are the advantages and disadvantages of creating separate objects for different events (e.g., goals, yellow cards, red cards) versus using a single object for all events in PHP?

When deciding whether to create separate objects for different events or use a single object for all events in PHP, it is important to consider the complexity and scalability of the project. Using separate objects for each event can make the code more organized and easier to maintain, especially if each event has unique properties and behaviors. However, using a single object for all events can simplify the code structure and reduce redundancy, but it may become more complex to manage as the project grows.

// Separate objects for different events
class Goal {
    public $player;
    public $time;
    
    public function __construct($player, $time) {
        $this->player = $player;
        $this->time = $time;
    }
}

class YellowCard {
    public $player;
    public $time;
    
    public function __construct($player, $time) {
        $this->player = $player;
        $this->time = $time;
    }
}

class RedCard {
    public $player;
    public $time;
    
    public function __construct($player, $time) {
        $this->player = $player;
        $this->time = $time;
    }
}