How can OOP principles be applied to improve the structure of the code provided in this forum thread?

The code provided in the forum thread lacks proper organization and structure, making it difficult to maintain and scale. By applying OOP principles such as encapsulation, inheritance, and polymorphism, we can improve the code's structure and readability.

class User {
    private $username;
    private $email;

    public function __construct($username, $email) {
        $this->username = $username;
        $this->email = $email;
    }

    public function getUsername() {
        return $this->username;
    }

    public function getEmail() {
        return $this->email;
    }
}

$user1 = new User("john_doe", "john@example.com");
echo $user1->getUsername(); // Output: john_doe
echo $user1->getEmail(); // Output: john@example.com