PHP: example Factory Design Pattern