プログラムの開始時に設定する必要がある次の依存関係があります。
//Set up dependencies
$fileSettings = array(12, 'extra_lines', 'close_on_save');
$exporter = new Exporter('exporterpath/filename.txt', $fileSettings);
$outputStream = new OutputStream();
$businessModel = new BusinessModel('param1', 'param2');
//Run application
$application = new Application($exporter, $outputStream, $businessModel);
$application->start();
ここで、メイン アプリケーションにいくつかの依存関係があることがわかります。これは、必要なものすべてを注入するためにブートストラップで必要なコードです。
これは依存性注入コンテナーを保証しますか?
そうでない場合、ファクトリメソッドの方が適していますか?