Ignore:
Timestamp:
2013/02/18 19:09:54 (11 years ago)
Author:
shutta
Message:

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_CartSession.php

    r22554 r22567  
    2828 * @version $Id$ 
    2929 */ 
    30 class SC_CartSession { 
     30class SC_CartSession  
     31{ 
    3132    /** ユニークIDを指定する. */ 
    3233    var $key_tmp; 
     
    3637 
    3738    /* コンストラクタ */ 
    38     function __construct($cartKey = 'cart') { 
     39    function __construct($cartKey = 'cart') 
     40    { 
    3941        if (!isset($_SESSION[$cartKey])) { 
    4042            $_SESSION[$cartKey] = array(); 
     
    4446 
    4547    // 商品購入処理中のロック 
    46     function saveCurrentCart($key_tmp, $productTypeId) { 
     48    function saveCurrentCart($key_tmp, $productTypeId) 
     49    { 
    4750        $this->key_tmp = 'savecart_' . $key_tmp; 
    4851        // すでに情報がなければ現状のカート情報を記録しておく 
     
    5962 
    6063    // 商品購入中の変更があったかをチェックする。 
    61     function getCancelPurchase($productTypeId) { 
     64    function getCancelPurchase($productTypeId) 
     65    { 
    6266        $ret = isset($this->cartSession[$productTypeId]['cancel_purchase']) 
    6367            ? $this->cartSession[$productTypeId]['cancel_purchase'] : ''; 
     
    6771 
    6872    // 購入処理中に商品に変更がなかったかを判定 
    69     function checkChangeCart($productTypeId) { 
     73    function checkChangeCart($productTypeId) 
     74    { 
    7075        $change = false; 
    7176        $max = $this->getMax($productTypeId); 
     
    95100 
    96101    // 次に割り当てるカートのIDを取得する 
    97     function getNextCartID($productTypeId) { 
     102    function getNextCartID($productTypeId) 
     103    { 
    98104        $count = array(); 
    99105        foreach ($this->cartSession[$productTypeId] as $key => $value) { 
     
    111117     * @deprecated SC_CartSession::getCartList() を使用してください 
    112118     */ 
    113     function getProductTotal($id, $productTypeId) { 
     119    function getProductTotal($id, $productTypeId) 
     120    { 
    114121        $max = $this->getMax($productTypeId); 
    115122        for ($i = 0; $i <= $max; $i++) { 
     
    129136 
    130137    // 値のセット 
    131     function setProductValue($id, $key, $val, $productTypeId) { 
     138    function setProductValue($id, $key, $val, $productTypeId) 
     139    { 
    132140        $max = $this->getMax($productTypeId); 
    133141        for ($i = 0; $i <= $max; $i++) { 
     
    141149 
    142150    // カート内商品の最大要素番号を取得する。 
    143     function getMax($productTypeId) { 
     151    function getMax($productTypeId) 
     152    { 
    144153        $max = 0; 
    145154        if (count($this->cartSession[$productTypeId]) > 0) { 
     
    156165 
    157166    // カート内商品数量の合計 
    158     function getTotalQuantity($productTypeId) { 
     167    function getTotalQuantity($productTypeId) 
     168    { 
    159169        $total = 0; 
    160170        $max = $this->getMax($productTypeId); 
     
    166176 
    167177    // 全商品の合計価格 
    168     function getAllProductsTotal($productTypeId) { 
     178    function getAllProductsTotal($productTypeId) 
     179    { 
    169180        // 税込み合計 
    170181        $total = 0; 
     
    190201 
    191202    // 全商品の合計税金 
    192     function getAllProductsTax($productTypeId) { 
     203    function getAllProductsTax($productTypeId) 
     204    { 
    193205        // 税合計 
    194206        $total = 0; 
     
    204216 
    205217    // 全商品の合計ポイント 
    206     function getAllProductsPoint($productTypeId) { 
     218    function getAllProductsPoint($productTypeId) 
     219    { 
    207220        // ポイント合計 
    208221        $total = 0; 
     
    229242 
    230243    // カートへの商品追加 
    231     function addProduct($product_class_id, $quantity) { 
     244    function addProduct($product_class_id, $quantity) 
     245    { 
    232246        $objProduct = new SC_Product_Ex(); 
    233247        $arrProduct = $objProduct->getProductsClass($product_class_id); 
     
    253267 
    254268    // 前頁のURLを記録しておく 
    255     function setPrevURL($url, $excludePaths = array()) { 
     269    function setPrevURL($url, $excludePaths = array()) 
     270    { 
    256271        // 前頁として記録しないページを指定する。 
    257272        $arrExclude = array( 
     
    274289 
    275290    // 前頁のURLを取得する 
    276     function getPrevURL() { 
     291    function getPrevURL() 
     292    { 
    277293        return isset($_SESSION['prev_url']) ? $_SESSION['prev_url'] : ''; 
    278294    } 
    279295 
    280296    // キーが一致した商品の削除 
    281     function delProductKey($keyname, $val, $productTypeId) { 
     297    function delProductKey($keyname, $val, $productTypeId) 
     298    { 
    282299        $max = count($this->cartSession[$productTypeId]); 
    283300        for ($i = 0; $i < $max; $i++) { 
     
    288305    } 
    289306 
    290     function setValue($key, $val, $productTypeId) { 
     307    function setValue($key, $val, $productTypeId) 
     308    { 
    291309        $this->cartSession[$productTypeId][$key] = $val; 
    292310    } 
    293311 
    294     function getValue($key, $productTypeId) { 
     312    function getValue($key, $productTypeId) 
     313    { 
    295314        return $this->cartSession[$productTypeId][$key]; 
    296315    } 
     
    300319     * productsClass項目から、不必要な項目を削除する。 
    301320     */ 
    302     function adjustSessionProductsClass(&$arrProductsClass) { 
     321    function adjustSessionProductsClass(&$arrProductsClass) 
     322    { 
    303323        $arrNecessaryItems = array( 
    304324            'product_id'          => true, 
     
    333353     * @return array カート内商品一覧の配列 
    334354     */ 
    335     function getCartList($productTypeId) { 
     355    function getCartList($productTypeId) 
     356    { 
    336357        $objProduct = new SC_Product_Ex(); 
    337358        $max = $this->getMax($productTypeId); 
     
    373394     * @return array すべてのカートの内容 
    374395     */ 
    375     function getAllCartList() { 
     396    function getAllCartList() 
     397    { 
    376398        $results = array(); 
    377399        $cartKeys = $this->getKeys(); 
     
    394416     * @return array 商品規格ID の配列 
    395417     */ 
    396     function getAllProductClassID($productTypeId) { 
     418    function getAllProductClassID($productTypeId) 
     419    { 
    397420        $max = $this->getMax($productTypeId); 
    398421        $productClassIDs = array(); 
     
    411434     * @return void 
    412435     */ 
    413     function delAllProducts($productTypeId) { 
     436    function delAllProducts($productTypeId) 
     437    { 
    414438        $max = $this->getMax($productTypeId); 
    415439        for ($i = 0; $i <= $max; $i++) { 
     
    419443 
    420444    // 商品の削除 
    421     function delProduct($cart_no, $productTypeId) { 
     445    function delProduct($cart_no, $productTypeId) 
     446    { 
    422447        $max = $this->getMax($productTypeId); 
    423448        for ($i = 0; $i <= $max; $i++) { 
     
    429454 
    430455    // 数量の増加 
    431     function upQuantity($cart_no, $productTypeId) { 
     456    function upQuantity($cart_no, $productTypeId) 
     457    { 
    432458        $quantity = $this->getQuantity($cart_no, $productTypeId); 
    433459        if (strlen($quantity + 1) <= INT_LEN) { 
     
    437463 
    438464    // 数量の減少 
    439     function downQuantity($cart_no, $productTypeId) { 
     465    function downQuantity($cart_no, $productTypeId) 
     466    { 
    440467        $quantity = $this->getQuantity($cart_no, $productTypeId); 
    441468        if ($quantity > 1) { 
     
    451478     * @return integer 該当商品規格の数量 
    452479     */ 
    453     function getQuantity($cart_no, $productTypeId) { 
     480    function getQuantity($cart_no, $productTypeId) 
     481    { 
    454482        $max = $this->getMax($productTypeId); 
    455483        for ($i = 0; $i <= $max; $i++) { 
     
    468496     * @retrun void 
    469497     */ 
    470     function setQuantity($quantity, $cart_no, $productTypeId) { 
     498    function setQuantity($quantity, $cart_no, $productTypeId) 
     499    { 
    471500        $max = $this->getMax($productTypeId); 
    472501        for ($i = 0; $i <= $max; $i++) { 
     
    484513     * @return integer 商品規格ID 
    485514     */ 
    486     function getProductClassId($cart_no, $productTypeId) { 
     515    function getProductClassId($cart_no, $productTypeId) 
     516    { 
    487517        for ($i = 0; $i < count($this->cartSession[$productTypeId]); $i++) { 
    488518            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) { 
     
    506536     * @return string エラーが発生した場合はエラーメッセージ 
    507537     */ 
    508     function checkProducts($productTypeId) { 
     538    function checkProducts($productTypeId) 
     539    { 
    509540        $objProduct = new SC_Product_Ex(); 
    510541        $objDelivery = new SC_Helper_Delivery_Ex(); 
     
    561592     * @return boolean 送料無料の場合 true 
    562593     */ 
    563     function isDelivFree($productTypeId) { 
     594    function isDelivFree($productTypeId) 
     595    { 
    564596        $objDb = new SC_Helper_DB_Ex(); 
    565597 
     
    675707     * @return array 商品種別IDの配列 
    676708     */ 
    677     function getKeys() { 
     709    function getKeys() 
     710    { 
    678711        $keys = array_keys($this->cartSession); 
    679712        // 数量が 0 の商品種別は削除する 
     
    693726     * @return void 
    694727     */ 
    695     function registerKey($key) { 
     728    function registerKey($key) 
     729    { 
    696730        $_SESSION['cartKey'] = $key; 
    697731    } 
     
    702736     * @return void 
    703737     */ 
    704     function unsetKey() { 
     738    function unsetKey() 
     739    { 
    705740        unset($_SESSION['cartKey']); 
    706741    } 
     
    711746     * @return integer 商品種別ID 
    712747     */ 
    713     function getKey() { 
     748    function getKey() 
     749    { 
    714750        return $_SESSION['cartKey']; 
    715751    } 
     
    720756     * @return boolean カートが複数商品種別の場合 true 
    721757     */ 
    722     function isMultiple() { 
     758    function isMultiple() 
     759    { 
    723760        return count($this->getKeys()) > 1; 
    724761    } 
     
    730767     * @return boolean 指定の商品種別がカートに含まれる場合 true 
    731768     */ 
    732     function hasProductType($product_type_id) { 
     769    function hasProductType($product_type_id) 
     770    { 
    733771        return in_array($product_type_id, $this->getKeys()); 
    734772    } 
Note: See TracChangeset for help on using the changeset viewer.