Ignore:
Timestamp:
2012/02/06 11:05:15 (12 years ago)
Author:
Seasoft
Message:

#1613 (ソース整形・ソースコメントの改善)

  • Zend Framework PHP 標準コーディング規約への準拠を高めた
File:
1 edited

Legend:

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

    r21420 r21441  
    4747        $this->key_tmp = "savecart_" . $key_tmp; 
    4848        // すでに情報がなければ現状のカート情報を記録しておく 
    49         if(count($_SESSION[$this->key_tmp]) == 0) { 
     49        if (count($_SESSION[$this->key_tmp]) == 0) { 
    5050            $_SESSION[$this->key_tmp] = $this->cartSession[$productTypeId]; 
    5151        } 
    5252        // 1世代古いコピー情報は、削除しておく 
    53         foreach($_SESSION as $k => $val) { 
    54             if($k != $this->key_tmp && preg_match("/^savecart_/", $k)) { 
     53        foreach ($_SESSION as $k => $val) { 
     54            if ($k != $this->key_tmp && preg_match("/^savecart_/", $k)) { 
    5555                unset($this->cartSession[$productTypeId][$k]); 
    5656            } 
     
    7070        $change = false; 
    7171        $max = $this->getMax($productTypeId); 
    72         for($i = 1; $i <= $max; $i++) { 
     72        for ($i = 1; $i <= $max; $i++) { 
    7373            if ($this->cartSession[$productTypeId][$i]['quantity'] 
    7474                != $_SESSION[$this->key_tmp][$i]['quantity']) { 
     
    9696    // 次に割り当てるカートのIDを取得する 
    9797    function getNextCartID($productTypeId) { 
    98         foreach($this->cartSession[$productTypeId] as $key => $val){ 
     98        foreach ($this->cartSession[$productTypeId] as $key => $val) { 
    9999            $arrRet[] = $this->cartSession[$productTypeId][$key]['cart_no']; 
    100100        } 
     
    112112    function getProductTotal($id, $productTypeId) { 
    113113        $max = $this->getMax($productTypeId); 
    114         for($i = 0; $i <= $max; $i++) { 
     114        for ($i = 0; $i <= $max; $i++) { 
    115115            if(isset($this->cartSession[$productTypeId][$i]['id']) 
    116116               && $this->cartSession[$productTypeId][$i]['id'] == $id) { 
     
    130130    function setProductValue($id, $key, $val, $productTypeId) { 
    131131        $max = $this->getMax($productTypeId); 
    132         for($i = 0; $i <= $max; $i++) { 
     132        for ($i = 0; $i <= $max; $i++) { 
    133133            if(isset($this->cartSession[$productTypeId][$i]['id']) 
    134134               && $this->cartSession[$productTypeId][$i]['id'] == $id) { 
     
    141141    function getMax($productTypeId) { 
    142142        $max = 0; 
    143         if (count($this->cartSession[$productTypeId]) > 0){ 
    144             foreach($this->cartSession[$productTypeId] as $key => $val) { 
     143        if (count($this->cartSession[$productTypeId]) > 0) { 
     144            foreach ($this->cartSession[$productTypeId] as $key => $val) { 
    145145                if (is_numeric($key)) { 
    146                     if($max < $key) { 
     146                    if ($max < $key) { 
    147147                        $max = $key; 
    148148                    } 
     
    157157        $total = 0; 
    158158        $max = $this->getMax($productTypeId); 
    159         for($i = 0; $i <= $max; $i++) { 
     159        for ($i = 0; $i <= $max; $i++) { 
    160160            $total+= $this->cartSession[$productTypeId][$i]['quantity']; 
    161161        } 
     
    168168        $total = 0; 
    169169        $max = $this->getMax($productTypeId); 
    170         for($i = 0; $i <= $max; $i++) { 
     170        for ($i = 0; $i <= $max; $i++) { 
    171171 
    172172            if (!isset($this->cartSession[$productTypeId][$i]['price'])) { 
     
    192192        $total = 0; 
    193193        $max = $this->getMax($productTypeId); 
    194         for($i = 0; $i <= $max; $i++) { 
     194        for ($i = 0; $i <= $max; $i++) { 
    195195            $price = $this->cartSession[$productTypeId][$i]['price']; 
    196196            $quantity = $this->cartSession[$productTypeId][$i]['quantity']; 
     
    207207        if (USE_POINT !== false) { 
    208208            $max = $this->getMax($productTypeId); 
    209             for($i = 0; $i <= $max; $i++) { 
     209            for ($i = 0; $i <= $max; $i++) { 
    210210                $price = $this->cartSession[$productTypeId][$i]['price']; 
    211211                $quantity = $this->cartSession[$productTypeId][$i]['quantity']; 
     
    233233        $find = false; 
    234234        $max = $this->getMax($productTypeId); 
    235         for($i = 0; $i <= $max; $i++) { 
    236  
    237             if($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) { 
     235        for ($i = 0; $i <= $max; $i++) { 
     236 
     237            if ($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) { 
    238238                $val = $this->cartSession[$productTypeId][$i]['quantity'] + $quantity; 
    239                 if(strlen($val) <= INT_LEN) { 
     239                if (strlen($val) <= INT_LEN) { 
    240240                    $this->cartSession[$productTypeId][$i]['quantity'] += $quantity; 
    241241                } 
     
    243243            } 
    244244        } 
    245         if(!$find) { 
     245        if (!$find) { 
    246246            $this->cartSession[$productTypeId][$max+1]['id'] = $product_class_id; 
    247247            $this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity; 
     
    259259        $exclude = false; 
    260260        // ページチェックを行う。 
    261         foreach($arrExclude as $val) { 
    262             if(preg_match("|" . preg_quote($val) . "|", $url)) { 
     261        foreach ($arrExclude as $val) { 
     262            if (preg_match("|" . preg_quote($val) . "|", $url)) { 
    263263                $exclude = true; 
    264264                break; 
     
    266266        } 
    267267        // 除外ページでない場合は、前頁として記録する。 
    268         if(!$exclude) { 
     268        if (!$exclude) { 
    269269            $_SESSION['prev_url'] = $url; 
    270270        } 
     
    279279    function delProductKey($keyname, $val, $productTypeId) { 
    280280        $max = count($this->cartSession[$productTypeId]); 
    281         for($i = 0; $i < $max; $i++) { 
    282             if($this->cartSession[$productTypeId][$i][$keyname] == $val) { 
     281        for ($i = 0; $i < $max; $i++) { 
     282            if ($this->cartSession[$productTypeId][$i][$keyname] == $val) { 
    283283                unset($this->cartSession[$productTypeId][$i]); 
    284284            } 
     
    335335        $max = $this->getMax($productTypeId); 
    336336        $arrRet = array(); 
    337         for($i = 0; $i <= $max; $i++) { 
     337        for ($i = 0; $i <= $max; $i++) { 
    338338            if(isset($this->cartSession[$productTypeId][$i]['cart_no']) 
    339339               && $this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
     
    391391    function getAllProductID($productTypeId) { 
    392392        $max = $this->getMax($productTypeId); 
    393         for($i = 0; $i <= $max; $i++) { 
    394             if($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
     393        for ($i = 0; $i <= $max; $i++) { 
     394            if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
    395395                $arrRet[] = $this->cartSession[$productTypeId][$i]['id'][0]; 
    396396            } 
     
    407407    function getAllProductClassID($productTypeId) { 
    408408        $max = $this->getMax($productTypeId); 
    409         for($i = 0; $i <= $max; $i++) { 
    410             if($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
     409        for ($i = 0; $i <= $max; $i++) { 
     410            if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
    411411                $arrRet[] = $this->cartSession[$productTypeId][$i]['id']; 
    412412            } 
     
    423423    function delAllProducts($productTypeId) { 
    424424        $max = $this->getMax($productTypeId); 
    425         for($i = 0; $i <= $max; $i++) { 
     425        for ($i = 0; $i <= $max; $i++) { 
    426426            unset($this->cartSession[$productTypeId][$i]); 
    427427        } 
     
    431431    function delProduct($cart_no, $productTypeId) { 
    432432        $max = $this->getMax($productTypeId); 
    433         for($i = 0; $i <= $max; $i++) { 
    434             if($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) { 
     433        for ($i = 0; $i <= $max; $i++) { 
     434            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) { 
    435435                unset($this->cartSession[$productTypeId][$i]); 
    436436            } 
     
    578578            $total_quantity = $this->getTotalQuantity($productTypeId); 
    579579 
    580             if($total_quantity >= DELIV_FREE_AMOUNT) { 
     580            if ($total_quantity >= DELIV_FREE_AMOUNT) { 
    581581                return true; 
    582582            } 
     
    587587        if ($arrInfo['free_rule'] > 0) { 
    588588            // 小計が無料条件を超えている場合 
    589             if($subtotal >= $arrInfo['free_rule']) { 
     589            if ($subtotal >= $arrInfo['free_rule']) { 
    590590                return true; 
    591591            } 
     
    659659            $results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point, 
    660660                                                                   $use_point); 
    661             if($objCustomer != "") { 
     661            if ($objCustomer != "") { 
    662662                // 誕生日月であった場合 
    663                 if($objCustomer->isBirthMonth()) { 
     663                if ($objCustomer->isBirthMonth()) { 
    664664                    $results['birth_point'] = BIRTH_MONTH_POINT; 
    665665                    $results['add_point'] += $results['birth_point']; 
    666666                } 
    667667            } 
    668             if($results['add_point'] < 0) { 
     668            if ($results['add_point'] < 0) { 
    669669                $results['add_point'] = 0; 
    670670            } 
Note: See TracChangeset for help on using the changeset viewer.