Hi,
Inside the DI I'll instantiate my tools class like this :
$di->set('tools', function(){
return new Tools();
});
Then inside my Controller will use
$var1 = $this->tools->myFirstFunction();
But what happened when I call $this->tools twice like this :
$var1 = $this->tools->myFirstFunction();
$var2 = $this->tools->mySecondFunction();
This will instantiate twice new Tools();
? Or once ? I want to know if it's better to instantiate my object inside the DI or if I have to instantiate my object inside my controller action.
Thanks.