PHP design pattern factory input for products and quotes I'm working on figuring out the best way to design this so that it's well organized and it seems like the factory design pattern makes sense. 

Updated:
What I'm building:
 - Pricing calculator 
 - There are 4 products each having their own specific pricing rules that vary from user input 
 - The person can choose between 1 product or all products

Should I have a Calculator class to determine product pricing or leave the calculations in each product type?

/*
 * Use Factory Pattern to build objects
 */

class ProductFactory {
    public static function createProduct($type) {
        switch ($type) {
            case 'solution1':
                return new Solution1Product();
                break;

            case 'solution2':
                return new Solution2Product();
                break;

            case 'solution3':
                return new Solution3Product();
                break;

            case 'solution4':
                return new Solution4Product();
                break;
        }

    }
}


/*
 * Abstract Product
 */

abstract class AbstractProduct {
    protected $price;
    protected $max_limit;
    protected $max_amount;

    abstract public function calculatePrice($dob, $gender, $amount);
}


/*
 * Solution 1 Product
 */
class Solution1Product extends AbstractProduct {
    protected $max_limit = 50000;

    function __contruct() {
        print "Test";
        return "Solution1";
    }

    function calculatePrice($dob, $gender, $amount) {
        $rate = 1.03;
        $price = 55;

        if ($amount &gt;= $this-&gt;max_limit) {
            return "Max Limit Reached";
        }
        //@TODO go lookup price from tables


        $this-&gt;price = $rate * $price;
        return $this-&gt;price;
    }
}
$solution1 = ProductFactory::createProduct('solution1');
print $solution1-&gt;calculatePrice("02/25/1982", "male", 100000);
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);