How can mixing object-oriented and procedural styles in PHP code, as seen in the provided example, impact the functionality and maintainability of the code?

Mixing object-oriented and procedural styles in PHP code can lead to confusion, inconsistency, and reduced maintainability. It can make the code harder to understand for developers who are not familiar with both styles, and it can also make it challenging to refactor or extend the code in the future. To address this issue, it's recommended to choose one programming paradigm and stick to it throughout the codebase.

class User {
    private $username;
    
    public function setUsername($username) {
        $this->username = $username;
    }
    
    public function getUsername() {
        return $this->username;
    }
}

// Procedural code using the User class
$user = new User();
$user->setUsername('JohnDoe');
echo $user->getUsername();