How do inject array of implementations into class through constructor. I am sharing the link which is c#. I want to achieve the same in php.
How to achieve same in php.
public interface IFoo { }
public class FooA : IFoo {}
public class FooB : IFoo {}
public class Bar
{
//array injected will contain [ FooA, FooB ]
public Bar(IFoo[] foos) { }
}
public class MyModule : NinjectModule
{
public override void Load()
{
Bind<IFoo>().To<FooA>();
Bind<IFoo>().To<FooB>();
//etc..
}
}
https://stackoverflow.com/a/13383476/1844634
Thanks in advance.