Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DatabaseConnection {
- /** @var string */
- protected $host;
- /** @var string */
- protected $user;
- /** @var string */
- protected $password;
- ...
- /**
- * @param string $host
- * @param string $user
- * @param string $password
- */
- public function __construct($host, $user, $password, ...) {
- $this->host = $host;
- $this->user = $user;
- $this->password = $password;
- ...
- }
- ...
- }
- class UserFacade {
- /** @var DatabaseConnection */
- protected $databaseConnection;
- /**
- * @param DatabaseConnection $databaseConnection
- */
- public function __construct(DatabaseConnection $databaseConnection) {
- $this->databaseConnection = $databaseConnection;
- }
- /**
- * @return array
- */
- public function getUsers() {
- $results = $this->databaseConnection->query('SELECT name FROM user');
- sort($results);
- return $results;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement