如果我在 PHP 中有一个接口,请说
interface AuthenticationInterface {
}
Run Code Online (Sandbox Code Playgroud)
和两个实现接口的类,例如
class ApiKey implements AuthenticationInterface {
}
class AuthToken implements AuthenticationInterface {
}
Run Code Online (Sandbox Code Playgroud)
在实例化新的 AuthenticationInterface 时,如何确定使用这些类中的哪一个?