id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,600 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetDeleteURL | public function GetDeleteURL($bUseFullUrl = false)
{
$aParameter = array(TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sReportLink = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
return $sReportLink;
} | php | public function GetDeleteURL($bUseFullUrl = false)
{
$aParameter = array(TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sReportLink = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
return $sReportLink;
} | [
"public",
"function",
"GetDeleteURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
"TdbShopArticleReview",
"::",
"URL_PARAM_REVIEW_ID",
"=>",
"$",
"this",
"->",
"id",
")",
";",
"$",
"sReportLink",
"=",
"TTools",
"::",
"GetExecuteMethodOnCurrentModuleURL",
"(",
"'DeleteReview'",
",",
"$",
"aParameter",
",",
"$",
"bUseFullUrl",
")",
";",
"return",
"$",
"sReportLink",
";",
"}"
] | Returns the URL to delete a review.
@param bool $bUseFullUrl
@return string | [
"Returns",
"the",
"URL",
"to",
"delete",
"a",
"review",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L125-L131 |
31,601 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.SendReviewCommentNotification | public function SendReviewCommentNotification($oComment)
{
if ($this->AllowSendAuthorReviewCommentNotification()) {
$sAuthorEmail = $this->GetSendReviewCommentNotificationEmail();
if (TTools::IsValidEMail($sAuthorEmail)) {
$oMail = TDataMailProfile::GetProfile('review-comment');
$aData = array();
$oArticle = &$this->GetFieldShopArticle();
$aData['sArticleName'] = $oArticle->GetName();
$aData['sReviewTitle'] = $this->fieldTitle;
$aData['sReviewText'] = $this->fieldComment;
$aData['sCommentText'] = $oComment->fieldComment;
$oMail->AddDataArray($aData);
$oMail->ChangeToAddress($this->fieldAuthorEmail, $this->fieldAuthorName);
$oMail->SendUsingObjectView('emails', 'Customer');
}
}
} | php | public function SendReviewCommentNotification($oComment)
{
if ($this->AllowSendAuthorReviewCommentNotification()) {
$sAuthorEmail = $this->GetSendReviewCommentNotificationEmail();
if (TTools::IsValidEMail($sAuthorEmail)) {
$oMail = TDataMailProfile::GetProfile('review-comment');
$aData = array();
$oArticle = &$this->GetFieldShopArticle();
$aData['sArticleName'] = $oArticle->GetName();
$aData['sReviewTitle'] = $this->fieldTitle;
$aData['sReviewText'] = $this->fieldComment;
$aData['sCommentText'] = $oComment->fieldComment;
$oMail->AddDataArray($aData);
$oMail->ChangeToAddress($this->fieldAuthorEmail, $this->fieldAuthorName);
$oMail->SendUsingObjectView('emails', 'Customer');
}
}
} | [
"public",
"function",
"SendReviewCommentNotification",
"(",
"$",
"oComment",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"AllowSendAuthorReviewCommentNotification",
"(",
")",
")",
"{",
"$",
"sAuthorEmail",
"=",
"$",
"this",
"->",
"GetSendReviewCommentNotificationEmail",
"(",
")",
";",
"if",
"(",
"TTools",
"::",
"IsValidEMail",
"(",
"$",
"sAuthorEmail",
")",
")",
"{",
"$",
"oMail",
"=",
"TDataMailProfile",
"::",
"GetProfile",
"(",
"'review-comment'",
")",
";",
"$",
"aData",
"=",
"array",
"(",
")",
";",
"$",
"oArticle",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopArticle",
"(",
")",
";",
"$",
"aData",
"[",
"'sArticleName'",
"]",
"=",
"$",
"oArticle",
"->",
"GetName",
"(",
")",
";",
"$",
"aData",
"[",
"'sReviewTitle'",
"]",
"=",
"$",
"this",
"->",
"fieldTitle",
";",
"$",
"aData",
"[",
"'sReviewText'",
"]",
"=",
"$",
"this",
"->",
"fieldComment",
";",
"$",
"aData",
"[",
"'sCommentText'",
"]",
"=",
"$",
"oComment",
"->",
"fieldComment",
";",
"$",
"oMail",
"->",
"AddDataArray",
"(",
"$",
"aData",
")",
";",
"$",
"oMail",
"->",
"ChangeToAddress",
"(",
"$",
"this",
"->",
"fieldAuthorEmail",
",",
"$",
"this",
"->",
"fieldAuthorName",
")",
";",
"$",
"oMail",
"->",
"SendUsingObjectView",
"(",
"'emails'",
",",
"'Customer'",
")",
";",
"}",
"}",
"}"
] | Send comment notification to review owner.
Send comment notification to owner only if owner set the option for the review.
@param TdbPkgComment $oComment | [
"Send",
"comment",
"notification",
"to",
"review",
"owner",
".",
"Send",
"comment",
"notification",
"to",
"owner",
"only",
"if",
"owner",
"set",
"the",
"option",
"for",
"the",
"review",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L161-L178 |
31,602 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetSendReviewCommentNotificationEmail | protected function GetSendReviewCommentNotificationEmail()
{
$sSendReviewCommentNotificationEmail = '';
if (!empty($this->fieldAuthorEmail)) {
$sSendReviewCommentNotificationEmail = $this->fieldAuthorEmail;
} elseif (!empty($this->fieldDataExtranetUserId)) {
$oAuthor = TdbDataExtranetUser::GetNewInstance();
if ($oAuthor->Load($this->fieldDataExtranetUserId)) {
$sSendReviewCommentNotificationEmail = $oAuthor->GetUserEMail();
}
}
return $sSendReviewCommentNotificationEmail;
} | php | protected function GetSendReviewCommentNotificationEmail()
{
$sSendReviewCommentNotificationEmail = '';
if (!empty($this->fieldAuthorEmail)) {
$sSendReviewCommentNotificationEmail = $this->fieldAuthorEmail;
} elseif (!empty($this->fieldDataExtranetUserId)) {
$oAuthor = TdbDataExtranetUser::GetNewInstance();
if ($oAuthor->Load($this->fieldDataExtranetUserId)) {
$sSendReviewCommentNotificationEmail = $oAuthor->GetUserEMail();
}
}
return $sSendReviewCommentNotificationEmail;
} | [
"protected",
"function",
"GetSendReviewCommentNotificationEmail",
"(",
")",
"{",
"$",
"sSendReviewCommentNotificationEmail",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldAuthorEmail",
")",
")",
"{",
"$",
"sSendReviewCommentNotificationEmail",
"=",
"$",
"this",
"->",
"fieldAuthorEmail",
";",
"}",
"elseif",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldDataExtranetUserId",
")",
")",
"{",
"$",
"oAuthor",
"=",
"TdbDataExtranetUser",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oAuthor",
"->",
"Load",
"(",
"$",
"this",
"->",
"fieldDataExtranetUserId",
")",
")",
"{",
"$",
"sSendReviewCommentNotificationEmail",
"=",
"$",
"oAuthor",
"->",
"GetUserEMail",
"(",
")",
";",
"}",
"}",
"return",
"$",
"sSendReviewCommentNotificationEmail",
";",
"}"
] | Get owner email for comment notification.
@return string|null | [
"Get",
"owner",
"email",
"for",
"comment",
"notification",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L185-L198 |
31,603 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.AllowSendAuthorReviewCommentNotification | protected function AllowSendAuthorReviewCommentNotification()
{
$bAllowSendAuthorCommentNotification = false;
if ($this->fieldSendCommentNotification) {
if (!empty($this->fieldAuthorEmail) || !empty($this->fieldDataExtranetUserId)) {
$bAllowSendAuthorCommentNotification = true;
}
}
return $bAllowSendAuthorCommentNotification;
} | php | protected function AllowSendAuthorReviewCommentNotification()
{
$bAllowSendAuthorCommentNotification = false;
if ($this->fieldSendCommentNotification) {
if (!empty($this->fieldAuthorEmail) || !empty($this->fieldDataExtranetUserId)) {
$bAllowSendAuthorCommentNotification = true;
}
}
return $bAllowSendAuthorCommentNotification;
} | [
"protected",
"function",
"AllowSendAuthorReviewCommentNotification",
"(",
")",
"{",
"$",
"bAllowSendAuthorCommentNotification",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"fieldSendCommentNotification",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldAuthorEmail",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldDataExtranetUserId",
")",
")",
"{",
"$",
"bAllowSendAuthorCommentNotification",
"=",
"true",
";",
"}",
"}",
"return",
"$",
"bAllowSendAuthorCommentNotification",
";",
"}"
] | Checks if its allowed to send comment notification to owner.
@return bool | [
"Checks",
"if",
"its",
"allowed",
"to",
"send",
"comment",
"notification",
"to",
"owner",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L205-L215 |
31,604 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.SaveActionIdToComment | protected function SaveActionIdToComment()
{
$sActionId = TTools::GetUUID();
$this->sqlData['action_id'] = $sActionId;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | php | protected function SaveActionIdToComment()
{
$sActionId = TTools::GetUUID();
$this->sqlData['action_id'] = $sActionId;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | [
"protected",
"function",
"SaveActionIdToComment",
"(",
")",
"{",
"$",
"sActionId",
"=",
"TTools",
"::",
"GetUUID",
"(",
")",
";",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
"=",
"$",
"sActionId",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"false",
")",
";",
"}"
] | Add new unique action id to the comment.
Action id was needed to run an action like unlock or delete via post. | [
"Add",
"new",
"unique",
"action",
"id",
"to",
"the",
"comment",
".",
"Action",
"id",
"was",
"needed",
"to",
"run",
"an",
"action",
"like",
"unlock",
"or",
"delete",
"via",
"post",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L221-L228 |
31,605 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetDeleteWithActionIdURL | protected function GetDeleteWithActionIdURL($bUseFullUrl = false)
{
$sDeleteURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sDeleteURL = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
}
return $sDeleteURL;
} | php | protected function GetDeleteWithActionIdURL($bUseFullUrl = false)
{
$sDeleteURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sDeleteURL = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
}
return $sDeleteURL;
} | [
"protected",
"function",
"GetDeleteWithActionIdURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"sDeleteURL",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
"TdbShopArticleReview",
"::",
"URL_PARAM_ACTION_ID",
"=>",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
";",
"$",
"sDeleteURL",
"=",
"TTools",
"::",
"GetExecuteMethodOnCurrentModuleURL",
"(",
"'DeleteReview'",
",",
"$",
"aParameter",
",",
"$",
"bUseFullUrl",
")",
";",
"}",
"return",
"$",
"sDeleteURL",
";",
"}"
] | Get URL to delete review with unique action id.
@param bool $bUseFullUrl
@return string | [
"Get",
"URL",
"to",
"delete",
"review",
"with",
"unique",
"action",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L237-L246 |
31,606 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetUnlockURL | protected function GetUnlockURL($bUseFullUrl = false)
{
$sUnlockURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sUnlockURL = TTools::GetExecuteMethodOnCurrentModuleURL('UnlockReview', $aParameter, $bUseFullUrl);
}
return $sUnlockURL;
} | php | protected function GetUnlockURL($bUseFullUrl = false)
{
$sUnlockURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sUnlockURL = TTools::GetExecuteMethodOnCurrentModuleURL('UnlockReview', $aParameter, $bUseFullUrl);
}
return $sUnlockURL;
} | [
"protected",
"function",
"GetUnlockURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"sUnlockURL",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
"TdbShopArticleReview",
"::",
"URL_PARAM_ACTION_ID",
"=>",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
";",
"$",
"sUnlockURL",
"=",
"TTools",
"::",
"GetExecuteMethodOnCurrentModuleURL",
"(",
"'UnlockReview'",
",",
"$",
"aParameter",
",",
"$",
"bUseFullUrl",
")",
";",
"}",
"return",
"$",
"sUnlockURL",
";",
"}"
] | Get URL to unlock a review with unique action id.
@param bool $bUseFullUrl
@return string | [
"Get",
"URL",
"to",
"unlock",
"a",
"review",
"with",
"unique",
"action",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L255-L264 |
31,607 | chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetCacheTrigger | protected function GetCacheTrigger($id, $aCallTimeVars = array())
{
$aCacheTrigger = parent::GetCacheTrigger($id, $aCallTimeVars);
if (array_key_exists('oPkgCommentModuleConfig', $aCallTimeVars) && !is_null($aCallTimeVars['oPkgCommentModuleConfig'])) {
$aCallTimeVars['oPkgCommentModuleConfig']->SetActiveItem($this);
$aCacheTrigger = array_merge($aCacheTrigger, $aCallTimeVars['oPkgCommentModuleConfig']->GetCacheTrigger());
}
return $aCacheTrigger;
} | php | protected function GetCacheTrigger($id, $aCallTimeVars = array())
{
$aCacheTrigger = parent::GetCacheTrigger($id, $aCallTimeVars);
if (array_key_exists('oPkgCommentModuleConfig', $aCallTimeVars) && !is_null($aCallTimeVars['oPkgCommentModuleConfig'])) {
$aCallTimeVars['oPkgCommentModuleConfig']->SetActiveItem($this);
$aCacheTrigger = array_merge($aCacheTrigger, $aCallTimeVars['oPkgCommentModuleConfig']->GetCacheTrigger());
}
return $aCacheTrigger;
} | [
"protected",
"function",
"GetCacheTrigger",
"(",
"$",
"id",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"aCacheTrigger",
"=",
"parent",
"::",
"GetCacheTrigger",
"(",
"$",
"id",
",",
"$",
"aCallTimeVars",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'oPkgCommentModuleConfig'",
",",
"$",
"aCallTimeVars",
")",
"&&",
"!",
"is_null",
"(",
"$",
"aCallTimeVars",
"[",
"'oPkgCommentModuleConfig'",
"]",
")",
")",
"{",
"$",
"aCallTimeVars",
"[",
"'oPkgCommentModuleConfig'",
"]",
"->",
"SetActiveItem",
"(",
"$",
"this",
")",
";",
"$",
"aCacheTrigger",
"=",
"array_merge",
"(",
"$",
"aCacheTrigger",
",",
"$",
"aCallTimeVars",
"[",
"'oPkgCommentModuleConfig'",
"]",
"->",
"GetCacheTrigger",
"(",
")",
")",
";",
"}",
"return",
"$",
"aCacheTrigger",
";",
"}"
] | Get cache trigger for comments.
@param $id
@param array $aCallTimeVars
@return array | [
"Get",
"cache",
"trigger",
"for",
"comments",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L274-L283 |
31,608 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopUserNoticeList.class.php | TShopUserNoticeList.GetRemoveFromNoticeListLink | public function GetRemoveFromNoticeListLink()
{
$oShop = TdbShop::GetInstance();
$aParams = array('module_fnc['.$oShop->GetBasketModuleSpotName().']' => 'RemoveFromNoticeList', MTShopBasketCore::URL_ITEM_ID => $this->fieldShopArticleId);
return $this->getActivePageService()->getLinkToActivePageRelative($aParams);
} | php | public function GetRemoveFromNoticeListLink()
{
$oShop = TdbShop::GetInstance();
$aParams = array('module_fnc['.$oShop->GetBasketModuleSpotName().']' => 'RemoveFromNoticeList', MTShopBasketCore::URL_ITEM_ID => $this->fieldShopArticleId);
return $this->getActivePageService()->getLinkToActivePageRelative($aParams);
} | [
"public",
"function",
"GetRemoveFromNoticeListLink",
"(",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aParams",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"oShop",
"->",
"GetBasketModuleSpotName",
"(",
")",
".",
"']'",
"=>",
"'RemoveFromNoticeList'",
",",
"MTShopBasketCore",
"::",
"URL_ITEM_ID",
"=>",
"$",
"this",
"->",
"fieldShopArticleId",
")",
";",
"return",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getLinkToActivePageRelative",
"(",
"$",
"aParams",
")",
";",
"}"
] | return link that can be used to remove the item from the notice list.
@return string | [
"return",
"link",
"that",
"can",
"be",
"used",
"to",
"remove",
"the",
"item",
"from",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopUserNoticeList.class.php#L21-L27 |
31,609 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/TShopAuskunftAPI.class.php | TShopAuskunftAPI.ReadFromURI | public function ReadFromURI($sURL)
{
$sBuf = '';
$fp = @fopen($sURL, 'r');
if (!$fp) {
echo "<!-- shopauskunft - no connection! -->\n";
} else {
stream_set_timeout($fp, 5);
while (!feof($fp)) {
$sBuf .= fread($fp, 128);
}
fclose($fp);
}
return $sBuf;
} | php | public function ReadFromURI($sURL)
{
$sBuf = '';
$fp = @fopen($sURL, 'r');
if (!$fp) {
echo "<!-- shopauskunft - no connection! -->\n";
} else {
stream_set_timeout($fp, 5);
while (!feof($fp)) {
$sBuf .= fread($fp, 128);
}
fclose($fp);
}
return $sBuf;
} | [
"public",
"function",
"ReadFromURI",
"(",
"$",
"sURL",
")",
"{",
"$",
"sBuf",
"=",
"''",
";",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"sURL",
",",
"'r'",
")",
";",
"if",
"(",
"!",
"$",
"fp",
")",
"{",
"echo",
"\"<!-- shopauskunft - no connection! -->\\n\"",
";",
"}",
"else",
"{",
"stream_set_timeout",
"(",
"$",
"fp",
",",
"5",
")",
";",
"while",
"(",
"!",
"feof",
"(",
"$",
"fp",
")",
")",
"{",
"$",
"sBuf",
".=",
"fread",
"(",
"$",
"fp",
",",
"128",
")",
";",
"}",
"fclose",
"(",
"$",
"fp",
")",
";",
"}",
"return",
"$",
"sBuf",
";",
"}"
] | Get content from URL.
@param $sURL
@return string | [
"Get",
"content",
"from",
"URL",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TShopAuskunftAPI.class.php#L58-L73 |
31,610 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.Init | public function Init()
{
$basket = $this->getShopService()->getActiveBasket();
$basket->aCompletedOrderStepList[$this->fieldSystemname] = false;
$this->CheckBasketContents();
if (false === $this->AllowAccessToStep(true)) {
$this->JumpToStep($this->GetPreviousStep());
}
if ('basket' !== $this->fieldSystemname && 'thankyou' !== $this->fieldSystemname) {
$basket->CommitCopyToDatabase(false, $this->fieldSystemname);
} // commit basket to database...
} | php | public function Init()
{
$basket = $this->getShopService()->getActiveBasket();
$basket->aCompletedOrderStepList[$this->fieldSystemname] = false;
$this->CheckBasketContents();
if (false === $this->AllowAccessToStep(true)) {
$this->JumpToStep($this->GetPreviousStep());
}
if ('basket' !== $this->fieldSystemname && 'thankyou' !== $this->fieldSystemname) {
$basket->CommitCopyToDatabase(false, $this->fieldSystemname);
} // commit basket to database...
} | [
"public",
"function",
"Init",
"(",
")",
"{",
"$",
"basket",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveBasket",
"(",
")",
";",
"$",
"basket",
"->",
"aCompletedOrderStepList",
"[",
"$",
"this",
"->",
"fieldSystemname",
"]",
"=",
"false",
";",
"$",
"this",
"->",
"CheckBasketContents",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"AllowAccessToStep",
"(",
"true",
")",
")",
"{",
"$",
"this",
"->",
"JumpToStep",
"(",
"$",
"this",
"->",
"GetPreviousStep",
"(",
")",
")",
";",
"}",
"if",
"(",
"'basket'",
"!==",
"$",
"this",
"->",
"fieldSystemname",
"&&",
"'thankyou'",
"!==",
"$",
"this",
"->",
"fieldSystemname",
")",
"{",
"$",
"basket",
"->",
"CommitCopyToDatabase",
"(",
"false",
",",
"$",
"this",
"->",
"fieldSystemname",
")",
";",
"}",
"// commit basket to database...",
"}"
] | Called from the init method of the calling module.
Visitor permissions for the requested step may be checked and the user redirected. | [
"Called",
"from",
"the",
"init",
"method",
"of",
"the",
"calling",
"module",
".",
"Visitor",
"permissions",
"for",
"the",
"requested",
"step",
"may",
"be",
"checked",
"and",
"the",
"user",
"redirected",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L38-L50 |
31,611 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.CheckBasketContents | protected function CheckBasketContents()
{
if ('basket' !== $this->fieldSystemname) {
$oBasket = $this->getShopService()->getActiveBasket();
if ($oBasket->dTotalNumberOfArticles <= 0) {
$oBasketStep = TdbShopOrderStep::GetStep('basket');
$this->JumpToStep($oBasketStep);
}
}
} | php | protected function CheckBasketContents()
{
if ('basket' !== $this->fieldSystemname) {
$oBasket = $this->getShopService()->getActiveBasket();
if ($oBasket->dTotalNumberOfArticles <= 0) {
$oBasketStep = TdbShopOrderStep::GetStep('basket');
$this->JumpToStep($oBasketStep);
}
}
} | [
"protected",
"function",
"CheckBasketContents",
"(",
")",
"{",
"if",
"(",
"'basket'",
"!==",
"$",
"this",
"->",
"fieldSystemname",
")",
"{",
"$",
"oBasket",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveBasket",
"(",
")",
";",
"if",
"(",
"$",
"oBasket",
"->",
"dTotalNumberOfArticles",
"<=",
"0",
")",
"{",
"$",
"oBasketStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"'basket'",
")",
";",
"$",
"this",
"->",
"JumpToStep",
"(",
"$",
"oBasketStep",
")",
";",
"}",
"}",
"}"
] | Redirects back to the basket if basket is currently empty. | [
"Redirects",
"back",
"to",
"the",
"basket",
"if",
"basket",
"is",
"currently",
"empty",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L87-L96 |
31,612 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.GetStepURL | public function GetStepURL($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$sOrderPage = '';
if ($bDisableAccessCheck || $this->AllowAccessToStep()) {
if ($bForcePortalLink) {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($this, $aAdditionalParameter);
} else {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageRelative($this, $aAdditionalParameter);
}
}
return $sOrderPage;
} | php | public function GetStepURL($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$sOrderPage = '';
if ($bDisableAccessCheck || $this->AllowAccessToStep()) {
if ($bForcePortalLink) {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($this, $aAdditionalParameter);
} else {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageRelative($this, $aAdditionalParameter);
}
}
return $sOrderPage;
} | [
"public",
"function",
"GetStepURL",
"(",
"$",
"bDisableAccessCheck",
"=",
"true",
",",
"$",
"bForcePortalLink",
"=",
"false",
",",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sOrderPage",
"=",
"''",
";",
"if",
"(",
"$",
"bDisableAccessCheck",
"||",
"$",
"this",
"->",
"AllowAccessToStep",
"(",
")",
")",
"{",
"if",
"(",
"$",
"bForcePortalLink",
")",
"{",
"$",
"sOrderPage",
"=",
"$",
"this",
"->",
"getOrderStepPageService",
"(",
")",
"->",
"getLinkToOrderStepPageAbsolute",
"(",
"$",
"this",
",",
"$",
"aAdditionalParameter",
")",
";",
"}",
"else",
"{",
"$",
"sOrderPage",
"=",
"$",
"this",
"->",
"getOrderStepPageService",
"(",
")",
"->",
"getLinkToOrderStepPageRelative",
"(",
"$",
"this",
",",
"$",
"aAdditionalParameter",
")",
";",
"}",
"}",
"return",
"$",
"sOrderPage",
";",
"}"
] | Returns the URL to this step.
@param bool $bDisableAccessCheck If false, there will be an access check for the step. If this access check fails, the returned URL will be empty.
@param bool $bForcePortalLink - set to true if you want to include the domain
@param array $aAdditionalParameter
@return string | [
"Returns",
"the",
"URL",
"to",
"this",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L229-L241 |
31,613 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.GetStepURLReturnStepViaAjax | public function GetStepURLReturnStepViaAjax($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$oGlobal = TGlobal::instance();
$aAdditionalParameter['module_fnc'] = array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'ExecuteAjaxCall');
$aAdditionalParameter['_fnc'] = 'GetStepAsAjax';
$aAdditionalParameter['sStepName'] = $this->fieldSystemname;
return $this->GetStepURL($bDisableAccessCheck, $bForcePortalLink, $aAdditionalParameter);
} | php | public function GetStepURLReturnStepViaAjax($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$oGlobal = TGlobal::instance();
$aAdditionalParameter['module_fnc'] = array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'ExecuteAjaxCall');
$aAdditionalParameter['_fnc'] = 'GetStepAsAjax';
$aAdditionalParameter['sStepName'] = $this->fieldSystemname;
return $this->GetStepURL($bDisableAccessCheck, $bForcePortalLink, $aAdditionalParameter);
} | [
"public",
"function",
"GetStepURLReturnStepViaAjax",
"(",
"$",
"bDisableAccessCheck",
"=",
"true",
",",
"$",
"bForcePortalLink",
"=",
"false",
",",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aAdditionalParameter",
"[",
"'module_fnc'",
"]",
"=",
"array",
"(",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
"->",
"sModuleSpotName",
"=>",
"'ExecuteAjaxCall'",
")",
";",
"$",
"aAdditionalParameter",
"[",
"'_fnc'",
"]",
"=",
"'GetStepAsAjax'",
";",
"$",
"aAdditionalParameter",
"[",
"'sStepName'",
"]",
"=",
"$",
"this",
"->",
"fieldSystemname",
";",
"return",
"$",
"this",
"->",
"GetStepURL",
"(",
"$",
"bDisableAccessCheck",
",",
"$",
"bForcePortalLink",
",",
"$",
"aAdditionalParameter",
")",
";",
"}"
] | Returns the URL required to load a step via ajax.
@param bool $bDisableAccessCheck
@param bool $bForcePortalLink
@return string | [
"Returns",
"the",
"URL",
"required",
"to",
"load",
"a",
"step",
"via",
"ajax",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L251-L259 |
31,614 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.ExecuteStep | public function ExecuteStep()
{
if ($this->ProcessStep()) {
$this->ProcessStepSuccessHook();
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList[$this->fieldSystemname] = true;
$oNextStep = $this->GetNextStep();
$this->JumpToStep($oNextStep);
}
} | php | public function ExecuteStep()
{
if ($this->ProcessStep()) {
$this->ProcessStepSuccessHook();
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList[$this->fieldSystemname] = true;
$oNextStep = $this->GetNextStep();
$this->JumpToStep($oNextStep);
}
} | [
"public",
"function",
"ExecuteStep",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ProcessStep",
"(",
")",
")",
"{",
"$",
"this",
"->",
"ProcessStepSuccessHook",
"(",
")",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
"[",
"$",
"this",
"->",
"fieldSystemname",
"]",
"=",
"true",
";",
"$",
"oNextStep",
"=",
"$",
"this",
"->",
"GetNextStep",
"(",
")",
";",
"$",
"this",
"->",
"JumpToStep",
"(",
"$",
"oNextStep",
")",
";",
"}",
"}"
] | Executes the current step. Redirects to the next step in line if no errors occur. | [
"Executes",
"the",
"current",
"step",
".",
"Redirects",
"to",
"the",
"next",
"step",
"in",
"line",
"if",
"no",
"errors",
"occur",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L280-L289 |
31,615 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.Render | public function Render($sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this->getShopService()->getActiveShop());
$oView->AddVar('oStep', $this);
$oStepNext = $this->GetNextStep();
$oStepPrevious = $this->GetPreviousStep();
$oView->AddVar('oStepNext', $oStepNext);
$oView->AddVar('oStepPrevious', $oStepPrevious);
$sBackLink = $this->GetReturnToLastStepURL();
$oView->AddVar('sBackLink', $sBackLink);
$oView->AddVar('sSpotName', $sSpotName);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$sViewName = $this->GetRenderViewName();
$sViewType = $this->GetRenderViewType();
$aOtherParameters = &$this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, $this->getStepViewPath(), $sViewType);
} | php | public function Render($sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this->getShopService()->getActiveShop());
$oView->AddVar('oStep', $this);
$oStepNext = $this->GetNextStep();
$oStepPrevious = $this->GetPreviousStep();
$oView->AddVar('oStepNext', $oStepNext);
$oView->AddVar('oStepPrevious', $oStepPrevious);
$sBackLink = $this->GetReturnToLastStepURL();
$oView->AddVar('sBackLink', $sBackLink);
$oView->AddVar('sSpotName', $sSpotName);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$sViewName = $this->GetRenderViewName();
$sViewType = $this->GetRenderViewType();
$aOtherParameters = &$this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, $this->getStepViewPath(), $sViewType);
} | [
"public",
"function",
"Render",
"(",
"$",
"sSpotName",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oView",
"=",
"new",
"TViewParser",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oShop'",
",",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveShop",
"(",
")",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oStep'",
",",
"$",
"this",
")",
";",
"$",
"oStepNext",
"=",
"$",
"this",
"->",
"GetNextStep",
"(",
")",
";",
"$",
"oStepPrevious",
"=",
"$",
"this",
"->",
"GetPreviousStep",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oStepNext'",
",",
"$",
"oStepNext",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oStepPrevious'",
",",
"$",
"oStepPrevious",
")",
";",
"$",
"sBackLink",
"=",
"$",
"this",
"->",
"GetReturnToLastStepURL",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'sBackLink'",
",",
"$",
"sBackLink",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'sSpotName'",
",",
"$",
"sSpotName",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'aCallTimeVars'",
",",
"$",
"aCallTimeVars",
")",
";",
"$",
"sViewName",
"=",
"$",
"this",
"->",
"GetRenderViewName",
"(",
")",
";",
"$",
"sViewType",
"=",
"$",
"this",
"->",
"GetRenderViewType",
"(",
")",
";",
"$",
"aOtherParameters",
"=",
"&",
"$",
"this",
"->",
"GetAdditionalViewVariables",
"(",
"$",
"sViewName",
",",
"$",
"sViewType",
")",
";",
"$",
"oView",
"->",
"AddVarArray",
"(",
"$",
"aOtherParameters",
")",
";",
"return",
"$",
"oView",
"->",
"RenderObjectPackageView",
"(",
"$",
"sViewName",
",",
"$",
"this",
"->",
"getStepViewPath",
"(",
")",
",",
"$",
"sViewType",
")",
";",
"}"
] | Renders the requested step.
@param array $aCallTimeVars - place any custom vars that you want to pass through the call here
@return string | [
"Renders",
"the",
"requested",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L435-L459 |
31,616 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemLevelTree.class.php | TPkgShopListfilterItemLevelTree.GetRenderedCategoryTree | public function GetRenderedCategoryTree()
{
$aFilterCategories = $this->GetOptions();
$oTree = TShopCategoryTree::GetCategoryTree();
$oTree->ResetCounter();
foreach ($aFilterCategories as $sCategoryId => $sCategoryCount) {
$oTree->AddItemCount($sCategoryId, $sCategoryCount);
}
if (is_array($this->aActiveFilterData) && count($this->aActiveFilterData) > 0) {
$oTree->MarkActiveCategories($this->aActiveFilterData);
}
$sRenderedCategoryTree = $oTree->Render($this->id, true, true);
return $sRenderedCategoryTree;
} | php | public function GetRenderedCategoryTree()
{
$aFilterCategories = $this->GetOptions();
$oTree = TShopCategoryTree::GetCategoryTree();
$oTree->ResetCounter();
foreach ($aFilterCategories as $sCategoryId => $sCategoryCount) {
$oTree->AddItemCount($sCategoryId, $sCategoryCount);
}
if (is_array($this->aActiveFilterData) && count($this->aActiveFilterData) > 0) {
$oTree->MarkActiveCategories($this->aActiveFilterData);
}
$sRenderedCategoryTree = $oTree->Render($this->id, true, true);
return $sRenderedCategoryTree;
} | [
"public",
"function",
"GetRenderedCategoryTree",
"(",
")",
"{",
"$",
"aFilterCategories",
"=",
"$",
"this",
"->",
"GetOptions",
"(",
")",
";",
"$",
"oTree",
"=",
"TShopCategoryTree",
"::",
"GetCategoryTree",
"(",
")",
";",
"$",
"oTree",
"->",
"ResetCounter",
"(",
")",
";",
"foreach",
"(",
"$",
"aFilterCategories",
"as",
"$",
"sCategoryId",
"=>",
"$",
"sCategoryCount",
")",
"{",
"$",
"oTree",
"->",
"AddItemCount",
"(",
"$",
"sCategoryId",
",",
"$",
"sCategoryCount",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"aActiveFilterData",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"aActiveFilterData",
")",
">",
"0",
")",
"{",
"$",
"oTree",
"->",
"MarkActiveCategories",
"(",
"$",
"this",
"->",
"aActiveFilterData",
")",
";",
"}",
"$",
"sRenderedCategoryTree",
"=",
"$",
"oTree",
"->",
"Render",
"(",
"$",
"this",
"->",
"id",
",",
"true",
",",
"true",
")",
";",
"return",
"$",
"sRenderedCategoryTree",
";",
"}"
] | Get the complete rendered filter as html.
@return string | [
"Get",
"the",
"complete",
"rendered",
"filter",
"as",
"html",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemLevelTree.class.php#L34-L48 |
31,617 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TCMSWizardStep/TCMSWizardStepShopTellAFriend.class.php | TCMSWizardStepShopTellAFriend.ValidateUserData | protected function ValidateUserData()
{
$bIsValid = true;
$oMsgManager = TCMSMessageManager::GetInstance();
// check user data
$sCaptchaValue = $this->GetCaptchaValue();
if (empty($sCaptchaValue) || $sCaptchaValue != $this->aUserInput['captcha']) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
}
$aRequiredFields = $this->RequiredFields();
foreach ($aRequiredFields as $sFieldName) {
$sVal = trim($this->aUserInput[$sFieldName]);
if (empty($sVal)) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
}
}
return $bIsValid;
} | php | protected function ValidateUserData()
{
$bIsValid = true;
$oMsgManager = TCMSMessageManager::GetInstance();
// check user data
$sCaptchaValue = $this->GetCaptchaValue();
if (empty($sCaptchaValue) || $sCaptchaValue != $this->aUserInput['captcha']) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
}
$aRequiredFields = $this->RequiredFields();
foreach ($aRequiredFields as $sFieldName) {
$sVal = trim($this->aUserInput[$sFieldName]);
if (empty($sVal)) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
}
}
return $bIsValid;
} | [
"protected",
"function",
"ValidateUserData",
"(",
")",
"{",
"$",
"bIsValid",
"=",
"true",
";",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"// check user data",
"$",
"sCaptchaValue",
"=",
"$",
"this",
"->",
"GetCaptchaValue",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sCaptchaValue",
")",
"||",
"$",
"sCaptchaValue",
"!=",
"$",
"this",
"->",
"aUserInput",
"[",
"'captcha'",
"]",
")",
"{",
"$",
"bIsValid",
"=",
"false",
";",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"'tell-a-friend-field-captcha'",
",",
"'INPUT-ERROR-INVALID-CAPTCHA'",
")",
";",
"}",
"$",
"aRequiredFields",
"=",
"$",
"this",
"->",
"RequiredFields",
"(",
")",
";",
"foreach",
"(",
"$",
"aRequiredFields",
"as",
"$",
"sFieldName",
")",
"{",
"$",
"sVal",
"=",
"trim",
"(",
"$",
"this",
"->",
"aUserInput",
"[",
"$",
"sFieldName",
"]",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sVal",
")",
")",
"{",
"$",
"bIsValid",
"=",
"false",
";",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"'tell-a-friend-field-'",
".",
"$",
"sFieldName",
",",
"'ERROR-USER-REQUIRED-FIELD-MISSING'",
")",
";",
"}",
"}",
"return",
"$",
"bIsValid",
";",
"}"
] | validate the user input.
@return bool | [
"validate",
"the",
"user",
"input",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TCMSWizardStep/TCMSWizardStepShopTellAFriend.class.php#L183-L205 |
31,618 | chameleon-system/chameleon-shop | src/ShopBundle/mappers/article/TPkgShopMapper_ArticleRatingOverview.class.php | TPkgShopMapper_ArticleRatingOverview.GetRatingOverview | protected function GetRatingOverview($oReviewModuleConfiguration, $oArticle, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aRatingOverview = array();
for ($i = $oReviewModuleConfiguration->fieldRatingCount; $i > 0; --$i) {
$aRatingOverview['r_'.$i] = array();
$aRatingOverview['r_'.$i]['dRating'] = $i;
$aRatingOverview['r_'.$i]['iRatingCount'] = 0;
}
$oReviewList = $oArticle->GetReviewsPublished();
while ($oReview = $oReviewList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oReview->table, $oReview->id);
}
if (isset($aRatingOverview['r_'.$oReview->fieldRating])) {
$aRatingOverview['r_'.$oReview->fieldRating];
++$aRatingOverview['r_'.$oReview->fieldRating]['iRatingCount'];
}
}
return $aRatingOverview;
} | php | protected function GetRatingOverview($oReviewModuleConfiguration, $oArticle, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aRatingOverview = array();
for ($i = $oReviewModuleConfiguration->fieldRatingCount; $i > 0; --$i) {
$aRatingOverview['r_'.$i] = array();
$aRatingOverview['r_'.$i]['dRating'] = $i;
$aRatingOverview['r_'.$i]['iRatingCount'] = 0;
}
$oReviewList = $oArticle->GetReviewsPublished();
while ($oReview = $oReviewList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oReview->table, $oReview->id);
}
if (isset($aRatingOverview['r_'.$oReview->fieldRating])) {
$aRatingOverview['r_'.$oReview->fieldRating];
++$aRatingOverview['r_'.$oReview->fieldRating]['iRatingCount'];
}
}
return $aRatingOverview;
} | [
"protected",
"function",
"GetRatingOverview",
"(",
"$",
"oReviewModuleConfiguration",
",",
"$",
"oArticle",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
",",
"$",
"bCachingEnabled",
")",
"{",
"$",
"aRatingOverview",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"oReviewModuleConfiguration",
"->",
"fieldRatingCount",
";",
"$",
"i",
">",
"0",
";",
"--",
"$",
"i",
")",
"{",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"i",
"]",
"=",
"array",
"(",
")",
";",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"i",
"]",
"[",
"'dRating'",
"]",
"=",
"$",
"i",
";",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"i",
"]",
"[",
"'iRatingCount'",
"]",
"=",
"0",
";",
"}",
"$",
"oReviewList",
"=",
"$",
"oArticle",
"->",
"GetReviewsPublished",
"(",
")",
";",
"while",
"(",
"$",
"oReview",
"=",
"$",
"oReviewList",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oReview",
"->",
"table",
",",
"$",
"oReview",
"->",
"id",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"oReview",
"->",
"fieldRating",
"]",
")",
")",
"{",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"oReview",
"->",
"fieldRating",
"]",
";",
"++",
"$",
"aRatingOverview",
"[",
"'r_'",
".",
"$",
"oReview",
"->",
"fieldRating",
"]",
"[",
"'iRatingCount'",
"]",
";",
"}",
"}",
"return",
"$",
"aRatingOverview",
";",
"}"
] | Get array for each rating count holding the count of rated reviews.
@param TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration $oReviewModuleConfiguration
@param TdbShopArticle $oArticle
@param \IMapperCacheTriggerRestricted $oCacheTriggerManager
@return array | [
"Get",
"array",
"for",
"each",
"rating",
"count",
"holding",
"the",
"count",
"of",
"rated",
"reviews",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/article/TPkgShopMapper_ArticleRatingOverview.class.php#L38-L58 |
31,619 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetConfigValues | protected function GetConfigValues()
{
$oShopConfig = TdbShop::GetInstance(1);
$this->Shopreviewmail_MailDelay = $oShopConfig->fieldShopreviewmailMailDelay;
$this->Shopreviewmail_PercentOfCustomers = $oShopConfig->fieldShopreviewmailPercentOfCustomers;
$this->Shopreviewmail_SendForEachOrder = $oShopConfig->fieldShopreviewmailSendForEachOrder;
} | php | protected function GetConfigValues()
{
$oShopConfig = TdbShop::GetInstance(1);
$this->Shopreviewmail_MailDelay = $oShopConfig->fieldShopreviewmailMailDelay;
$this->Shopreviewmail_PercentOfCustomers = $oShopConfig->fieldShopreviewmailPercentOfCustomers;
$this->Shopreviewmail_SendForEachOrder = $oShopConfig->fieldShopreviewmailSendForEachOrder;
} | [
"protected",
"function",
"GetConfigValues",
"(",
")",
"{",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
"1",
")",
";",
"$",
"this",
"->",
"Shopreviewmail_MailDelay",
"=",
"$",
"oShopConfig",
"->",
"fieldShopreviewmailMailDelay",
";",
"$",
"this",
"->",
"Shopreviewmail_PercentOfCustomers",
"=",
"$",
"oShopConfig",
"->",
"fieldShopreviewmailPercentOfCustomers",
";",
"$",
"this",
"->",
"Shopreviewmail_SendForEachOrder",
"=",
"$",
"oShopConfig",
"->",
"fieldShopreviewmailSendForEachOrder",
";",
"}"
] | Read rating-mail-config. | [
"Read",
"rating",
"-",
"mail",
"-",
"config",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L69-L75 |
31,620 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetShippingDateLowerBound | public function GetShippingDateLowerBound()
{
$iAgeInDays = $this->Shopreviewmail_MailDelay;
$iNow = time();
$hour = date('G', $iNow);
$minute = date('i', $iNow);
if ('0' == substr($minute, 0, 1)) {
$minute = substr($minute, 1);
}
$second = date('s', $iNow);
if ('0' == substr($second, 0, 1)) {
$second = substr($second, 1);
}
$iLowerBound = mktime($hour, $minute, $second, date('n', $iNow), date('j', $iNow) - $iAgeInDays, date('Y', $iNow));
return $iLowerBound;
} | php | public function GetShippingDateLowerBound()
{
$iAgeInDays = $this->Shopreviewmail_MailDelay;
$iNow = time();
$hour = date('G', $iNow);
$minute = date('i', $iNow);
if ('0' == substr($minute, 0, 1)) {
$minute = substr($minute, 1);
}
$second = date('s', $iNow);
if ('0' == substr($second, 0, 1)) {
$second = substr($second, 1);
}
$iLowerBound = mktime($hour, $minute, $second, date('n', $iNow), date('j', $iNow) - $iAgeInDays, date('Y', $iNow));
return $iLowerBound;
} | [
"public",
"function",
"GetShippingDateLowerBound",
"(",
")",
"{",
"$",
"iAgeInDays",
"=",
"$",
"this",
"->",
"Shopreviewmail_MailDelay",
";",
"$",
"iNow",
"=",
"time",
"(",
")",
";",
"$",
"hour",
"=",
"date",
"(",
"'G'",
",",
"$",
"iNow",
")",
";",
"$",
"minute",
"=",
"date",
"(",
"'i'",
",",
"$",
"iNow",
")",
";",
"if",
"(",
"'0'",
"==",
"substr",
"(",
"$",
"minute",
",",
"0",
",",
"1",
")",
")",
"{",
"$",
"minute",
"=",
"substr",
"(",
"$",
"minute",
",",
"1",
")",
";",
"}",
"$",
"second",
"=",
"date",
"(",
"'s'",
",",
"$",
"iNow",
")",
";",
"if",
"(",
"'0'",
"==",
"substr",
"(",
"$",
"second",
",",
"0",
",",
"1",
")",
")",
"{",
"$",
"second",
"=",
"substr",
"(",
"$",
"second",
",",
"1",
")",
";",
"}",
"$",
"iLowerBound",
"=",
"mktime",
"(",
"$",
"hour",
",",
"$",
"minute",
",",
"$",
"second",
",",
"date",
"(",
"'n'",
",",
"$",
"iNow",
")",
",",
"date",
"(",
"'j'",
",",
"$",
"iNow",
")",
"-",
"$",
"iAgeInDays",
",",
"date",
"(",
"'Y'",
",",
"$",
"iNow",
")",
")",
";",
"return",
"$",
"iLowerBound",
";",
"}"
] | return the shipping date past which a review notification should be send.
@return int (unix time stamp) | [
"return",
"the",
"shipping",
"date",
"past",
"which",
"a",
"review",
"notification",
"should",
"be",
"send",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L125-L141 |
31,621 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.SendShopReviewMail | public function SendShopReviewMail($aOrder)
{
$bMailWasSend = false;
$oUser = TdbDataExtranetUser::GetNewInstance();
$oUser->Load($aOrder['data_extranet_user_id']);
if ($this->AllowSendingMailForOrder($oUser, $aOrder)) {
$oRatingService = $this->GetSuitableRatingService($oUser, $aOrder);
if (null !== $oRatingService) {
$bMailWasSend = $oRatingService->SendShopRatingEmail($oUser, $aOrder);
if ($bMailWasSend) {
$query = "UPDATE `shop_order` SET `pkg_shop_rating_service_mail_sent` = '1', `pkg_shop_rating_service_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."' WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."'";
MySqlLegacySupport::getInstance()->query($query);
if (false == $this->bDisableSentHistory) {
$sNewID = TTools::GetUUID();
$iSendDate = date('Y-m-d H:i:s');
$query = "INSERT INTO `pkg_shop_rating_service_history`
SET `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sNewID)."',
`data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->id)."',
`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."',
`date` = '".MySqlLegacySupport::getInstance()->real_escape_string($iSendDate)."',
`pkg_shop_rating_service_id_list` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."'
";
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
MySqlLegacySupport::getInstance()->query($query);
}
}
}
}
return $bMailWasSend;
} | php | public function SendShopReviewMail($aOrder)
{
$bMailWasSend = false;
$oUser = TdbDataExtranetUser::GetNewInstance();
$oUser->Load($aOrder['data_extranet_user_id']);
if ($this->AllowSendingMailForOrder($oUser, $aOrder)) {
$oRatingService = $this->GetSuitableRatingService($oUser, $aOrder);
if (null !== $oRatingService) {
$bMailWasSend = $oRatingService->SendShopRatingEmail($oUser, $aOrder);
if ($bMailWasSend) {
$query = "UPDATE `shop_order` SET `pkg_shop_rating_service_mail_sent` = '1', `pkg_shop_rating_service_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."' WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."'";
MySqlLegacySupport::getInstance()->query($query);
if (false == $this->bDisableSentHistory) {
$sNewID = TTools::GetUUID();
$iSendDate = date('Y-m-d H:i:s');
$query = "INSERT INTO `pkg_shop_rating_service_history`
SET `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sNewID)."',
`data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->id)."',
`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."',
`date` = '".MySqlLegacySupport::getInstance()->real_escape_string($iSendDate)."',
`pkg_shop_rating_service_id_list` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."'
";
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
MySqlLegacySupport::getInstance()->query($query);
}
}
}
}
return $bMailWasSend;
} | [
"public",
"function",
"SendShopReviewMail",
"(",
"$",
"aOrder",
")",
"{",
"$",
"bMailWasSend",
"=",
"false",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oUser",
"->",
"Load",
"(",
"$",
"aOrder",
"[",
"'data_extranet_user_id'",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"AllowSendingMailForOrder",
"(",
"$",
"oUser",
",",
"$",
"aOrder",
")",
")",
"{",
"$",
"oRatingService",
"=",
"$",
"this",
"->",
"GetSuitableRatingService",
"(",
"$",
"oUser",
",",
"$",
"aOrder",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oRatingService",
")",
"{",
"$",
"bMailWasSend",
"=",
"$",
"oRatingService",
"->",
"SendShopRatingEmail",
"(",
"$",
"oUser",
",",
"$",
"aOrder",
")",
";",
"if",
"(",
"$",
"bMailWasSend",
")",
"{",
"$",
"query",
"=",
"\"UPDATE `shop_order` SET `pkg_shop_rating_service_mail_sent` = '1', `pkg_shop_rating_service_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oRatingService",
"->",
"id",
")",
".",
"\"' WHERE `id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"aOrder",
"[",
"'id'",
"]",
")",
".",
"\"'\"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"bDisableSentHistory",
")",
"{",
"$",
"sNewID",
"=",
"TTools",
"::",
"GetUUID",
"(",
")",
";",
"$",
"iSendDate",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"query",
"=",
"\"INSERT INTO `pkg_shop_rating_service_history`\n SET `id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sNewID",
")",
".",
"\"',\n `data_extranet_user_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oUser",
"->",
"id",
")",
".",
"\"',\n `shop_order_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"aOrder",
"[",
"'id'",
"]",
")",
".",
"\"',\n `date` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iSendDate",
")",
".",
"\"',\n `pkg_shop_rating_service_id_list` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oRatingService",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"': '",
".",
"$",
"query",
".",
"\"\\n<br />\\n\"",
";",
"}",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"bMailWasSend",
";",
"}"
] | send the shop review mail and log the action in es_shop_review
returns true if the mail was send. note that the method checks if the customer is allowed
to receiven a mail for the given order.
@param array $aOrder - the order data
@return bool | [
"send",
"the",
"shop",
"review",
"mail",
"and",
"log",
"the",
"action",
"in",
"es_shop_review",
"returns",
"true",
"if",
"the",
"mail",
"was",
"send",
".",
"note",
"that",
"the",
"method",
"checks",
"if",
"the",
"customer",
"is",
"allowed",
"to",
"receiven",
"a",
"mail",
"for",
"the",
"given",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L200-L234 |
31,622 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.CleanupAffiliateCode | protected function CleanupAffiliateCode($sAffiliateCode)
{
$sRet = '';
$sAffiliateCode = trim($sAffiliateCode);
if (!empty($sAffiliateCode)) {
//get all rating services
$sQuery = " SELECT *
FROM `pkg_shop_rating_service`
WHERE `active` = '1'
ORDER BY `position`,`weight` ASC
";
$oRatingServiceList = TdbPkgShopRatingServiceList::GetList($sQuery);
$oRatingServiceList->GoToStart();
//loop and try to identify one...
while ($oService = $oRatingServiceList->Next()) {
/* @var $oService TdbPkgShopRatingService */
$pos = strpos($sAffiliateCode, strtolower(trim($oService->fieldAffiliateValue)));
if (false !== $pos) {
//service found!
$oRatingServiceList->GoToEnd();
$sRet = $oService->fieldAffiliateValue;
}
}
}
return $sRet;
} | php | protected function CleanupAffiliateCode($sAffiliateCode)
{
$sRet = '';
$sAffiliateCode = trim($sAffiliateCode);
if (!empty($sAffiliateCode)) {
//get all rating services
$sQuery = " SELECT *
FROM `pkg_shop_rating_service`
WHERE `active` = '1'
ORDER BY `position`,`weight` ASC
";
$oRatingServiceList = TdbPkgShopRatingServiceList::GetList($sQuery);
$oRatingServiceList->GoToStart();
//loop and try to identify one...
while ($oService = $oRatingServiceList->Next()) {
/* @var $oService TdbPkgShopRatingService */
$pos = strpos($sAffiliateCode, strtolower(trim($oService->fieldAffiliateValue)));
if (false !== $pos) {
//service found!
$oRatingServiceList->GoToEnd();
$sRet = $oService->fieldAffiliateValue;
}
}
}
return $sRet;
} | [
"protected",
"function",
"CleanupAffiliateCode",
"(",
"$",
"sAffiliateCode",
")",
"{",
"$",
"sRet",
"=",
"''",
";",
"$",
"sAffiliateCode",
"=",
"trim",
"(",
"$",
"sAffiliateCode",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sAffiliateCode",
")",
")",
"{",
"//get all rating services",
"$",
"sQuery",
"=",
"\" SELECT *\n FROM `pkg_shop_rating_service`\n WHERE `active` = '1'\n ORDER BY `position`,`weight` ASC\n \"",
";",
"$",
"oRatingServiceList",
"=",
"TdbPkgShopRatingServiceList",
"::",
"GetList",
"(",
"$",
"sQuery",
")",
";",
"$",
"oRatingServiceList",
"->",
"GoToStart",
"(",
")",
";",
"//loop and try to identify one...",
"while",
"(",
"$",
"oService",
"=",
"$",
"oRatingServiceList",
"->",
"Next",
"(",
")",
")",
"{",
"/* @var $oService TdbPkgShopRatingService */",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"sAffiliateCode",
",",
"strtolower",
"(",
"trim",
"(",
"$",
"oService",
"->",
"fieldAffiliateValue",
")",
")",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"pos",
")",
"{",
"//service found!",
"$",
"oRatingServiceList",
"->",
"GoToEnd",
"(",
")",
";",
"$",
"sRet",
"=",
"$",
"oService",
"->",
"fieldAffiliateValue",
";",
"}",
"}",
"}",
"return",
"$",
"sRet",
";",
"}"
] | Try to cleanup incomming shop_order.affiliate_code.
@param $sAffiliateCode
@return string | [
"Try",
"to",
"cleanup",
"incomming",
"shop_order",
".",
"affiliate_code",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L243-L270 |
31,623 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetMaxNumberOfShopReviewMailsToSend | public function GetMaxNumberOfShopReviewMailsToSend($iSendForShippingDateNewerThan)
{
if ($this->bDebug) {
echo '<br><br>';
}
$query = "SELECT *
FROM `shop_order`
WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'
AND `shop_order`.`shop_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sShopID)."'
AND `shop_order`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sLanguageID)."'
AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '".MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s', $iSendForShippingDateNewerThan))."'
AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'
AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'
AND `shop_order`.`adr_billing_country_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sUserCountryID)."'
";
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `shop_order`.`customer_number`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfCompletedOrders = MySqlLegacySupport::getInstance()->num_rows($rRow);
$query = ' SELECT * FROM `pkg_shop_rating_service_history` ';
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfReviewMailsSend = MySqlLegacySupport::getInstance()->num_rows($rRow);
$iPercentageToBeSend = $this->Shopreviewmail_PercentOfCustomers; //$this->GetConfigValue('shopreviewmail_percent_of_customers');;
$iPercentageMailSend = 100;
if (0 == $iNumberOfCompletedOrders && 0 == $iNumberOfReviewMailsSend) {
$iPercentageMailSend = 100;
} elseif ($iNumberOfCompletedOrders > 0) {
$iPercentageMailSend = ($iNumberOfReviewMailsSend / $iNumberOfCompletedOrders) * 100;
} else {
$iPercentageMailSend = 0;
}
if ($this->bDebug) {
echo '<br />';
}
if ($this->bDebug) {
echo __LINE__.'iPercentageToBeSend: '.$iPercentageToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfCompletedOrders: '.$iNumberOfCompletedOrders."\n<br />\n";
}
$iNumberOfReviewMailsToBeSend = ceil(($iPercentageToBeSend / 100) * $iNumberOfCompletedOrders);
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsToBeSend: '.$iNumberOfReviewMailsToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsSend: '.$iNumberOfReviewMailsSend."\n<br />\n";
}
echo '<br><br>';
// NOTE: the total possible mails covers all orders that have been send out
// (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)
return $iNumberOfReviewMailsToBeSend;
} | php | public function GetMaxNumberOfShopReviewMailsToSend($iSendForShippingDateNewerThan)
{
if ($this->bDebug) {
echo '<br><br>';
}
$query = "SELECT *
FROM `shop_order`
WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'
AND `shop_order`.`shop_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sShopID)."'
AND `shop_order`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sLanguageID)."'
AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '".MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s', $iSendForShippingDateNewerThan))."'
AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'
AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'
AND `shop_order`.`adr_billing_country_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sUserCountryID)."'
";
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `shop_order`.`customer_number`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfCompletedOrders = MySqlLegacySupport::getInstance()->num_rows($rRow);
$query = ' SELECT * FROM `pkg_shop_rating_service_history` ';
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfReviewMailsSend = MySqlLegacySupport::getInstance()->num_rows($rRow);
$iPercentageToBeSend = $this->Shopreviewmail_PercentOfCustomers; //$this->GetConfigValue('shopreviewmail_percent_of_customers');;
$iPercentageMailSend = 100;
if (0 == $iNumberOfCompletedOrders && 0 == $iNumberOfReviewMailsSend) {
$iPercentageMailSend = 100;
} elseif ($iNumberOfCompletedOrders > 0) {
$iPercentageMailSend = ($iNumberOfReviewMailsSend / $iNumberOfCompletedOrders) * 100;
} else {
$iPercentageMailSend = 0;
}
if ($this->bDebug) {
echo '<br />';
}
if ($this->bDebug) {
echo __LINE__.'iPercentageToBeSend: '.$iPercentageToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfCompletedOrders: '.$iNumberOfCompletedOrders."\n<br />\n";
}
$iNumberOfReviewMailsToBeSend = ceil(($iPercentageToBeSend / 100) * $iNumberOfCompletedOrders);
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsToBeSend: '.$iNumberOfReviewMailsToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsSend: '.$iNumberOfReviewMailsSend."\n<br />\n";
}
echo '<br><br>';
// NOTE: the total possible mails covers all orders that have been send out
// (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)
return $iNumberOfReviewMailsToBeSend;
} | [
"public",
"function",
"GetMaxNumberOfShopReviewMailsToSend",
"(",
"$",
"iSendForShippingDateNewerThan",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"'<br><br>'",
";",
"}",
"$",
"query",
"=",
"\"SELECT *\n FROM `shop_order`\n WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'\n AND `shop_order`.`shop_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"sShopID",
")",
".",
"\"'\n AND `shop_order`.`cms_language_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"sLanguageID",
")",
".",
"\"'\n AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"$",
"iSendForShippingDateNewerThan",
")",
")",
".",
"\"'\n AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'\n AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'\n AND `shop_order`.`adr_billing_country_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"sUserCountryID",
")",
".",
"\"'\n \"",
";",
"if",
"(",
"$",
"this",
"->",
"SendCustomersMailOnlyOnce",
"(",
")",
")",
"{",
"$",
"query",
".=",
"'GROUP BY `shop_order`.`customer_number`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"': '",
".",
"$",
"query",
".",
"\"\\n<br />\\n\"",
";",
"}",
"$",
"rRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"iNumberOfCompletedOrders",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"rRow",
")",
";",
"$",
"query",
"=",
"' SELECT * FROM `pkg_shop_rating_service_history` '",
";",
"if",
"(",
"$",
"this",
"->",
"SendCustomersMailOnlyOnce",
"(",
")",
")",
"{",
"$",
"query",
".=",
"'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"': '",
".",
"$",
"query",
".",
"\"\\n<br />\\n\"",
";",
"}",
"$",
"rRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"iNumberOfReviewMailsSend",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"rRow",
")",
";",
"$",
"iPercentageToBeSend",
"=",
"$",
"this",
"->",
"Shopreviewmail_PercentOfCustomers",
";",
"//$this->GetConfigValue('shopreviewmail_percent_of_customers');;",
"$",
"iPercentageMailSend",
"=",
"100",
";",
"if",
"(",
"0",
"==",
"$",
"iNumberOfCompletedOrders",
"&&",
"0",
"==",
"$",
"iNumberOfReviewMailsSend",
")",
"{",
"$",
"iPercentageMailSend",
"=",
"100",
";",
"}",
"elseif",
"(",
"$",
"iNumberOfCompletedOrders",
">",
"0",
")",
"{",
"$",
"iPercentageMailSend",
"=",
"(",
"$",
"iNumberOfReviewMailsSend",
"/",
"$",
"iNumberOfCompletedOrders",
")",
"*",
"100",
";",
"}",
"else",
"{",
"$",
"iPercentageMailSend",
"=",
"0",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"'<br />'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"'iPercentageToBeSend: '",
".",
"$",
"iPercentageToBeSend",
".",
"\"\\n<br />\\n\"",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"'iNumberOfCompletedOrders: '",
".",
"$",
"iNumberOfCompletedOrders",
".",
"\"\\n<br />\\n\"",
";",
"}",
"$",
"iNumberOfReviewMailsToBeSend",
"=",
"ceil",
"(",
"(",
"$",
"iPercentageToBeSend",
"/",
"100",
")",
"*",
"$",
"iNumberOfCompletedOrders",
")",
";",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"'iNumberOfReviewMailsToBeSend: '",
".",
"$",
"iNumberOfReviewMailsToBeSend",
".",
"\"\\n<br />\\n\"",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"__LINE__",
".",
"'iNumberOfReviewMailsSend: '",
".",
"$",
"iNumberOfReviewMailsSend",
".",
"\"\\n<br />\\n\"",
";",
"}",
"echo",
"'<br><br>'",
";",
"// NOTE: the total possible mails covers all orders that have been send out",
"// (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)",
"return",
"$",
"iNumberOfReviewMailsToBeSend",
";",
"}"
] | returns the number of review mails that should be send out. this is relevant
if only a specified percentages of all orders should get a mail.
@param $iSendForShippingDateNewerThan
@return int | [
"returns",
"the",
"number",
"of",
"review",
"mails",
"that",
"should",
"be",
"send",
"out",
".",
"this",
"is",
"relevant",
"if",
"only",
"a",
"specified",
"percentages",
"of",
"all",
"orders",
"should",
"get",
"a",
"mail",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L323-L395 |
31,624 | comporu/compo-core | src/Compo/Sonata/DashboardBundle/Admin/BlockAdmin.php | BlockAdmin.toString | public function toString($object)
{
if (!\is_object($object)) {
return '';
}
if (method_exists($object, 'getName') && null !== $object->getName()) {
return (string) $object->getName();
}
return parent::toString($object);
} | php | public function toString($object)
{
if (!\is_object($object)) {
return '';
}
if (method_exists($object, 'getName') && null !== $object->getName()) {
return (string) $object->getName();
}
return parent::toString($object);
} | [
"public",
"function",
"toString",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"\\",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"object",
",",
"'getName'",
")",
"&&",
"null",
"!==",
"$",
"object",
"->",
"getName",
"(",
")",
")",
"{",
"return",
"(",
"string",
")",
"$",
"object",
"->",
"getName",
"(",
")",
";",
"}",
"return",
"parent",
"::",
"toString",
"(",
"$",
"object",
")",
";",
"}"
] | Override needed to make the dashboard composer cleaner.
{@inheritdoc} | [
"Override",
"needed",
"to",
"make",
"the",
"dashboard",
"composer",
"cleaner",
"."
] | ebaa9fe8a4b831506c78fdf637da6b4deadec1e2 | https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/DashboardBundle/Admin/BlockAdmin.php#L281-L291 |
31,625 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleStringFields | public static function setSimpleStringFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::STRING,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->length(Database::MAX_VARCHAR_LENGTH)
->build();
}
} | php | public static function setSimpleStringFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::STRING,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->length(Database::MAX_VARCHAR_LENGTH)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleStringFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
",",
"bool",
"$",
"isUnique",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_string",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"STRING",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"unique",
"(",
"$",
"isUnique",
")",
"->",
"length",
"(",
"Database",
"::",
"MAX_VARCHAR_LENGTH",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard string fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
@param bool $isUnique
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"string",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L243-L271 |
31,626 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleFloatFields | public static function setSimpleFloatFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_float($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::FLOAT,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleFloatFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_float($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::FLOAT,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleFloatFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_float",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"FLOAT",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard float fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"float",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L340-L365 |
31,627 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleDecimalFields | public static function setSimpleDecimalFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
if (null !== $default && !is_numeric($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ', even though it is a string, it must be numeric '
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DECIMAL,
'default' => (string)(float)$default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->precision(Database::MAX_DECIMAL_PRECISION)
->scale(Database::MAX_DECIMAL_SCALE)
->build();
}
} | php | public static function setSimpleDecimalFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
if (null !== $default && !is_numeric($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ', even though it is a string, it must be numeric '
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DECIMAL,
'default' => (string)(float)$default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->precision(Database::MAX_DECIMAL_PRECISION)
->scale(Database::MAX_DECIMAL_SCALE)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleDecimalFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_string",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"is_numeric",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"', even though it is a string, it must be numeric '",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"DECIMAL",
",",
"'default'",
"=>",
"(",
"string",
")",
"(",
"float",
")",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"precision",
"(",
"Database",
"::",
"MAX_DECIMAL_PRECISION",
")",
"->",
"scale",
"(",
"Database",
"::",
"MAX_DECIMAL_SCALE",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard decimal fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"decimal",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L376-L409 |
31,628 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleDatetimeFields | public static function setSimpleDatetimeFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default) {
throw new \InvalidArgumentException('DateTime currently only support null as a default value');
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DATETIME_IMMUTABLE,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleDatetimeFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default) {
throw new \InvalidArgumentException('DateTime currently only support null as a default value');
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DATETIME_IMMUTABLE,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleDatetimeFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'DateTime currently only support null as a default value'",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"DATETIME_IMMUTABLE",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard dateTime fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"dateTime",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L420-L442 |
31,629 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleIntegerFields | public static function setSimpleIntegerFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_int($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::INTEGER,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->build();
}
} | php | public static function setSimpleIntegerFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_int($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::INTEGER,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleIntegerFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
",",
"bool",
"$",
"isUnique",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_int",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"INTEGER",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"unique",
"(",
"$",
"isUnique",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard integer fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
@param bool $isUnique
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"integer",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L454-L481 |
31,630 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleBooleanFields | public static function setSimpleBooleanFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_bool($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::BOOLEAN,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleBooleanFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_bool($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::BOOLEAN,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleBooleanFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_bool",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"BOOLEAN",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Set bog standard boolean fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"boolean",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L492-L517 |
31,631 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleJsonFields | public static function setSimpleJsonFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::JSON,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleJsonFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::JSON,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleJsonFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_string",
"(",
"$",
"default",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid default value '",
".",
"$",
"default",
".",
"' with type '",
".",
"self",
"::",
"getType",
"(",
"$",
"default",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"fieldBuilder",
"=",
"new",
"FieldBuilder",
"(",
"$",
"builder",
",",
"[",
"'fieldName'",
"=>",
"$",
"field",
",",
"'type'",
"=>",
"Type",
"::",
"JSON",
",",
"'default'",
"=>",
"$",
"default",
",",
"]",
")",
";",
"$",
"fieldBuilder",
"->",
"columnName",
"(",
"self",
"::",
"getColumnNameForField",
"(",
"$",
"field",
")",
")",
"->",
"nullable",
"(",
"null",
"===",
"$",
"default",
")",
"->",
"build",
"(",
")",
";",
"}",
"}"
] | Create JSON fields
Will use real JSON in the DB engine if it is supported
This should be used for any structured data, arrays, lists, simple objects
@param array $fields
@param ClassMetadataBuilder $builder
@param null $default | [
"Create",
"JSON",
"fields"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L530-L555 |
31,632 | edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleFields | public static function setSimpleFields(
array $fieldToType,
ClassMetadataBuilder $builder
): void {
foreach ($fieldToType as $field => $type) {
$method = "setSimple$type" . 'fields';
static::$method([$field], $builder);
}
} | php | public static function setSimpleFields(
array $fieldToType,
ClassMetadataBuilder $builder
): void {
foreach ($fieldToType as $field => $type) {
$method = "setSimple$type" . 'fields';
static::$method([$field], $builder);
}
} | [
"public",
"static",
"function",
"setSimpleFields",
"(",
"array",
"$",
"fieldToType",
",",
"ClassMetadataBuilder",
"$",
"builder",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"fieldToType",
"as",
"$",
"field",
"=>",
"$",
"type",
")",
"{",
"$",
"method",
"=",
"\"setSimple$type\"",
".",
"'fields'",
";",
"static",
"::",
"$",
"method",
"(",
"[",
"$",
"field",
"]",
",",
"$",
"builder",
")",
";",
"}",
"}"
] | Bulk create multiple fields of different simple types
Always creates nullable fields, if you want to set a default, you must call the type based method
@param array $fieldToType [
'fieldName'=>'fieldSimpleType'
]
@param ClassMetadataBuilder $builder | [
"Bulk",
"create",
"multiple",
"fields",
"of",
"different",
"simple",
"types"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L567-L575 |
31,633 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.GetInstanceFromSystemName | public static function GetInstanceFromSystemName($sSystemName)
{
$sQuery = "SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSystemName)."'";
$aData = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery));
if (is_array($aData)) {
$oInstance = TdbPkgShopRatingService::GetNewInstance($aData); // need to do this to morph to the correct subclass
} else {
$oInstance = null;
}
return $oInstance;
} | php | public static function GetInstanceFromSystemName($sSystemName)
{
$sQuery = "SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSystemName)."'";
$aData = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery));
if (is_array($aData)) {
$oInstance = TdbPkgShopRatingService::GetNewInstance($aData); // need to do this to morph to the correct subclass
} else {
$oInstance = null;
}
return $oInstance;
} | [
"public",
"static",
"function",
"GetInstanceFromSystemName",
"(",
"$",
"sSystemName",
")",
"{",
"$",
"sQuery",
"=",
"\"SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sSystemName",
")",
".",
"\"'\"",
";",
"$",
"aData",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aData",
")",
")",
"{",
"$",
"oInstance",
"=",
"TdbPkgShopRatingService",
"::",
"GetNewInstance",
"(",
"$",
"aData",
")",
";",
"// need to do this to morph to the correct subclass",
"}",
"else",
"{",
"$",
"oInstance",
"=",
"null",
";",
"}",
"return",
"$",
"oInstance",
";",
"}"
] | return the rating service via system name.
@static
@param string $sSystemName
@return TdbPkgShopRatingService | [
"return",
"the",
"rating",
"service",
"via",
"system",
"name",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L23-L34 |
31,634 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.GetNewInstance | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$oObject = parent::GetNewInstance($sData, $sLanguage);
if ($oObject && !empty($oObject->fieldClass)) {
$aData = $oObject->sqlData;
$sClassName = $aData['class'];
$oObject = new $sClassName();
/** @var $oInterface TCMSInterfaceManagerBase */
$oObject->LoadFromRow($aData);
}
return $oObject;
} | php | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$oObject = parent::GetNewInstance($sData, $sLanguage);
if ($oObject && !empty($oObject->fieldClass)) {
$aData = $oObject->sqlData;
$sClassName = $aData['class'];
$oObject = new $sClassName();
/** @var $oInterface TCMSInterfaceManagerBase */
$oObject->LoadFromRow($aData);
}
return $oObject;
} | [
"public",
"static",
"function",
"GetNewInstance",
"(",
"$",
"sData",
"=",
"null",
",",
"$",
"sLanguage",
"=",
"null",
")",
"{",
"$",
"oObject",
"=",
"parent",
"::",
"GetNewInstance",
"(",
"$",
"sData",
",",
"$",
"sLanguage",
")",
";",
"if",
"(",
"$",
"oObject",
"&&",
"!",
"empty",
"(",
"$",
"oObject",
"->",
"fieldClass",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"oObject",
"->",
"sqlData",
";",
"$",
"sClassName",
"=",
"$",
"aData",
"[",
"'class'",
"]",
";",
"$",
"oObject",
"=",
"new",
"$",
"sClassName",
"(",
")",
";",
"/** @var $oInterface TCMSInterfaceManagerBase */",
"$",
"oObject",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"}",
"return",
"$",
"oObject",
";",
"}"
] | Return new instance of "row-object".
factory creates a new instance and returns it.
@param string|array $sData - either the id of the object to load, or the row with which the instance should be initialized
@param string $sLanguage - init with the language passed
@return TdbPkgShopRatingService | [
"Return",
"new",
"instance",
"of",
"row",
"-",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L45-L58 |
31,635 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.Render | public function Render($sViewName = 'RatingService_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$sHTML = '';
$oView = new TViewParser();
/** @var $oView TViewParser */
//create view name for this "active" rating-service
if (!empty($this->fieldAffiliateValue)) {
$sViewName = $sViewName.'_'.trim($this->fieldAffiliateValue);
}
foreach ($aCallTimeVars as $sKeyName => $sValue) {
if (!empty($sKeyName)) {
$oView->AddVar($sKeyName, $sValue);
}
}
$sHTML .= $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
return $sHTML;
} | php | public function Render($sViewName = 'RatingService_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$sHTML = '';
$oView = new TViewParser();
/** @var $oView TViewParser */
//create view name for this "active" rating-service
if (!empty($this->fieldAffiliateValue)) {
$sViewName = $sViewName.'_'.trim($this->fieldAffiliateValue);
}
foreach ($aCallTimeVars as $sKeyName => $sValue) {
if (!empty($sKeyName)) {
$oView->AddVar($sKeyName, $sValue);
}
}
$sHTML .= $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
return $sHTML;
} | [
"public",
"function",
"Render",
"(",
"$",
"sViewName",
"=",
"'RatingService_standard'",
",",
"$",
"sViewSubType",
"=",
"'pkgShopRatingService/views'",
",",
"$",
"sViewType",
"=",
"'Customer'",
",",
"$",
"sSpotName",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sHTML",
"=",
"''",
";",
"$",
"oView",
"=",
"new",
"TViewParser",
"(",
")",
";",
"/** @var $oView TViewParser */",
"//create view name for this \"active\" rating-service",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldAffiliateValue",
")",
")",
"{",
"$",
"sViewName",
"=",
"$",
"sViewName",
".",
"'_'",
".",
"trim",
"(",
"$",
"this",
"->",
"fieldAffiliateValue",
")",
";",
"}",
"foreach",
"(",
"$",
"aCallTimeVars",
"as",
"$",
"sKeyName",
"=>",
"$",
"sValue",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"sKeyName",
")",
")",
"{",
"$",
"oView",
"->",
"AddVar",
"(",
"$",
"sKeyName",
",",
"$",
"sValue",
")",
";",
"}",
"}",
"$",
"sHTML",
".=",
"$",
"oView",
"->",
"RenderObjectPackageView",
"(",
"$",
"sViewName",
",",
"$",
"sViewSubType",
",",
"$",
"sViewType",
")",
";",
"return",
"$",
"sHTML",
";",
"}"
] | Render rating-widget for active rating-service.
@param string $sViewName
@param string $sViewSubType
@param string $sViewType
@param null $sSpotName
@param array $aCallTimeVars
@return string | [
"Render",
"rating",
"-",
"widget",
"for",
"active",
"rating",
"-",
"service",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L71-L91 |
31,636 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.UpdateMainScroeValue | protected function UpdateMainScroeValue()
{
$bRet = false;
$sQuery = " SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '".$this->id."' ";
$rs = MySqlLegacySupport::getInstance()->query($sQuery);
if ($rs) {
$oAVG = MySqlLegacySupport::getInstance()->fetch_object($rs);
}
//Update value
if ($oAVG->main_score > 0) {
$sQuery = "UPDATE pkg_shop_rating_service SET current_rating = '".$oAVG->main_score."', current_rating_date = NOW() WHERE id = '".$this->id."' ";
MySqlLegacySupport::getInstance()->query($sQuery);
$bRet = $oAVG->main_score;
}
return $bRet;
} | php | protected function UpdateMainScroeValue()
{
$bRet = false;
$sQuery = " SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '".$this->id."' ";
$rs = MySqlLegacySupport::getInstance()->query($sQuery);
if ($rs) {
$oAVG = MySqlLegacySupport::getInstance()->fetch_object($rs);
}
//Update value
if ($oAVG->main_score > 0) {
$sQuery = "UPDATE pkg_shop_rating_service SET current_rating = '".$oAVG->main_score."', current_rating_date = NOW() WHERE id = '".$this->id."' ";
MySqlLegacySupport::getInstance()->query($sQuery);
$bRet = $oAVG->main_score;
}
return $bRet;
} | [
"protected",
"function",
"UpdateMainScroeValue",
"(",
")",
"{",
"$",
"bRet",
"=",
"false",
";",
"$",
"sQuery",
"=",
"\" SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '\"",
".",
"$",
"this",
"->",
"id",
".",
"\"' \"",
";",
"$",
"rs",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"if",
"(",
"$",
"rs",
")",
"{",
"$",
"oAVG",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_object",
"(",
"$",
"rs",
")",
";",
"}",
"//Update value",
"if",
"(",
"$",
"oAVG",
"->",
"main_score",
">",
"0",
")",
"{",
"$",
"sQuery",
"=",
"\"UPDATE pkg_shop_rating_service SET current_rating = '\"",
".",
"$",
"oAVG",
"->",
"main_score",
".",
"\"', current_rating_date = NOW() WHERE id = '\"",
".",
"$",
"this",
"->",
"id",
".",
"\"' \"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"$",
"bRet",
"=",
"$",
"oAVG",
"->",
"main_score",
";",
"}",
"return",
"$",
"bRet",
";",
"}"
] | Update main score value of rating service - calculated from `pkg_shop_rating_service_rating`.`score`.
@return bool | [
"Update",
"main",
"score",
"value",
"of",
"rating",
"service",
"-",
"calculated",
"from",
"pkg_shop_rating_service_rating",
".",
"score",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L108-L125 |
31,637 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.SetUserMode | public static function SetUserMode($sMode)
{
$aAllowedModes = array('register', 'user', 'guest');
if (false == in_array($sMode, $aAllowedModes)) {
trigger_error('invalid mode requested. please use one of '.implode(', ', $aAllowedModes), E_USER_ERROR);
}
$_SESSION['tw_order_umode'] = $sMode;
} | php | public static function SetUserMode($sMode)
{
$aAllowedModes = array('register', 'user', 'guest');
if (false == in_array($sMode, $aAllowedModes)) {
trigger_error('invalid mode requested. please use one of '.implode(', ', $aAllowedModes), E_USER_ERROR);
}
$_SESSION['tw_order_umode'] = $sMode;
} | [
"public",
"static",
"function",
"SetUserMode",
"(",
"$",
"sMode",
")",
"{",
"$",
"aAllowedModes",
"=",
"array",
"(",
"'register'",
",",
"'user'",
",",
"'guest'",
")",
";",
"if",
"(",
"false",
"==",
"in_array",
"(",
"$",
"sMode",
",",
"$",
"aAllowedModes",
")",
")",
"{",
"trigger_error",
"(",
"'invalid mode requested. please use one of '",
".",
"implode",
"(",
"', '",
",",
"$",
"aAllowedModes",
")",
",",
"E_USER_ERROR",
")",
";",
"}",
"$",
"_SESSION",
"[",
"'tw_order_umode'",
"]",
"=",
"$",
"sMode",
";",
"}"
] | Set a user mode.
@static
@param string $sMode - must be one of register, user, or guest | [
"Set",
"a",
"user",
"mode",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L126-L133 |
31,638 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.GetUserMode | public static function GetUserMode()
{
$umode = 'register';
if (array_key_exists('tw_order_umode', $_SESSION)) {
$umode = $_SESSION['tw_order_umode'];
}
if ('user' != $umode) {
// check if the user is signed in... if so, we change the mode to user
$oUser = self::getExtranetUserProvider()->getActiveUser();
if ($oUser && $oUser->IsLoggedIn()) {
$umode = 'user';
TShopStepUserDataV2::SetUserMode($umode);
}
}
return $umode;
} | php | public static function GetUserMode()
{
$umode = 'register';
if (array_key_exists('tw_order_umode', $_SESSION)) {
$umode = $_SESSION['tw_order_umode'];
}
if ('user' != $umode) {
// check if the user is signed in... if so, we change the mode to user
$oUser = self::getExtranetUserProvider()->getActiveUser();
if ($oUser && $oUser->IsLoggedIn()) {
$umode = 'user';
TShopStepUserDataV2::SetUserMode($umode);
}
}
return $umode;
} | [
"public",
"static",
"function",
"GetUserMode",
"(",
")",
"{",
"$",
"umode",
"=",
"'register'",
";",
"if",
"(",
"array_key_exists",
"(",
"'tw_order_umode'",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"umode",
"=",
"$",
"_SESSION",
"[",
"'tw_order_umode'",
"]",
";",
"}",
"if",
"(",
"'user'",
"!=",
"$",
"umode",
")",
"{",
"// check if the user is signed in... if so, we change the mode to user",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"if",
"(",
"$",
"oUser",
"&&",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"umode",
"=",
"'user'",
";",
"TShopStepUserDataV2",
"::",
"SetUserMode",
"(",
"$",
"umode",
")",
";",
"}",
"}",
"return",
"$",
"umode",
";",
"}"
] | return the current registration mode... if the user is logged in the mode will be forced to user.
@return string | [
"return",
"the",
"current",
"registration",
"mode",
"...",
"if",
"the",
"user",
"is",
"logged",
"in",
"the",
"mode",
"will",
"be",
"forced",
"to",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L140-L156 |
31,639 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.Init | public function Init()
{
parent::Init();
$this->bUserDataSubmission = false;
$this->InitUserData();
// primary address should be initialized first
if (TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->InitShippingAddress();
$this->InitBillingAddress();
} else {
$this->InitBillingAddress();
$this->InitShippingAddress();
}
// change shipping to billing
$this->InitChangeShipToBillingState();
} | php | public function Init()
{
parent::Init();
$this->bUserDataSubmission = false;
$this->InitUserData();
// primary address should be initialized first
if (TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->InitShippingAddress();
$this->InitBillingAddress();
} else {
$this->InitBillingAddress();
$this->InitShippingAddress();
}
// change shipping to billing
$this->InitChangeShipToBillingState();
} | [
"public",
"function",
"Init",
"(",
")",
"{",
"parent",
"::",
"Init",
"(",
")",
";",
"$",
"this",
"->",
"bUserDataSubmission",
"=",
"false",
";",
"$",
"this",
"->",
"InitUserData",
"(",
")",
";",
"// primary address should be initialized first",
"if",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_SHIPPING",
"==",
"$",
"this",
"->",
"AddressUsedAsPrimaryAddress",
"(",
")",
")",
"{",
"$",
"this",
"->",
"InitShippingAddress",
"(",
")",
";",
"$",
"this",
"->",
"InitBillingAddress",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"InitBillingAddress",
"(",
")",
";",
"$",
"this",
"->",
"InitShippingAddress",
"(",
")",
";",
"}",
"// change shipping to billing",
"$",
"this",
"->",
"InitChangeShipToBillingState",
"(",
")",
";",
"}"
] | we use the method to populate the state and user data. | [
"we",
"use",
"the",
"method",
"to",
"populate",
"the",
"state",
"and",
"user",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L161-L180 |
31,640 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.InitUserData | protected function InitUserData()
{
$userData = $this->getInputFilterUtil()->getFilteredPostInput('aUser');
if (null === $userData) {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$this->SetUserData($oUser->sqlData);
} else {
$this->SetUserData($userData);
$this->bUserDataSubmission = true;
}
} | php | protected function InitUserData()
{
$userData = $this->getInputFilterUtil()->getFilteredPostInput('aUser');
if (null === $userData) {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$this->SetUserData($oUser->sqlData);
} else {
$this->SetUserData($userData);
$this->bUserDataSubmission = true;
}
} | [
"protected",
"function",
"InitUserData",
"(",
")",
"{",
"$",
"userData",
"=",
"$",
"this",
"->",
"getInputFilterUtil",
"(",
")",
"->",
"getFilteredPostInput",
"(",
"'aUser'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"userData",
")",
"{",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"$",
"this",
"->",
"SetUserData",
"(",
"$",
"oUser",
"->",
"sqlData",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"SetUserData",
"(",
"$",
"userData",
")",
";",
"$",
"this",
"->",
"bUserDataSubmission",
"=",
"true",
";",
"}",
"}"
] | initialize user data and set the state of UserDataSubmission to true if submitted
if no data was submitted the user data will be loaded by the data of the user object. | [
"initialize",
"user",
"data",
"and",
"set",
"the",
"state",
"of",
"UserDataSubmission",
"to",
"true",
"if",
"submitted",
"if",
"no",
"data",
"was",
"submitted",
"the",
"user",
"data",
"will",
"be",
"loaded",
"by",
"the",
"data",
"of",
"the",
"user",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L186-L196 |
31,641 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.InitShippingAddress | protected function InitShippingAddress()
{
$inputFilterUtil = $this->getInputFilterUtil();
$shippingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
if (null !== $shippingAddressData) {
$this->SetShippingAddressData($shippingAddressData);
$this->bUserDataSubmission = true;
} else {
$billingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
if (null !== $billingAddressData && TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING == $this->AddressUsedAsPrimaryAddress()) {
$this->SetShippingAddressData($this->GetBillingAddressData());
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oShipping = $oUser->GetShippingAddress();
$aShipping = array();
if ($oShipping) {
$aShipping = $oShipping->sqlData;
}
$this->SetShippingAddressData($aShipping);
}
}
} | php | protected function InitShippingAddress()
{
$inputFilterUtil = $this->getInputFilterUtil();
$shippingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
if (null !== $shippingAddressData) {
$this->SetShippingAddressData($shippingAddressData);
$this->bUserDataSubmission = true;
} else {
$billingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
if (null !== $billingAddressData && TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING == $this->AddressUsedAsPrimaryAddress()) {
$this->SetShippingAddressData($this->GetBillingAddressData());
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oShipping = $oUser->GetShippingAddress();
$aShipping = array();
if ($oShipping) {
$aShipping = $oShipping->sqlData;
}
$this->SetShippingAddressData($aShipping);
}
}
} | [
"protected",
"function",
"InitShippingAddress",
"(",
")",
"{",
"$",
"inputFilterUtil",
"=",
"$",
"this",
"->",
"getInputFilterUtil",
"(",
")",
";",
"$",
"shippingAddressData",
"=",
"$",
"inputFilterUtil",
"->",
"getFilteredPostInput",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_SHIPPING",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"shippingAddressData",
")",
"{",
"$",
"this",
"->",
"SetShippingAddressData",
"(",
"$",
"shippingAddressData",
")",
";",
"$",
"this",
"->",
"bUserDataSubmission",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"billingAddressData",
"=",
"$",
"inputFilterUtil",
"->",
"getFilteredPostInput",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_BILLING",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"billingAddressData",
"&&",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_BILLING",
"==",
"$",
"this",
"->",
"AddressUsedAsPrimaryAddress",
"(",
")",
")",
"{",
"$",
"this",
"->",
"SetShippingAddressData",
"(",
"$",
"this",
"->",
"GetBillingAddressData",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"$",
"oShipping",
"=",
"$",
"oUser",
"->",
"GetShippingAddress",
"(",
")",
";",
"$",
"aShipping",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"oShipping",
")",
"{",
"$",
"aShipping",
"=",
"$",
"oShipping",
"->",
"sqlData",
";",
"}",
"$",
"this",
"->",
"SetShippingAddressData",
"(",
"$",
"aShipping",
")",
";",
"}",
"}",
"}"
] | initialize shipping address data and set the state of UserDataSubmission to true if data was submitted
if no data was submitted the shipping address data will be loaded by shipping address of user. | [
"initialize",
"shipping",
"address",
"data",
"and",
"set",
"the",
"state",
"of",
"UserDataSubmission",
"to",
"true",
"if",
"data",
"was",
"submitted",
"if",
"no",
"data",
"was",
"submitted",
"the",
"shipping",
"address",
"data",
"will",
"be",
"loaded",
"by",
"shipping",
"address",
"of",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L202-L223 |
31,642 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.InitBillingAddress | protected function InitBillingAddress()
{
$inputFilterUtil = $this->getInputFilterUtil();
$billingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
if (null !== $billingAddressData) {
$this->SetBillingAddressData($billingAddressData);
$this->bUserDataSubmission = true;
} else {
$shippingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
if (null !== $shippingAddressData && TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->SetBillingAddressData($this->GetShippingAddressData());
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oBilling = $oUser->GetBillingAddress();
$aBilling = array();
if ($oBilling) {
$aBilling = $oBilling->sqlData;
}
$this->SetBillingAddressData($aBilling);
}
}
} | php | protected function InitBillingAddress()
{
$inputFilterUtil = $this->getInputFilterUtil();
$billingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
if (null !== $billingAddressData) {
$this->SetBillingAddressData($billingAddressData);
$this->bUserDataSubmission = true;
} else {
$shippingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
if (null !== $shippingAddressData && TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->SetBillingAddressData($this->GetShippingAddressData());
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oBilling = $oUser->GetBillingAddress();
$aBilling = array();
if ($oBilling) {
$aBilling = $oBilling->sqlData;
}
$this->SetBillingAddressData($aBilling);
}
}
} | [
"protected",
"function",
"InitBillingAddress",
"(",
")",
"{",
"$",
"inputFilterUtil",
"=",
"$",
"this",
"->",
"getInputFilterUtil",
"(",
")",
";",
"$",
"billingAddressData",
"=",
"$",
"inputFilterUtil",
"->",
"getFilteredPostInput",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_BILLING",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"billingAddressData",
")",
"{",
"$",
"this",
"->",
"SetBillingAddressData",
"(",
"$",
"billingAddressData",
")",
";",
"$",
"this",
"->",
"bUserDataSubmission",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"shippingAddressData",
"=",
"$",
"inputFilterUtil",
"->",
"getFilteredPostInput",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_SHIPPING",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"shippingAddressData",
"&&",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_SHIPPING",
"==",
"$",
"this",
"->",
"AddressUsedAsPrimaryAddress",
"(",
")",
")",
"{",
"$",
"this",
"->",
"SetBillingAddressData",
"(",
"$",
"this",
"->",
"GetShippingAddressData",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"$",
"oBilling",
"=",
"$",
"oUser",
"->",
"GetBillingAddress",
"(",
")",
";",
"$",
"aBilling",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"oBilling",
")",
"{",
"$",
"aBilling",
"=",
"$",
"oBilling",
"->",
"sqlData",
";",
"}",
"$",
"this",
"->",
"SetBillingAddressData",
"(",
"$",
"aBilling",
")",
";",
"}",
"}",
"}"
] | initialize billing address data and set the state of UserDataSubmission to true if data was submitted
if no data was submitted the billing address data will be loaded by billing address of user. | [
"initialize",
"billing",
"address",
"data",
"and",
"set",
"the",
"state",
"of",
"UserDataSubmission",
"to",
"true",
"if",
"data",
"was",
"submitted",
"if",
"no",
"data",
"was",
"submitted",
"the",
"billing",
"address",
"data",
"will",
"be",
"loaded",
"by",
"billing",
"address",
"of",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L229-L250 |
31,643 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.ValidateUser | protected function ValidateUser($aUserData)
{
$bValid = false;
$oActiveUser = self::getExtranetUserProvider()->getActiveUser();
if ($oActiveUser && is_array($oActiveUser->sqlData) && array_key_exists('customer_number', $oActiveUser->sqlData)) {
$aUserData['customer_number'] = $oActiveUser->sqlData['customer_number'];
}
$oUser = TdbDataExtranetUser::GetNewInstance($aUserData);
$bValid = $oUser->ValidateData();
if ('register' == TShopStepUserDataV2::GetUserMode()) {
$bValid = ($oUser->ValidateLoginData($aUserData) && $bValid);
} elseif ('guest' == TShopStepUserDataV2::GetUserMode()) {
if (TdbDataExtranet::GetInstance()->fieldLoginIsEmail) {
$bValid = ($this->validateUserEMail($aUserData['name']) && $bValid);
} else {
$bValid = ($this->validateUserEMail($aUserData['email']) && $bValid);
}
}
return $bValid;
} | php | protected function ValidateUser($aUserData)
{
$bValid = false;
$oActiveUser = self::getExtranetUserProvider()->getActiveUser();
if ($oActiveUser && is_array($oActiveUser->sqlData) && array_key_exists('customer_number', $oActiveUser->sqlData)) {
$aUserData['customer_number'] = $oActiveUser->sqlData['customer_number'];
}
$oUser = TdbDataExtranetUser::GetNewInstance($aUserData);
$bValid = $oUser->ValidateData();
if ('register' == TShopStepUserDataV2::GetUserMode()) {
$bValid = ($oUser->ValidateLoginData($aUserData) && $bValid);
} elseif ('guest' == TShopStepUserDataV2::GetUserMode()) {
if (TdbDataExtranet::GetInstance()->fieldLoginIsEmail) {
$bValid = ($this->validateUserEMail($aUserData['name']) && $bValid);
} else {
$bValid = ($this->validateUserEMail($aUserData['email']) && $bValid);
}
}
return $bValid;
} | [
"protected",
"function",
"ValidateUser",
"(",
"$",
"aUserData",
")",
"{",
"$",
"bValid",
"=",
"false",
";",
"$",
"oActiveUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"if",
"(",
"$",
"oActiveUser",
"&&",
"is_array",
"(",
"$",
"oActiveUser",
"->",
"sqlData",
")",
"&&",
"array_key_exists",
"(",
"'customer_number'",
",",
"$",
"oActiveUser",
"->",
"sqlData",
")",
")",
"{",
"$",
"aUserData",
"[",
"'customer_number'",
"]",
"=",
"$",
"oActiveUser",
"->",
"sqlData",
"[",
"'customer_number'",
"]",
";",
"}",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetNewInstance",
"(",
"$",
"aUserData",
")",
";",
"$",
"bValid",
"=",
"$",
"oUser",
"->",
"ValidateData",
"(",
")",
";",
"if",
"(",
"'register'",
"==",
"TShopStepUserDataV2",
"::",
"GetUserMode",
"(",
")",
")",
"{",
"$",
"bValid",
"=",
"(",
"$",
"oUser",
"->",
"ValidateLoginData",
"(",
"$",
"aUserData",
")",
"&&",
"$",
"bValid",
")",
";",
"}",
"elseif",
"(",
"'guest'",
"==",
"TShopStepUserDataV2",
"::",
"GetUserMode",
"(",
")",
")",
"{",
"if",
"(",
"TdbDataExtranet",
"::",
"GetInstance",
"(",
")",
"->",
"fieldLoginIsEmail",
")",
"{",
"$",
"bValid",
"=",
"(",
"$",
"this",
"->",
"validateUserEMail",
"(",
"$",
"aUserData",
"[",
"'name'",
"]",
")",
"&&",
"$",
"bValid",
")",
";",
"}",
"else",
"{",
"$",
"bValid",
"=",
"(",
"$",
"this",
"->",
"validateUserEMail",
"(",
"$",
"aUserData",
"[",
"'email'",
"]",
")",
"&&",
"$",
"bValid",
")",
";",
"}",
"}",
"return",
"$",
"bValid",
";",
"}"
] | validate the user base data. registration request will also validate user name and password.
@param array $aUserData
@return bool | [
"validate",
"the",
"user",
"base",
"data",
".",
"registration",
"request",
"will",
"also",
"validate",
"user",
"name",
"and",
"password",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L480-L502 |
31,644 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.ValidateShippingAddress | protected function ValidateShippingAddress($aAddress)
{
$oAddress = TdbDataExtranetUserAddress::GetNewInstance($aAddress);
return $oAddress->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
} | php | protected function ValidateShippingAddress($aAddress)
{
$oAddress = TdbDataExtranetUserAddress::GetNewInstance($aAddress);
return $oAddress->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
} | [
"protected",
"function",
"ValidateShippingAddress",
"(",
"$",
"aAddress",
")",
"{",
"$",
"oAddress",
"=",
"TdbDataExtranetUserAddress",
"::",
"GetNewInstance",
"(",
"$",
"aAddress",
")",
";",
"return",
"$",
"oAddress",
"->",
"ValidateData",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_SHIPPING",
")",
";",
"}"
] | validate shipping address.
@param array $aAddress
@return bool | [
"validate",
"shipping",
"address",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L523-L528 |
31,645 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.GetShipToBillingAddress | protected function GetShipToBillingAddress()
{
if (array_key_exists('bShipToBillingAddress', $this->aUserData)) {
return $this->aUserData['bShipToBillingAddress'];
}
if (array_key_exists('shopstepuserdata_bShipToBillingAddress', $_SESSION)) {
return $_SESSION['shopstepuserdata_bShipToBillingAddress'];
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
return $oUser->ShipToBillingAddress() ? (1) : (0);
}
} | php | protected function GetShipToBillingAddress()
{
if (array_key_exists('bShipToBillingAddress', $this->aUserData)) {
return $this->aUserData['bShipToBillingAddress'];
}
if (array_key_exists('shopstepuserdata_bShipToBillingAddress', $_SESSION)) {
return $_SESSION['shopstepuserdata_bShipToBillingAddress'];
} else {
$oUser = self::getExtranetUserProvider()->getActiveUser();
return $oUser->ShipToBillingAddress() ? (1) : (0);
}
} | [
"protected",
"function",
"GetShipToBillingAddress",
"(",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'bShipToBillingAddress'",
",",
"$",
"this",
"->",
"aUserData",
")",
")",
"{",
"return",
"$",
"this",
"->",
"aUserData",
"[",
"'bShipToBillingAddress'",
"]",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"'shopstepuserdata_bShipToBillingAddress'",
",",
"$",
"_SESSION",
")",
")",
"{",
"return",
"$",
"_SESSION",
"[",
"'shopstepuserdata_bShipToBillingAddress'",
"]",
";",
"}",
"else",
"{",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"return",
"$",
"oUser",
"->",
"ShipToBillingAddress",
"(",
")",
"?",
"(",
"1",
")",
":",
"(",
"0",
")",
";",
"}",
"}"
] | return 1 if the user wants to ship to the billing address, else 0.
@return int | [
"return",
"1",
"if",
"the",
"user",
"wants",
"to",
"ship",
"to",
"the",
"billing",
"address",
"else",
"0",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L648-L660 |
31,646 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.GetShippingAddressData | protected function GetShippingAddressData($sReturnThisParameterOnly = null)
{
$aReturnVal = false;
if (array_key_exists('aShipping', $this->aUserData)) {
$aAddress = $this->aUserData['aShipping'];
if (array_key_exists('id', $aAddress) && !array_key_exists('selectedAddressId', $aAddress)) {
$aAddress['selectedAddressId'] = $aAddress['id'];
}
$oActiveUser = self::getExtranetUserProvider()->getActiveUser();
if ($oActiveUser && !empty($oActiveUser->id)) {
$aAddress['data_extranet_user_id'] = $oActiveUser->id;
}
$aCheckboxFields = $this->GetShippingAddressCheckboxFields();
foreach ($aCheckboxFields as $sFieldName) {
if (!array_key_exists($sFieldName, $aAddress)) {
$aAddress[$sFieldName] = '0';
}
}
if (!is_null($sReturnThisParameterOnly)) {
if (array_key_exists($sReturnThisParameterOnly, $aAddress)) {
$aReturnVal = $aAddress[$sReturnThisParameterOnly];
}
} else {
$aReturnVal = $aAddress;
}
}
return $aReturnVal;
} | php | protected function GetShippingAddressData($sReturnThisParameterOnly = null)
{
$aReturnVal = false;
if (array_key_exists('aShipping', $this->aUserData)) {
$aAddress = $this->aUserData['aShipping'];
if (array_key_exists('id', $aAddress) && !array_key_exists('selectedAddressId', $aAddress)) {
$aAddress['selectedAddressId'] = $aAddress['id'];
}
$oActiveUser = self::getExtranetUserProvider()->getActiveUser();
if ($oActiveUser && !empty($oActiveUser->id)) {
$aAddress['data_extranet_user_id'] = $oActiveUser->id;
}
$aCheckboxFields = $this->GetShippingAddressCheckboxFields();
foreach ($aCheckboxFields as $sFieldName) {
if (!array_key_exists($sFieldName, $aAddress)) {
$aAddress[$sFieldName] = '0';
}
}
if (!is_null($sReturnThisParameterOnly)) {
if (array_key_exists($sReturnThisParameterOnly, $aAddress)) {
$aReturnVal = $aAddress[$sReturnThisParameterOnly];
}
} else {
$aReturnVal = $aAddress;
}
}
return $aReturnVal;
} | [
"protected",
"function",
"GetShippingAddressData",
"(",
"$",
"sReturnThisParameterOnly",
"=",
"null",
")",
"{",
"$",
"aReturnVal",
"=",
"false",
";",
"if",
"(",
"array_key_exists",
"(",
"'aShipping'",
",",
"$",
"this",
"->",
"aUserData",
")",
")",
"{",
"$",
"aAddress",
"=",
"$",
"this",
"->",
"aUserData",
"[",
"'aShipping'",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"'id'",
",",
"$",
"aAddress",
")",
"&&",
"!",
"array_key_exists",
"(",
"'selectedAddressId'",
",",
"$",
"aAddress",
")",
")",
"{",
"$",
"aAddress",
"[",
"'selectedAddressId'",
"]",
"=",
"$",
"aAddress",
"[",
"'id'",
"]",
";",
"}",
"$",
"oActiveUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"if",
"(",
"$",
"oActiveUser",
"&&",
"!",
"empty",
"(",
"$",
"oActiveUser",
"->",
"id",
")",
")",
"{",
"$",
"aAddress",
"[",
"'data_extranet_user_id'",
"]",
"=",
"$",
"oActiveUser",
"->",
"id",
";",
"}",
"$",
"aCheckboxFields",
"=",
"$",
"this",
"->",
"GetShippingAddressCheckboxFields",
"(",
")",
";",
"foreach",
"(",
"$",
"aCheckboxFields",
"as",
"$",
"sFieldName",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"sFieldName",
",",
"$",
"aAddress",
")",
")",
"{",
"$",
"aAddress",
"[",
"$",
"sFieldName",
"]",
"=",
"'0'",
";",
"}",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sReturnThisParameterOnly",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"sReturnThisParameterOnly",
",",
"$",
"aAddress",
")",
")",
"{",
"$",
"aReturnVal",
"=",
"$",
"aAddress",
"[",
"$",
"sReturnThisParameterOnly",
"]",
";",
"}",
"}",
"else",
"{",
"$",
"aReturnVal",
"=",
"$",
"aAddress",
";",
"}",
"}",
"return",
"$",
"aReturnVal",
";",
"}"
] | return shipping address data from user post.
@param string $sReturnThisParameterOnly - if set, then only that field of the address is returned. if that field is not found, we return false
@return array|bool | [
"return",
"shipping",
"address",
"data",
"from",
"user",
"post",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L750-L779 |
31,647 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Field/FieldGenerator.php | FieldGenerator.generateField | public function generateField(
string $fieldFqn,
string $fieldType,
?string $phpType = null,
$defaultValue = null,
bool $isUnique = false
): string {
$this->validateArguments($fieldFqn, $fieldType, $phpType);
$this->setupClassProperties($fieldFqn, $fieldType, $phpType, $defaultValue, $isUnique);
$this->pathHelper->ensurePathExists($this->fieldsPath);
$this->pathHelper->ensurePathExists($this->fieldsInterfacePath);
$this->assertFileDoesNotExist($this->getTraitPath(), 'Trait');
$this->assertFileDoesNotExist($this->getInterfacePath(), 'Interface');
if (true === $this->isArchetype) {
return $this->createFieldFromArchetype();
}
return $this->createDbalField();
} | php | public function generateField(
string $fieldFqn,
string $fieldType,
?string $phpType = null,
$defaultValue = null,
bool $isUnique = false
): string {
$this->validateArguments($fieldFqn, $fieldType, $phpType);
$this->setupClassProperties($fieldFqn, $fieldType, $phpType, $defaultValue, $isUnique);
$this->pathHelper->ensurePathExists($this->fieldsPath);
$this->pathHelper->ensurePathExists($this->fieldsInterfacePath);
$this->assertFileDoesNotExist($this->getTraitPath(), 'Trait');
$this->assertFileDoesNotExist($this->getInterfacePath(), 'Interface');
if (true === $this->isArchetype) {
return $this->createFieldFromArchetype();
}
return $this->createDbalField();
} | [
"public",
"function",
"generateField",
"(",
"string",
"$",
"fieldFqn",
",",
"string",
"$",
"fieldType",
",",
"?",
"string",
"$",
"phpType",
"=",
"null",
",",
"$",
"defaultValue",
"=",
"null",
",",
"bool",
"$",
"isUnique",
"=",
"false",
")",
":",
"string",
"{",
"$",
"this",
"->",
"validateArguments",
"(",
"$",
"fieldFqn",
",",
"$",
"fieldType",
",",
"$",
"phpType",
")",
";",
"$",
"this",
"->",
"setupClassProperties",
"(",
"$",
"fieldFqn",
",",
"$",
"fieldType",
",",
"$",
"phpType",
",",
"$",
"defaultValue",
",",
"$",
"isUnique",
")",
";",
"$",
"this",
"->",
"pathHelper",
"->",
"ensurePathExists",
"(",
"$",
"this",
"->",
"fieldsPath",
")",
";",
"$",
"this",
"->",
"pathHelper",
"->",
"ensurePathExists",
"(",
"$",
"this",
"->",
"fieldsInterfacePath",
")",
";",
"$",
"this",
"->",
"assertFileDoesNotExist",
"(",
"$",
"this",
"->",
"getTraitPath",
"(",
")",
",",
"'Trait'",
")",
";",
"$",
"this",
"->",
"assertFileDoesNotExist",
"(",
"$",
"this",
"->",
"getInterfacePath",
"(",
")",
",",
"'Interface'",
")",
";",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"isArchetype",
")",
"{",
"return",
"$",
"this",
"->",
"createFieldFromArchetype",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"createDbalField",
"(",
")",
";",
"}"
] | Generate a new Field based on a property name and Doctrine Type or Archetype field FQN
@see MappingHelper::ALL_DBAL_TYPES for the full list of Dbal Types
@param string $fieldFqn
@param string $fieldType
@param null|string $phpType
@param mixed $defaultValue
@param bool $isUnique
@return string - The Fully Qualified Name of the generated Field Trait
@throws DoctrineStaticMetaException
@throws \ReflectionException
@SuppressWarnings(PHPMD.StaticAccess)
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Generate",
"a",
"new",
"Field",
"based",
"on",
"a",
"property",
"name",
"and",
"Doctrine",
"Type",
"or",
"Archetype",
"field",
"FQN"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Field/FieldGenerator.php#L181-L202 |
31,648 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Field/FieldGenerator.php | FieldGenerator.traitFqnLooksLikeField | protected function traitFqnLooksLikeField(string $traitFqn): bool
{
try {
$reflection = new \ts\Reflection\ReflectionClass($traitFqn);
} catch (\ReflectionException $e) {
throw new \InvalidArgumentException(
'invalid traitFqn ' . $traitFqn . ' does not seem to exist',
$e->getCode(),
$e
);
}
if (true !== $reflection->isTrait()) {
throw new \InvalidArgumentException('field type is not a trait FQN');
}
if ('FieldTrait' !== \substr($traitFqn, -\strlen('FieldTrait'))) {
throw new \InvalidArgumentException('traitFqn does not end in FieldTrait');
}
return true;
} | php | protected function traitFqnLooksLikeField(string $traitFqn): bool
{
try {
$reflection = new \ts\Reflection\ReflectionClass($traitFqn);
} catch (\ReflectionException $e) {
throw new \InvalidArgumentException(
'invalid traitFqn ' . $traitFqn . ' does not seem to exist',
$e->getCode(),
$e
);
}
if (true !== $reflection->isTrait()) {
throw new \InvalidArgumentException('field type is not a trait FQN');
}
if ('FieldTrait' !== \substr($traitFqn, -\strlen('FieldTrait'))) {
throw new \InvalidArgumentException('traitFqn does not end in FieldTrait');
}
return true;
} | [
"protected",
"function",
"traitFqnLooksLikeField",
"(",
"string",
"$",
"traitFqn",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ts",
"\\",
"Reflection",
"\\",
"ReflectionClass",
"(",
"$",
"traitFqn",
")",
";",
"}",
"catch",
"(",
"\\",
"ReflectionException",
"$",
"e",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'invalid traitFqn '",
".",
"$",
"traitFqn",
".",
"' does not seem to exist'",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
")",
";",
"}",
"if",
"(",
"true",
"!==",
"$",
"reflection",
"->",
"isTrait",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'field type is not a trait FQN'",
")",
";",
"}",
"if",
"(",
"'FieldTrait'",
"!==",
"\\",
"substr",
"(",
"$",
"traitFqn",
",",
"-",
"\\",
"strlen",
"(",
"'FieldTrait'",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'traitFqn does not end in FieldTrait'",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Does the specified trait FQN look like a field trait?
@param string $traitFqn
@return bool
@throws \ReflectionException | [
"Does",
"the",
"specified",
"trait",
"FQN",
"look",
"like",
"a",
"field",
"trait?"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Field/FieldGenerator.php#L252-L271 |
31,649 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Field/FieldGenerator.php | FieldGenerator.setupClassProperties | protected function setupClassProperties(
string $fieldFqn,
string $fieldType,
?string $phpType,
$defaultValue,
bool $isUnique
): void {
$this->isArchetype = false;
$this->fieldType = \strtolower($fieldType);
if (true !== \in_array($this->fieldType, MappingHelper::COMMON_TYPES, true)) {
$this->isArchetype = true;
$this->fieldType = $fieldType;
}
$this->phpType = $phpType ?? $this->getPhpTypeForDbalType();
$this->defaultValue = $this->typeHelper->normaliseValueToType($defaultValue, $this->phpType);
if (null !== $this->defaultValue) {
$defaultValueType = $this->typeHelper->getType($this->defaultValue);
if ($defaultValueType !== $this->phpType) {
throw new \InvalidArgumentException(
'default value ' .
$this->defaultValue .
' has the type: ' .
$defaultValueType
.
' whereas the phpType for this field has been set as ' .
$this->phpType .
', these do not match up'
);
}
}
$this->isNullable = (null === $defaultValue);
$this->isUnique = $isUnique;
if (\substr($fieldFqn, -\strlen(self::FIELD_TRAIT_SUFFIX)) === self::FIELD_TRAIT_SUFFIX) {
$fieldFqn = \substr($fieldFqn, 0, -\strlen(self::FIELD_TRAIT_SUFFIX));
}
$this->fieldFqn = $fieldFqn;
list($className, $traitNamespace, $traitSubDirectories) = $this->parseFullyQualifiedName(
$this->fieldFqn,
$this->srcSubFolderName
);
$this->className = $className;
list(, $interfaceNamespace, $interfaceSubDirectories) = $this->parseFullyQualifiedName(
\str_replace('Traits', 'Interfaces', $this->fieldFqn),
$this->srcSubFolderName
);
$this->fieldsPath = $this->pathHelper->resolvePath(
$this->pathToProjectRoot . '/' . \implode('/', $traitSubDirectories)
);
$this->fieldsInterfacePath = $this->pathHelper->resolvePath(
$this->pathToProjectRoot . '/' . \implode('/', $interfaceSubDirectories)
);
$this->traitNamespace = $traitNamespace;
$this->interfaceNamespace = $interfaceNamespace;
} | php | protected function setupClassProperties(
string $fieldFqn,
string $fieldType,
?string $phpType,
$defaultValue,
bool $isUnique
): void {
$this->isArchetype = false;
$this->fieldType = \strtolower($fieldType);
if (true !== \in_array($this->fieldType, MappingHelper::COMMON_TYPES, true)) {
$this->isArchetype = true;
$this->fieldType = $fieldType;
}
$this->phpType = $phpType ?? $this->getPhpTypeForDbalType();
$this->defaultValue = $this->typeHelper->normaliseValueToType($defaultValue, $this->phpType);
if (null !== $this->defaultValue) {
$defaultValueType = $this->typeHelper->getType($this->defaultValue);
if ($defaultValueType !== $this->phpType) {
throw new \InvalidArgumentException(
'default value ' .
$this->defaultValue .
' has the type: ' .
$defaultValueType
.
' whereas the phpType for this field has been set as ' .
$this->phpType .
', these do not match up'
);
}
}
$this->isNullable = (null === $defaultValue);
$this->isUnique = $isUnique;
if (\substr($fieldFqn, -\strlen(self::FIELD_TRAIT_SUFFIX)) === self::FIELD_TRAIT_SUFFIX) {
$fieldFqn = \substr($fieldFqn, 0, -\strlen(self::FIELD_TRAIT_SUFFIX));
}
$this->fieldFqn = $fieldFqn;
list($className, $traitNamespace, $traitSubDirectories) = $this->parseFullyQualifiedName(
$this->fieldFqn,
$this->srcSubFolderName
);
$this->className = $className;
list(, $interfaceNamespace, $interfaceSubDirectories) = $this->parseFullyQualifiedName(
\str_replace('Traits', 'Interfaces', $this->fieldFqn),
$this->srcSubFolderName
);
$this->fieldsPath = $this->pathHelper->resolvePath(
$this->pathToProjectRoot . '/' . \implode('/', $traitSubDirectories)
);
$this->fieldsInterfacePath = $this->pathHelper->resolvePath(
$this->pathToProjectRoot . '/' . \implode('/', $interfaceSubDirectories)
);
$this->traitNamespace = $traitNamespace;
$this->interfaceNamespace = $interfaceNamespace;
} | [
"protected",
"function",
"setupClassProperties",
"(",
"string",
"$",
"fieldFqn",
",",
"string",
"$",
"fieldType",
",",
"?",
"string",
"$",
"phpType",
",",
"$",
"defaultValue",
",",
"bool",
"$",
"isUnique",
")",
":",
"void",
"{",
"$",
"this",
"->",
"isArchetype",
"=",
"false",
";",
"$",
"this",
"->",
"fieldType",
"=",
"\\",
"strtolower",
"(",
"$",
"fieldType",
")",
";",
"if",
"(",
"true",
"!==",
"\\",
"in_array",
"(",
"$",
"this",
"->",
"fieldType",
",",
"MappingHelper",
"::",
"COMMON_TYPES",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"isArchetype",
"=",
"true",
";",
"$",
"this",
"->",
"fieldType",
"=",
"$",
"fieldType",
";",
"}",
"$",
"this",
"->",
"phpType",
"=",
"$",
"phpType",
"??",
"$",
"this",
"->",
"getPhpTypeForDbalType",
"(",
")",
";",
"$",
"this",
"->",
"defaultValue",
"=",
"$",
"this",
"->",
"typeHelper",
"->",
"normaliseValueToType",
"(",
"$",
"defaultValue",
",",
"$",
"this",
"->",
"phpType",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"defaultValue",
")",
"{",
"$",
"defaultValueType",
"=",
"$",
"this",
"->",
"typeHelper",
"->",
"getType",
"(",
"$",
"this",
"->",
"defaultValue",
")",
";",
"if",
"(",
"$",
"defaultValueType",
"!==",
"$",
"this",
"->",
"phpType",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'default value '",
".",
"$",
"this",
"->",
"defaultValue",
".",
"' has the type: '",
".",
"$",
"defaultValueType",
".",
"' whereas the phpType for this field has been set as '",
".",
"$",
"this",
"->",
"phpType",
".",
"', these do not match up'",
")",
";",
"}",
"}",
"$",
"this",
"->",
"isNullable",
"=",
"(",
"null",
"===",
"$",
"defaultValue",
")",
";",
"$",
"this",
"->",
"isUnique",
"=",
"$",
"isUnique",
";",
"if",
"(",
"\\",
"substr",
"(",
"$",
"fieldFqn",
",",
"-",
"\\",
"strlen",
"(",
"self",
"::",
"FIELD_TRAIT_SUFFIX",
")",
")",
"===",
"self",
"::",
"FIELD_TRAIT_SUFFIX",
")",
"{",
"$",
"fieldFqn",
"=",
"\\",
"substr",
"(",
"$",
"fieldFqn",
",",
"0",
",",
"-",
"\\",
"strlen",
"(",
"self",
"::",
"FIELD_TRAIT_SUFFIX",
")",
")",
";",
"}",
"$",
"this",
"->",
"fieldFqn",
"=",
"$",
"fieldFqn",
";",
"list",
"(",
"$",
"className",
",",
"$",
"traitNamespace",
",",
"$",
"traitSubDirectories",
")",
"=",
"$",
"this",
"->",
"parseFullyQualifiedName",
"(",
"$",
"this",
"->",
"fieldFqn",
",",
"$",
"this",
"->",
"srcSubFolderName",
")",
";",
"$",
"this",
"->",
"className",
"=",
"$",
"className",
";",
"list",
"(",
",",
"$",
"interfaceNamespace",
",",
"$",
"interfaceSubDirectories",
")",
"=",
"$",
"this",
"->",
"parseFullyQualifiedName",
"(",
"\\",
"str_replace",
"(",
"'Traits'",
",",
"'Interfaces'",
",",
"$",
"this",
"->",
"fieldFqn",
")",
",",
"$",
"this",
"->",
"srcSubFolderName",
")",
";",
"$",
"this",
"->",
"fieldsPath",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"resolvePath",
"(",
"$",
"this",
"->",
"pathToProjectRoot",
".",
"'/'",
".",
"\\",
"implode",
"(",
"'/'",
",",
"$",
"traitSubDirectories",
")",
")",
";",
"$",
"this",
"->",
"fieldsInterfacePath",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"resolvePath",
"(",
"$",
"this",
"->",
"pathToProjectRoot",
".",
"'/'",
".",
"\\",
"implode",
"(",
"'/'",
",",
"$",
"interfaceSubDirectories",
")",
")",
";",
"$",
"this",
"->",
"traitNamespace",
"=",
"$",
"traitNamespace",
";",
"$",
"this",
"->",
"interfaceNamespace",
"=",
"$",
"interfaceNamespace",
";",
"}"
] | Defining the properties for the field to be generated
@param string $fieldFqn
@param string $fieldType
@param null|string $phpType
@param mixed $defaultValue
@param bool $isUnique
@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.StaticAccess)
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Defining",
"the",
"properties",
"for",
"the",
"field",
"to",
"be",
"generated"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Field/FieldGenerator.php#L286-L345 |
31,650 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.GetCurrentFilter | protected function GetCurrentFilter()
{
static $aFilter = 'x';
if ('x' == $aFilter) {
$oShop = TdbShop::GetInstance();
$aFilter = $oShop->GetActiveFilter();
}
return $aFilter;
} | php | protected function GetCurrentFilter()
{
static $aFilter = 'x';
if ('x' == $aFilter) {
$oShop = TdbShop::GetInstance();
$aFilter = $oShop->GetActiveFilter();
}
return $aFilter;
} | [
"protected",
"function",
"GetCurrentFilter",
"(",
")",
"{",
"static",
"$",
"aFilter",
"=",
"'x'",
";",
"if",
"(",
"'x'",
"==",
"$",
"aFilter",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aFilter",
"=",
"$",
"oShop",
"->",
"GetActiveFilter",
"(",
")",
";",
"}",
"return",
"$",
"aFilter",
";",
"}"
] | return current filter.
@return array | [
"return",
"current",
"filter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L60-L69 |
31,651 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.GetSearchLink | public function GetSearchLink($aFilterAddition = array(), $aExcludeFilterKeys = array())
{
$sLink = '';
$aParams = array();
if (is_array($this->aSearchTerms) && count($this->aSearchTerms) > 0) {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY.'[0]'] = $this->sSearchTerm;
reset($this->aSearchTerms);
foreach ($this->aSearchTerms as $fieldId => $sVal) {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY."[{$fieldId}]"] = $sVal;
}
reset($this->aSearchTerms);
} else {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY] = $this->sSearchTerm;
}
$aFilter = $this->GetCurrentFilter();
if (!is_array($aFilter) && count($aFilterAddition) > 0) {
$aFilter = array();
}
foreach ($aFilterAddition as $sFilterKey => $sFilterValue) {
$aFilter[$sFilterKey] = $sFilterValue;
}
// add filter
if (is_array($aFilter) && count($aFilter) > 0) {
reset($aFilter);
foreach ($aFilter as $sFilterKeyName => $sVal) {
if (!in_array($sFilterKeyName, $aExcludeFilterKeys)) {
$aParams[TShopModuleArticlelistFilterSearch::URL_FILTER."[{$sFilterKeyName}]"] = $sVal;
}
}
}
$oShop = TdbShop::GetInstance();
$sLink = $oShop->GetLinkToSystemPage('search', $aParams);
return $sLink;
} | php | public function GetSearchLink($aFilterAddition = array(), $aExcludeFilterKeys = array())
{
$sLink = '';
$aParams = array();
if (is_array($this->aSearchTerms) && count($this->aSearchTerms) > 0) {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY.'[0]'] = $this->sSearchTerm;
reset($this->aSearchTerms);
foreach ($this->aSearchTerms as $fieldId => $sVal) {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY."[{$fieldId}]"] = $sVal;
}
reset($this->aSearchTerms);
} else {
$aParams[TShopModuleArticlelistFilterSearch::PARAM_QUERY] = $this->sSearchTerm;
}
$aFilter = $this->GetCurrentFilter();
if (!is_array($aFilter) && count($aFilterAddition) > 0) {
$aFilter = array();
}
foreach ($aFilterAddition as $sFilterKey => $sFilterValue) {
$aFilter[$sFilterKey] = $sFilterValue;
}
// add filter
if (is_array($aFilter) && count($aFilter) > 0) {
reset($aFilter);
foreach ($aFilter as $sFilterKeyName => $sVal) {
if (!in_array($sFilterKeyName, $aExcludeFilterKeys)) {
$aParams[TShopModuleArticlelistFilterSearch::URL_FILTER."[{$sFilterKeyName}]"] = $sVal;
}
}
}
$oShop = TdbShop::GetInstance();
$sLink = $oShop->GetLinkToSystemPage('search', $aParams);
return $sLink;
} | [
"public",
"function",
"GetSearchLink",
"(",
"$",
"aFilterAddition",
"=",
"array",
"(",
")",
",",
"$",
"aExcludeFilterKeys",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sLink",
"=",
"''",
";",
"$",
"aParams",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"aSearchTerms",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"aSearchTerms",
")",
">",
"0",
")",
"{",
"$",
"aParams",
"[",
"TShopModuleArticlelistFilterSearch",
"::",
"PARAM_QUERY",
".",
"'[0]'",
"]",
"=",
"$",
"this",
"->",
"sSearchTerm",
";",
"reset",
"(",
"$",
"this",
"->",
"aSearchTerms",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"aSearchTerms",
"as",
"$",
"fieldId",
"=>",
"$",
"sVal",
")",
"{",
"$",
"aParams",
"[",
"TShopModuleArticlelistFilterSearch",
"::",
"PARAM_QUERY",
".",
"\"[{$fieldId}]\"",
"]",
"=",
"$",
"sVal",
";",
"}",
"reset",
"(",
"$",
"this",
"->",
"aSearchTerms",
")",
";",
"}",
"else",
"{",
"$",
"aParams",
"[",
"TShopModuleArticlelistFilterSearch",
"::",
"PARAM_QUERY",
"]",
"=",
"$",
"this",
"->",
"sSearchTerm",
";",
"}",
"$",
"aFilter",
"=",
"$",
"this",
"->",
"GetCurrentFilter",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aFilter",
")",
"&&",
"count",
"(",
"$",
"aFilterAddition",
")",
">",
"0",
")",
"{",
"$",
"aFilter",
"=",
"array",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"aFilterAddition",
"as",
"$",
"sFilterKey",
"=>",
"$",
"sFilterValue",
")",
"{",
"$",
"aFilter",
"[",
"$",
"sFilterKey",
"]",
"=",
"$",
"sFilterValue",
";",
"}",
"// add filter",
"if",
"(",
"is_array",
"(",
"$",
"aFilter",
")",
"&&",
"count",
"(",
"$",
"aFilter",
")",
">",
"0",
")",
"{",
"reset",
"(",
"$",
"aFilter",
")",
";",
"foreach",
"(",
"$",
"aFilter",
"as",
"$",
"sFilterKeyName",
"=>",
"$",
"sVal",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"sFilterKeyName",
",",
"$",
"aExcludeFilterKeys",
")",
")",
"{",
"$",
"aParams",
"[",
"TShopModuleArticlelistFilterSearch",
"::",
"URL_FILTER",
".",
"\"[{$sFilterKeyName}]\"",
"]",
"=",
"$",
"sVal",
";",
"}",
"}",
"}",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sLink",
"=",
"$",
"oShop",
"->",
"GetLinkToSystemPage",
"(",
"'search'",
",",
"$",
"aParams",
")",
";",
"return",
"$",
"sLink",
";",
"}"
] | return a search query based on the current filter.
@param array $aExcludeFilterKeys - any filter keys (same as in $this->aFilter) you place in here
will be excluded from the link
@return string | [
"return",
"a",
"search",
"query",
"based",
"on",
"the",
"current",
"filter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L79-L118 |
31,652 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.GetSearchResultCategoryHits | public function GetSearchResultCategoryHits($sFilters = '')
{
$aHits = array();
if (!empty($this->fieldCategoryHits) && empty($sFilters)) {
$aHits = unserialize($this->fieldCategoryHits);
} else {
$aCategoryCount = array();
$sRestrcition = '';
$query = '';
if (!empty($sFilters)) {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`
INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND {$sFilters}
GROUP BY `shop_category`.`id`
";
} else {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*
FROM `shop_search_cache_item`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`
INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
GROUP BY `shop_category`.`id`
";
}
$oCatList = &TdbShopCategoryList::GetList($query);
// now organize list into a tree... we trace back each node untill we reach a root node... in the end we
// will have a collection of rows. then we merge these
while ($oCat = &$oCatList->Next()) {
if (!array_key_exists($oCat->id, $aHits)) {
$aHits[$oCat->id] = 0;
}
$aHits[$oCat->id] += $oCat->sqlData['shop_search_cache_item_count'];
// add all children to vector
while ($oParent = $oCat->GetParent()) {
$oParent->sqlData['shop_search_cache_item_count'] = $oCat->sqlData['shop_search_cache_item_count'];
if (!array_key_exists($oParent->id, $aHits)) {
$aHits[$oParent->id] = 0;
}
$aHits[$oParent->id] += $oParent->sqlData['shop_search_cache_item_count'];
$oCat = $oParent;
}
}
if (empty($sFilters)) {
$this->fieldCategoryHits = serialize($aHits);
$this->sqlData['category_hits'] = $this->fieldCategoryHits;
$this->AllowEditByAll(true);
$this->Save();
}
}
return $aHits;
} | php | public function GetSearchResultCategoryHits($sFilters = '')
{
$aHits = array();
if (!empty($this->fieldCategoryHits) && empty($sFilters)) {
$aHits = unserialize($this->fieldCategoryHits);
} else {
$aCategoryCount = array();
$sRestrcition = '';
$query = '';
if (!empty($sFilters)) {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`
INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND {$sFilters}
GROUP BY `shop_category`.`id`
";
} else {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*
FROM `shop_search_cache_item`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`
INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
GROUP BY `shop_category`.`id`
";
}
$oCatList = &TdbShopCategoryList::GetList($query);
// now organize list into a tree... we trace back each node untill we reach a root node... in the end we
// will have a collection of rows. then we merge these
while ($oCat = &$oCatList->Next()) {
if (!array_key_exists($oCat->id, $aHits)) {
$aHits[$oCat->id] = 0;
}
$aHits[$oCat->id] += $oCat->sqlData['shop_search_cache_item_count'];
// add all children to vector
while ($oParent = $oCat->GetParent()) {
$oParent->sqlData['shop_search_cache_item_count'] = $oCat->sqlData['shop_search_cache_item_count'];
if (!array_key_exists($oParent->id, $aHits)) {
$aHits[$oParent->id] = 0;
}
$aHits[$oParent->id] += $oParent->sqlData['shop_search_cache_item_count'];
$oCat = $oParent;
}
}
if (empty($sFilters)) {
$this->fieldCategoryHits = serialize($aHits);
$this->sqlData['category_hits'] = $this->fieldCategoryHits;
$this->AllowEditByAll(true);
$this->Save();
}
}
return $aHits;
} | [
"public",
"function",
"GetSearchResultCategoryHits",
"(",
"$",
"sFilters",
"=",
"''",
")",
"{",
"$",
"aHits",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldCategoryHits",
")",
"&&",
"empty",
"(",
"$",
"sFilters",
")",
")",
"{",
"$",
"aHits",
"=",
"unserialize",
"(",
"$",
"this",
"->",
"fieldCategoryHits",
")",
";",
"}",
"else",
"{",
"$",
"aCategoryCount",
"=",
"array",
"(",
")",
";",
"$",
"sRestrcition",
"=",
"''",
";",
"$",
"query",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sFilters",
")",
")",
"{",
"$",
"query",
"=",
"\"SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*\n FROM `shop_search_cache_item`\n INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`\n INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`\n INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`\n WHERE `shop_search_cache_item`.`shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n AND {$sFilters}\n GROUP BY `shop_category`.`id`\n \"",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"\"SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS shop_search_cache_item_count, `shop_category`.*\n FROM `shop_search_cache_item`\n INNER JOIN `shop_article_shop_category_mlt` ON `shop_search_cache_item`.`shop_article_id` = `shop_article_shop_category_mlt`.`source_id`\n INNER JOIN `shop_category` ON `shop_article_shop_category_mlt`.`target_id` = `shop_category`.`id`\n WHERE `shop_search_cache_item`.`shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n GROUP BY `shop_category`.`id`\n \"",
";",
"}",
"$",
"oCatList",
"=",
"&",
"TdbShopCategoryList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"// now organize list into a tree... we trace back each node untill we reach a root node... in the end we",
"// will have a collection of rows. then we merge these",
"while",
"(",
"$",
"oCat",
"=",
"&",
"$",
"oCatList",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"oCat",
"->",
"id",
",",
"$",
"aHits",
")",
")",
"{",
"$",
"aHits",
"[",
"$",
"oCat",
"->",
"id",
"]",
"=",
"0",
";",
"}",
"$",
"aHits",
"[",
"$",
"oCat",
"->",
"id",
"]",
"+=",
"$",
"oCat",
"->",
"sqlData",
"[",
"'shop_search_cache_item_count'",
"]",
";",
"// add all children to vector",
"while",
"(",
"$",
"oParent",
"=",
"$",
"oCat",
"->",
"GetParent",
"(",
")",
")",
"{",
"$",
"oParent",
"->",
"sqlData",
"[",
"'shop_search_cache_item_count'",
"]",
"=",
"$",
"oCat",
"->",
"sqlData",
"[",
"'shop_search_cache_item_count'",
"]",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"oParent",
"->",
"id",
",",
"$",
"aHits",
")",
")",
"{",
"$",
"aHits",
"[",
"$",
"oParent",
"->",
"id",
"]",
"=",
"0",
";",
"}",
"$",
"aHits",
"[",
"$",
"oParent",
"->",
"id",
"]",
"+=",
"$",
"oParent",
"->",
"sqlData",
"[",
"'shop_search_cache_item_count'",
"]",
";",
"$",
"oCat",
"=",
"$",
"oParent",
";",
"}",
"}",
"if",
"(",
"empty",
"(",
"$",
"sFilters",
")",
")",
"{",
"$",
"this",
"->",
"fieldCategoryHits",
"=",
"serialize",
"(",
"$",
"aHits",
")",
";",
"$",
"this",
"->",
"sqlData",
"[",
"'category_hits'",
"]",
"=",
"$",
"this",
"->",
"fieldCategoryHits",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"}",
"}",
"return",
"$",
"aHits",
";",
"}"
] | return array with categorie ids and number of hits for that category.
@return array | [
"return",
"array",
"with",
"categorie",
"ids",
"and",
"number",
"of",
"hits",
"for",
"that",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L295-L355 |
31,653 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.GetNumberOfHits | public function GetNumberOfHits()
{
if ($this->fieldNumberOfRecordsFound < 0) {
$query = "SELECT COUNT(*) AS recs FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$this->fieldNumberOfRecordsFound = $row['recs'];
$this->sqlData['number_of_records_found'] = $this->fieldNumberOfRecordsFound;
$this->AllowEditByAll(true);
$this->Save();
}
}
return $this->fieldNumberOfRecordsFound;
} | php | public function GetNumberOfHits()
{
if ($this->fieldNumberOfRecordsFound < 0) {
$query = "SELECT COUNT(*) AS recs FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$this->fieldNumberOfRecordsFound = $row['recs'];
$this->sqlData['number_of_records_found'] = $this->fieldNumberOfRecordsFound;
$this->AllowEditByAll(true);
$this->Save();
}
}
return $this->fieldNumberOfRecordsFound;
} | [
"public",
"function",
"GetNumberOfHits",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fieldNumberOfRecordsFound",
"<",
"0",
")",
"{",
"$",
"query",
"=",
"\"SELECT COUNT(*) AS recs FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\"",
";",
"if",
"(",
"$",
"row",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"this",
"->",
"fieldNumberOfRecordsFound",
"=",
"$",
"row",
"[",
"'recs'",
"]",
";",
"$",
"this",
"->",
"sqlData",
"[",
"'number_of_records_found'",
"]",
"=",
"$",
"this",
"->",
"fieldNumberOfRecordsFound",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"fieldNumberOfRecordsFound",
";",
"}"
] | return number of records found.
@return int | [
"return",
"number",
"of",
"records",
"found",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L362-L375 |
31,654 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.CacheIsStale | public function CacheIsStale()
{
$cachAge = strtotime($this->fieldLastUsedDate);
$bIsStale = ((time() - $cachAge) > TdbShopSearchCache::MAX_CACHE_AGE_IN_SECONDS);
return $bIsStale;
} | php | public function CacheIsStale()
{
$cachAge = strtotime($this->fieldLastUsedDate);
$bIsStale = ((time() - $cachAge) > TdbShopSearchCache::MAX_CACHE_AGE_IN_SECONDS);
return $bIsStale;
} | [
"public",
"function",
"CacheIsStale",
"(",
")",
"{",
"$",
"cachAge",
"=",
"strtotime",
"(",
"$",
"this",
"->",
"fieldLastUsedDate",
")",
";",
"$",
"bIsStale",
"=",
"(",
"(",
"time",
"(",
")",
"-",
"$",
"cachAge",
")",
">",
"TdbShopSearchCache",
"::",
"MAX_CACHE_AGE_IN_SECONDS",
")",
";",
"return",
"$",
"bIsStale",
";",
"}"
] | return true if the cache has become stale - will remove stale cache entries.
@return bool | [
"return",
"true",
"if",
"the",
"cache",
"has",
"become",
"stale",
"-",
"will",
"remove",
"stale",
"cache",
"entries",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L382-L388 |
31,655 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchCache.class.php | TShopSearchCache.ClearCache | public function ClearCache()
{
$query = "DELETE FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' ";
MySqlLegacySupport::getInstance()->query($query);
$query = "DELETE FROM `shop_search_cache` WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
MySqlLegacySupport::getInstance()->query($query);
$this->id = null;
$this->sqlData['id'] = null;
} | php | public function ClearCache()
{
$query = "DELETE FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' ";
MySqlLegacySupport::getInstance()->query($query);
$query = "DELETE FROM `shop_search_cache` WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
MySqlLegacySupport::getInstance()->query($query);
$this->id = null;
$this->sqlData['id'] = null;
} | [
"public",
"function",
"ClearCache",
"(",
")",
"{",
"$",
"query",
"=",
"\"DELETE FROM `shop_search_cache_item` WHERE `shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"' \"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"query",
"=",
"\"DELETE FROM `shop_search_cache` WHERE `id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"this",
"->",
"id",
"=",
"null",
";",
"$",
"this",
"->",
"sqlData",
"[",
"'id'",
"]",
"=",
"null",
";",
"}"
] | clear cache item. | [
"clear",
"cache",
"item",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchCache.class.php#L393-L401 |
31,656 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchQuery.class.php | TShopSearchQuery.CreateIndexTick | public function CreateIndexTick($iNumberOfRowsToProcess)
{
$iRealNumberProcessed = 0;
$oFields = &TdbShopSearchFieldWeightList::GetListForShopSearchQueryId($this->id);
if (CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS > 0) {
usleep(CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS * 1000);
}
// fetch as many rows as we can....
$sLimit = " LIMIT 0,{$iNumberOfRowsToProcess}";
if ($iNumberOfRowsToProcess < 0) {
$sLimit = '';
}
$query = 'SELECT * FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName())."` {$sLimit}";
$tres = MySqlLegacySupport::getInstance()->query($query);
$sError = MySqlLegacySupport::getInstance()->error();
if (!empty($sError)) {
trigger_error('SQL Error: '.$sError, E_USER_WARNING);
} else {
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($tres)) {
$oFields->GoToStart();
while ($oField = &$oFields->Next()) {
$oField->CreateIndexTick($aRow);
}
$query = 'DELETE FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName())."` WHERE `sysid` = '".MySqlLegacySupport::getInstance()->real_escape_string($aRow['sysid'])."'";
MySqlLegacySupport::getInstance()->query($query);
++$iRealNumberProcessed;
}
}
if (($iRealNumberProcessed < $iNumberOfRowsToProcess) || ($iNumberOfRowsToProcess < 0)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName()).'`';
MySqlLegacySupport::getInstance()->query($query);
}
return $iRealNumberProcessed;
} | php | public function CreateIndexTick($iNumberOfRowsToProcess)
{
$iRealNumberProcessed = 0;
$oFields = &TdbShopSearchFieldWeightList::GetListForShopSearchQueryId($this->id);
if (CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS > 0) {
usleep(CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS * 1000);
}
// fetch as many rows as we can....
$sLimit = " LIMIT 0,{$iNumberOfRowsToProcess}";
if ($iNumberOfRowsToProcess < 0) {
$sLimit = '';
}
$query = 'SELECT * FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName())."` {$sLimit}";
$tres = MySqlLegacySupport::getInstance()->query($query);
$sError = MySqlLegacySupport::getInstance()->error();
if (!empty($sError)) {
trigger_error('SQL Error: '.$sError, E_USER_WARNING);
} else {
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($tres)) {
$oFields->GoToStart();
while ($oField = &$oFields->Next()) {
$oField->CreateIndexTick($aRow);
}
$query = 'DELETE FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName())."` WHERE `sysid` = '".MySqlLegacySupport::getInstance()->real_escape_string($aRow['sysid'])."'";
MySqlLegacySupport::getInstance()->query($query);
++$iRealNumberProcessed;
}
}
if (($iRealNumberProcessed < $iNumberOfRowsToProcess) || ($iNumberOfRowsToProcess < 0)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($this->GetIndexRawTableName()).'`';
MySqlLegacySupport::getInstance()->query($query);
}
return $iRealNumberProcessed;
} | [
"public",
"function",
"CreateIndexTick",
"(",
"$",
"iNumberOfRowsToProcess",
")",
"{",
"$",
"iRealNumberProcessed",
"=",
"0",
";",
"$",
"oFields",
"=",
"&",
"TdbShopSearchFieldWeightList",
"::",
"GetListForShopSearchQueryId",
"(",
"$",
"this",
"->",
"id",
")",
";",
"if",
"(",
"CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS",
">",
"0",
")",
"{",
"usleep",
"(",
"CMS_SHOP_INDEX_LOAD_DELAY_MILLISECONDS",
"*",
"1000",
")",
";",
"}",
"// fetch as many rows as we can....",
"$",
"sLimit",
"=",
"\" LIMIT 0,{$iNumberOfRowsToProcess}\"",
";",
"if",
"(",
"$",
"iNumberOfRowsToProcess",
"<",
"0",
")",
"{",
"$",
"sLimit",
"=",
"''",
";",
"}",
"$",
"query",
"=",
"'SELECT * FROM `'",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"GetIndexRawTableName",
"(",
")",
")",
".",
"\"` {$sLimit}\"",
";",
"$",
"tres",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"sError",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"error",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sError",
")",
")",
"{",
"trigger_error",
"(",
"'SQL Error: '",
".",
"$",
"sError",
",",
"E_USER_WARNING",
")",
";",
"}",
"else",
"{",
"while",
"(",
"$",
"aRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"$",
"tres",
")",
")",
"{",
"$",
"oFields",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oField",
"=",
"&",
"$",
"oFields",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oField",
"->",
"CreateIndexTick",
"(",
"$",
"aRow",
")",
";",
"}",
"$",
"query",
"=",
"'DELETE FROM `'",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"GetIndexRawTableName",
"(",
")",
")",
".",
"\"` WHERE `sysid` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"aRow",
"[",
"'sysid'",
"]",
")",
".",
"\"'\"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"++",
"$",
"iRealNumberProcessed",
";",
"}",
"}",
"if",
"(",
"(",
"$",
"iRealNumberProcessed",
"<",
"$",
"iNumberOfRowsToProcess",
")",
"||",
"(",
"$",
"iNumberOfRowsToProcess",
"<",
"0",
")",
")",
"{",
"$",
"query",
"=",
"'DROP TABLE `'",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"GetIndexRawTableName",
"(",
")",
")",
".",
"'`'",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"}",
"return",
"$",
"iRealNumberProcessed",
";",
"}"
] | creates index for the number of rows requested. returns the real number of rows processed.
@param int $iNumberOfRowsToProcess - if set to -1 we will process all rows
@return int | [
"creates",
"index",
"for",
"the",
"number",
"of",
"rows",
"requested",
".",
"returns",
"the",
"real",
"number",
"of",
"rows",
"processed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchQuery.class.php#L122-L158 |
31,657 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchQuery.class.php | TShopSearchQuery.NumberOfRecordsLeftToIndex | public function NumberOfRecordsLeftToIndex()
{
$iCount = 0;
if ($this->fieldIndexRunning) {
$sIndexTableName = $this->GetIndexRawTableName();
$query = "SHOW TABLES LIKE '".MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName)."'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
$bTableExists = (MySqlLegacySupport::getInstance()->num_rows($tRes) >= 1);
if ($bTableExists) {
$query = 'SELECT COUNT(sysid) AS reccount FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName).'`';
if ($trow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iCount = $trow['reccount'];
}
}
if ($iCount < 1) {
$this->StopIndex();
}
}
return $iCount;
} | php | public function NumberOfRecordsLeftToIndex()
{
$iCount = 0;
if ($this->fieldIndexRunning) {
$sIndexTableName = $this->GetIndexRawTableName();
$query = "SHOW TABLES LIKE '".MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName)."'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
$bTableExists = (MySqlLegacySupport::getInstance()->num_rows($tRes) >= 1);
if ($bTableExists) {
$query = 'SELECT COUNT(sysid) AS reccount FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName).'`';
if ($trow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iCount = $trow['reccount'];
}
}
if ($iCount < 1) {
$this->StopIndex();
}
}
return $iCount;
} | [
"public",
"function",
"NumberOfRecordsLeftToIndex",
"(",
")",
"{",
"$",
"iCount",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"fieldIndexRunning",
")",
"{",
"$",
"sIndexTableName",
"=",
"$",
"this",
"->",
"GetIndexRawTableName",
"(",
")",
";",
"$",
"query",
"=",
"\"SHOW TABLES LIKE '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sIndexTableName",
")",
".",
"\"'\"",
";",
"$",
"tRes",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"$",
"bTableExists",
"=",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"tRes",
")",
">=",
"1",
")",
";",
"if",
"(",
"$",
"bTableExists",
")",
"{",
"$",
"query",
"=",
"'SELECT COUNT(sysid) AS reccount FROM `'",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sIndexTableName",
")",
".",
"'`'",
";",
"if",
"(",
"$",
"trow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"iCount",
"=",
"$",
"trow",
"[",
"'reccount'",
"]",
";",
"}",
"}",
"if",
"(",
"$",
"iCount",
"<",
"1",
")",
"{",
"$",
"this",
"->",
"StopIndex",
"(",
")",
";",
"}",
"}",
"return",
"$",
"iCount",
";",
"}"
] | returns the number of records that still need to be indext for the query
will stop the index if no entries are left to index.
@return int | [
"returns",
"the",
"number",
"of",
"records",
"that",
"still",
"need",
"to",
"be",
"indext",
"for",
"the",
"query",
"will",
"stop",
"the",
"index",
"if",
"no",
"entries",
"are",
"left",
"to",
"index",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchQuery.class.php#L166-L186 |
31,658 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchQuery.class.php | TShopSearchQuery.StopIndex | public function StopIndex()
{
$sIndexTableName = $this->GetIndexRawTableName();
if (TCMSRecord::TableExists($sIndexTableName)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName).'`';
MySqlLegacySupport::getInstance()->query($query);
}
$aData = $this->sqlData;
$aData['index_running'] = '0';
$aData['index_completed'] = date('Y-m-d H:i:s');
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
} | php | public function StopIndex()
{
$sIndexTableName = $this->GetIndexRawTableName();
if (TCMSRecord::TableExists($sIndexTableName)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($sIndexTableName).'`';
MySqlLegacySupport::getInstance()->query($query);
}
$aData = $this->sqlData;
$aData['index_running'] = '0';
$aData['index_completed'] = date('Y-m-d H:i:s');
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
} | [
"public",
"function",
"StopIndex",
"(",
")",
"{",
"$",
"sIndexTableName",
"=",
"$",
"this",
"->",
"GetIndexRawTableName",
"(",
")",
";",
"if",
"(",
"TCMSRecord",
"::",
"TableExists",
"(",
"$",
"sIndexTableName",
")",
")",
"{",
"$",
"query",
"=",
"'DROP TABLE `'",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sIndexTableName",
")",
".",
"'`'",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"}",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'index_running'",
"]",
"=",
"'0'",
";",
"$",
"aData",
"[",
"'index_completed'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"this",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"}"
] | stop the current index operation. | [
"stop",
"the",
"current",
"index",
"operation",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchQuery.class.php#L191-L205 |
31,659 | edmondscommerce/doctrine-static-meta | src/Entity/Validation/EntityDataValidatorFactory.php | EntityDataValidatorFactory.buildEntityDataValidator | public function buildEntityDataValidator(): EntityDataValidatorInterface
{
$builder = Validation::createValidatorBuilder();
$builder->addMethodMapping(self::METHOD_LOAD_VALIDATOR_META_DATA);
$builder->setMetadataCache($this->doctrineCache);
$builder->setConstraintValidatorFactory($this->factory);
$builder->addObjectInitializer($this->initialiser);
$validator = $builder->getValidator();
return new EntityDataValidator($validator);
} | php | public function buildEntityDataValidator(): EntityDataValidatorInterface
{
$builder = Validation::createValidatorBuilder();
$builder->addMethodMapping(self::METHOD_LOAD_VALIDATOR_META_DATA);
$builder->setMetadataCache($this->doctrineCache);
$builder->setConstraintValidatorFactory($this->factory);
$builder->addObjectInitializer($this->initialiser);
$validator = $builder->getValidator();
return new EntityDataValidator($validator);
} | [
"public",
"function",
"buildEntityDataValidator",
"(",
")",
":",
"EntityDataValidatorInterface",
"{",
"$",
"builder",
"=",
"Validation",
"::",
"createValidatorBuilder",
"(",
")",
";",
"$",
"builder",
"->",
"addMethodMapping",
"(",
"self",
"::",
"METHOD_LOAD_VALIDATOR_META_DATA",
")",
";",
"$",
"builder",
"->",
"setMetadataCache",
"(",
"$",
"this",
"->",
"doctrineCache",
")",
";",
"$",
"builder",
"->",
"setConstraintValidatorFactory",
"(",
"$",
"this",
"->",
"factory",
")",
";",
"$",
"builder",
"->",
"addObjectInitializer",
"(",
"$",
"this",
"->",
"initialiser",
")",
";",
"$",
"validator",
"=",
"$",
"builder",
"->",
"getValidator",
"(",
")",
";",
"return",
"new",
"EntityDataValidator",
"(",
"$",
"validator",
")",
";",
"}"
] | Build an EntityDataValidatorInterface
@return EntityDataValidatorInterface
@SuppressWarnings(PHPMD.StaticAccess) | [
"Build",
"an",
"EntityDataValidatorInterface"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Validation/EntityDataValidatorFactory.php#L63-L73 |
31,660 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderItem.class.php | TShopOrderItem.PostInsertHook | protected function PostInsertHook()
{
parent::PostInsertHook();
$oArticle = &$this->GetFieldShopArticle();
if (!is_null($oArticle)) {
$bNewAmountIsDelta = true;
$bUpdateSaleCounter = true;
$oArticle->UpdateStock(-1 * $this->fieldOrderAmount, $bNewAmountIsDelta, $bUpdateSaleCounter);
}
} | php | protected function PostInsertHook()
{
parent::PostInsertHook();
$oArticle = &$this->GetFieldShopArticle();
if (!is_null($oArticle)) {
$bNewAmountIsDelta = true;
$bUpdateSaleCounter = true;
$oArticle->UpdateStock(-1 * $this->fieldOrderAmount, $bNewAmountIsDelta, $bUpdateSaleCounter);
}
} | [
"protected",
"function",
"PostInsertHook",
"(",
")",
"{",
"parent",
"::",
"PostInsertHook",
"(",
")",
";",
"$",
"oArticle",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopArticle",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oArticle",
")",
")",
"{",
"$",
"bNewAmountIsDelta",
"=",
"true",
";",
"$",
"bUpdateSaleCounter",
"=",
"true",
";",
"$",
"oArticle",
"->",
"UpdateStock",
"(",
"-",
"1",
"*",
"$",
"this",
"->",
"fieldOrderAmount",
",",
"$",
"bNewAmountIsDelta",
",",
"$",
"bUpdateSaleCounter",
")",
";",
"}",
"}"
] | use the method to up the sales count for the article. | [
"use",
"the",
"method",
"to",
"up",
"the",
"sales",
"count",
"for",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderItem.class.php#L112-L121 |
31,661 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderItem.class.php | TShopOrderItem.isDownload | public function isDownload()
{
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'select COUNT(*) AS matches FROM `shop_order_item_download_cms_document_mlt`
WHERE `source_id` = :shopOrderItemId';
$result = $db->fetchAssoc($query, array('shopOrderItemId' => $this->id));
return intval($result['matches']) > 0;
} | php | public function isDownload()
{
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'select COUNT(*) AS matches FROM `shop_order_item_download_cms_document_mlt`
WHERE `source_id` = :shopOrderItemId';
$result = $db->fetchAssoc($query, array('shopOrderItemId' => $this->id));
return intval($result['matches']) > 0;
} | [
"public",
"function",
"isDownload",
"(",
")",
"{",
"$",
"db",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'database_connection'",
")",
";",
"$",
"query",
"=",
"'select COUNT(*) AS matches FROM `shop_order_item_download_cms_document_mlt`\n WHERE `source_id` = :shopOrderItemId'",
";",
"$",
"result",
"=",
"$",
"db",
"->",
"fetchAssoc",
"(",
"$",
"query",
",",
"array",
"(",
"'shopOrderItemId'",
"=>",
"$",
"this",
"->",
"id",
")",
")",
";",
"return",
"intval",
"(",
"$",
"result",
"[",
"'matches'",
"]",
")",
">",
"0",
";",
"}"
] | return true if this is a download product.
@return bool | [
"return",
"true",
"if",
"this",
"is",
"a",
"download",
"product",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderItem.class.php#L162-L170 |
31,662 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.ClearBasket | protected function ClearBasket()
{
$oBasket = TShopBasket::GetInstance();
if ($oBasket->iTotalNumberOfUniqueArticles > 0) {
$oBasket->ClearBasket();
$aParams = $this->global->GetUserData();
if (array_key_exists('basket', $aParams) && is_array($aParams['basket'])) {
if (array_key_exists(self::URL_CLEAR_BASKET_NAME, $aParams['basket'])) {
unset($aParams['basket'][self::URL_CLEAR_BASKET_NAME]);
}
}
$sURL = $this->getActivePageService()->getLinkToActivePageRelative($aParams, array('pagedef'));
$this->getRedirect()->redirect($sURL);
}
} | php | protected function ClearBasket()
{
$oBasket = TShopBasket::GetInstance();
if ($oBasket->iTotalNumberOfUniqueArticles > 0) {
$oBasket->ClearBasket();
$aParams = $this->global->GetUserData();
if (array_key_exists('basket', $aParams) && is_array($aParams['basket'])) {
if (array_key_exists(self::URL_CLEAR_BASKET_NAME, $aParams['basket'])) {
unset($aParams['basket'][self::URL_CLEAR_BASKET_NAME]);
}
}
$sURL = $this->getActivePageService()->getLinkToActivePageRelative($aParams, array('pagedef'));
$this->getRedirect()->redirect($sURL);
}
} | [
"protected",
"function",
"ClearBasket",
"(",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oBasket",
"->",
"iTotalNumberOfUniqueArticles",
">",
"0",
")",
"{",
"$",
"oBasket",
"->",
"ClearBasket",
"(",
")",
";",
"$",
"aParams",
"=",
"$",
"this",
"->",
"global",
"->",
"GetUserData",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'basket'",
",",
"$",
"aParams",
")",
"&&",
"is_array",
"(",
"$",
"aParams",
"[",
"'basket'",
"]",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"URL_CLEAR_BASKET_NAME",
",",
"$",
"aParams",
"[",
"'basket'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"aParams",
"[",
"'basket'",
"]",
"[",
"self",
"::",
"URL_CLEAR_BASKET_NAME",
"]",
")",
";",
"}",
"}",
"$",
"sURL",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getLinkToActivePageRelative",
"(",
"$",
"aParams",
",",
"array",
"(",
"'pagedef'",
")",
")",
";",
"$",
"this",
"->",
"getRedirect",
"(",
")",
"->",
"redirect",
"(",
"$",
"sURL",
")",
";",
"}",
"}"
] | clear all products from the basket and redirect to active page. | [
"clear",
"all",
"products",
"from",
"the",
"basket",
"and",
"redirect",
"to",
"active",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L89-L103 |
31,663 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.JumpToBasketPage | public function JumpToBasketPage()
{
$bJumpAsFarAsPossible = false;
if ('1' === $this->getInputFilterUtil()->getFilteredInput('bJumpAsFarAsPossible')) {
$bJumpAsFarAsPossible = true;
}
// save calling url to session
$sCallingURL = $this->getCallingUrl();
MTShopOrderWizardCore::SetCallingURL($sCallingURL);
$systemPageService = $this->getSystemPageService();
$checkoutSystemPage = $systemPageService->getSystemPage('checkout');
if (null === $checkoutSystemPage) {
throw new RouteNotFoundException("No system page with system name 'checkout' found - unable to redirect to the basket.");
}
$iRequestRedirectNodeId = $checkoutSystemPage->fieldCmsTreeId;
$bNeedToRedirect = true;
if (false === $bJumpAsFarAsPossible && $this->getActivePageService()->getActivePage()->GetMainTreeId() == $iRequestRedirectNodeId) {
// we are already on the
$bNeedToRedirect = false;
}
if (true === $bNeedToRedirect) {
$oNode = new TCMSTreeNode();
/** @var $oNode TCMSTreeNode */
if ($oNode->Load($iRequestRedirectNodeId)) {
$sURL = null;
if ($bJumpAsFarAsPossible) {
$oUser = $this->getExtranetUserProvider()->getActiveUser();
$oStep = null;
$oBillingAdr = $oUser->GetBillingAddress();
if ($oUser->IsLoggedIn() && !is_null($oBillingAdr) && $oBillingAdr->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING)) {
$oStep = TdbShopOrderStep::GetStep('shipping');
} else {
$oStep = TdbShopOrderStep::GetStep('user');
}
if (!is_null($oStep)) {
$sURL = $oStep->GetStepURL();
}
}
if (null === $sURL) {
$sURL = $systemPageService->getLinkToSystemPageRelative('checkout');
}
$this->getRedirect()->redirect($sURL);
} else {
$this->RedirectToCallingPage();
}
}
} | php | public function JumpToBasketPage()
{
$bJumpAsFarAsPossible = false;
if ('1' === $this->getInputFilterUtil()->getFilteredInput('bJumpAsFarAsPossible')) {
$bJumpAsFarAsPossible = true;
}
// save calling url to session
$sCallingURL = $this->getCallingUrl();
MTShopOrderWizardCore::SetCallingURL($sCallingURL);
$systemPageService = $this->getSystemPageService();
$checkoutSystemPage = $systemPageService->getSystemPage('checkout');
if (null === $checkoutSystemPage) {
throw new RouteNotFoundException("No system page with system name 'checkout' found - unable to redirect to the basket.");
}
$iRequestRedirectNodeId = $checkoutSystemPage->fieldCmsTreeId;
$bNeedToRedirect = true;
if (false === $bJumpAsFarAsPossible && $this->getActivePageService()->getActivePage()->GetMainTreeId() == $iRequestRedirectNodeId) {
// we are already on the
$bNeedToRedirect = false;
}
if (true === $bNeedToRedirect) {
$oNode = new TCMSTreeNode();
/** @var $oNode TCMSTreeNode */
if ($oNode->Load($iRequestRedirectNodeId)) {
$sURL = null;
if ($bJumpAsFarAsPossible) {
$oUser = $this->getExtranetUserProvider()->getActiveUser();
$oStep = null;
$oBillingAdr = $oUser->GetBillingAddress();
if ($oUser->IsLoggedIn() && !is_null($oBillingAdr) && $oBillingAdr->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING)) {
$oStep = TdbShopOrderStep::GetStep('shipping');
} else {
$oStep = TdbShopOrderStep::GetStep('user');
}
if (!is_null($oStep)) {
$sURL = $oStep->GetStepURL();
}
}
if (null === $sURL) {
$sURL = $systemPageService->getLinkToSystemPageRelative('checkout');
}
$this->getRedirect()->redirect($sURL);
} else {
$this->RedirectToCallingPage();
}
}
} | [
"public",
"function",
"JumpToBasketPage",
"(",
")",
"{",
"$",
"bJumpAsFarAsPossible",
"=",
"false",
";",
"if",
"(",
"'1'",
"===",
"$",
"this",
"->",
"getInputFilterUtil",
"(",
")",
"->",
"getFilteredInput",
"(",
"'bJumpAsFarAsPossible'",
")",
")",
"{",
"$",
"bJumpAsFarAsPossible",
"=",
"true",
";",
"}",
"// save calling url to session",
"$",
"sCallingURL",
"=",
"$",
"this",
"->",
"getCallingUrl",
"(",
")",
";",
"MTShopOrderWizardCore",
"::",
"SetCallingURL",
"(",
"$",
"sCallingURL",
")",
";",
"$",
"systemPageService",
"=",
"$",
"this",
"->",
"getSystemPageService",
"(",
")",
";",
"$",
"checkoutSystemPage",
"=",
"$",
"systemPageService",
"->",
"getSystemPage",
"(",
"'checkout'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"checkoutSystemPage",
")",
"{",
"throw",
"new",
"RouteNotFoundException",
"(",
"\"No system page with system name 'checkout' found - unable to redirect to the basket.\"",
")",
";",
"}",
"$",
"iRequestRedirectNodeId",
"=",
"$",
"checkoutSystemPage",
"->",
"fieldCmsTreeId",
";",
"$",
"bNeedToRedirect",
"=",
"true",
";",
"if",
"(",
"false",
"===",
"$",
"bJumpAsFarAsPossible",
"&&",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
"->",
"GetMainTreeId",
"(",
")",
"==",
"$",
"iRequestRedirectNodeId",
")",
"{",
"// we are already on the",
"$",
"bNeedToRedirect",
"=",
"false",
";",
"}",
"if",
"(",
"true",
"===",
"$",
"bNeedToRedirect",
")",
"{",
"$",
"oNode",
"=",
"new",
"TCMSTreeNode",
"(",
")",
";",
"/** @var $oNode TCMSTreeNode */",
"if",
"(",
"$",
"oNode",
"->",
"Load",
"(",
"$",
"iRequestRedirectNodeId",
")",
")",
"{",
"$",
"sURL",
"=",
"null",
";",
"if",
"(",
"$",
"bJumpAsFarAsPossible",
")",
"{",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"$",
"oStep",
"=",
"null",
";",
"$",
"oBillingAdr",
"=",
"$",
"oUser",
"->",
"GetBillingAddress",
"(",
")",
";",
"if",
"(",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
"&&",
"!",
"is_null",
"(",
"$",
"oBillingAdr",
")",
"&&",
"$",
"oBillingAdr",
"->",
"ValidateData",
"(",
"TdbDataExtranetUserAddress",
"::",
"FORM_DATA_NAME_BILLING",
")",
")",
"{",
"$",
"oStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"'shipping'",
")",
";",
"}",
"else",
"{",
"$",
"oStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"'user'",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oStep",
")",
")",
"{",
"$",
"sURL",
"=",
"$",
"oStep",
"->",
"GetStepURL",
"(",
")",
";",
"}",
"}",
"if",
"(",
"null",
"===",
"$",
"sURL",
")",
"{",
"$",
"sURL",
"=",
"$",
"systemPageService",
"->",
"getLinkToSystemPageRelative",
"(",
"'checkout'",
")",
";",
"}",
"$",
"this",
"->",
"getRedirect",
"(",
")",
"->",
"redirect",
"(",
"$",
"sURL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"RedirectToCallingPage",
"(",
")",
";",
"}",
"}",
"}"
] | call the method to jump to the basket detail page. it will store the calling URL in the session, so
that it becomes possible to jump back to this page from the basket.
@throws RouteNotFoundException | [
"call",
"the",
"method",
"to",
"jump",
"to",
"the",
"basket",
"detail",
"page",
".",
"it",
"will",
"store",
"the",
"calling",
"URL",
"in",
"the",
"session",
"so",
"that",
"it",
"becomes",
"possible",
"to",
"jump",
"back",
"to",
"this",
"page",
"from",
"the",
"basket",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L155-L205 |
31,664 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.getCallingUrl | protected function getCallingUrl()
{
$oGlobal = TGlobal::instance();
$sCallingURL = $oGlobal->GetUserData('sourceurl');
if (true === empty($sCallingURL)) {
//the method will most likely be called on a basket page, in this case, ignore it...
$activePageService = $this->getActivePageService();
$oActivePage = $activePageService->getActivePage();
$checkoutSystemPage = $this->getSystemPageService()->getSystemPage('checkout');
if (null === $checkoutSystemPage || $checkoutSystemPage->fieldCmsTreeId !== $oActivePage->GetMainTreeId()) {
$aExcludeParams = array('module_fnc');
// we may be on a category list or an item page... so ignore those parameters, too
$aExcludeParams[] = MTShopArticleCatalogCore::URL_CATEGORY_ID;
$aExcludeParams[] = MTShopArticleCatalogCore::URL_ITEM_ID;
$aExcludeParams[] = MTShopBasketCore::URL_REQUEST_PARAMETER;
$sCallingURL = $activePageService->getLinkToActivePageRelative(array(), $aExcludeParams);
} else {
//basket, so try to get from session
if (isset($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME]) && !empty($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME])) {
$sCallingURL = $_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME];
} else {
$portal = $this->getPortalDomainService()->getActivePortal();
if (null !== $portal) {
$sCallingURL = $this->getPageService()->getLinkToPortalHomePageAbsolute();
} else {
$sCallingURL = '/';
}
}
}
}
return $sCallingURL;
} | php | protected function getCallingUrl()
{
$oGlobal = TGlobal::instance();
$sCallingURL = $oGlobal->GetUserData('sourceurl');
if (true === empty($sCallingURL)) {
//the method will most likely be called on a basket page, in this case, ignore it...
$activePageService = $this->getActivePageService();
$oActivePage = $activePageService->getActivePage();
$checkoutSystemPage = $this->getSystemPageService()->getSystemPage('checkout');
if (null === $checkoutSystemPage || $checkoutSystemPage->fieldCmsTreeId !== $oActivePage->GetMainTreeId()) {
$aExcludeParams = array('module_fnc');
// we may be on a category list or an item page... so ignore those parameters, too
$aExcludeParams[] = MTShopArticleCatalogCore::URL_CATEGORY_ID;
$aExcludeParams[] = MTShopArticleCatalogCore::URL_ITEM_ID;
$aExcludeParams[] = MTShopBasketCore::URL_REQUEST_PARAMETER;
$sCallingURL = $activePageService->getLinkToActivePageRelative(array(), $aExcludeParams);
} else {
//basket, so try to get from session
if (isset($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME]) && !empty($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME])) {
$sCallingURL = $_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME];
} else {
$portal = $this->getPortalDomainService()->getActivePortal();
if (null !== $portal) {
$sCallingURL = $this->getPageService()->getLinkToPortalHomePageAbsolute();
} else {
$sCallingURL = '/';
}
}
}
}
return $sCallingURL;
} | [
"protected",
"function",
"getCallingUrl",
"(",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sCallingURL",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'sourceurl'",
")",
";",
"if",
"(",
"true",
"===",
"empty",
"(",
"$",
"sCallingURL",
")",
")",
"{",
"//the method will most likely be called on a basket page, in this case, ignore it...",
"$",
"activePageService",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
";",
"$",
"oActivePage",
"=",
"$",
"activePageService",
"->",
"getActivePage",
"(",
")",
";",
"$",
"checkoutSystemPage",
"=",
"$",
"this",
"->",
"getSystemPageService",
"(",
")",
"->",
"getSystemPage",
"(",
"'checkout'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"checkoutSystemPage",
"||",
"$",
"checkoutSystemPage",
"->",
"fieldCmsTreeId",
"!==",
"$",
"oActivePage",
"->",
"GetMainTreeId",
"(",
")",
")",
"{",
"$",
"aExcludeParams",
"=",
"array",
"(",
"'module_fnc'",
")",
";",
"// we may be on a category list or an item page... so ignore those parameters, too",
"$",
"aExcludeParams",
"[",
"]",
"=",
"MTShopArticleCatalogCore",
"::",
"URL_CATEGORY_ID",
";",
"$",
"aExcludeParams",
"[",
"]",
"=",
"MTShopArticleCatalogCore",
"::",
"URL_ITEM_ID",
";",
"$",
"aExcludeParams",
"[",
"]",
"=",
"MTShopBasketCore",
"::",
"URL_REQUEST_PARAMETER",
";",
"$",
"sCallingURL",
"=",
"$",
"activePageService",
"->",
"getLinkToActivePageRelative",
"(",
"array",
"(",
")",
",",
"$",
"aExcludeParams",
")",
";",
"}",
"else",
"{",
"//basket, so try to get from session",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"MTShopOrderWizardCore",
"::",
"SESSION_PARAM_NAME",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"_SESSION",
"[",
"MTShopOrderWizardCore",
"::",
"SESSION_PARAM_NAME",
"]",
")",
")",
"{",
"$",
"sCallingURL",
"=",
"$",
"_SESSION",
"[",
"MTShopOrderWizardCore",
"::",
"SESSION_PARAM_NAME",
"]",
";",
"}",
"else",
"{",
"$",
"portal",
"=",
"$",
"this",
"->",
"getPortalDomainService",
"(",
")",
"->",
"getActivePortal",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"portal",
")",
"{",
"$",
"sCallingURL",
"=",
"$",
"this",
"->",
"getPageService",
"(",
")",
"->",
"getLinkToPortalHomePageAbsolute",
"(",
")",
";",
"}",
"else",
"{",
"$",
"sCallingURL",
"=",
"'/'",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"sCallingURL",
";",
"}"
] | returns the url to the current page.
@return string | [
"returns",
"the",
"url",
"to",
"the",
"current",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L212-L245 |
31,665 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.RemoveFromNoticeList | public function RemoveFromNoticeList($aArticleIdsToMove = null, $sMessageHandler = null, $bIsInteralCall = false, $bIsAjaxCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($aArticleIdsToMove) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$aArticleIdsToMove = $aRequestData[self::URL_ITEM_ID_NAME];
if (!is_array($aArticleIdsToMove)) {
$aArticleIdsToMove = array($aArticleIdsToMove);
}
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMessageManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
foreach ($aArticleIdsToMove as $iArticleId) {
$oUser->RemoveArticleFromNoticeList($iArticleId);
$oArticle = TdbShopArticle::GetNewInstance();
/** @var $oArticle TdbShopArticle */
$oArticle->Load($iArticleId);
$aMessageData = array('sArticleLinkStart' => '<a href="'.TGlobal::OutHTML($oArticle->GetDetailLink()).'">', 'sArticleLinkEnd' => '</a>', 'sArticleName' => $oArticle->GetName());
if (!$bIsAjaxCall) {
$oMessageManager->AddMessage($sMessageHandler, 'NOTICE-LIST-REMOVED-ITEM', $aMessageData);
}
}
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInteralCall) {
if ($bIsAjaxCall) {
return array('message' => '');
} else {
$this->RedirectAfterEvent($iRedirectNodeId);
}
}
} | php | public function RemoveFromNoticeList($aArticleIdsToMove = null, $sMessageHandler = null, $bIsInteralCall = false, $bIsAjaxCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($aArticleIdsToMove) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$aArticleIdsToMove = $aRequestData[self::URL_ITEM_ID_NAME];
if (!is_array($aArticleIdsToMove)) {
$aArticleIdsToMove = array($aArticleIdsToMove);
}
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMessageManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
foreach ($aArticleIdsToMove as $iArticleId) {
$oUser->RemoveArticleFromNoticeList($iArticleId);
$oArticle = TdbShopArticle::GetNewInstance();
/** @var $oArticle TdbShopArticle */
$oArticle->Load($iArticleId);
$aMessageData = array('sArticleLinkStart' => '<a href="'.TGlobal::OutHTML($oArticle->GetDetailLink()).'">', 'sArticleLinkEnd' => '</a>', 'sArticleName' => $oArticle->GetName());
if (!$bIsAjaxCall) {
$oMessageManager->AddMessage($sMessageHandler, 'NOTICE-LIST-REMOVED-ITEM', $aMessageData);
}
}
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInteralCall) {
if ($bIsAjaxCall) {
return array('message' => '');
} else {
$this->RedirectAfterEvent($iRedirectNodeId);
}
}
} | [
"public",
"function",
"RemoveFromNoticeList",
"(",
"$",
"aArticleIdsToMove",
"=",
"null",
",",
"$",
"sMessageHandler",
"=",
"null",
",",
"$",
"bIsInteralCall",
"=",
"false",
",",
"$",
"bIsAjaxCall",
"=",
"false",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aRequestData",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"self",
"::",
"URL_REQUEST_PARAMETER",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aArticleIdsToMove",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_ITEM_ID_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"aArticleIdsToMove",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_ITEM_ID_NAME",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aArticleIdsToMove",
")",
")",
"{",
"$",
"aArticleIdsToMove",
"=",
"array",
"(",
"$",
"aArticleIdsToMove",
")",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sMessageHandler",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_MESSAGE_CONSUMER_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_MESSAGE_CONSUMER_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"sMessageHandler",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sMessageHandler",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"self",
"::",
"MSG_CONSUMER_NAME",
";",
"}",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"foreach",
"(",
"$",
"aArticleIdsToMove",
"as",
"$",
"iArticleId",
")",
"{",
"$",
"oUser",
"->",
"RemoveArticleFromNoticeList",
"(",
"$",
"iArticleId",
")",
";",
"$",
"oArticle",
"=",
"TdbShopArticle",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oArticle TdbShopArticle */",
"$",
"oArticle",
"->",
"Load",
"(",
"$",
"iArticleId",
")",
";",
"$",
"aMessageData",
"=",
"array",
"(",
"'sArticleLinkStart'",
"=>",
"'<a href=\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"$",
"oArticle",
"->",
"GetDetailLink",
"(",
")",
")",
".",
"'\">'",
",",
"'sArticleLinkEnd'",
"=>",
"'</a>'",
",",
"'sArticleName'",
"=>",
"$",
"oArticle",
"->",
"GetName",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"bIsAjaxCall",
")",
"{",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'NOTICE-LIST-REMOVED-ITEM'",
",",
"$",
"aMessageData",
")",
";",
"}",
"}",
"$",
"iRedirectNodeId",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"URL_REDIRECT_NODE_ID_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"iRedirectNodeId",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_REDIRECT_NODE_ID_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"iRedirectNodeId",
")",
")",
"{",
"$",
"iRedirectNodeId",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"!",
"$",
"bIsInteralCall",
")",
"{",
"if",
"(",
"$",
"bIsAjaxCall",
")",
"{",
"return",
"array",
"(",
"'message'",
"=>",
"''",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"RedirectAfterEvent",
"(",
"$",
"iRedirectNodeId",
")",
";",
"}",
"}",
"}"
] | remove item from notice list.
@param array $aArticleIdsToMove
@param string $sMessageHandler
@param bool $bIsInteralCall | [
"remove",
"item",
"from",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L364-L412 |
31,666 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.TransferToNoticeList | public function TransferToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$this->RemoveFromBasket($iArticleId, $sMessageHandler, true);
$this->AddToNoticeList($iArticleId, $iAmount, $sMessageHandler, $bIsInternalCall);
} | php | public function TransferToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$this->RemoveFromBasket($iArticleId, $sMessageHandler, true);
$this->AddToNoticeList($iArticleId, $iAmount, $sMessageHandler, $bIsInternalCall);
} | [
"public",
"function",
"TransferToNoticeList",
"(",
"$",
"iArticleId",
"=",
"null",
",",
"$",
"iAmount",
"=",
"null",
",",
"$",
"sMessageHandler",
"=",
"null",
",",
"$",
"bIsInternalCall",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"RemoveFromBasket",
"(",
"$",
"iArticleId",
",",
"$",
"sMessageHandler",
",",
"true",
")",
";",
"$",
"this",
"->",
"AddToNoticeList",
"(",
"$",
"iArticleId",
",",
"$",
"iAmount",
",",
"$",
"sMessageHandler",
",",
"$",
"bIsInternalCall",
")",
";",
"}"
] | moves or copies one or more articles from the basket to the notice list. products to be moved must be passed.
@param int $iArticleId - if you pass null, it will attempt to fetch the item id from post
@param int $iAmount - amount to add
@param string $sMessageHandler - info passed to this handler - uses the default message consumer for the shop if non passed (can also be passed via get/post)
@param bool $bIsInternalCall | [
"moves",
"or",
"copies",
"one",
"or",
"more",
"articles",
"from",
"the",
"basket",
"to",
"the",
"notice",
"list",
".",
"products",
"to",
"be",
"moved",
"must",
"be",
"passed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L422-L426 |
31,667 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.AddToNoticeList | public function AddToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($iArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$iArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
if (empty($iArticleId)) {
$iArticleId = null;
}
}
if (is_null($iAmount) && array_key_exists(self::URL_ITEM_AMOUNT_NAME, $aRequestData)) {
$iAmount = $aRequestData[self::URL_ITEM_AMOUNT_NAME];
if (empty($iAmount)) {
$iAmount = 1;
}
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMsgManager = TCMSMessageManager::GetInstance();
if (is_null($iArticleId)) {
$oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN');
} else {
$oItem = TdbShopArticle::GetNewInstance();
/** @var $oItem TdbShopArticle */
if ($oItem->Load($iArticleId)) {
$oShop = TdbShop::GetInstance();
// add item to list
$oUser = TdbDataExtranetUser::GetInstance();
$dNewAmountOnList = $oUser->AddArticleIdToNoticeList($iArticleId, $iAmount);
$aInfoData = array('sLinkNoticeListStart' => '<a href="'.$oShop->GetLinkToSystemPage('noticelist').'">', 'sLinkNoticeListEnd' => '</a>', 'sLinkArticleStart' => '<a href="'.$oItem->GetDetailLink().'">', 'sLinkArticleEnd' => '</a>', 'sArticleName' => TGlobal::OutHTML($oItem->GetName()), 'dAddedAmount' => $iAmount, 'dNewAmount' => $dNewAmountOnList, 'sArticleAddedId' => $oItem->id);
if (false === $dNewAmountOnList) {
// article was already on notice list...
$oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ITEM-ALREADY-ON-LIST', $aInfoData);
} else {
$oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ADDED-ITEM', $aInfoData);
}
} else {
$oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID');
}
}
// now redirect either to requested page, or to calling page
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInternalCall) {
$this->RedirectAfterEvent($iRedirectNodeId);
}
} | php | public function AddToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($iArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$iArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
if (empty($iArticleId)) {
$iArticleId = null;
}
}
if (is_null($iAmount) && array_key_exists(self::URL_ITEM_AMOUNT_NAME, $aRequestData)) {
$iAmount = $aRequestData[self::URL_ITEM_AMOUNT_NAME];
if (empty($iAmount)) {
$iAmount = 1;
}
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMsgManager = TCMSMessageManager::GetInstance();
if (is_null($iArticleId)) {
$oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN');
} else {
$oItem = TdbShopArticle::GetNewInstance();
/** @var $oItem TdbShopArticle */
if ($oItem->Load($iArticleId)) {
$oShop = TdbShop::GetInstance();
// add item to list
$oUser = TdbDataExtranetUser::GetInstance();
$dNewAmountOnList = $oUser->AddArticleIdToNoticeList($iArticleId, $iAmount);
$aInfoData = array('sLinkNoticeListStart' => '<a href="'.$oShop->GetLinkToSystemPage('noticelist').'">', 'sLinkNoticeListEnd' => '</a>', 'sLinkArticleStart' => '<a href="'.$oItem->GetDetailLink().'">', 'sLinkArticleEnd' => '</a>', 'sArticleName' => TGlobal::OutHTML($oItem->GetName()), 'dAddedAmount' => $iAmount, 'dNewAmount' => $dNewAmountOnList, 'sArticleAddedId' => $oItem->id);
if (false === $dNewAmountOnList) {
// article was already on notice list...
$oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ITEM-ALREADY-ON-LIST', $aInfoData);
} else {
$oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ADDED-ITEM', $aInfoData);
}
} else {
$oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID');
}
}
// now redirect either to requested page, or to calling page
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInternalCall) {
$this->RedirectAfterEvent($iRedirectNodeId);
}
} | [
"public",
"function",
"AddToNoticeList",
"(",
"$",
"iArticleId",
"=",
"null",
",",
"$",
"iAmount",
"=",
"null",
",",
"$",
"sMessageHandler",
"=",
"null",
",",
"$",
"bIsInternalCall",
"=",
"false",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aRequestData",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"self",
"::",
"URL_REQUEST_PARAMETER",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"iArticleId",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_ITEM_ID_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"iArticleId",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_ITEM_ID_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"iArticleId",
")",
")",
"{",
"$",
"iArticleId",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"iAmount",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_ITEM_AMOUNT_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"iAmount",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_ITEM_AMOUNT_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"iAmount",
")",
")",
"{",
"$",
"iAmount",
"=",
"1",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sMessageHandler",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_MESSAGE_CONSUMER_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_MESSAGE_CONSUMER_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"sMessageHandler",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sMessageHandler",
")",
")",
"{",
"$",
"sMessageHandler",
"=",
"self",
"::",
"MSG_CONSUMER_NAME",
";",
"}",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"iArticleId",
")",
")",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN'",
")",
";",
"}",
"else",
"{",
"$",
"oItem",
"=",
"TdbShopArticle",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oItem TdbShopArticle */",
"if",
"(",
"$",
"oItem",
"->",
"Load",
"(",
"$",
"iArticleId",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"// add item to list",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"dNewAmountOnList",
"=",
"$",
"oUser",
"->",
"AddArticleIdToNoticeList",
"(",
"$",
"iArticleId",
",",
"$",
"iAmount",
")",
";",
"$",
"aInfoData",
"=",
"array",
"(",
"'sLinkNoticeListStart'",
"=>",
"'<a href=\"'",
".",
"$",
"oShop",
"->",
"GetLinkToSystemPage",
"(",
"'noticelist'",
")",
".",
"'\">'",
",",
"'sLinkNoticeListEnd'",
"=>",
"'</a>'",
",",
"'sLinkArticleStart'",
"=>",
"'<a href=\"'",
".",
"$",
"oItem",
"->",
"GetDetailLink",
"(",
")",
".",
"'\">'",
",",
"'sLinkArticleEnd'",
"=>",
"'</a>'",
",",
"'sArticleName'",
"=>",
"TGlobal",
"::",
"OutHTML",
"(",
"$",
"oItem",
"->",
"GetName",
"(",
")",
")",
",",
"'dAddedAmount'",
"=>",
"$",
"iAmount",
",",
"'dNewAmount'",
"=>",
"$",
"dNewAmountOnList",
",",
"'sArticleAddedId'",
"=>",
"$",
"oItem",
"->",
"id",
")",
";",
"if",
"(",
"false",
"===",
"$",
"dNewAmountOnList",
")",
"{",
"// article was already on notice list...",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'NOTICE-LIST-ITEM-ALREADY-ON-LIST'",
",",
"$",
"aInfoData",
")",
";",
"}",
"else",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'NOTICE-LIST-ADDED-ITEM'",
",",
"$",
"aInfoData",
")",
";",
"}",
"}",
"else",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID'",
")",
";",
"}",
"}",
"// now redirect either to requested page, or to calling page",
"$",
"iRedirectNodeId",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"URL_REDIRECT_NODE_ID_NAME",
",",
"$",
"aRequestData",
")",
")",
"{",
"$",
"iRedirectNodeId",
"=",
"$",
"aRequestData",
"[",
"self",
"::",
"URL_REDIRECT_NODE_ID_NAME",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"iRedirectNodeId",
")",
")",
"{",
"$",
"iRedirectNodeId",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"!",
"$",
"bIsInternalCall",
")",
"{",
"$",
"this",
"->",
"RedirectAfterEvent",
"(",
"$",
"iRedirectNodeId",
")",
";",
"}",
"}"
] | insert an item into the notice list.
@param int $iArticleId - if you pass null, it will attempt to fetch the item id from post
@param int $iAmount - amount to add
@param string $sMessageHandler - info passed to this handler - uses the default message consumer for the shop if non passed (can also be passed via get/post)
@param bool $bIsInternalCall | [
"insert",
"an",
"item",
"into",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L436-L498 |
31,668 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.getValidVoucher | protected function getValidVoucher($sShopVoucherCode)
{
$oValidVoucher = null;
/** @var $oVoucher TdbShopVoucher */
$oVoucher = TdbShopVoucher::GetNewInstance();
if (strlen($sShopVoucherCode) >= 3) {
if ($oVoucher->LoadFromFields(array('code' => $sShopVoucherCode, 'is_used_up' => '0'))) {
$oValidVoucher = $oVoucher;
}
}
return $oValidVoucher;
} | php | protected function getValidVoucher($sShopVoucherCode)
{
$oValidVoucher = null;
/** @var $oVoucher TdbShopVoucher */
$oVoucher = TdbShopVoucher::GetNewInstance();
if (strlen($sShopVoucherCode) >= 3) {
if ($oVoucher->LoadFromFields(array('code' => $sShopVoucherCode, 'is_used_up' => '0'))) {
$oValidVoucher = $oVoucher;
}
}
return $oValidVoucher;
} | [
"protected",
"function",
"getValidVoucher",
"(",
"$",
"sShopVoucherCode",
")",
"{",
"$",
"oValidVoucher",
"=",
"null",
";",
"/** @var $oVoucher TdbShopVoucher */",
"$",
"oVoucher",
"=",
"TdbShopVoucher",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"sShopVoucherCode",
")",
">=",
"3",
")",
"{",
"if",
"(",
"$",
"oVoucher",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'code'",
"=>",
"$",
"sShopVoucherCode",
",",
"'is_used_up'",
"=>",
"'0'",
")",
")",
")",
"{",
"$",
"oValidVoucher",
"=",
"$",
"oVoucher",
";",
"}",
"}",
"return",
"$",
"oValidVoucher",
";",
"}"
] | validates the voucher code and tries to load the voucher record.
@param $sShopVoucherCode
@return TdbShopVoucher|null | [
"validates",
"the",
"voucher",
"code",
"and",
"tries",
"to",
"load",
"the",
"voucher",
"record",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L560-L573 |
31,669 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint.RedirectAfterEvent | protected function RedirectAfterEvent($iRequestRedirectNodeId)
{
if (is_null($iRequestRedirectNodeId)) {
$this->RedirectToCallingPage();
} else {
$checkoutSystemPage = $this->getSystemPageService()->getSystemPage('checkout');
if (null !== $checkoutSystemPage && $checkoutSystemPage->fieldCmsTreeId == $iRequestRedirectNodeId) {
$this->JumpToBasketPage();
} else {
$oNode = new TdbCmsTree();
if ($oNode->Load($iRequestRedirectNodeId)) {
$url = $this->getTreeService()->getLinkToPageForTreeRelative($oNode);
$this->getRedirect()->redirect($url);
} else {
$this->RedirectToCallingPage();
}
}
}
} | php | protected function RedirectAfterEvent($iRequestRedirectNodeId)
{
if (is_null($iRequestRedirectNodeId)) {
$this->RedirectToCallingPage();
} else {
$checkoutSystemPage = $this->getSystemPageService()->getSystemPage('checkout');
if (null !== $checkoutSystemPage && $checkoutSystemPage->fieldCmsTreeId == $iRequestRedirectNodeId) {
$this->JumpToBasketPage();
} else {
$oNode = new TdbCmsTree();
if ($oNode->Load($iRequestRedirectNodeId)) {
$url = $this->getTreeService()->getLinkToPageForTreeRelative($oNode);
$this->getRedirect()->redirect($url);
} else {
$this->RedirectToCallingPage();
}
}
}
} | [
"protected",
"function",
"RedirectAfterEvent",
"(",
"$",
"iRequestRedirectNodeId",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"iRequestRedirectNodeId",
")",
")",
"{",
"$",
"this",
"->",
"RedirectToCallingPage",
"(",
")",
";",
"}",
"else",
"{",
"$",
"checkoutSystemPage",
"=",
"$",
"this",
"->",
"getSystemPageService",
"(",
")",
"->",
"getSystemPage",
"(",
"'checkout'",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"checkoutSystemPage",
"&&",
"$",
"checkoutSystemPage",
"->",
"fieldCmsTreeId",
"==",
"$",
"iRequestRedirectNodeId",
")",
"{",
"$",
"this",
"->",
"JumpToBasketPage",
"(",
")",
";",
"}",
"else",
"{",
"$",
"oNode",
"=",
"new",
"TdbCmsTree",
"(",
")",
";",
"if",
"(",
"$",
"oNode",
"->",
"Load",
"(",
"$",
"iRequestRedirectNodeId",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getTreeService",
"(",
")",
"->",
"getLinkToPageForTreeRelative",
"(",
"$",
"oNode",
")",
";",
"$",
"this",
"->",
"getRedirect",
"(",
")",
"->",
"redirect",
"(",
"$",
"url",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"RedirectToCallingPage",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | redirects the user to the requested node after performing some action.
@param string|int $iRequestRedirectNodeId | [
"redirects",
"the",
"user",
"to",
"the",
"requested",
"node",
"after",
"performing",
"some",
"action",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L1005-L1023 |
31,670 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php | MTShopBasketCoreEndpoint._AllowCache | public function _AllowCache()
{
if (0 != TShopBasket::GetInstance()->iTotalNumberOfUniqueArticles) {
return false;
}
if (true === $this->cacheDisabledBecauseBasketHasMessages()) {
return false;
}
return true;
} | php | public function _AllowCache()
{
if (0 != TShopBasket::GetInstance()->iTotalNumberOfUniqueArticles) {
return false;
}
if (true === $this->cacheDisabledBecauseBasketHasMessages()) {
return false;
}
return true;
} | [
"public",
"function",
"_AllowCache",
"(",
")",
"{",
"if",
"(",
"0",
"!=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
"->",
"iTotalNumberOfUniqueArticles",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"cacheDisabledBecauseBasketHasMessages",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | if this function returns true, then the result of the execute function will be cached.
@deprecated - use a mapper instead (see getMapper)
@return bool | [
"if",
"this",
"function",
"returns",
"true",
"then",
"the",
"result",
"of",
"the",
"execute",
"function",
"will",
"be",
"cached",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php#L1050-L1061 |
31,671 | CVO-Technologies/cakephp-github | src/Webservice/EventsWebservice.php | EventsWebservice._stream | protected function _stream($url, array $queryParameters)
{
while (true) {
$this->_lastTime = time();
$options = [];
if ($this->_lastEtag) {
$options['headers']['If-None-Match'] = $this->_lastEtag;
}
/* @var Response $response */
$response = $this->driver()->client()->get($url, $queryParameters, $options);
if ((!$response->isOk()) && ($response->statusCode() != 304)) {
switch ($response->statusCode()) {
case 403:
if ($response->header('X-Ratelimit-Remaining') == 0) {
var_dump($response);
throw new RateLimitExceededException([$response->header('X-Ratelimit-Remaining')]);
}
}
return;
}
if ($response->statusCode() != 304) {
$this->_lastEtag = $response->header('Etag');
$this->_lastPollInterval = $response->header('X-Poll-Interval');
$resources = array_reverse($response->json);
foreach ($resources as $resource) {
if (in_array($resource['id'], $this->_lastIds)) {
continue;
}
array_unshift($this->_lastIds, $resource['id']);
yield $resource;
}
$this->_lastIds = array_splice($this->_lastIds, 0, 30);
}
$sleepingTime = $this->_lastPollInterval - (time() - $this->_lastTime);
if ($sleepingTime > 0) {
sleep($sleepingTime);
}
}
} | php | protected function _stream($url, array $queryParameters)
{
while (true) {
$this->_lastTime = time();
$options = [];
if ($this->_lastEtag) {
$options['headers']['If-None-Match'] = $this->_lastEtag;
}
/* @var Response $response */
$response = $this->driver()->client()->get($url, $queryParameters, $options);
if ((!$response->isOk()) && ($response->statusCode() != 304)) {
switch ($response->statusCode()) {
case 403:
if ($response->header('X-Ratelimit-Remaining') == 0) {
var_dump($response);
throw new RateLimitExceededException([$response->header('X-Ratelimit-Remaining')]);
}
}
return;
}
if ($response->statusCode() != 304) {
$this->_lastEtag = $response->header('Etag');
$this->_lastPollInterval = $response->header('X-Poll-Interval');
$resources = array_reverse($response->json);
foreach ($resources as $resource) {
if (in_array($resource['id'], $this->_lastIds)) {
continue;
}
array_unshift($this->_lastIds, $resource['id']);
yield $resource;
}
$this->_lastIds = array_splice($this->_lastIds, 0, 30);
}
$sleepingTime = $this->_lastPollInterval - (time() - $this->_lastTime);
if ($sleepingTime > 0) {
sleep($sleepingTime);
}
}
} | [
"protected",
"function",
"_stream",
"(",
"$",
"url",
",",
"array",
"$",
"queryParameters",
")",
"{",
"while",
"(",
"true",
")",
"{",
"$",
"this",
"->",
"_lastTime",
"=",
"time",
"(",
")",
";",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_lastEtag",
")",
"{",
"$",
"options",
"[",
"'headers'",
"]",
"[",
"'If-None-Match'",
"]",
"=",
"$",
"this",
"->",
"_lastEtag",
";",
"}",
"/* @var Response $response */",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"(",
")",
"->",
"client",
"(",
")",
"->",
"get",
"(",
"$",
"url",
",",
"$",
"queryParameters",
",",
"$",
"options",
")",
";",
"if",
"(",
"(",
"!",
"$",
"response",
"->",
"isOk",
"(",
")",
")",
"&&",
"(",
"$",
"response",
"->",
"statusCode",
"(",
")",
"!=",
"304",
")",
")",
"{",
"switch",
"(",
"$",
"response",
"->",
"statusCode",
"(",
")",
")",
"{",
"case",
"403",
":",
"if",
"(",
"$",
"response",
"->",
"header",
"(",
"'X-Ratelimit-Remaining'",
")",
"==",
"0",
")",
"{",
"var_dump",
"(",
"$",
"response",
")",
";",
"throw",
"new",
"RateLimitExceededException",
"(",
"[",
"$",
"response",
"->",
"header",
"(",
"'X-Ratelimit-Remaining'",
")",
"]",
")",
";",
"}",
"}",
"return",
";",
"}",
"if",
"(",
"$",
"response",
"->",
"statusCode",
"(",
")",
"!=",
"304",
")",
"{",
"$",
"this",
"->",
"_lastEtag",
"=",
"$",
"response",
"->",
"header",
"(",
"'Etag'",
")",
";",
"$",
"this",
"->",
"_lastPollInterval",
"=",
"$",
"response",
"->",
"header",
"(",
"'X-Poll-Interval'",
")",
";",
"$",
"resources",
"=",
"array_reverse",
"(",
"$",
"response",
"->",
"json",
")",
";",
"foreach",
"(",
"$",
"resources",
"as",
"$",
"resource",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"resource",
"[",
"'id'",
"]",
",",
"$",
"this",
"->",
"_lastIds",
")",
")",
"{",
"continue",
";",
"}",
"array_unshift",
"(",
"$",
"this",
"->",
"_lastIds",
",",
"$",
"resource",
"[",
"'id'",
"]",
")",
";",
"yield",
"$",
"resource",
";",
"}",
"$",
"this",
"->",
"_lastIds",
"=",
"array_splice",
"(",
"$",
"this",
"->",
"_lastIds",
",",
"0",
",",
"30",
")",
";",
"}",
"$",
"sleepingTime",
"=",
"$",
"this",
"->",
"_lastPollInterval",
"-",
"(",
"time",
"(",
")",
"-",
"$",
"this",
"->",
"_lastTime",
")",
";",
"if",
"(",
"$",
"sleepingTime",
">",
"0",
")",
"{",
"sleep",
"(",
"$",
"sleepingTime",
")",
";",
"}",
"}",
"}"
] | Stream results from the events endpoint.
@param string $url Endpoint to stream events from.
@param array $queryParameters Query parameters to send
@return \Generator|void | [
"Stream",
"results",
"from",
"the",
"events",
"endpoint",
"."
] | 43647e53fd87a3ab93fe2f24ce3686b594d36241 | https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Webservice/EventsWebservice.php#L81-L127 |
31,672 | CVO-Technologies/cakephp-github | src/Webservice/EventsWebservice.php | EventsWebservice._transformStreamResponses | protected function _transformStreamResponses(Endpoint $endpoint, \Iterator $resources)
{
foreach ($resources as $resource) {
yield $this->_transformResource($endpoint, $resource);
}
} | php | protected function _transformStreamResponses(Endpoint $endpoint, \Iterator $resources)
{
foreach ($resources as $resource) {
yield $this->_transformResource($endpoint, $resource);
}
} | [
"protected",
"function",
"_transformStreamResponses",
"(",
"Endpoint",
"$",
"endpoint",
",",
"\\",
"Iterator",
"$",
"resources",
")",
"{",
"foreach",
"(",
"$",
"resources",
"as",
"$",
"resource",
")",
"{",
"yield",
"$",
"this",
"->",
"_transformResource",
"(",
"$",
"endpoint",
",",
"$",
"resource",
")",
";",
"}",
"}"
] | Transforms streamed responses into resources
@param \Muffin\Webservice\Model\Endpoint $endpoint Endpoint to use for resource class
@param \Iterator $resources Iterator to get responses from
@yield \Muffin\Webservice\Model\Resource Webservice resource
@return \Generator Resource generator
@throws \Exception HTTP exception | [
"Transforms",
"streamed",
"responses",
"into",
"resources"
] | 43647e53fd87a3ab93fe2f24ce3686b594d36241 | https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Webservice/EventsWebservice.php#L138-L143 |
31,673 | PGB-LIV/php-ms | src/Utility/Digest/AbstractDigest.php | AbstractDigest.setMaxMissedCleavage | public function setMaxMissedCleavage($maxMissedCleavage)
{
if (! is_int($maxMissedCleavage)) {
throw new \InvalidArgumentException(
'Invalid argument type, integer expected. Received ' . gettype($maxMissedCleavage));
}
$this->maxMissedCleavage = $maxMissedCleavage;
} | php | public function setMaxMissedCleavage($maxMissedCleavage)
{
if (! is_int($maxMissedCleavage)) {
throw new \InvalidArgumentException(
'Invalid argument type, integer expected. Received ' . gettype($maxMissedCleavage));
}
$this->maxMissedCleavage = $maxMissedCleavage;
} | [
"public",
"function",
"setMaxMissedCleavage",
"(",
"$",
"maxMissedCleavage",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"maxMissedCleavage",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid argument type, integer expected. Received '",
".",
"gettype",
"(",
"$",
"maxMissedCleavage",
")",
")",
";",
"}",
"$",
"this",
"->",
"maxMissedCleavage",
"=",
"$",
"maxMissedCleavage",
";",
"}"
] | Set the maximum number of missed cleavages the algorithm should produce.
By default no missed cleavages are produced.
@param int $maxMissedCleavage
Maximum number of cleavages to account for | [
"Set",
"the",
"maximum",
"number",
"of",
"missed",
"cleavages",
"the",
"algorithm",
"should",
"produce",
".",
"By",
"default",
"no",
"missed",
"cleavages",
"are",
"produced",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Digest/AbstractDigest.php#L58-L66 |
31,674 | PGB-LIV/php-ms | src/Utility/Digest/AbstractDigest.php | AbstractDigest.setNmeEnabled | public function setNmeEnabled($isNmeEnabled)
{
if (! is_bool($isNmeEnabled)) {
throw new \InvalidArgumentException(
'Invalid argument type, bool expected. Received ' . gettype($isNmeEnabled));
}
$this->isNmeEnabled = $isNmeEnabled;
} | php | public function setNmeEnabled($isNmeEnabled)
{
if (! is_bool($isNmeEnabled)) {
throw new \InvalidArgumentException(
'Invalid argument type, bool expected. Received ' . gettype($isNmeEnabled));
}
$this->isNmeEnabled = $isNmeEnabled;
} | [
"public",
"function",
"setNmeEnabled",
"(",
"$",
"isNmeEnabled",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"isNmeEnabled",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid argument type, bool expected. Received '",
".",
"gettype",
"(",
"$",
"isNmeEnabled",
")",
")",
";",
"}",
"$",
"this",
"->",
"isNmeEnabled",
"=",
"$",
"isNmeEnabled",
";",
"}"
] | Sets whether n-terminal methionine excision should be performed.
When enabled any methionine at the n-terminus of a protein will be removed.
Both the excised and non-excised peptide will be returned after
digestion. Defaults to true.
@param bool $isNmeEnabled
Set true to enable n-terminal methionine excision | [
"Sets",
"whether",
"n",
"-",
"terminal",
"methionine",
"excision",
"should",
"be",
"performed",
".",
"When",
"enabled",
"any",
"methionine",
"at",
"the",
"n",
"-",
"terminus",
"of",
"a",
"protein",
"will",
"be",
"removed",
".",
"Both",
"the",
"excised",
"and",
"non",
"-",
"excised",
"peptide",
"will",
"be",
"returned",
"after",
"digestion",
".",
"Defaults",
"to",
"true",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Digest/AbstractDigest.php#L87-L95 |
31,675 | PGB-LIV/php-ms | src/Utility/Digest/AbstractDigest.php | AbstractDigest.performMethionineExcision | private function performMethionineExcision(array $peptides)
{
$nmePeptides = array();
foreach ($peptides as $peptide) {
$entry = $peptide->getProteins()[0];
if ($entry->getStart() > 0) {
continue;
}
$sequence = $peptide->getSequence();
if (strlen($sequence) <= 1) {
continue;
}
if ($sequence[0] != 'M') {
continue;
}
$nmePeptide = new Peptide();
$nmePeptide->setSequence(substr($sequence, 1));
$nmePeptide->addProtein($entry->getProtein(), 1, $entry->getEnd());
$nmePeptide->setMissedCleavageCount($peptide->getMissedCleavageCount());
$nmePeptides[] = $nmePeptide;
}
return array_merge($peptides, $nmePeptides);
} | php | private function performMethionineExcision(array $peptides)
{
$nmePeptides = array();
foreach ($peptides as $peptide) {
$entry = $peptide->getProteins()[0];
if ($entry->getStart() > 0) {
continue;
}
$sequence = $peptide->getSequence();
if (strlen($sequence) <= 1) {
continue;
}
if ($sequence[0] != 'M') {
continue;
}
$nmePeptide = new Peptide();
$nmePeptide->setSequence(substr($sequence, 1));
$nmePeptide->addProtein($entry->getProtein(), 1, $entry->getEnd());
$nmePeptide->setMissedCleavageCount($peptide->getMissedCleavageCount());
$nmePeptides[] = $nmePeptide;
}
return array_merge($peptides, $nmePeptides);
} | [
"private",
"function",
"performMethionineExcision",
"(",
"array",
"$",
"peptides",
")",
"{",
"$",
"nmePeptides",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"peptides",
"as",
"$",
"peptide",
")",
"{",
"$",
"entry",
"=",
"$",
"peptide",
"->",
"getProteins",
"(",
")",
"[",
"0",
"]",
";",
"if",
"(",
"$",
"entry",
"->",
"getStart",
"(",
")",
">",
"0",
")",
"{",
"continue",
";",
"}",
"$",
"sequence",
"=",
"$",
"peptide",
"->",
"getSequence",
"(",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"sequence",
")",
"<=",
"1",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"sequence",
"[",
"0",
"]",
"!=",
"'M'",
")",
"{",
"continue",
";",
"}",
"$",
"nmePeptide",
"=",
"new",
"Peptide",
"(",
")",
";",
"$",
"nmePeptide",
"->",
"setSequence",
"(",
"substr",
"(",
"$",
"sequence",
",",
"1",
")",
")",
";",
"$",
"nmePeptide",
"->",
"addProtein",
"(",
"$",
"entry",
"->",
"getProtein",
"(",
")",
",",
"1",
",",
"$",
"entry",
"->",
"getEnd",
"(",
")",
")",
";",
"$",
"nmePeptide",
"->",
"setMissedCleavageCount",
"(",
"$",
"peptide",
"->",
"getMissedCleavageCount",
"(",
")",
")",
";",
"$",
"nmePeptides",
"[",
"]",
"=",
"$",
"nmePeptide",
";",
"}",
"return",
"array_merge",
"(",
"$",
"peptides",
",",
"$",
"nmePeptides",
")",
";",
"}"
] | Performs methionine excision on an array of peptides
@param Peptide $peptides
@return Peptide[] | [
"Performs",
"methionine",
"excision",
"on",
"an",
"array",
"of",
"peptides"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Digest/AbstractDigest.php#L131-L160 |
31,676 | PGB-LIV/php-ms | src/Core/Entry/ProteinEntry.php | ProteinEntry.setStart | public function setStart($position)
{
if (! is_int($position)) {
throw new \InvalidArgumentException(
'Argument 1 must be of type integer. Argument type is ' . gettype($position));
}
$this->start = $position;
} | php | public function setStart($position)
{
if (! is_int($position)) {
throw new \InvalidArgumentException(
'Argument 1 must be of type integer. Argument type is ' . gettype($position));
}
$this->start = $position;
} | [
"public",
"function",
"setStart",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"position",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must be of type integer. Argument type is '",
".",
"gettype",
"(",
"$",
"position",
")",
")",
";",
"}",
"$",
"this",
"->",
"start",
"=",
"$",
"position",
";",
"}"
] | Sets the start position of the parent object inside the protein
@param int $position
@throws \InvalidArgumentException If argument is non-integer | [
"Sets",
"the",
"start",
"position",
"of",
"the",
"parent",
"object",
"inside",
"the",
"protein"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Entry/ProteinEntry.php#L78-L86 |
31,677 | PGB-LIV/php-ms | src/Core/Entry/ProteinEntry.php | ProteinEntry.setEnd | public function setEnd($position)
{
if (! is_int($position)) {
throw new \InvalidArgumentException(
'Argument 1 must be of type integer. Argument type is ' . gettype($position));
}
$this->end = $position;
} | php | public function setEnd($position)
{
if (! is_int($position)) {
throw new \InvalidArgumentException(
'Argument 1 must be of type integer. Argument type is ' . gettype($position));
}
$this->end = $position;
} | [
"public",
"function",
"setEnd",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"position",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must be of type integer. Argument type is '",
".",
"gettype",
"(",
"$",
"position",
")",
")",
";",
"}",
"$",
"this",
"->",
"end",
"=",
"$",
"position",
";",
"}"
] | Sets the end position of the parent object inside the protein
@param int $position
@throws \InvalidArgumentException If argument is non-integer | [
"Sets",
"the",
"end",
"position",
"of",
"the",
"parent",
"object",
"inside",
"the",
"protein"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Entry/ProteinEntry.php#L104-L112 |
31,678 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVariantSet.class.php | TShopVariantSet.GetChangableFieldNames | public function GetChangableFieldNames()
{
$aFieldNames = $this->GetFromInternalCache('aChangableFieldNames');
if (is_null($aFieldNames)) {
$aFieldNames = array();
$oFields = $this->GetFieldCmsFieldConfList();
while ($oField = $oFields->Next()) {
$aFieldNames[] = $oField->fieldName;
}
$oFields->GoToStart();
$this->SetInternalCache('aChangableFieldNames', $aFieldNames);
}
return $aFieldNames;
} | php | public function GetChangableFieldNames()
{
$aFieldNames = $this->GetFromInternalCache('aChangableFieldNames');
if (is_null($aFieldNames)) {
$aFieldNames = array();
$oFields = $this->GetFieldCmsFieldConfList();
while ($oField = $oFields->Next()) {
$aFieldNames[] = $oField->fieldName;
}
$oFields->GoToStart();
$this->SetInternalCache('aChangableFieldNames', $aFieldNames);
}
return $aFieldNames;
} | [
"public",
"function",
"GetChangableFieldNames",
"(",
")",
"{",
"$",
"aFieldNames",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'aChangableFieldNames'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aFieldNames",
")",
")",
"{",
"$",
"aFieldNames",
"=",
"array",
"(",
")",
";",
"$",
"oFields",
"=",
"$",
"this",
"->",
"GetFieldCmsFieldConfList",
"(",
")",
";",
"while",
"(",
"$",
"oField",
"=",
"$",
"oFields",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aFieldNames",
"[",
"]",
"=",
"$",
"oField",
"->",
"fieldName",
";",
"}",
"$",
"oFields",
"->",
"GoToStart",
"(",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'aChangableFieldNames'",
",",
"$",
"aFieldNames",
")",
";",
"}",
"return",
"$",
"aFieldNames",
";",
"}"
] | return an array of fields that may be edited for variants of this set.
@return array | [
"return",
"an",
"array",
"of",
"fields",
"that",
"may",
"be",
"edited",
"for",
"variants",
"of",
"this",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantSet.class.php#L19-L33 |
31,679 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVariantSet.class.php | TShopVariantSet.AllowEditOfField | public function AllowEditOfField($sFieldName)
{
$aFieldsEditable = $this->GetChangableFieldNames();
$sFieldName = str_replace('`', '', $sFieldName);
return in_array($sFieldName, $aFieldsEditable);
} | php | public function AllowEditOfField($sFieldName)
{
$aFieldsEditable = $this->GetChangableFieldNames();
$sFieldName = str_replace('`', '', $sFieldName);
return in_array($sFieldName, $aFieldsEditable);
} | [
"public",
"function",
"AllowEditOfField",
"(",
"$",
"sFieldName",
")",
"{",
"$",
"aFieldsEditable",
"=",
"$",
"this",
"->",
"GetChangableFieldNames",
"(",
")",
";",
"$",
"sFieldName",
"=",
"str_replace",
"(",
"'`'",
",",
"''",
",",
"$",
"sFieldName",
")",
";",
"return",
"in_array",
"(",
"$",
"sFieldName",
",",
"$",
"aFieldsEditable",
")",
";",
"}"
] | returns true if the field name passed is allowed to be edtited for variants of this set type.
@param string $sFieldName
@return bool | [
"returns",
"true",
"if",
"the",
"field",
"name",
"passed",
"is",
"allowed",
"to",
"be",
"edtited",
"for",
"variants",
"of",
"this",
"set",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantSet.class.php#L42-L48 |
31,680 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVariantSet.class.php | TShopVariantSet.GetVariantTypeForIdentifier | public function GetVariantTypeForIdentifier($sVariantTypeIdentifier)
{
$oType = &$this->GetFromInternalCache('VariantTypeForIdentifier'.$sVariantTypeIdentifier);
if (is_null($oType)) {
$oType = TdbShopVariantType::GetNewInstance();
/** @var $oType TdbShopVariantType */
if (!$oType->Loadfromfields(array('shop_variant_set_id' => $this->id, 'identifier' => $sVariantTypeIdentifier))) {
$oType = null;
}
$this->SetInternalCache('VariantTypeForIdentifier'.$sVariantTypeIdentifier, $oType);
}
return $oType;
} | php | public function GetVariantTypeForIdentifier($sVariantTypeIdentifier)
{
$oType = &$this->GetFromInternalCache('VariantTypeForIdentifier'.$sVariantTypeIdentifier);
if (is_null($oType)) {
$oType = TdbShopVariantType::GetNewInstance();
/** @var $oType TdbShopVariantType */
if (!$oType->Loadfromfields(array('shop_variant_set_id' => $this->id, 'identifier' => $sVariantTypeIdentifier))) {
$oType = null;
}
$this->SetInternalCache('VariantTypeForIdentifier'.$sVariantTypeIdentifier, $oType);
}
return $oType;
} | [
"public",
"function",
"GetVariantTypeForIdentifier",
"(",
"$",
"sVariantTypeIdentifier",
")",
"{",
"$",
"oType",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'VariantTypeForIdentifier'",
".",
"$",
"sVariantTypeIdentifier",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oType",
")",
")",
"{",
"$",
"oType",
"=",
"TdbShopVariantType",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oType TdbShopVariantType */",
"if",
"(",
"!",
"$",
"oType",
"->",
"Loadfromfields",
"(",
"array",
"(",
"'shop_variant_set_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'identifier'",
"=>",
"$",
"sVariantTypeIdentifier",
")",
")",
")",
"{",
"$",
"oType",
"=",
"null",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'VariantTypeForIdentifier'",
".",
"$",
"sVariantTypeIdentifier",
",",
"$",
"oType",
")",
";",
"}",
"return",
"$",
"oType",
";",
"}"
] | return the variant type with the identifier.
@param string $sVariantTypeIdentifier
@return TdbShopVariantType | [
"return",
"the",
"variant",
"type",
"with",
"the",
"identifier",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantSet.class.php#L73-L86 |
31,681 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/Constraints.php | OffAmazonPaymentsService_Model_Constraints.setConstraint | public function setConstraint($constraint)
{
if (!$this->_isNumericArray($constraint)) {
$constraint = array ($constraint);
}
$this->_fields['Constraint']['FieldValue'] = $constraint;
return $this;
} | php | public function setConstraint($constraint)
{
if (!$this->_isNumericArray($constraint)) {
$constraint = array ($constraint);
}
$this->_fields['Constraint']['FieldValue'] = $constraint;
return $this;
} | [
"public",
"function",
"setConstraint",
"(",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isNumericArray",
"(",
"$",
"constraint",
")",
")",
"{",
"$",
"constraint",
"=",
"array",
"(",
"$",
"constraint",
")",
";",
"}",
"$",
"this",
"->",
"_fields",
"[",
"'Constraint'",
"]",
"[",
"'FieldValue'",
"]",
"=",
"$",
"constraint",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the value of the Constraint.
@param mixed Constraint or an array of Constraint Constraint
@return this instance | [
"Sets",
"the",
"value",
"of",
"the",
"Constraint",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/Constraints.php#L75-L82 |
31,682 | PGB-LIV/php-ms | src/Core/Peptide.php | Peptide.getMolecularFormula | public function getMolecularFormula()
{
$acids = str_split($this->getSequence(), 1);
$frequency = array(
'C' => 0,
'H' => 0,
'N' => 0,
'O' => 0,
'S' => 0
);
foreach ($acids as $acid) {
$composition = AminoAcidComposition::getFormula($acid);
$matches = array();
preg_match_all('/([A-Z][a-z]?)([0-9]*)/', $composition, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$chemical = $match[1];
$count = $match[2];
if (! isset($frequency[$chemical])) {
$frequency[$chemical] = 0;
}
$frequency[$chemical] += $count == '' ? 1 : $count;
}
}
// Remove hydrogen and oxygen from C-TERM
$frequency['H'] -= count($acids) - 1;
$frequency['O'] -= count($acids) - 1;
// Remove hydrogen from N-TERM.
$frequency['H'] -= count($acids) - 1;
$formula = '';
foreach ($frequency as $chemical => $count) {
if ($count == 0) {
continue;
}
$formula .= $chemical;
if ($count > 1) {
$formula .= $count;
}
}
return $formula;
} | php | public function getMolecularFormula()
{
$acids = str_split($this->getSequence(), 1);
$frequency = array(
'C' => 0,
'H' => 0,
'N' => 0,
'O' => 0,
'S' => 0
);
foreach ($acids as $acid) {
$composition = AminoAcidComposition::getFormula($acid);
$matches = array();
preg_match_all('/([A-Z][a-z]?)([0-9]*)/', $composition, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$chemical = $match[1];
$count = $match[2];
if (! isset($frequency[$chemical])) {
$frequency[$chemical] = 0;
}
$frequency[$chemical] += $count == '' ? 1 : $count;
}
}
// Remove hydrogen and oxygen from C-TERM
$frequency['H'] -= count($acids) - 1;
$frequency['O'] -= count($acids) - 1;
// Remove hydrogen from N-TERM.
$frequency['H'] -= count($acids) - 1;
$formula = '';
foreach ($frequency as $chemical => $count) {
if ($count == 0) {
continue;
}
$formula .= $chemical;
if ($count > 1) {
$formula .= $count;
}
}
return $formula;
} | [
"public",
"function",
"getMolecularFormula",
"(",
")",
"{",
"$",
"acids",
"=",
"str_split",
"(",
"$",
"this",
"->",
"getSequence",
"(",
")",
",",
"1",
")",
";",
"$",
"frequency",
"=",
"array",
"(",
"'C'",
"=>",
"0",
",",
"'H'",
"=>",
"0",
",",
"'N'",
"=>",
"0",
",",
"'O'",
"=>",
"0",
",",
"'S'",
"=>",
"0",
")",
";",
"foreach",
"(",
"$",
"acids",
"as",
"$",
"acid",
")",
"{",
"$",
"composition",
"=",
"AminoAcidComposition",
"::",
"getFormula",
"(",
"$",
"acid",
")",
";",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"preg_match_all",
"(",
"'/([A-Z][a-z]?)([0-9]*)/'",
",",
"$",
"composition",
",",
"$",
"matches",
",",
"PREG_SET_ORDER",
")",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"match",
")",
"{",
"$",
"chemical",
"=",
"$",
"match",
"[",
"1",
"]",
";",
"$",
"count",
"=",
"$",
"match",
"[",
"2",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"frequency",
"[",
"$",
"chemical",
"]",
")",
")",
"{",
"$",
"frequency",
"[",
"$",
"chemical",
"]",
"=",
"0",
";",
"}",
"$",
"frequency",
"[",
"$",
"chemical",
"]",
"+=",
"$",
"count",
"==",
"''",
"?",
"1",
":",
"$",
"count",
";",
"}",
"}",
"// Remove hydrogen and oxygen from C-TERM",
"$",
"frequency",
"[",
"'H'",
"]",
"-=",
"count",
"(",
"$",
"acids",
")",
"-",
"1",
";",
"$",
"frequency",
"[",
"'O'",
"]",
"-=",
"count",
"(",
"$",
"acids",
")",
"-",
"1",
";",
"// Remove hydrogen from N-TERM.",
"$",
"frequency",
"[",
"'H'",
"]",
"-=",
"count",
"(",
"$",
"acids",
")",
"-",
"1",
";",
"$",
"formula",
"=",
"''",
";",
"foreach",
"(",
"$",
"frequency",
"as",
"$",
"chemical",
"=>",
"$",
"count",
")",
"{",
"if",
"(",
"$",
"count",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"$",
"formula",
".=",
"$",
"chemical",
";",
"if",
"(",
"$",
"count",
">",
"1",
")",
"{",
"$",
"formula",
".=",
"$",
"count",
";",
"}",
"}",
"return",
"$",
"formula",
";",
"}"
] | Gets the molecular formula for this peptide string.
@return string Molecular formula | [
"Gets",
"the",
"molecular",
"formula",
"for",
"this",
"peptide",
"string",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Peptide.php#L119-L170 |
31,683 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSSmartURLHandler/TCMSSmartURLHandler_ShopIPayment.class.php | TCMSSmartURLHandler_ShopIPayment.SetStepParameter | protected function SetStepParameter($oStep)
{
$bParameterSet = false;
$oBasket = TShopBasket::GetInstance();
$oGlobal = TGlobal::instance();
$sPaymentMethodId = $oGlobal->GetUserData('shop_payment_method_id');
$oActivePaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if ($oActivePaymentMethod->load($sPaymentMethodId)) {
$bParameterSet = $oBasket->SetActivePaymentMethod($oActivePaymentMethod);
}
return $bParameterSet;
} | php | protected function SetStepParameter($oStep)
{
$bParameterSet = false;
$oBasket = TShopBasket::GetInstance();
$oGlobal = TGlobal::instance();
$sPaymentMethodId = $oGlobal->GetUserData('shop_payment_method_id');
$oActivePaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if ($oActivePaymentMethod->load($sPaymentMethodId)) {
$bParameterSet = $oBasket->SetActivePaymentMethod($oActivePaymentMethod);
}
return $bParameterSet;
} | [
"protected",
"function",
"SetStepParameter",
"(",
"$",
"oStep",
")",
"{",
"$",
"bParameterSet",
"=",
"false",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sPaymentMethodId",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'shop_payment_method_id'",
")",
";",
"$",
"oActivePaymentMethod",
"=",
"TdbShopPaymentMethod",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oActivePaymentMethod",
"->",
"load",
"(",
"$",
"sPaymentMethodId",
")",
")",
"{",
"$",
"bParameterSet",
"=",
"$",
"oBasket",
"->",
"SetActivePaymentMethod",
"(",
"$",
"oActivePaymentMethod",
")",
";",
"}",
"return",
"$",
"bParameterSet",
";",
"}"
] | Set needed parameter for next step like step completed and active payment method.
@param TShopOrderStep $oStep
@return bool $bParameterSet | [
"Set",
"needed",
"parameter",
"for",
"next",
"step",
"like",
"step",
"completed",
"and",
"active",
"payment",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSSmartURLHandler/TCMSSmartURLHandler_ShopIPayment.class.php#L62-L74 |
31,684 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSSmartURLHandler/TCMSSmartURLHandler_ShopIPayment.class.php | TCMSSmartURLHandler_ShopIPayment.DeleteNotExecutedOrder | protected function DeleteNotExecutedOrder($sUniqId)
{
$oNotExecutedOrder = TdbShopOrder::GetNewInstance();
if ($oNotExecutedOrder->LoadFromField('order_ident', $sUniqId)) {
$oNotExecutedOrder->AllowEditByAll(true);
$oNotExecutedOrder->Delete();
$oNotExecutedOrder->AllowEditByAll(false);
unset($_SESSION[TShopBasket::SESSION_KEY_PROCESSING_BASKET]);
}
} | php | protected function DeleteNotExecutedOrder($sUniqId)
{
$oNotExecutedOrder = TdbShopOrder::GetNewInstance();
if ($oNotExecutedOrder->LoadFromField('order_ident', $sUniqId)) {
$oNotExecutedOrder->AllowEditByAll(true);
$oNotExecutedOrder->Delete();
$oNotExecutedOrder->AllowEditByAll(false);
unset($_SESSION[TShopBasket::SESSION_KEY_PROCESSING_BASKET]);
}
} | [
"protected",
"function",
"DeleteNotExecutedOrder",
"(",
"$",
"sUniqId",
")",
"{",
"$",
"oNotExecutedOrder",
"=",
"TdbShopOrder",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oNotExecutedOrder",
"->",
"LoadFromField",
"(",
"'order_ident'",
",",
"$",
"sUniqId",
")",
")",
"{",
"$",
"oNotExecutedOrder",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"oNotExecutedOrder",
"->",
"Delete",
"(",
")",
";",
"$",
"oNotExecutedOrder",
"->",
"AllowEditByAll",
"(",
"false",
")",
";",
"unset",
"(",
"$",
"_SESSION",
"[",
"TShopBasket",
"::",
"SESSION_KEY_PROCESSING_BASKET",
"]",
")",
";",
"}",
"}"
] | Delete existing order if payment wasnt done correctly.
@param string $sUniqId | [
"Delete",
"existing",
"order",
"if",
"payment",
"wasnt",
"done",
"correctly",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSSmartURLHandler/TCMSSmartURLHandler_ShopIPayment.class.php#L81-L90 |
31,685 | sylingd/Yesf | src/Http/Router.php | Router.parseMap | private function parseMap(Request $request) {
//解析
$res = explode('/', trim($request->uri, '/'), 3);
if (count($res) === 3) {
$request->module = $res[0];
$request->controller = $res[1];
$request->action = $res[2];
} else {
$request->module = $this->module;
$request->controller = $res[0];
$request->action = $res[1];
}
return true;
} | php | private function parseMap(Request $request) {
//解析
$res = explode('/', trim($request->uri, '/'), 3);
if (count($res) === 3) {
$request->module = $res[0];
$request->controller = $res[1];
$request->action = $res[2];
} else {
$request->module = $this->module;
$request->controller = $res[0];
$request->action = $res[1];
}
return true;
} | [
"private",
"function",
"parseMap",
"(",
"Request",
"$",
"request",
")",
"{",
"//解析",
"$",
"res",
"=",
"explode",
"(",
"'/'",
",",
"trim",
"(",
"$",
"request",
"->",
"uri",
",",
"'/'",
")",
",",
"3",
")",
";",
"if",
"(",
"count",
"(",
"$",
"res",
")",
"===",
"3",
")",
"{",
"$",
"request",
"->",
"module",
"=",
"$",
"res",
"[",
"0",
"]",
";",
"$",
"request",
"->",
"controller",
"=",
"$",
"res",
"[",
"1",
"]",
";",
"$",
"request",
"->",
"action",
"=",
"$",
"res",
"[",
"2",
"]",
";",
"}",
"else",
"{",
"$",
"request",
"->",
"module",
"=",
"$",
"this",
"->",
"module",
";",
"$",
"request",
"->",
"controller",
"=",
"$",
"res",
"[",
"0",
"]",
";",
"$",
"request",
"->",
"action",
"=",
"$",
"res",
"[",
"1",
"]",
";",
"}",
"return",
"true",
";",
"}"
] | Parse request in map way
@access private
@param Request $request
@return bool | [
"Parse",
"request",
"in",
"map",
"way"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Router.php#L124-L137 |
31,686 | sylingd/Yesf | src/Http/Router.php | Router.parseBy | private function parseBy($rules, Request $request) {
foreach ($rules as $rewrite) {
if (isset($rewrite['uri'])) {
if ($request->uri === $rewrite['uri']) {
$dispatch = $rewrite['dispatch'];
break;
}
} else {
if (preg_match($rewrite['regex'], $request->uri, $matches)) {
$param = [];
unset($matches[0]);
//参数
foreach ($rewrite['param'] as $k => $v) {
$param[$v] = $matches[$k + 1];
}
$dispatch = $rewrite['dispatch'];
if ($dispatch instanceof \Closure) {
$dispatch = $dispatch($param);
if ($dispatch === null) {
unset($dispatch);
continue;
}
}
break;
}
}
}
if (isset($dispatch)) {
$request->module = isset($dispatch['module']) ? $dispatch['module'] : $this->module;
$request->controller = $dispatch['controller'];
$request->action = $dispatch['action'];
if (isset($param)) {
$request->param = $param;
}
return true;
}
return false;
} | php | private function parseBy($rules, Request $request) {
foreach ($rules as $rewrite) {
if (isset($rewrite['uri'])) {
if ($request->uri === $rewrite['uri']) {
$dispatch = $rewrite['dispatch'];
break;
}
} else {
if (preg_match($rewrite['regex'], $request->uri, $matches)) {
$param = [];
unset($matches[0]);
//参数
foreach ($rewrite['param'] as $k => $v) {
$param[$v] = $matches[$k + 1];
}
$dispatch = $rewrite['dispatch'];
if ($dispatch instanceof \Closure) {
$dispatch = $dispatch($param);
if ($dispatch === null) {
unset($dispatch);
continue;
}
}
break;
}
}
}
if (isset($dispatch)) {
$request->module = isset($dispatch['module']) ? $dispatch['module'] : $this->module;
$request->controller = $dispatch['controller'];
$request->action = $dispatch['action'];
if (isset($param)) {
$request->param = $param;
}
return true;
}
return false;
} | [
"private",
"function",
"parseBy",
"(",
"$",
"rules",
",",
"Request",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"rewrite",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"rewrite",
"[",
"'uri'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"uri",
"===",
"$",
"rewrite",
"[",
"'uri'",
"]",
")",
"{",
"$",
"dispatch",
"=",
"$",
"rewrite",
"[",
"'dispatch'",
"]",
";",
"break",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"rewrite",
"[",
"'regex'",
"]",
",",
"$",
"request",
"->",
"uri",
",",
"$",
"matches",
")",
")",
"{",
"$",
"param",
"=",
"[",
"]",
";",
"unset",
"(",
"$",
"matches",
"[",
"0",
"]",
")",
";",
"//参数",
"foreach",
"(",
"$",
"rewrite",
"[",
"'param'",
"]",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"param",
"[",
"$",
"v",
"]",
"=",
"$",
"matches",
"[",
"$",
"k",
"+",
"1",
"]",
";",
"}",
"$",
"dispatch",
"=",
"$",
"rewrite",
"[",
"'dispatch'",
"]",
";",
"if",
"(",
"$",
"dispatch",
"instanceof",
"\\",
"Closure",
")",
"{",
"$",
"dispatch",
"=",
"$",
"dispatch",
"(",
"$",
"param",
")",
";",
"if",
"(",
"$",
"dispatch",
"===",
"null",
")",
"{",
"unset",
"(",
"$",
"dispatch",
")",
";",
"continue",
";",
"}",
"}",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"dispatch",
")",
")",
"{",
"$",
"request",
"->",
"module",
"=",
"isset",
"(",
"$",
"dispatch",
"[",
"'module'",
"]",
")",
"?",
"$",
"dispatch",
"[",
"'module'",
"]",
":",
"$",
"this",
"->",
"module",
";",
"$",
"request",
"->",
"controller",
"=",
"$",
"dispatch",
"[",
"'controller'",
"]",
";",
"$",
"request",
"->",
"action",
"=",
"$",
"dispatch",
"[",
"'action'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"param",
")",
")",
"{",
"$",
"request",
"->",
"param",
"=",
"$",
"param",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Parse request with given rules
@access private
@param array $rules
@param Request $request
@return bool | [
"Parse",
"request",
"with",
"given",
"rules"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Router.php#L146-L183 |
31,687 | sylingd/Yesf | src/Http/Router.php | Router.parse | public function parse(Request $request) {
$len = strlen($this->prefix);
//路由解析
$uri = $request->server['request_uri'];
if (strpos('?', $uri) !== false) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
//去除开头的prefix
if ($len > 0 && strpos($uri, $this->prefix) === 0) {
$uri = substr($uri, $len);
}
$request->uri = $uri;
$res = false;
if (isset($this->routes[$request->server['request_method']])) {
$res = $this->parseBy($this->routes[$request->server['request_method']], $request);
}
if ($res === false && isset($this->routes['any'])) {
$res = $this->parseBy($this->routes['any'], $request);
}
if ($res === false) {
if ($this->enable_map) {
//为空则读取默认设置
if (empty($uri) || $uri === '/') {
$request->module = $this->module;
$request->controller = 'index';
$request->action = 'index';
} else {
if ($this->enable_extension) {
$hasPoint = strrpos($uri, '.');
if ($hasPoint !== false) {
$request->extension = substr($uri, $hasPoint + 1);
$uri = substr($uri, 0, $hasPoint);
$request->uri = $uri;
}
}
$this->parseMap($request);
}
}
}
} | php | public function parse(Request $request) {
$len = strlen($this->prefix);
//路由解析
$uri = $request->server['request_uri'];
if (strpos('?', $uri) !== false) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
//去除开头的prefix
if ($len > 0 && strpos($uri, $this->prefix) === 0) {
$uri = substr($uri, $len);
}
$request->uri = $uri;
$res = false;
if (isset($this->routes[$request->server['request_method']])) {
$res = $this->parseBy($this->routes[$request->server['request_method']], $request);
}
if ($res === false && isset($this->routes['any'])) {
$res = $this->parseBy($this->routes['any'], $request);
}
if ($res === false) {
if ($this->enable_map) {
//为空则读取默认设置
if (empty($uri) || $uri === '/') {
$request->module = $this->module;
$request->controller = 'index';
$request->action = 'index';
} else {
if ($this->enable_extension) {
$hasPoint = strrpos($uri, '.');
if ($hasPoint !== false) {
$request->extension = substr($uri, $hasPoint + 1);
$uri = substr($uri, 0, $hasPoint);
$request->uri = $uri;
}
}
$this->parseMap($request);
}
}
}
} | [
"public",
"function",
"parse",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"this",
"->",
"prefix",
")",
";",
"//路由解析",
"$",
"uri",
"=",
"$",
"request",
"->",
"server",
"[",
"'request_uri'",
"]",
";",
"if",
"(",
"strpos",
"(",
"'?'",
",",
"$",
"uri",
")",
"!==",
"false",
")",
"{",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"0",
",",
"strpos",
"(",
"$",
"uri",
",",
"'?'",
")",
")",
";",
"}",
"//去除开头的prefix",
"if",
"(",
"$",
"len",
">",
"0",
"&&",
"strpos",
"(",
"$",
"uri",
",",
"$",
"this",
"->",
"prefix",
")",
"===",
"0",
")",
"{",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"$",
"len",
")",
";",
"}",
"$",
"request",
"->",
"uri",
"=",
"$",
"uri",
";",
"$",
"res",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"request",
"->",
"server",
"[",
"'request_method'",
"]",
"]",
")",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"parseBy",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"request",
"->",
"server",
"[",
"'request_method'",
"]",
"]",
",",
"$",
"request",
")",
";",
"}",
"if",
"(",
"$",
"res",
"===",
"false",
"&&",
"isset",
"(",
"$",
"this",
"->",
"routes",
"[",
"'any'",
"]",
")",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"parseBy",
"(",
"$",
"this",
"->",
"routes",
"[",
"'any'",
"]",
",",
"$",
"request",
")",
";",
"}",
"if",
"(",
"$",
"res",
"===",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enable_map",
")",
"{",
"//为空则读取默认设置",
"if",
"(",
"empty",
"(",
"$",
"uri",
")",
"||",
"$",
"uri",
"===",
"'/'",
")",
"{",
"$",
"request",
"->",
"module",
"=",
"$",
"this",
"->",
"module",
";",
"$",
"request",
"->",
"controller",
"=",
"'index'",
";",
"$",
"request",
"->",
"action",
"=",
"'index'",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"enable_extension",
")",
"{",
"$",
"hasPoint",
"=",
"strrpos",
"(",
"$",
"uri",
",",
"'.'",
")",
";",
"if",
"(",
"$",
"hasPoint",
"!==",
"false",
")",
"{",
"$",
"request",
"->",
"extension",
"=",
"substr",
"(",
"$",
"uri",
",",
"$",
"hasPoint",
"+",
"1",
")",
";",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"0",
",",
"$",
"hasPoint",
")",
";",
"$",
"request",
"->",
"uri",
"=",
"$",
"uri",
";",
"}",
"}",
"$",
"this",
"->",
"parseMap",
"(",
"$",
"request",
")",
";",
"}",
"}",
"}",
"}"
] | Parse a request
@access public
@param Request $request | [
"Parse",
"a",
"request"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Router.php#L206-L245 |
31,688 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.quoteApplicationVersion | private function quoteApplicationVersion($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\(/', '\\(', $quotedString);
return $quotedString;
} | php | private function quoteApplicationVersion($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\(/', '\\(', $quotedString);
return $quotedString;
} | [
"private",
"function",
"quoteApplicationVersion",
"(",
"$",
"s",
")",
"{",
"$",
"quotedString",
"=",
"$",
"this",
"->",
"collapseWhitespace",
"(",
"$",
"s",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\\\\\/'",
",",
"'\\\\\\\\\\\\\\\\'",
",",
"$",
"quotedString",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\(/'",
",",
"'\\\\('",
",",
"$",
"quotedString",
")",
";",
"return",
"$",
"quotedString",
";",
"}"
] | Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
and '(' characters from a string.
@param $s
@return string | [
"Collapse",
"multiple",
"whitespace",
"characters",
"into",
"a",
"single",
"and",
"backslash",
"escape",
"\\",
"and",
"(",
"characters",
"from",
"a",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L259-L265 |
31,689 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.quoteAttributeName | private function quoteAttributeName($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\=/', '\\=', $quotedString);
return $quotedString;
} | php | private function quoteAttributeName($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\=/', '\\=', $quotedString);
return $quotedString;
} | [
"private",
"function",
"quoteAttributeName",
"(",
"$",
"s",
")",
"{",
"$",
"quotedString",
"=",
"$",
"this",
"->",
"collapseWhitespace",
"(",
"$",
"s",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\\\\\/'",
",",
"'\\\\\\\\\\\\\\\\'",
",",
"$",
"quotedString",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\=/'",
",",
"'\\\\='",
",",
"$",
"quotedString",
")",
";",
"return",
"$",
"quotedString",
";",
"}"
] | Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
and '=' characters from a string.
@param $s
@return unknown_type | [
"Collapse",
"multiple",
"whitespace",
"characters",
"into",
"a",
"single",
"and",
"backslash",
"escape",
"\\",
"and",
"=",
"characters",
"from",
"a",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L274-L280 |
31,690 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.quoteAttributeValue | private function quoteAttributeValue($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\;/', '\\;', $quotedString);
$quotedString = preg_replace('/\\)/', '\\)', $quotedString);
return $quotedString;
} | php | private function quoteAttributeValue($s) {
$quotedString = $this->collapseWhitespace($s);
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
$quotedString = preg_replace('/\\;/', '\\;', $quotedString);
$quotedString = preg_replace('/\\)/', '\\)', $quotedString);
return $quotedString;
} | [
"private",
"function",
"quoteAttributeValue",
"(",
"$",
"s",
")",
"{",
"$",
"quotedString",
"=",
"$",
"this",
"->",
"collapseWhitespace",
"(",
"$",
"s",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\\\\\/'",
",",
"'\\\\\\\\\\\\\\\\'",
",",
"$",
"quotedString",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\;/'",
",",
"'\\\\;'",
",",
"$",
"quotedString",
")",
";",
"$",
"quotedString",
"=",
"preg_replace",
"(",
"'/\\\\)/'",
",",
"'\\\\)'",
",",
"$",
"quotedString",
")",
";",
"return",
"$",
"quotedString",
";",
"}"
] | Collapse multiple whitespace characters into a single ' ' and backslash escape ';', '\',
and ')' characters from a string.
@param $s
@return unknown_type | [
"Collapse",
"multiple",
"whitespace",
"characters",
"into",
"a",
"single",
"and",
"backslash",
"escape",
";",
"\\",
"and",
")",
"characters",
"from",
"a",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L289-L296 |
31,691 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.getRefundDetails | public function getRefundDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetRefundDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetRefundDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetRefundDetails($request));
$response = OffAmazonPaymentsService_Model_GetRefundDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function getRefundDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetRefundDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetRefundDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetRefundDetails($request));
$response = OffAmazonPaymentsService_Model_GetRefundDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"getRefundDetails",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_GetRefundDetailsRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_GetRefundDetailsRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertGetRefundDetails",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_GetRefundDetailsResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Get Refund Details
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_GetRefundDetailsRequest request
or OffAmazonPaymentsService_Model_GetRefundDetailsRequest object itself
@see OffAmazonPaymentsService_Model_GetRefundDetails
@return OffAmazonPaymentsService_Model_GetRefundDetailsResponse OffAmazonPaymentsService_Model_GetRefundDetailsResponse
@throws OffAmazonPaymentsService_Exception | [
"Get",
"Refund",
"Details"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L382-L391 |
31,692 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.getCaptureDetails | public function getCaptureDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetCaptureDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetCaptureDetails($request));
$response = OffAmazonPaymentsService_Model_GetCaptureDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function getCaptureDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetCaptureDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetCaptureDetails($request));
$response = OffAmazonPaymentsService_Model_GetCaptureDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"getCaptureDetails",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_GetCaptureDetailsRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_GetCaptureDetailsRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertGetCaptureDetails",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_GetCaptureDetailsResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Get Capture Details
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_GetCaptureDetailsRequest request
or OffAmazonPaymentsService_Model_GetCaptureDetailsRequest object itself
@see OffAmazonPaymentsService_Model_GetCaptureDetails
@return OffAmazonPaymentsService_Model_GetCaptureDetailsResponse OffAmazonPaymentsService_Model_GetCaptureDetailsResponse
@throws OffAmazonPaymentsService_Exception | [
"Get",
"Capture",
"Details"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L405-L414 |
31,693 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.closeOrderReference | public function closeOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CloseOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_CloseOrderReferenceRequest($request);
};
$httpResponse = $this->_invoke($this->_convertCloseOrderReference($request));
$response = OffAmazonPaymentsService_Model_CloseOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function closeOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CloseOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_CloseOrderReferenceRequest($request);
};
$httpResponse = $this->_invoke($this->_convertCloseOrderReference($request));
$response = OffAmazonPaymentsService_Model_CloseOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"closeOrderReference",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_CloseOrderReferenceRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_CloseOrderReferenceRequest",
"(",
"$",
"request",
")",
";",
"}",
";",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertCloseOrderReference",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_CloseOrderReferenceResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Close Order Reference
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_CloseOrderReferenceRequest request
or OffAmazonPaymentsService_Model_CloseOrderReferenceRequest object itself
@see OffAmazonPaymentsService_Model_CloseOrderReference
@return OffAmazonPaymentsService_Model_CloseOrderReferenceResponse OffAmazonPaymentsService_Model_CloseOrderReferenceResponse
@throws OffAmazonPaymentsService_Exception | [
"Close",
"Order",
"Reference"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L428-L437 |
31,694 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.confirmOrderReference | public function confirmOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest($request);
}
$httpResponse = $this->_invoke($this->_convertConfirmOrderReference($request));
$response = OffAmazonPaymentsService_Model_ConfirmOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function confirmOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest($request);
}
$httpResponse = $this->_invoke($this->_convertConfirmOrderReference($request));
$response = OffAmazonPaymentsService_Model_ConfirmOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"confirmOrderReference",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertConfirmOrderReference",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_ConfirmOrderReferenceResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Confirm Order Reference
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest request
or OffAmazonPaymentsService_Model_ConfirmOrderReferenceRequest object itself
@see OffAmazonPaymentsService_Model_ConfirmOrderReference
@return OffAmazonPaymentsService_Model_ConfirmOrderReferenceResponse OffAmazonPaymentsService_Model_ConfirmOrderReferenceResponse
@throws OffAmazonPaymentsService_Exception | [
"Confirm",
"Order",
"Reference"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L451-L460 |
31,695 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.getOrderReferenceDetails | public function getOrderReferenceDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetOrderReferenceDetails($request));
$response = OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function getOrderReferenceDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetOrderReferenceDetails($request));
$response = OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"getOrderReferenceDetails",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertGetOrderReferenceDetails",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Get Order Reference Details
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest request
or OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest object itself
@see OffAmazonPaymentsService_Model_GetOrderReferenceDetails
@return OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse
@throws OffAmazonPaymentsService_Exception | [
"Get",
"Order",
"Reference",
"Details"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L474-L483 |
31,696 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.setOrderReferenceDetails | public function setOrderReferenceDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertSetOrderReferenceDetails($request));
$response = OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function setOrderReferenceDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertSetOrderReferenceDetails($request));
$response = OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"setOrderReferenceDetails",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertSetOrderReferenceDetails",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Set Order Reference Details
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest request
or OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest object itself
@see OffAmazonPaymentsService_Model_SetOrderReferenceDetails
@return OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse
@throws OffAmazonPaymentsService_Exception | [
"Set",
"Order",
"Reference",
"Details"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L520-L529 |
31,697 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.getAuthorizationDetails | public function getAuthorizationDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetAuthorizationDetails($request));
$response = OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function getAuthorizationDetails($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest) {
$request = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest($request);
}
$httpResponse = $this->_invoke($this->_convertGetAuthorizationDetails($request));
$response = OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"getAuthorizationDetails",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertGetAuthorizationDetails",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Get Authorization Details
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest request
or OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest object itself
@see OffAmazonPaymentsService_Model_GetAuthorizationDetails
@return OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse
@throws OffAmazonPaymentsService_Exception | [
"Get",
"Authorization",
"Details"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L543-L552 |
31,698 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.cancelOrderReference | public function cancelOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CancelOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest($request);
}
$httpResponse = $this->_invoke($this->_convertCancelOrderReference($request));
$response = OffAmazonPaymentsService_Model_CancelOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function cancelOrderReference($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CancelOrderReferenceRequest) {
$request = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest($request);
}
$httpResponse = $this->_invoke($this->_convertCancelOrderReference($request));
$response = OffAmazonPaymentsService_Model_CancelOrderReferenceResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"cancelOrderReference",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_CancelOrderReferenceRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_CancelOrderReferenceRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertCancelOrderReference",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_CancelOrderReferenceResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Cancel Order Reference
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_CancelOrderReferenceRequest request
or OffAmazonPaymentsService_Model_CancelOrderReferenceRequest object itself
@see OffAmazonPaymentsService_Model_CancelOrderReference
@return OffAmazonPaymentsService_Model_CancelOrderReferenceResponse OffAmazonPaymentsService_Model_CancelOrderReferenceResponse
@throws OffAmazonPaymentsService_Exception | [
"Cancel",
"Order",
"Reference"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L566-L575 |
31,699 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php | OffAmazonPaymentsService_Client.createOrderReferenceForId | public function createOrderReferenceForId($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest) {
$request = new OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest($request);
}
$httpResponse = $this->_invoke($this->_convertCreateOrderReferenceForId($request));
$response = OffAmazonPaymentsService_Model_CreateOrderReferenceForIdResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | php | public function createOrderReferenceForId($request)
{
if (!$request instanceof OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest) {
$request = new OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest($request);
}
$httpResponse = $this->_invoke($this->_convertCreateOrderReferenceForId($request));
$response = OffAmazonPaymentsService_Model_CreateOrderReferenceForIdResponse::fromXML($httpResponse['ResponseBody']);
$response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
return $response;
} | [
"public",
"function",
"createOrderReferenceForId",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"instanceof",
"OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest",
")",
"{",
"$",
"request",
"=",
"new",
"OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest",
"(",
"$",
"request",
")",
";",
"}",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"_invoke",
"(",
"$",
"this",
"->",
"_convertCreateOrderReferenceForId",
"(",
"$",
"request",
")",
")",
";",
"$",
"response",
"=",
"OffAmazonPaymentsService_Model_CreateOrderReferenceForIdResponse",
"::",
"fromXML",
"(",
"$",
"httpResponse",
"[",
"'ResponseBody'",
"]",
")",
";",
"$",
"response",
"->",
"setResponseHeaderMetadata",
"(",
"$",
"httpResponse",
"[",
"'ResponseHeaderMetadata'",
"]",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Create Order Reference For Id
@param mixed $request array of parameters for OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest request
or OffAmazonPaymentsService_Model_CreateOrderReferenceForIdRequest object itself
@see OffAmazonPaymentsService_Model_CreateOrderReferenceForId
@return OffAmazonPaymentsService_Model_CreateOrderReferenceForIdResponse OffAmazonPaymentsService_Model_CreateOrderReferenceForIdResponse
@throws OffAmazonPaymentsService_Exception | [
"Create",
"Order",
"Reference",
"For",
"Id"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Client.php#L589-L598 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.