PHP design pattern factory input for products and quotes
Flexible approach


First defining an ultimate abstraction of the factory
Implement it with product type - class mapping
Creating an entry point to register and use the factory

interface IProductFactory {

    function createProduct($type);
}

class DefaultProductFactory implements IProductFactory {

    private $_mappings;

    public function __construct(array $mappings = array()) {
        $this-&gt;_mappings = $mappings;
    }

    public function addMappings(array $mappings) {
        $this-&gt;_mappings = array_merge($this-&gt;_mappings, $mappings);
    }

    public function createProduct($type) {
        if (!isset($this-&gt;_mappings[$type])) {
            throw new \Exception("Cannot create product of type " . $type);
        }

        $class = $this-&gt;_mappings[$type];

        //can be passed to a DI container to instantiate if needed

        return new $class();
    }
}

class ProductFactory {

    private static $_factory;

    public static function setCurrent(IProductFactory $factory) {
        $this-&gt;_factory = $factory;
    }

    public static function getCurrent() {
        return $this-&gt;_factory;
    }
}

ProductFactory::setCurrent(new DefaultProductFactory(array(
    "solution1" =&gt; "Solution1Product",
    "solution2" =&gt; "Solution2Product",
    "solution3" =&gt; "Solution3Product",
    "solution4" =&gt; "Solution4Product",
    "solution5" =&gt; "\\\\In\\\Some\\\\Other\\\\Namespace\\\\Solution5Product",
    )));

$solution1 = ProductFactory::getCurrent()-&gt;createProduct('solution1');

print $solution1-&gt;calculatePrice("02/25/1982", "male", 100000);