Skip to content

Commit

Permalink
php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
nobuhiko committed Dec 23, 2024
1 parent 9dc9084 commit 5499faf
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
52 changes: 26 additions & 26 deletions data/class/SC_Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function getLastQuery($disp = true)
{
$sql = $this->conn->last_query;
if ($disp) {
echo $sql . ";<br />\n";
echo $sql.";<br />\n";
}

return $sql;
Expand Down Expand Up @@ -359,7 +359,7 @@ public function getSql($cols, $from = '', $where = '', &$arrWhereVal = null)
$sqlse = "SELECT $cols";

if (strlen($from) === 0) {
$sqlse .= ' ' . $dbFactory->getDummyFromClauseSql();
$sqlse .= ' '.$dbFactory->getDummyFromClauseSql();
} else {
$sqlse .= " FROM $from";
}
Expand All @@ -368,15 +368,15 @@ public function getSql($cols, $from = '', $where = '', &$arrWhereVal = null)
if (strlen($where) >= 1) {
$sqlse .= " WHERE $where";
} elseif (strlen($this->where) >= 1) {
$sqlse .= ' WHERE ' . $this->where;
$sqlse .= ' WHERE '.$this->where;
// 実行時と同じくキャストしてから評価する (空文字を要素1の配列と評価させる意図)
$arrWhereValForEval = (array) $arrWhereVal;
if (empty($arrWhereValForEval)) {
$arrWhereVal = $this->arrWhereVal;
}
}

$sqlse .= ' ' . $this->groupby . ' ' . $this->order . ' ' . $this->option;
$sqlse .= ' '.$this->groupby.' '.$this->order.' '.$this->option;

return $sqlse;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ public function setGroupBy($str)
if (strlen($str) == 0) {
$this->groupby = '';
} else {
$this->groupby = 'GROUP BY ' . $str;
$this->groupby = 'GROUP BY '.$str;
}

return $this;
Expand All @@ -448,7 +448,7 @@ public function setGroupBy($str)
public function andWhere($str)
{
if ($this->where != '') {
$this->where .= ' AND ' . $str;
$this->where .= ' AND '.$str;
} else {
$this->where = $str;
}
Expand All @@ -468,7 +468,7 @@ public function andWhere($str)
public function orWhere($str)
{
if ($this->where != '') {
$this->where .= ' OR ' . $str;
$this->where .= ' OR '.$str;
} else {
$this->where = $str;
}
Expand Down Expand Up @@ -508,7 +508,7 @@ public function setOrder($str)
if (strlen($str) == 0) {
$this->order = '';
} else {
$this->order = 'ORDER BY ' . $str;
$this->order = 'ORDER BY '.$str;
}

return $this;
Expand Down Expand Up @@ -570,7 +570,7 @@ public function insert($table, $arrVal, $arrSql = [], $arrSqlVal = [], $from = '
$arrValForQuery = [];

foreach ($arrVal as $key => $val) {
$strcol .= $key . ',';
$strcol .= $key.',';
if (strcasecmp('Now()', $val) === 0) {
$strval .= 'Now(),';
} elseif (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) {
Expand All @@ -583,8 +583,8 @@ public function insert($table, $arrVal, $arrSql = [], $arrSqlVal = [], $from = '
}

foreach ($arrSql as $key => $val) {
$strcol .= $key . ',';
$strval .= $val . ',';
$strcol .= $key.',';
$strval .= $val.',';
$find = true;
}

Expand All @@ -599,7 +599,7 @@ public function insert($table, $arrVal, $arrSql = [], $arrSqlVal = [], $from = '
$sqlin = "INSERT INTO $table($strcol) SELECT $strval";

if (strlen($from) >= 1) {
$sqlin .= ' ' . $from;
$sqlin .= ' '.$from;
$arrValForQuery = array_merge($arrValForQuery, $arrFromVal);
}

Expand Down Expand Up @@ -629,11 +629,11 @@ public function update($table, $arrVal, $where = '', $arrWhereVal = [], $arrRawS

foreach ($arrVal as $key => $val) {
if (strcasecmp('Now()', $val) === 0) {
$arrCol[] = $key . '= Now()';
$arrCol[] = $key.'= Now()';
} elseif (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) {
$arrCol[] = $key . '= CURRENT_TIMESTAMP';
$arrCol[] = $key.'= CURRENT_TIMESTAMP';
} else {
$arrCol[] = $key . '= ?';
$arrCol[] = $key.'= ?';
$arrValForQuery[] = $val;
}
$find = true;
Expand Down Expand Up @@ -838,9 +838,9 @@ public function delete($table, $where = '', $arrWhereVal = [])
}

if (strlen($where) <= 0) {
$sqlde = 'DELETE FROM ' . $this->conn->quoteIdentifier($table);
$sqlde = 'DELETE FROM '.$this->conn->quoteIdentifier($table);
} else {
$sqlde = 'DELETE FROM ' . $this->conn->quoteIdentifier($table) . ' WHERE ' . $where;
$sqlde = 'DELETE FROM '.$this->conn->quoteIdentifier($table).' WHERE '.$where;
}
$ret = $this->query($sqlde, $arrWhereVal, false, null, MDB2_PREPARE_MANIP);

Expand Down Expand Up @@ -1130,10 +1130,10 @@ public function traceError($error, $sql = '', $arrVal = false)
{
$err = "SQL: [$sql]\n";
if ($arrVal !== false) {
$err .= 'PlaceHolder: [' . var_export($arrVal, true) . "]\n";
$err .= 'PlaceHolder: ['.var_export($arrVal, true)."]\n";
}
$err .= $error->getMessage() . "\n";
$err .= rtrim($error->getUserInfo()) . "\n";
$err .= $error->getMessage()."\n";
$err .= rtrim($error->getUserInfo())."\n";

// PEAR::MDB2 内部のスタックトレースを出力する場合、下記のコメントを外す。
// $err .= GC_Utils_Ex::toStringBacktrace($error->getBackTrace());
Expand All @@ -1145,7 +1145,7 @@ public function traceError($error, $sql = '', $arrVal = false)
*/
public function error($msg)
{
$msg = "DB処理でエラーが発生しました。\n" . $msg;
$msg = "DB処理でエラーが発生しました。\n".$msg;
if (!$this->force_run) {
trigger_error($msg, E_USER_ERROR);
} else {
Expand Down Expand Up @@ -1219,8 +1219,8 @@ private function lfStartDbTraceLog(&$objSth, &$arrVal)
}

$msg = "[execute start {$arrStartInfo['http_request_id']}#{$arrStartInfo['count']}]\n"
. 'SQL: ' . $objSth->query . "\n"
. 'PlaceHolder: ' . var_export($arrVal, true) . "\n";
.'SQL: '.$objSth->query."\n"
.'PlaceHolder: '.var_export($arrVal, true)."\n";
GC_Utils_Ex::gfPrintLog($msg, DB_LOG_REALFILE);

return $arrStartInfo;
Expand Down Expand Up @@ -1251,11 +1251,11 @@ private function lfEndDbTraceLog(&$arrStartInfo, &$objSth, &$arrVal)
return;
}
// 開始時にログ出力していないため、ここで実行内容を出力する
$msg .= 'SQL: ' . $objSth->query . "\n";
$msg .= 'PlaceHolder: ' . var_export($arrVal, true) . "\n";
$msg .= 'SQL: '.$objSth->query."\n";
$msg .= 'PlaceHolder: '.var_export($arrVal, true)."\n";
}

$msg .= 'execution time: ' . sprintf('%.2f sec', $timeExecTime) . "\n";
$msg .= 'execution time: '.sprintf('%.2f sec', $timeExecTime)."\n";
GC_Utils_Ex::gfPrintLog($msg, DB_LOG_REALFILE);
}

Expand Down
42 changes: 21 additions & 21 deletions data/class/helper/SC_Helper_Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function completeOrder($orderStatus = ORDER_NEW)

$this->cleanupSession($order_id, $objCartSession, $objCustomer, $cartkey);

GC_Utils_Ex::gfPrintLog('order complete. order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order complete. order_id='.$order_id);
}

/**
Expand Down Expand Up @@ -567,7 +567,7 @@ public static function copyFromCustomer(
if ($objCustomer->isLoginSuccess(true)) {
foreach ($keys as $key) {
if (in_array($key, $keys)) {
$dest[$prefix . '_' . $key] = $objCustomer->getValue($key);
$dest[$prefix.'_'.$key] = $objCustomer->getValue($key);
}
}

Expand All @@ -576,9 +576,9 @@ public static function copyFromCustomer(
) {
$email_mobile = $objCustomer->getValue('email_mobile');
if (empty($email_mobile)) {
$dest[$prefix . '_email'] = $objCustomer->getValue('email');
$dest[$prefix.'_email'] = $objCustomer->getValue('email');
} else {
$dest[$prefix . '_email'] = $email_mobile;
$dest[$prefix.'_email'] = $email_mobile;
}
}

Expand Down Expand Up @@ -614,8 +614,8 @@ public function copyFromOrder(&$dest, $src, $prefix = 'shipping', $src_prefix =
$src_prefix .= '_';
}
foreach ($arrKey as $key) {
if (isset($src[$src_prefix . $key])) {
$dest[$prefix . $key] = $src[$src_prefix . $key];
if (isset($src[$src_prefix.$key])) {
$dest[$prefix.$key] = $src[$src_prefix.$key];
}
}
}
Expand All @@ -631,7 +631,7 @@ public function extractShipping($arrSrc)
{
$arrKey = [];
foreach ($this->arrShippingKey as $key) {
$arrKey[] = 'shipping_' . $key;
$arrKey[] = 'shipping_'.$key;
}

return SC_Utils_Ex::sfArrayIntersectKeys($arrSrc, $arrKey);
Expand All @@ -653,7 +653,7 @@ public function getDelivDate(&$objCartSess, $product_type_id)
$max_date = max($delivDateIds);
// 発送目安
switch ($max_date) {
// 即日発送
// 即日発送
case '1':
$start_day = 1;
break;
Expand Down Expand Up @@ -1080,7 +1080,7 @@ public static function getOrderDetail($order_id, $has_order_status = true)
ELSE '0'
END AS enable,
__EOS__;
$col .= $dbFactory->getDownloadableDaysWhereSql('T1') . ' AS effective';
$col .= $dbFactory->getDownloadableDaysWhereSql('T1').' AS effective';
$from = <<< __EOS__
dtb_order T1
JOIN dtb_order_detail T2
Expand Down Expand Up @@ -1113,7 +1113,7 @@ public static function setDownloadableFlgTo(&$arrOrderDetail)
// 販売価格が 0 円
if ($arrOrderDetail[$key]['price'] == '0') {
$arrOrderDetail[$key]['is_downloadable'] = true;
// ダウンロード期限内かつ, 入金日あり
// ダウンロード期限内かつ, 入金日あり
} elseif (
$arrOrderDetail[$key]['effective'] == '1'
&& !SC_Utils_Ex::isBlank($arrOrderDetail[$key]['payment_date'])
Expand Down Expand Up @@ -1331,7 +1331,7 @@ public static function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddP
// 対応状況が発送済みに変更の場合、発送日を更新
if ($arrOrderOld['status'] != ORDER_DELIV && $newStatus == ORDER_DELIV) {
$sqlval['commit_date'] = 'CURRENT_TIMESTAMP';
// 対応状況が入金済みに変更の場合、入金日を更新
// 対応状況が入金済みに変更の場合、入金日を更新
} elseif ($arrOrderOld['status'] != ORDER_PRE_END && $newStatus == ORDER_PRE_END) {
$sqlval['payment_date'] = 'CURRENT_TIMESTAMP';
}
Expand Down Expand Up @@ -1374,7 +1374,7 @@ public static function sfUpdateOrderNameCol($order_id, $temp_table = false)
[],
$sql_where,
[$order_id],
['payment_method' => '(SELECT payment_method FROM dtb_payment WHERE payment_id = ' . $tgt_table . '.payment_id)']
['payment_method' => '(SELECT payment_method FROM dtb_payment WHERE payment_id = '.$tgt_table.'.payment_id)']
);
}

Expand Down Expand Up @@ -1515,7 +1515,7 @@ public function checkDbAllPendingOrder()
{
$term = PENDING_ORDER_CANCEL_TIME;
if (!SC_Utils_Ex::isBlank($term) && preg_match('/^[0-9]+$/', $term)) {
$target_time = strtotime('-' . $term . ' sec');
$target_time = strtotime('-'.$term.' sec');
$objQuery = SC_Query_Ex::getSingletonInstance();
$arrVal = [date('Y/m/d H:i:s', $target_time), ORDER_PENDING];
$objQuery->begin();
Expand All @@ -1524,7 +1524,7 @@ public function checkDbAllPendingOrder()
foreach ($arrOrders as $arrOrder) {
$order_id = $arrOrder['order_id'];
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order cancel.(time expire) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order cancel.(time expire) order_id='.$order_id);
}
}
$objQuery->commit();
Expand All @@ -1549,23 +1549,23 @@ public function checkDbMyPendignOrder()
$cartKeys = $objCartSess->getKeys();
$term = PENDING_ORDER_CANCEL_TIME;
if (preg_match('/^[0-9]+$/', $term)) {
$target_time = strtotime('-' . $term . ' sec');
$target_time = strtotime('-'.$term.' sec');
$create_time = strtotime($arrOrder['create_date']);
if (SC_Utils_Ex::isBlank($cartKeys) && $target_time < $create_time) {
SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(my pending) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order rollback.(my pending) order_id='.$order_id);
} else {
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
if ($target_time > $create_time) {
GC_Utils_Ex::gfPrintLog('order cancel.(my pending and time expire) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order cancel.(my pending and time expire) order_id='.$order_id);
} else {
GC_Utils_Ex::gfPrintLog('order cancel.(my pending and set cart) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order cancel.(my pending and set cart) order_id='.$order_id);
}
}
}
} else {
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order cancel.(my old pending) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order cancel.(my old pending) order_id='.$order_id);
}
}
}
Expand All @@ -1592,10 +1592,10 @@ public function checkSessionPendingOrder()
$cartKeys = $objCartSess->getKeys();
if (SC_Utils_Ex::isBlank($cartKeys)) {
SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id='.$order_id);
} else {
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id='.$order_id);
}
}
$objQuery->commit();
Expand Down

0 comments on commit 5499faf

Please sign in to comment.