I am new to OOP and I have recently asked question, which have thaught me that:
- every "operation" should be implemented in seperate class,
- issue I have faced should be resolved with dependency injection,
- I must not have one object for entire application.
Let's say I have the following code:
class FtpConnect {
     public $server;
     private function connect () { ... }
     public __construct ($db, $mailer, $server) {
         $this->server = $server;
         $this->connect();
     } 
}
class Database {
    public $database_property;
    ...
}
class Phpmailer {
    public $phpmailer_property;
    ...
}
$db = new Database();
$mail = new Phpmailer();
$ftp = new Ftpconnect ($db, $mail, "ftp.mozilla.org");
$ftp->db->database_property;
$ftp->mail->phpmailer_property;
Is this a proper approach? It seems that I still have one object $ftp.
Reading property or calling methods like $ftp->db->database_property; is this the proper way?
 
     
     
    