PHP Interfaces are used in Dependency Injections, how then? -
i have seen following code:
class loginauth { function __construct(authinterface $auth) { $this->auth = $auth; } function userlogin ($credits) { return $this->auth->login($credits); } }
my question interfaces described php is:
object interfaces allow create code specifies methods class must implement, without having define how these methods handled.
so, see interfaces not used define internal logic of [class'] controller, allow definition of methods should implemented class.
how possible that, interface not contain actual logic inside methods, deployed. mean, method login()
member of auth()
class defined in interface:
interface authinterface () { function login($credits){} }
then how such signature used (as used in main example)?
Comments
Post a Comment