Factory.php 558 Bytes
<?php

/**
 * Created by PhpStorm.
 * User: ziy
 * Date: 14-7-7
 * Time: 上午12:58
 */
class YHMCart_Factory
{
    /**
     * $platform = 'pc'
     * @param string $cartType
     * @param string $shoppingKey
     * @return YHMCart_Cart_Ordinary
     * @throws Exception
     */
    static function shoppingCart($cartType = 'ordinary', $shoppingKey = '')
    {
        if ($cartType == 'ordinary') {
            return new YHMCart_Cart_Ordinary($shoppingKey);
        } else {
            throw new Exception('没有相应的购物车.');
        }
    }
}