.
.
function doFoo(Application $app) {
$app->doStuff();
}
, singleton , .
, singleton, "" :
, ,
"" 3 , singleton. , . , , - Context
class Context {
public $application;
public $logger;
....
}
========
$context = new Context();
$context->application = new Application();
$context->logger = new Logger(...);
doFoo($context);
========
function doFoo(Context $context) {
$context->application->doStuff();
$context->logger->logThings();
}
( /, , ..).
!