factory pattern added in php, 2 examples