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
partition
stringclasses
1 value
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.RedirectToItemPage
protected function RedirectToItemPage($oReviewItem = null, $aAddParameter = array(), $bGoToWriteReviewFrom = false) { $oActivePage = $this->getActivePageService()->getActivePage(); $sRedirectURL = $oActivePage->GetRealURLPlain($aAddParameter); if (null !== $oReviewItem) { $sRedirectURL .= '#'.TdbShopArticleReview::URL_PARAM_REVIEW_ITEM_JUMPER.$oReviewItem->sqlData['id']; } else { if ($bGoToWriteReviewFrom) { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_WRITE_JUMPER; } else { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_JUMPER; } } $this->getRedirect()->redirect($sRedirectURL); }
php
protected function RedirectToItemPage($oReviewItem = null, $aAddParameter = array(), $bGoToWriteReviewFrom = false) { $oActivePage = $this->getActivePageService()->getActivePage(); $sRedirectURL = $oActivePage->GetRealURLPlain($aAddParameter); if (null !== $oReviewItem) { $sRedirectURL .= '#'.TdbShopArticleReview::URL_PARAM_REVIEW_ITEM_JUMPER.$oReviewItem->sqlData['id']; } else { if ($bGoToWriteReviewFrom) { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_WRITE_JUMPER; } else { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_JUMPER; } } $this->getRedirect()->redirect($sRedirectURL); }
[ "protected", "function", "RedirectToItemPage", "(", "$", "oReviewItem", "=", "null", ",", "$", "aAddParameter", "=", "array", "(", ")", ",", "$", "bGoToWriteReviewFrom", "=", "false", ")", "{", "$", "oActivePage", "=", "$", "this", "->", "getActivePageService"...
Redirect to review item page and set anchor to start of the review module. @param array $aAddParameter
[ "Redirect", "to", "review", "item", "page", "and", "set", "anchor", "to", "start", "of", "the", "review", "module", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L350-L365
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetReviewsForUser
protected function GetReviewsForUser() { $oUserReviews = null; $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $oUserReviews = $oUser->GetFieldShopArticleReviewList(); } return $oUserReviews; }
php
protected function GetReviewsForUser() { $oUserReviews = null; $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $oUserReviews = $oUser->GetFieldShopArticleReviewList(); } return $oUserReviews; }
[ "protected", "function", "GetReviewsForUser", "(", ")", "{", "$", "oUserReviews", "=", "null", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "oUser...
get the reviews from logged in user.
[ "get", "the", "reviews", "from", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L389-L398
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetReviewsForArticle
protected function GetReviewsForArticle($oActiveArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oActiveArticle->IsVariant()) { $oActiveArticle = $oActiveArticle->GetFieldVariantParent(); } $oActiveCategory = TdbShop::GetActiveCategory(); $this->data['oActiveCategory'] = $oActiveCategory; $this->data['oActiveArticle'] = $oActiveArticle; if ($oModuleConfiguration->fieldAllowRateReview) { $oReviewList = TdbShopArticleReviewList::GetReviewsForArticleSortedByRate($oActiveArticle->id); } else { $oReviewList = TdbShopArticleReviewList::GetListForShopArticleId($oActiveArticle->id); } $oReviewList->AddFilterString("`shop_article_review`.`publish`='1'"); return $oReviewList; }
php
protected function GetReviewsForArticle($oActiveArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oActiveArticle->IsVariant()) { $oActiveArticle = $oActiveArticle->GetFieldVariantParent(); } $oActiveCategory = TdbShop::GetActiveCategory(); $this->data['oActiveCategory'] = $oActiveCategory; $this->data['oActiveArticle'] = $oActiveArticle; if ($oModuleConfiguration->fieldAllowRateReview) { $oReviewList = TdbShopArticleReviewList::GetReviewsForArticleSortedByRate($oActiveArticle->id); } else { $oReviewList = TdbShopArticleReviewList::GetListForShopArticleId($oActiveArticle->id); } $oReviewList->AddFilterString("`shop_article_review`.`publish`='1'"); return $oReviewList; }
[ "protected", "function", "GetReviewsForArticle", "(", "$", "oActiveArticle", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "$", "oActiveArticle", "->", "IsVariant", "(", ")", ")", "{", "$", ...
Get the reviews for given shop article. @param TdbShopArticle $oActiveArticle @return TdbShopArticleReviewList
[ "Get", "the", "reviews", "for", "given", "shop", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L407-L425
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.UnlockReview
protected function UnlockReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $oReviewItem->AllowEditByAll(true); $oReviewItem->sqlData['publish'] = true; $oReviewItem->sqlData['action_id'] = ''; $oReviewItem->Save(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-UNLOCK-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
protected function UnlockReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $oReviewItem->AllowEditByAll(true); $oReviewItem->sqlData['publish'] = true; $oReviewItem->sqlData['action_id'] = ''; $oReviewItem->Save(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-UNLOCK-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "protected", "function", "UnlockReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "...
Unlocks a locked review.
[ "Unlocks", "a", "locked", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L430-L458
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ChangeReviewReportNotificationState
public function ChangeReviewReportNotificationState() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $sReviewReportNotificationState = $oReviewItem->fieldSendCommentNotification; if ($sReviewReportNotificationState) { $sReviewReportNotificationState = 0; } else { $sReviewReportNotificationState = 1; } $oReviewItem->sqlData['send_comment_notification'] = $sReviewReportNotificationState; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-CHANGE-REPORT-NOTIFICATION-STATE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function ChangeReviewReportNotificationState() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $sReviewReportNotificationState = $oReviewItem->fieldSendCommentNotification; if ($sReviewReportNotificationState) { $sReviewReportNotificationState = 0; } else { $sReviewReportNotificationState = 1; } $oReviewItem->sqlData['send_comment_notification'] = $sReviewReportNotificationState; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-CHANGE-REPORT-NOTIFICATION-STATE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "ChangeReviewReportNotificationState", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "...
Changes the report notification state for one review. this can only be called from the owning user.
[ "Changes", "the", "report", "notification", "state", "for", "one", "review", ".", "this", "can", "only", "be", "called", "from", "the", "owning", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L464-L488
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReview
public function DeleteReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $this->DeleteReviewFromActionId(); } elseif ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $this->DeleteReviewFromOwner(); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function DeleteReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $this->DeleteReviewFromActionId(); } elseif ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $this->DeleteReviewFromOwner(); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "DeleteReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(",...
Deletes one review. This function can only be called with valid action id or from owning user.
[ "Deletes", "one", "review", ".", "This", "function", "can", "only", "be", "called", "with", "valid", "action", "id", "or", "from", "owning", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L494-L506
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReviewFromActionId
protected function DeleteReviewFromActionId() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
php
protected function DeleteReviewFromActionId() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
[ "protected", "function", "DeleteReviewFromActionId", "(", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageMana...
Deletes one review with valid action id.
[ "Deletes", "one", "review", "with", "valid", "action", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L511-L528
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReviewFromOwner
protected function DeleteReviewFromOwner() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
php
protected function DeleteReviewFromOwner() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
[ "protected", "function", "DeleteReviewFromOwner", "(", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager...
Deletes one review if owner is logged in.
[ "Deletes", "one", "review", "if", "owner", "is", "logged", "in", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L533-L546
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteConnectedComments
protected function DeleteConnectedComments($oReviewItem) { if ($this->AllowToCommentReview()) { $sQuery = "SELECT `pkg_comment`.* FROM `cms_tbl_conf` INNER JOIN `pkg_comment_type` ON `pkg_comment_type`.`cms_tbl_conf_id` = `cms_tbl_conf`.`id` INNER JOIN `pkg_comment` ON `pkg_comment`.`pkg_comment_type_id` = `pkg_comment_type`.`id` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview' AND `cms_tbl_conf`.`name` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->table)."' AND `pkg_comment`.`item_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->id)."'"; $oConnectedCommentList = TdbPkgCommentList::GetList($sQuery); while ($oConnectedComment = $oConnectedCommentList->Next()) { $oCommentEditor = TTools::GetTableEditorManager('pkg_comment', $oConnectedComment->id); $oCommentEditor->AllowDeleteByAll(true); $oCommentEditor->Delete($oConnectedComment->id); } } }
php
protected function DeleteConnectedComments($oReviewItem) { if ($this->AllowToCommentReview()) { $sQuery = "SELECT `pkg_comment`.* FROM `cms_tbl_conf` INNER JOIN `pkg_comment_type` ON `pkg_comment_type`.`cms_tbl_conf_id` = `cms_tbl_conf`.`id` INNER JOIN `pkg_comment` ON `pkg_comment`.`pkg_comment_type_id` = `pkg_comment_type`.`id` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview' AND `cms_tbl_conf`.`name` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->table)."' AND `pkg_comment`.`item_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->id)."'"; $oConnectedCommentList = TdbPkgCommentList::GetList($sQuery); while ($oConnectedComment = $oConnectedCommentList->Next()) { $oCommentEditor = TTools::GetTableEditorManager('pkg_comment', $oConnectedComment->id); $oCommentEditor->AllowDeleteByAll(true); $oCommentEditor->Delete($oConnectedComment->id); } } }
[ "protected", "function", "DeleteConnectedComments", "(", "$", "oReviewItem", ")", "{", "if", "(", "$", "this", "->", "AllowToCommentReview", "(", ")", ")", "{", "$", "sQuery", "=", "\"SELECT `pkg_comment`.* FROM `cms_tbl_conf`\n INNER JOIN `pkg_comment_ty...
Deletes all comment for a given review. @param TdbShopArticleReview $oReviewItem
[ "Deletes", "all", "comment", "for", "a", "given", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L553-L569
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ReportReview
public function ReportReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $this->AllowReportReviews()) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if (0 != $oReviewItem->sqlData['publish'] && '0' != $oReviewItem->sqlData['publish']) { $oReviewItem->sqlData['publish'] = 0; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oReviewItem->SendReviewReportNotification(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-SUCCESS'); $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain()); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-ALREADY-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function ReportReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $this->AllowReportReviews()) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if (0 != $oReviewItem->sqlData['publish'] && '0' != $oReviewItem->sqlData['publish']) { $oReviewItem->sqlData['publish'] = 0; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oReviewItem->SendReviewReportNotification(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-SUCCESS'); $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain()); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-ALREADY-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "ReportReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(",...
Reports one review to shop owner and lock reported review. Shop owner owner will get an email with delete and unlock link.
[ "Reports", "one", "review", "to", "shop", "owner", "and", "lock", "reported", "review", ".", "Shop", "owner", "owner", "will", "get", "an", "email", "with", "delete", "and", "unlock", "link", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L575-L604
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.RateReview
public function RateReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if ($this->AllowRateReviews() && $oGlobal->UserDataExists('bRate') && $oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $bRate = $oGlobal->GetUserData('bRate'); if ($bRate) { $oReviewItem->RateReview(true); } else { $oReviewItem->RateReview(false); } $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-RATE-REVIEW-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } $this->RedirectToItemPage(); }
php
public function RateReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if ($this->AllowRateReviews() && $oGlobal->UserDataExists('bRate') && $oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $bRate = $oGlobal->GetUserData('bRate'); if ($bRate) { $oReviewItem->RateReview(true); } else { $oReviewItem->RateReview(false); } $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-RATE-REVIEW-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } $this->RedirectToItemPage(); }
[ "public", "function", "RateReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "Get...
Rates one review positive or negative.
[ "Rates", "one", "review", "positive", "or", "negative", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L609-L630
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.EditReview
public function EditReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $oEditReview = TdbShopArticleReview::GetNewInstance(); if ($oEditReview->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { $aUserData = $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); foreach ($aUserData as $sKey => $sValue) { $oEditReview->sqlData[$sKey] = $sValue; } if ($this->ValidateWriteReviewData($oEditReview->sqlData)) { $oEditReview->AllowEditByAll(true); $oEditReview->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } }
php
public function EditReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $oEditReview = TdbShopArticleReview::GetNewInstance(); if ($oEditReview->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { $aUserData = $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); foreach ($aUserData as $sKey => $sValue) { $oEditReview->sqlData[$sKey] = $sValue; } if ($this->ValidateWriteReviewData($oEditReview->sqlData)) { $oEditReview->AllowEditByAll(true); $oEditReview->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } }
[ "public", "function", "EditReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", ...
Edit one review.
[ "Edit", "one", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L635-L657
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.WriteReview
public function WriteReview() { //validate user input... $oGlobal = TGlobal::instance(); $aUserData = array(); if ($this->AllowWriteReview()) { $aUserData = $this->GetReviewWriteData(); $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); if ($this->ValidateWriteReviewData($aUserData)) { $oArticle = $this->GetArticleToReview(); $oReviewItem = $this->CreateReview($aUserData, $oArticle); $oArticle->UpdateStatsReviews(); $oReviewItem->SendNewReviewNotification(); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $this->RedirectToItemPage(); } } $this->RedirectToItemPage(null, array(TdbShopArticleReview::INPUT_BASE_NAME => $aUserData), true); }
php
public function WriteReview() { //validate user input... $oGlobal = TGlobal::instance(); $aUserData = array(); if ($this->AllowWriteReview()) { $aUserData = $this->GetReviewWriteData(); $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); if ($this->ValidateWriteReviewData($aUserData)) { $oArticle = $this->GetArticleToReview(); $oReviewItem = $this->CreateReview($aUserData, $oArticle); $oArticle->UpdateStatsReviews(); $oReviewItem->SendNewReviewNotification(); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $this->RedirectToItemPage(); } } $this->RedirectToItemPage(null, array(TdbShopArticleReview::INPUT_BASE_NAME => $aUserData), true); }
[ "public", "function", "WriteReview", "(", ")", "{", "//validate user input...", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aUserData", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "AllowWriteReview", "(", ")", ")...
Writes a review.
[ "Writes", "a", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L701-L720
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.CreateReview
protected function CreateReview($aUserData, $oArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); /*@var $oReviewItem TdbShopArticleReview*/ $aUserData['shop_article_id'] = $oArticle->id; $oReviewItem->LoadFromRowProtected($aUserData); if ($oModuleConfiguration->fieldManageReviews) { $oReviewItem->sqlData['publish'] = '0'; } else { $oReviewItem->sqlData['publish'] = '1'; } $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); return $oReviewItem; }
php
protected function CreateReview($aUserData, $oArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); /*@var $oReviewItem TdbShopArticleReview*/ $aUserData['shop_article_id'] = $oArticle->id; $oReviewItem->LoadFromRowProtected($aUserData); if ($oModuleConfiguration->fieldManageReviews) { $oReviewItem->sqlData['publish'] = '0'; } else { $oReviewItem->sqlData['publish'] = '1'; } $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); return $oReviewItem; }
[ "protected", "function", "CreateReview", "(", "$", "aUserData", ",", "$", "oArticle", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", ...
Create a new review for given article with given data. @param array $aUserData @param TdbShopArticle $oArticle @return TdbShopArticleReview
[ "Create", "a", "new", "review", "for", "given", "article", "with", "given", "data", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L759-L774
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ValidateWriteReviewData
protected function ValidateWriteReviewData($aUserData) { $bDataValid = false; $oMsgManager = TCMSMessageManager::GetInstance(); if (is_array($aUserData)) { $bDataValid = true; $sCaptcha = ''; if ($this->NeedCaptcha()) { if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA'); } } $aRequiredFields = $this->GetRequiredFields(); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING'); } } if ($this->InsertOfReviewLocked()) { $bDataValid = false; $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED'); } } return $bDataValid; }
php
protected function ValidateWriteReviewData($aUserData) { $bDataValid = false; $oMsgManager = TCMSMessageManager::GetInstance(); if (is_array($aUserData)) { $bDataValid = true; $sCaptcha = ''; if ($this->NeedCaptcha()) { if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA'); } } $aRequiredFields = $this->GetRequiredFields(); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING'); } } if ($this->InsertOfReviewLocked()) { $bDataValid = false; $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED'); } } return $bDataValid; }
[ "protected", "function", "ValidateWriteReviewData", "(", "$", "aUserData", ")", "{", "$", "bDataValid", "=", "false", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "is_array", "(", "$", "aUserData", ")", "...
Validates given review data to write a new review. @param array $aUserData @return bool
[ "Validates", "given", "review", "data", "to", "write", "a", "new", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L800-L835
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.NeedUserFieldForName
protected function NeedUserFieldForName() { $bNeedUserFieldForName = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName) { $bNeedUserFieldForName = true; } } else { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName || (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) || AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) { $bNeedUserFieldForName = true; } } return $bNeedUserFieldForName; }
php
protected function NeedUserFieldForName() { $bNeedUserFieldForName = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName) { $bNeedUserFieldForName = true; } } else { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName || (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) || AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) { $bNeedUserFieldForName = true; } } return $bNeedUserFieldForName; }
[ "protected", "function", "NeedUserFieldForName", "(", ")", "{", "$", "bNeedUserFieldForName", "=", "false", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfigurat...
Checks if user have to enter user name manually or user name comes from logged in user. @return bool
[ "Checks", "if", "user", "have", "to", "enter", "user", "name", "manually", "or", "user", "name", "comes", "from", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L875-L891
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetAuthorName
protected function GetAuthorName($sUserPostName = false) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oAuthor = TdbDataExtranetUser::GetInstance(); if ($this->NeedUserFieldForName()) { $sAuthor = $sUserPostName; } else { switch ($oModuleConfiguration->fieldOptionShowAuthorName) { case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME: $sAuthor = $oAuthor->fieldFirstname.' '.$oAuthor->fieldLastname; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_INITIALS: $sAuthor = $oAuthor->fieldFirstname.' '.substr($oAuthor->fieldLastname, 0, 1).'.'; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS: $sAuthor = $oAuthor->fieldAliasName; if (empty($sAuthor)) { $sAuthor = $sUserPostName; } if (0 !== strcmp($sUserPostName, $oAuthor->fieldAliasName) && $oAuthor->IsLoggedIn() && $oAuthor->validateUserAlias($sUserPostName)) { $oAuthor->SaveFieldsFast(array('alias_name' => $sUserPostName)); } break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ANONYMOUS: default: $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); break; } } if (empty($sAuthor)) { $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); } return $sAuthor; }
php
protected function GetAuthorName($sUserPostName = false) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oAuthor = TdbDataExtranetUser::GetInstance(); if ($this->NeedUserFieldForName()) { $sAuthor = $sUserPostName; } else { switch ($oModuleConfiguration->fieldOptionShowAuthorName) { case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME: $sAuthor = $oAuthor->fieldFirstname.' '.$oAuthor->fieldLastname; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_INITIALS: $sAuthor = $oAuthor->fieldFirstname.' '.substr($oAuthor->fieldLastname, 0, 1).'.'; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS: $sAuthor = $oAuthor->fieldAliasName; if (empty($sAuthor)) { $sAuthor = $sUserPostName; } if (0 !== strcmp($sUserPostName, $oAuthor->fieldAliasName) && $oAuthor->IsLoggedIn() && $oAuthor->validateUserAlias($sUserPostName)) { $oAuthor->SaveFieldsFast(array('alias_name' => $sUserPostName)); } break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ANONYMOUS: default: $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); break; } } if (empty($sAuthor)) { $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); } return $sAuthor; }
[ "protected", "function", "GetAuthorName", "(", "$", "sUserPostName", "=", "false", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oAuthor", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ...
Gets the author name from post data or form logged in user. @param string $sUserPostName @return bool|string
[ "Gets", "the", "author", "name", "from", "post", "data", "or", "form", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L900-L934
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetCaptchaValue
protected function GetCaptchaValue() { $sCaptchaValue = false; if (array_key_exists(self::SESSION_CAPTCHA, $_SESSION)) { $sCaptchaValue = $_SESSION[self::SESSION_CAPTCHA]; } return $sCaptchaValue; }
php
protected function GetCaptchaValue() { $sCaptchaValue = false; if (array_key_exists(self::SESSION_CAPTCHA, $_SESSION)) { $sCaptchaValue = $_SESSION[self::SESSION_CAPTCHA]; } return $sCaptchaValue; }
[ "protected", "function", "GetCaptchaValue", "(", ")", "{", "$", "sCaptchaValue", "=", "false", ";", "if", "(", "array_key_exists", "(", "self", "::", "SESSION_CAPTCHA", ",", "$", "_SESSION", ")", ")", "{", "$", "sCaptchaValue", "=", "$", "_SESSION", "[", "...
gets captcha value fro session. @return bool
[ "gets", "captcha", "value", "fro", "session", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L941-L949
train
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GenerateCaptcha
protected function GenerateCaptcha() { $sCaptchaQuestion = false; if ($this->NeedCaptcha()) { $num1 = rand(1, 10); $num2 = rand(1, 10); $val = $num1 + $num2; $_SESSION[self::SESSION_CAPTCHA] = $val; $sCaptchaQuestion = ('Was ergibt '.$num1.' + '.$num2.' ?'); } return $sCaptchaQuestion; }
php
protected function GenerateCaptcha() { $sCaptchaQuestion = false; if ($this->NeedCaptcha()) { $num1 = rand(1, 10); $num2 = rand(1, 10); $val = $num1 + $num2; $_SESSION[self::SESSION_CAPTCHA] = $val; $sCaptchaQuestion = ('Was ergibt '.$num1.' + '.$num2.' ?'); } return $sCaptchaQuestion; }
[ "protected", "function", "GenerateCaptcha", "(", ")", "{", "$", "sCaptchaQuestion", "=", "false", ";", "if", "(", "$", "this", "->", "NeedCaptcha", "(", ")", ")", "{", "$", "num1", "=", "rand", "(", "1", ",", "10", ")", ";", "$", "num2", "=", "rand...
Generates new captcha. @return bool
[ "Generates", "new", "captcha", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L956-L968
train
PGB-LIV/php-ms
src/Statistic/FalseDiscoveryRate.php
FalseDiscoveryRate.getScore
public function getScore($targetRate) { $score = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] < $targetRate) { $score = $falseDiscoryRate['score']; continue; } break; } return $score; }
php
public function getScore($targetRate) { $score = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] < $targetRate) { $score = $falseDiscoryRate['score']; continue; } break; } return $score; }
[ "public", "function", "getScore", "(", "$", "targetRate", ")", "{", "$", "score", "=", "0", ";", "foreach", "(", "$", "this", "->", "falseDiscoveryRates", "as", "$", "falseDiscoryRate", ")", "{", "if", "(", "$", "falseDiscoryRate", "[", "'FDR'", "]", "<"...
Gets the score that corresponds to the target FDR @param float $targetRate
[ "Gets", "the", "score", "that", "corresponds", "to", "the", "target", "FDR" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Statistic/FalseDiscoveryRate.php#L75-L89
train
PGB-LIV/php-ms
src/Statistic/FalseDiscoveryRate.php
FalseDiscoveryRate.getMatches
public function getMatches($targetRate) { $matches = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] <= $targetRate) { $matches ++; continue; } break; } return $matches; }
php
public function getMatches($targetRate) { $matches = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] <= $targetRate) { $matches ++; continue; } break; } return $matches; }
[ "public", "function", "getMatches", "(", "$", "targetRate", ")", "{", "$", "matches", "=", "0", ";", "foreach", "(", "$", "this", "->", "falseDiscoveryRates", "as", "$", "falseDiscoryRate", ")", "{", "if", "(", "$", "falseDiscoryRate", "[", "'FDR'", "]", ...
Gets the number of matches for the target FDR @param float $targetRate
[ "Gets", "the", "number", "of", "matches", "for", "the", "target", "FDR" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Statistic/FalseDiscoveryRate.php#L96-L109
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.Run
public function Run() { $bSuccess = false; set_time_limit(1800); TCacheManager::SetDisableCaching(true); TCacheManagerRuntimeCache::SetEnableAutoCaching(false); if ($this->Prepare()) { $bSuccess = $this->Perform(); } $this->Cleanup($bSuccess); TCacheManager::SetDisableCaching(false); TCacheManagerRuntimeCache::SetEnableAutoCaching(true); return $bSuccess; }
php
public function Run() { $bSuccess = false; set_time_limit(1800); TCacheManager::SetDisableCaching(true); TCacheManagerRuntimeCache::SetEnableAutoCaching(false); if ($this->Prepare()) { $bSuccess = $this->Perform(); } $this->Cleanup($bSuccess); TCacheManager::SetDisableCaching(false); TCacheManagerRuntimeCache::SetEnableAutoCaching(true); return $bSuccess; }
[ "public", "function", "Run", "(", ")", "{", "$", "bSuccess", "=", "false", ";", "set_time_limit", "(", "1800", ")", ";", "TCacheManager", "::", "SetDisableCaching", "(", "true", ")", ";", "TCacheManagerRuntimeCache", "::", "SetEnableAutoCaching", "(", "false", ...
Run the export. returns true if the export was successful, otherwise false this method should not be overwritten in child classes. @return bool
[ "Run", "the", "export", ".", "returns", "true", "if", "the", "export", "was", "successful", "otherwise", "false", "this", "method", "should", "not", "be", "overwritten", "in", "child", "classes", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L85-L100
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.Perform
protected function Perform() { $bSuccess = true; $this->PreArticleListHandling(); $this->HandleArticleList(); $this->PostArticleListHandling(); return $bSuccess; }
php
protected function Perform() { $bSuccess = true; $this->PreArticleListHandling(); $this->HandleArticleList(); $this->PostArticleListHandling(); return $bSuccess; }
[ "protected", "function", "Perform", "(", ")", "{", "$", "bSuccess", "=", "true", ";", "$", "this", "->", "PreArticleListHandling", "(", ")", ";", "$", "this", "->", "HandleArticleList", "(", ")", ";", "$", "this", "->", "PostArticleListHandling", "(", ")",...
perform the actual export work. return true if the export was successful, otherwise false. @return bool
[ "perform", "the", "actual", "export", "work", ".", "return", "true", "if", "the", "export", "was", "successful", "otherwise", "false", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L138-L147
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAttributeName
public function getAttributeName($sIdentifier) { static $aAttributesForSystemNames = null; static $aAttributesForIds = null; if (null === $aAttributesForSystemNames && null === $aAttributesForIds) { $oAttributesList = TdbShopAttributeList::GetList(); while ($oAttribute = &$oAttributesList->Next()) { $sName = $oAttribute->GetName(); $aAttributesForSystemNames[$oAttribute->fieldSystemName] = $sName; $aAttributesForIds[$oAttribute->id] = $sName; } } if (isset($aAttributesForSystemNames[$sIdentifier])) { return $aAttributesForSystemNames[$sIdentifier]; } elseif (isset($aAttributesForIds[$sIdentifier])) { return $aAttributesForIds[$sIdentifier]; } else { return ''; } }
php
public function getAttributeName($sIdentifier) { static $aAttributesForSystemNames = null; static $aAttributesForIds = null; if (null === $aAttributesForSystemNames && null === $aAttributesForIds) { $oAttributesList = TdbShopAttributeList::GetList(); while ($oAttribute = &$oAttributesList->Next()) { $sName = $oAttribute->GetName(); $aAttributesForSystemNames[$oAttribute->fieldSystemName] = $sName; $aAttributesForIds[$oAttribute->id] = $sName; } } if (isset($aAttributesForSystemNames[$sIdentifier])) { return $aAttributesForSystemNames[$sIdentifier]; } elseif (isset($aAttributesForIds[$sIdentifier])) { return $aAttributesForIds[$sIdentifier]; } else { return ''; } }
[ "public", "function", "getAttributeName", "(", "$", "sIdentifier", ")", "{", "static", "$", "aAttributesForSystemNames", "=", "null", ";", "static", "$", "aAttributesForIds", "=", "null", ";", "if", "(", "null", "===", "$", "aAttributesForSystemNames", "&&", "nu...
load attribute by system_name field and return the name. @param string $sIdentifier @return string
[ "load", "attribute", "by", "system_name", "field", "and", "return", "the", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L241-L260
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.GetArticleAttributeValueListForAttributeNames
public function GetArticleAttributeValueListForAttributeNames( &$oArticle, $aAttributeNames, $sFieldName = 'system_name' ) { $aList = array(); foreach ($aAttributeNames as $sAttributeName) { $aList[$sAttributeName] = $this->GetArticleAttributeValueForAttributeName( $oArticle, $sAttributeName, $sFieldName, false ); } return $aList; }
php
public function GetArticleAttributeValueListForAttributeNames( &$oArticle, $aAttributeNames, $sFieldName = 'system_name' ) { $aList = array(); foreach ($aAttributeNames as $sAttributeName) { $aList[$sAttributeName] = $this->GetArticleAttributeValueForAttributeName( $oArticle, $sAttributeName, $sFieldName, false ); } return $aList; }
[ "public", "function", "GetArticleAttributeValueListForAttributeNames", "(", "&", "$", "oArticle", ",", "$", "aAttributeNames", ",", "$", "sFieldName", "=", "'system_name'", ")", "{", "$", "aList", "=", "array", "(", ")", ";", "foreach", "(", "$", "aAttributeName...
returns an array with a nested array of values for each requested attribute. @param TdbShopArticle $oArticle @param array $aAttributeNames @param string $sFieldName @return array|null
[ "returns", "an", "array", "with", "a", "nested", "array", "of", "values", "for", "each", "requested", "attribute", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L271-L287
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getArticleImageLink
protected function getArticleImageLink(&$oArticle, $iWidth = null) { $sLink = ''; $oArticleImage = $oArticle->GetPrimaryImage(); if (null !== $oArticleImage) { $oImage = $oArticleImage->GetImage(0, 'cms_media_id'); if (null !== $oImage) { if (is_int($iWidth) && $iWidth > 0) { $oThumbnail = $oImage->GetThumbnail($iWidth, 1000); $sLink = $oThumbnail->GetFullURL(); } else { $sLink = $oImage->GetFullURL(); } } } return $sLink; }
php
protected function getArticleImageLink(&$oArticle, $iWidth = null) { $sLink = ''; $oArticleImage = $oArticle->GetPrimaryImage(); if (null !== $oArticleImage) { $oImage = $oArticleImage->GetImage(0, 'cms_media_id'); if (null !== $oImage) { if (is_int($iWidth) && $iWidth > 0) { $oThumbnail = $oImage->GetThumbnail($iWidth, 1000); $sLink = $oThumbnail->GetFullURL(); } else { $sLink = $oImage->GetFullURL(); } } } return $sLink; }
[ "protected", "function", "getArticleImageLink", "(", "&", "$", "oArticle", ",", "$", "iWidth", "=", "null", ")", "{", "$", "sLink", "=", "''", ";", "$", "oArticleImage", "=", "$", "oArticle", "->", "GetPrimaryImage", "(", ")", ";", "if", "(", "null", "...
returns the link to the article image you can set iWidth to get thumbnail links. @param int|null $iWidth @param TdbShopArticle $oArticle @return string
[ "returns", "the", "link", "to", "the", "article", "image", "you", "can", "set", "iWidth", "to", "get", "thumbnail", "links", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L393-L410
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.GetTmpCacheFileFromCacheFileName
public static function GetTmpCacheFileFromCacheFileName($sCacheFileName) { $sCacheTmpFileName = false; $aFileInfo = pathinfo($sCacheFileName); if (is_array($aFileInfo) && isset($aFileInfo['filename'])) { $sCacheTmpFileName = 'generate_tmp_'.$aFileInfo['filename']; $sCacheTmpFileName = str_replace($aFileInfo['filename'], $sCacheTmpFileName, $sCacheFileName); } return $sCacheTmpFileName; }
php
public static function GetTmpCacheFileFromCacheFileName($sCacheFileName) { $sCacheTmpFileName = false; $aFileInfo = pathinfo($sCacheFileName); if (is_array($aFileInfo) && isset($aFileInfo['filename'])) { $sCacheTmpFileName = 'generate_tmp_'.$aFileInfo['filename']; $sCacheTmpFileName = str_replace($aFileInfo['filename'], $sCacheTmpFileName, $sCacheFileName); } return $sCacheTmpFileName; }
[ "public", "static", "function", "GetTmpCacheFileFromCacheFileName", "(", "$", "sCacheFileName", ")", "{", "$", "sCacheTmpFileName", "=", "false", ";", "$", "aFileInfo", "=", "pathinfo", "(", "$", "sCacheFileName", ")", ";", "if", "(", "is_array", "(", "$", "aF...
Returns tmp cache file name generated from cache file name. @static @param string $sCacheFileName @return bool|mixed|string
[ "Returns", "tmp", "cache", "file", "name", "generated", "from", "cache", "file", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L537-L547
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAvailablePaymentList
protected function getAvailablePaymentList() { static $oPaymentList = null; if (null === $oPaymentList) { $sQuery = "SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` = '1'"; $oPaymentList = TdbShopPaymentMethodList::GetList($sQuery); } return $oPaymentList; }
php
protected function getAvailablePaymentList() { static $oPaymentList = null; if (null === $oPaymentList) { $sQuery = "SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` = '1'"; $oPaymentList = TdbShopPaymentMethodList::GetList($sQuery); } return $oPaymentList; }
[ "protected", "function", "getAvailablePaymentList", "(", ")", "{", "static", "$", "oPaymentList", "=", "null", ";", "if", "(", "null", "===", "$", "oPaymentList", ")", "{", "$", "sQuery", "=", "\"SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` =...
loads list of available payment methods. @return TdbShopPaymentMethodList|null
[ "loads", "list", "of", "available", "payment", "methods", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L575-L585
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAvailablePaymentListAsString
protected function getAvailablePaymentListAsString() { static $sPaymentMethods = null; if (null === $sPaymentMethods) { $sPaymentMethods = ''; $oPaymentList = $this->getAvailablePaymentList(); if (null !== $oPaymentList) { if ($oPaymentList->Length() > 0) { while ($oPaymentMethod = $oPaymentList->Next()) { if ('' != $sPaymentMethods) { $sPaymentMethods .= ', '; } $sPaymentMethods .= $oPaymentMethod->GetName(); } } } } if (!is_string($sPaymentMethods)) { $sPaymentMethods = ''; } return $sPaymentMethods; }
php
protected function getAvailablePaymentListAsString() { static $sPaymentMethods = null; if (null === $sPaymentMethods) { $sPaymentMethods = ''; $oPaymentList = $this->getAvailablePaymentList(); if (null !== $oPaymentList) { if ($oPaymentList->Length() > 0) { while ($oPaymentMethod = $oPaymentList->Next()) { if ('' != $sPaymentMethods) { $sPaymentMethods .= ', '; } $sPaymentMethods .= $oPaymentMethod->GetName(); } } } } if (!is_string($sPaymentMethods)) { $sPaymentMethods = ''; } return $sPaymentMethods; }
[ "protected", "function", "getAvailablePaymentListAsString", "(", ")", "{", "static", "$", "sPaymentMethods", "=", "null", ";", "if", "(", "null", "===", "$", "sPaymentMethods", ")", "{", "$", "sPaymentMethods", "=", "''", ";", "$", "oPaymentList", "=", "$", ...
returns comma separated string of payment methods. @return string
[ "returns", "comma", "separated", "string", "of", "payment", "methods", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L592-L616
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.RenderVariantDetails
protected function RenderVariantDetails($sViewName, $aCallTimeVars = array()) { $oView = new TViewParser(); $aActivatedIds = $this->oTableRow->GetMLTIdList('shop_variant_type_value', 'shop_variant_type_value_mlt'); $oView->AddVar('aActivatedIds', $aActivatedIds); $oView->AddVar('oField', $this); $oView->AddVarArray($aCallTimeVars); return $oView->RenderObjectView($sViewName, 'TCMSFields/TCMSFieldShopVariantDetails', 'Core'); }
php
protected function RenderVariantDetails($sViewName, $aCallTimeVars = array()) { $oView = new TViewParser(); $aActivatedIds = $this->oTableRow->GetMLTIdList('shop_variant_type_value', 'shop_variant_type_value_mlt'); $oView->AddVar('aActivatedIds', $aActivatedIds); $oView->AddVar('oField', $this); $oView->AddVarArray($aCallTimeVars); return $oView->RenderObjectView($sViewName, 'TCMSFields/TCMSFieldShopVariantDetails', 'Core'); }
[ "protected", "function", "RenderVariantDetails", "(", "$", "sViewName", ",", "$", "aCallTimeVars", "=", "array", "(", ")", ")", "{", "$", "oView", "=", "new", "TViewParser", "(", ")", ";", "$", "aActivatedIds", "=", "$", "this", "->", "oTableRow", "->", ...
render field details. @param string $sViewName @param array $aCallTimeVars @return string
[ "render", "field", "details", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L107-L116
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.GetSQL
public function GetSQL() { /** * @var array $aNewValues */ $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new'); if (!is_array($this->data)) { $this->data = array(); } elseif (array_key_exists('x', $this->data)) { unset($this->data['x']); } $oEditorObjectConf = TdbCmsTblConf::GetNewInstance(); $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value'); if (!is_array($aNewValues)) { return false; } foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) { $sNewValueName = trim($sNewValueName); if (!empty($sNewValueName)) { // first make sure the value does not exist already $oValue = TdbShopVariantTypeValue::GetNewInstance(); if ($oValue->LoadFromFields( array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId) ) ) { $this->data[$sShopVariantTypeId] = $oValue->id; } else { // need to create entry $aNewItemData = array( 'shop_variant_type_id' => $sShopVariantTypeId, 'name' => $sNewValueName, 'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName), ); $oTableManager = new TCMSTableEditorManager(); $oTableManager->Init($oEditorObjectConf->id); $oTableManager->Save($aNewItemData); $this->data[$sShopVariantTypeId] = $oTableManager->sId; } } } // now save connecting records.... we can use the parent method return parent::GetSQL(); }
php
public function GetSQL() { /** * @var array $aNewValues */ $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new'); if (!is_array($this->data)) { $this->data = array(); } elseif (array_key_exists('x', $this->data)) { unset($this->data['x']); } $oEditorObjectConf = TdbCmsTblConf::GetNewInstance(); $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value'); if (!is_array($aNewValues)) { return false; } foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) { $sNewValueName = trim($sNewValueName); if (!empty($sNewValueName)) { // first make sure the value does not exist already $oValue = TdbShopVariantTypeValue::GetNewInstance(); if ($oValue->LoadFromFields( array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId) ) ) { $this->data[$sShopVariantTypeId] = $oValue->id; } else { // need to create entry $aNewItemData = array( 'shop_variant_type_id' => $sShopVariantTypeId, 'name' => $sNewValueName, 'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName), ); $oTableManager = new TCMSTableEditorManager(); $oTableManager->Init($oEditorObjectConf->id); $oTableManager->Save($aNewItemData); $this->data[$sShopVariantTypeId] = $oTableManager->sId; } } } // now save connecting records.... we can use the parent method return parent::GetSQL(); }
[ "public", "function", "GetSQL", "(", ")", "{", "/**\n * @var array $aNewValues\n */", "$", "aNewValues", "=", "$", "this", "->", "getInputFilterUtil", "(", ")", "->", "getFilteredInput", "(", "$", "this", "->", "name", ".", "'_new'", ")", ";", "i...
overwrites sql method to ensure that the connecting mlt is filled properly. {@inheritdoc}
[ "overwrites", "sql", "method", "to", "ensure", "that", "the", "connecting", "mlt", "is", "filled", "properly", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L160-L207
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.generateVariants
public function generateVariants() { /** * @var array|null $aVariantParameters */ $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters'); if (null === $aVariantParameters) { return ''; } foreach ($aVariantParameters as $aVariant) { $oTableEditorManager = new TCMSTableEditorManager(); $oTableEditorManager->sRestrictionField = 'variant_parent_id'; $oTableEditorManager->sRestriction = $this->oTableRow->id; $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id); $oTableEditorManager->AllowEditByAll(true); $oTableEditorManager->Insert(); $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant)); foreach ($aVariant['variantIDs'] as $sVariantID) { $oTableEditorManager->AddMLTConnection($this->name, $sVariantID); } $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable); $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage(); foreach ($nameList as $languageId => $name) { $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId); $oTableEditorManager->SaveField('name_variant_info', $name); } $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId); } return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters))); }
php
public function generateVariants() { /** * @var array|null $aVariantParameters */ $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters'); if (null === $aVariantParameters) { return ''; } foreach ($aVariantParameters as $aVariant) { $oTableEditorManager = new TCMSTableEditorManager(); $oTableEditorManager->sRestrictionField = 'variant_parent_id'; $oTableEditorManager->sRestriction = $this->oTableRow->id; $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id); $oTableEditorManager->AllowEditByAll(true); $oTableEditorManager->Insert(); $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant)); foreach ($aVariant['variantIDs'] as $sVariantID) { $oTableEditorManager->AddMLTConnection($this->name, $sVariantID); } $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable); $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage(); foreach ($nameList as $languageId => $name) { $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId); $oTableEditorManager->SaveField('name_variant_info', $name); } $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId); } return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters))); }
[ "public", "function", "generateVariants", "(", ")", "{", "/**\n * @var array|null $aVariantParameters\n */", "$", "aVariantParameters", "=", "$", "this", "->", "getInputFilterUtil", "(", ")", "->", "getFilteredInput", "(", "'variantParameters'", ")", ";", ...
called via ajax generates all variants that where checked in the field matrix. @return string
[ "called", "via", "ajax", "generates", "all", "variants", "that", "where", "checked", "in", "the", "field", "matrix", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L215-L248
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.UpdateInheritableProperties
protected function UpdateInheritableProperties($oOwningCategory, $oCategory) { $activeValue = '1'; if (false === $oOwningCategory->fieldActive || false === $oCategory->parentCategoriesAreActive()) { $activeValue = '0'; } $oTableEditor = TTools::GetTableEditorManager($this->oTableConf->fieldName, $oCategory->id); $oTableEditor->AllowEditByAll($this->bAllowEditByAll); $oTableEditor->SaveField('tree_active', $activeValue, false); }
php
protected function UpdateInheritableProperties($oOwningCategory, $oCategory) { $activeValue = '1'; if (false === $oOwningCategory->fieldActive || false === $oCategory->parentCategoriesAreActive()) { $activeValue = '0'; } $oTableEditor = TTools::GetTableEditorManager($this->oTableConf->fieldName, $oCategory->id); $oTableEditor->AllowEditByAll($this->bAllowEditByAll); $oTableEditor->SaveField('tree_active', $activeValue, false); }
[ "protected", "function", "UpdateInheritableProperties", "(", "$", "oOwningCategory", ",", "$", "oCategory", ")", "{", "$", "activeValue", "=", "'1'", ";", "if", "(", "false", "===", "$", "oOwningCategory", "->", "fieldActive", "||", "false", "===", "$", "oCate...
update recursive properties in oCategory based on oOwningCategory. @param TdbShopCategory $oOwningCategory @param TdbShopCategory $oCategory
[ "update", "recursive", "properties", "in", "oCategory", "based", "on", "oOwningCategory", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L51-L60
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.UpdatePageNaviBreadCrumb
public function UpdatePageNaviBreadCrumb() { $sEditLanguage = $this->oTableConf->GetLanguage(); $breadcrumbs = self::GetNavigationBreadCrumbs($this->sId, $sEditLanguage); $this->SaveField('url_path', $breadcrumbs); // now we also need to update all children of this category... $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sEditLanguage); /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($this->sId)) { $oCategory = null; } else { $oChildren = &$oCategory->GetChildren(); while ($oChild = $oChildren->Next()) { $oEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oEditor->Init($this->oTableConf->id, $oChild->id, $sEditLanguage); $oEditor->AllowEditByAll($this->bAllowEditByAll); $oEditor->SaveField('name', $oChild->fieldName, true); } } }
php
public function UpdatePageNaviBreadCrumb() { $sEditLanguage = $this->oTableConf->GetLanguage(); $breadcrumbs = self::GetNavigationBreadCrumbs($this->sId, $sEditLanguage); $this->SaveField('url_path', $breadcrumbs); // now we also need to update all children of this category... $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sEditLanguage); /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($this->sId)) { $oCategory = null; } else { $oChildren = &$oCategory->GetChildren(); while ($oChild = $oChildren->Next()) { $oEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oEditor->Init($this->oTableConf->id, $oChild->id, $sEditLanguage); $oEditor->AllowEditByAll($this->bAllowEditByAll); $oEditor->SaveField('name', $oChild->fieldName, true); } } }
[ "public", "function", "UpdatePageNaviBreadCrumb", "(", ")", "{", "$", "sEditLanguage", "=", "$", "this", "->", "oTableConf", "->", "GetLanguage", "(", ")", ";", "$", "breadcrumbs", "=", "self", "::", "GetNavigationBreadCrumbs", "(", "$", "this", "->", "sId", ...
update the page navi breadcrumb.
[ "update", "the", "page", "navi", "breadcrumb", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L75-L96
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.GetNavigationBreadCrumbs
public static function GetNavigationBreadCrumbs($id, $sLanguageID = null) { $sBreadCrumb = ''; $oCategory = TdbShopCategory::GetNewInstance(); if (!is_null($sLanguageID)) { $oCategory->SetLanguage($sLanguageID); } /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($id)) { $oCategory = null; } if (!is_null($oCategory)) { $oCategoryBreadcrumb = &$oCategory->GetBreadcrumb(); $oCategoryBreadcrumb->GoToStart(); while ($oCategoryItem = $oCategoryBreadcrumb->Next()) { $sBreadCrumb .= '/'.self::getUrlNormalizationUtil()->normalizeUrl($oCategoryItem->GetName()); } } return $sBreadCrumb; }
php
public static function GetNavigationBreadCrumbs($id, $sLanguageID = null) { $sBreadCrumb = ''; $oCategory = TdbShopCategory::GetNewInstance(); if (!is_null($sLanguageID)) { $oCategory->SetLanguage($sLanguageID); } /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($id)) { $oCategory = null; } if (!is_null($oCategory)) { $oCategoryBreadcrumb = &$oCategory->GetBreadcrumb(); $oCategoryBreadcrumb->GoToStart(); while ($oCategoryItem = $oCategoryBreadcrumb->Next()) { $sBreadCrumb .= '/'.self::getUrlNormalizationUtil()->normalizeUrl($oCategoryItem->GetName()); } } return $sBreadCrumb; }
[ "public", "static", "function", "GetNavigationBreadCrumbs", "(", "$", "id", ",", "$", "sLanguageID", "=", "null", ")", "{", "$", "sBreadCrumb", "=", "''", ";", "$", "oCategory", "=", "TdbShopCategory", "::", "GetNewInstance", "(", ")", ";", "if", "(", "!",...
returns the breadcrumb navigation as plaintext. @param string $id - id of the page to update @param string $sLanguageID @return string
[ "returns", "the", "breadcrumb", "navigation", "as", "plaintext", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L106-L126
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopDiscount.class.php
TCMSShopTableEditor_ShopDiscount.PostSaveHook
protected function PostSaveHook(&$oFields, &$oPostTable) { parent::PostSaveHook($oFields, $oPostTable); $this->oTable->ClearCacheOnAllAffectedArticles(); }
php
protected function PostSaveHook(&$oFields, &$oPostTable) { parent::PostSaveHook($oFields, $oPostTable); $this->oTable->ClearCacheOnAllAffectedArticles(); }
[ "protected", "function", "PostSaveHook", "(", "&", "$", "oFields", ",", "&", "$", "oPostTable", ")", "{", "parent", "::", "PostSaveHook", "(", "$", "oFields", ",", "$", "oPostTable", ")", ";", "$", "this", "->", "oTable", "->", "ClearCacheOnAllAffectedArticl...
we need to cache trigger all articles connected to the discount. @param TIterator $oFields holds an iterator of all field classes from DB table with the posted values or default if no post data is present @param TCMSRecord $oPostTable holds the record object of all posted data
[ "we", "need", "to", "cache", "trigger", "all", "articles", "connected", "to", "the", "discount", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopDiscount.class.php#L23-L27
train
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setLocation
public function setLocation($location) { if (! is_int($location)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($location)); } $this->location = $location; }
php
public function setLocation($location) { if (! is_int($location)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($location)); } $this->location = $location; }
[ "public", "function", "setLocation", "(", "$", "location", ")", "{", "if", "(", "!", "is_int", "(", "$", "location", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be an int value. Valued passed is of type '", ".", "gettype",...
Sets the location for this modification @param int $location The location to set this modification at @throws \InvalidArgumentException If argument 1 is not of type int
[ "Sets", "the", "location", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L69-L77
train
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setMonoisotopicMass
public function setMonoisotopicMass($mass) { if (! is_float($mass) && ! is_int($mass)) { throw new \InvalidArgumentException( 'Argument 1 must be a float or integer value. Valued passed is of type ' . gettype($mass)); } $this->monoisotopicMass = $mass; }
php
public function setMonoisotopicMass($mass) { if (! is_float($mass) && ! is_int($mass)) { throw new \InvalidArgumentException( 'Argument 1 must be a float or integer value. Valued passed is of type ' . gettype($mass)); } $this->monoisotopicMass = $mass; }
[ "public", "function", "setMonoisotopicMass", "(", "$", "mass", ")", "{", "if", "(", "!", "is_float", "(", "$", "mass", ")", "&&", "!", "is_int", "(", "$", "mass", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be a ...
Sets the monoisotopic mass for this modification @param float $mass The monoisotopic mass to set @throws \InvalidArgumentException If argument 1 is not of type float
[ "Sets", "the", "monoisotopic", "mass", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L96-L104
train
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setResidues
public function setResidues(array $residues) { if (empty($residues)) { throw new \InvalidArgumentException('Argument 1 must not be empty.'); } foreach ($residues as $residue) { if (!preg_match('/^[A-Z]$/', $residue)) { throw new \InvalidArgumentException('Argument 1 must be an array of single char values (A-Z). Value passed is ' . $residue); } } // Force sort order sort($residues); // Force unique residue positions $this->residues = array_combine($residues, $residues); }
php
public function setResidues(array $residues) { if (empty($residues)) { throw new \InvalidArgumentException('Argument 1 must not be empty.'); } foreach ($residues as $residue) { if (!preg_match('/^[A-Z]$/', $residue)) { throw new \InvalidArgumentException('Argument 1 must be an array of single char values (A-Z). Value passed is ' . $residue); } } // Force sort order sort($residues); // Force unique residue positions $this->residues = array_combine($residues, $residues); }
[ "public", "function", "setResidues", "(", "array", "$", "residues", ")", "{", "if", "(", "empty", "(", "$", "residues", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must not be empty.'", ")", ";", "}", "foreach", "(", "$...
Set residues for this modification @param array $residues Array of residues this modification may occur on @throws \InvalidArgumentException If argument 1 is not of type float
[ "Set", "residues", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L153-L170
train
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setPosition
public function setPosition($position) { switch ($position) { case Modification::POSITION_ANY: case Modification::POSITION_NTERM: case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_NTERM: case Modification::POSITION_PROTEIN_CTERM: $this->position = $position; break; default: throw new \InvalidArgumentException('Postion must be any or terminus (see POSITION_XXXX)'); } }
php
public function setPosition($position) { switch ($position) { case Modification::POSITION_ANY: case Modification::POSITION_NTERM: case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_NTERM: case Modification::POSITION_PROTEIN_CTERM: $this->position = $position; break; default: throw new \InvalidArgumentException('Postion must be any or terminus (see POSITION_XXXX)'); } }
[ "public", "function", "setPosition", "(", "$", "position", ")", "{", "switch", "(", "$", "position", ")", "{", "case", "Modification", "::", "POSITION_ANY", ":", "case", "Modification", "::", "POSITION_NTERM", ":", "case", "Modification", "::", "POSITION_CTERM",...
Sets the position this modification can occur on within the peptide or protein. Default is 'Any'. @param int $position Position the modification can occur, see POSITION_ for list of options. @throws \InvalidArgumentException If unknown position specified
[ "Sets", "the", "position", "this", "modification", "can", "occur", "on", "within", "the", "peptide", "or", "protein", ".", "Default", "is", "Any", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L214-L228
train
chameleon-system/chameleon-shop
src/ShopAffiliateBundle/objects/db/TPkgShopAffiliatePrograms/TPkgShopAffiliate_TradeDoubler.class.php
TPkgShopAffiliate_TradeDoubler.GetAdditionalViewVariables
protected function GetAdditionalViewVariables(&$oOrder, &$aParameter) { parent::GetAdditionalViewVariables($oOrder, $aParameter); $aParameter['currency'] = $this->GetValueFromArray($aParameter, 'currency'); $aParameter['organization'] = $this->GetValueFromArray($aParameter, 'organization'); $aParameter['checksumCode'] = $this->GetValueFromArray($aParameter, 'checksumCode'); $aParameter['event'] = $this->GetValueFromArray($aParameter, 'event'); $isSale = $this->GetValueFromArray($aParameter, 'isSale'); $isSecure = $this->GetValueFromArray($aParameter, 'isSecure'); $aParameter['shop_order__ordernumber'] = rawurlencode($aParameter['shop_order__ordernumber']); $aParameter['orderNumber'] = $aParameter['shop_order__ordernumber']; $aParameter['orderValue'] = $aParameter['dNetProductValue']; $aParameter['reportInfo'] = ''; $oItems = $oOrder->GetFieldShopOrderItemList(); /** @var TdbShopOrderItemList $oItems */ while ($oItem = $oItems->Next()) { /** @var TdbShopOrderItem $oItem */ $aParameter['reportInfo'] .= 'f1='.$oItem->fieldArticlenumber.'&amp;f2='.$oItem->GetName().'&amp;f3='.$oItem->fieldPrice.'&amp;f4='.$oItem->fieldOrderAmount.'|'; } $aParameter['reportInfo'] = urlencode($aParameter['reportInfo']); $aParameter['tduid'] = ''; if (!empty($_SESSION['TdbPkgShopAffiliate-data']['sCode'])) { $aParameter['tduid'] = $_SESSION['TdbPkgShopAffiliate-data']['sCode']; } //if (!empty($_COOKIE["tduid"])) $aParameter['tduid'] = $_COOKIE["TdbPkgShopAffiliate-data"]["sCode"]; if ($isSale) { $aParameter['domain'] = 'tbs.tradedoubler.com'; $aParameter['checkNumberName'] = 'orderNumber'; } else { $aParameter['domain'] = 'tbl.tradedoubler.com'; $aParameter['checkNumberName'] = 'leadNumber'; $aParameter['orderValue'] = '1'; } $aParameter['checksum'] = ''; $aParameter['checksum'] = 'v04'.md5($aParameter['checksumCode'].$aParameter['orderNumber'].$aParameter['orderValue']); if ($isSecure) { $aParameter['scheme'] = 'https'; } else { $aParameter['scheme'] = 'http'; } /*if ($isSale) { $trackBackUrl .= "&amp;orderValue=" . $orderValue . "&amp;currency=" . $currency; }*/ }
php
protected function GetAdditionalViewVariables(&$oOrder, &$aParameter) { parent::GetAdditionalViewVariables($oOrder, $aParameter); $aParameter['currency'] = $this->GetValueFromArray($aParameter, 'currency'); $aParameter['organization'] = $this->GetValueFromArray($aParameter, 'organization'); $aParameter['checksumCode'] = $this->GetValueFromArray($aParameter, 'checksumCode'); $aParameter['event'] = $this->GetValueFromArray($aParameter, 'event'); $isSale = $this->GetValueFromArray($aParameter, 'isSale'); $isSecure = $this->GetValueFromArray($aParameter, 'isSecure'); $aParameter['shop_order__ordernumber'] = rawurlencode($aParameter['shop_order__ordernumber']); $aParameter['orderNumber'] = $aParameter['shop_order__ordernumber']; $aParameter['orderValue'] = $aParameter['dNetProductValue']; $aParameter['reportInfo'] = ''; $oItems = $oOrder->GetFieldShopOrderItemList(); /** @var TdbShopOrderItemList $oItems */ while ($oItem = $oItems->Next()) { /** @var TdbShopOrderItem $oItem */ $aParameter['reportInfo'] .= 'f1='.$oItem->fieldArticlenumber.'&amp;f2='.$oItem->GetName().'&amp;f3='.$oItem->fieldPrice.'&amp;f4='.$oItem->fieldOrderAmount.'|'; } $aParameter['reportInfo'] = urlencode($aParameter['reportInfo']); $aParameter['tduid'] = ''; if (!empty($_SESSION['TdbPkgShopAffiliate-data']['sCode'])) { $aParameter['tduid'] = $_SESSION['TdbPkgShopAffiliate-data']['sCode']; } //if (!empty($_COOKIE["tduid"])) $aParameter['tduid'] = $_COOKIE["TdbPkgShopAffiliate-data"]["sCode"]; if ($isSale) { $aParameter['domain'] = 'tbs.tradedoubler.com'; $aParameter['checkNumberName'] = 'orderNumber'; } else { $aParameter['domain'] = 'tbl.tradedoubler.com'; $aParameter['checkNumberName'] = 'leadNumber'; $aParameter['orderValue'] = '1'; } $aParameter['checksum'] = ''; $aParameter['checksum'] = 'v04'.md5($aParameter['checksumCode'].$aParameter['orderNumber'].$aParameter['orderValue']); if ($isSecure) { $aParameter['scheme'] = 'https'; } else { $aParameter['scheme'] = 'http'; } /*if ($isSale) { $trackBackUrl .= "&amp;orderValue=" . $orderValue . "&amp;currency=" . $currency; }*/ }
[ "protected", "function", "GetAdditionalViewVariables", "(", "&", "$", "oOrder", ",", "&", "$", "aParameter", ")", "{", "parent", "::", "GetAdditionalViewVariables", "(", "$", "oOrder", ",", "$", "aParameter", ")", ";", "$", "aParameter", "[", "'currency'", "]"...
add custom vars to the view. @param TdbShopOrder $oOrder @param array $aParameter
[ "add", "custom", "vars", "to", "the", "view", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopAffiliateBundle/objects/db/TPkgShopAffiliatePrograms/TPkgShopAffiliate_TradeDoubler.class.php#L20-L73
train
symbiote/silverstripe-cdncontent
code/content/ContentDeliveryService.php
ContentDeliveryService.storeThemeFile
public function storeThemeFile($toCdn, $file, $forceUpdate = false, $processReferences = false) { $mtime = @filemtime($file); $relativeName = self::CDN_THEME_PREFIX . '/' . $mtime . '/' . trim(str_replace(Director::baseFolder(), '', $file), '/'); if (!$forceUpdate) { // see if the file already exists, if not we do NOT do an update $reader = $this->contentService->findReaderFor($toCdn, $relativeName); if ($reader && $reader->exists()) { return $reader->getURL(); } } $clear = false; if ($processReferences) { $clear = true; $file = $this->processFileReferences($toCdn, $file, $forceUpdate); } // otherwise, lets get a content writer $writer = $this->contentService->getWriter($toCdn); try { $writer->write($file, $relativeName); } catch (Exception $e) { SS_Log::log($e, SS_Log::WARN); } if ($clear && strpos($file, '.cdn') > 0) { @unlink($file); } $id = $writer->getContentId(); return $writer->getReader()->getURL(); }
php
public function storeThemeFile($toCdn, $file, $forceUpdate = false, $processReferences = false) { $mtime = @filemtime($file); $relativeName = self::CDN_THEME_PREFIX . '/' . $mtime . '/' . trim(str_replace(Director::baseFolder(), '', $file), '/'); if (!$forceUpdate) { // see if the file already exists, if not we do NOT do an update $reader = $this->contentService->findReaderFor($toCdn, $relativeName); if ($reader && $reader->exists()) { return $reader->getURL(); } } $clear = false; if ($processReferences) { $clear = true; $file = $this->processFileReferences($toCdn, $file, $forceUpdate); } // otherwise, lets get a content writer $writer = $this->contentService->getWriter($toCdn); try { $writer->write($file, $relativeName); } catch (Exception $e) { SS_Log::log($e, SS_Log::WARN); } if ($clear && strpos($file, '.cdn') > 0) { @unlink($file); } $id = $writer->getContentId(); return $writer->getReader()->getURL(); }
[ "public", "function", "storeThemeFile", "(", "$", "toCdn", ",", "$", "file", ",", "$", "forceUpdate", "=", "false", ",", "$", "processReferences", "=", "false", ")", "{", "$", "mtime", "=", "@", "filemtime", "(", "$", "file", ")", ";", "$", "relativeNa...
Store the contents of a folder on a CDN. If processReferences is set, relative URL references are attempted to be detected and stored remotely as well, with the file to be stored rewritten to refer to the CDN value. This really is only useful for CSS @param string $folder @param boolean $processReferences
[ "Store", "the", "contents", "of", "a", "folder", "on", "a", "CDN", "." ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/content/ContentDeliveryService.php#L58-L90
train
chameleon-system/chameleon-shop
src/SearchBundle/objects/db/TShopSearchFieldWeight.class.php
TShopSearchFieldWeight.InsertSoundex
protected function InsertSoundex($iArticleId, $sOriginalWord, $iCount, $dOriginalWeight) { $sSoundEx = TdbShopSearchIndexer::GetSoundexForWord($sOriginalWord); $sSoundEx = TdbShopSearchIndexer::PrepareSearchWord($sSoundEx); // clean and cut the word if (!empty($sSoundEx) && '0000' != $sSoundEx) { $oShop = &$this->GetFieldShop(); // now add to index $sIndexTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEx)); $dWeight = $dOriginalWeight * $oShop->fieldShopSearchSoundexPenalty; $this->AddIndexToTable($sIndexTable, $iArticleId, $sSoundEx, $iCount, $dWeight); } }
php
protected function InsertSoundex($iArticleId, $sOriginalWord, $iCount, $dOriginalWeight) { $sSoundEx = TdbShopSearchIndexer::GetSoundexForWord($sOriginalWord); $sSoundEx = TdbShopSearchIndexer::PrepareSearchWord($sSoundEx); // clean and cut the word if (!empty($sSoundEx) && '0000' != $sSoundEx) { $oShop = &$this->GetFieldShop(); // now add to index $sIndexTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEx)); $dWeight = $dOriginalWeight * $oShop->fieldShopSearchSoundexPenalty; $this->AddIndexToTable($sIndexTable, $iArticleId, $sSoundEx, $iCount, $dWeight); } }
[ "protected", "function", "InsertSoundex", "(", "$", "iArticleId", ",", "$", "sOriginalWord", ",", "$", "iCount", ",", "$", "dOriginalWeight", ")", "{", "$", "sSoundEx", "=", "TdbShopSearchIndexer", "::", "GetSoundexForWord", "(", "$", "sOriginalWord", ")", ";", ...
insert soundex for word. @param string $sOriginalWord @param float $dOriginalWeight
[ "insert", "soundex", "for", "word", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchFieldWeight.class.php#L221-L233
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleQuestionEndPoint.class.php
MTShopArticleQuestionEndPoint.isAntiSpamFieldValid
protected function isAntiSpamFieldValid() { $bCodeIsValid = false; $oCaptcha = TdbPkgCmsCaptcha::GetInstanceFromName('text-field-javascript-hidden'); if ($oCaptcha->CodeIsValid('question', '')) { $bCodeIsValid = true; } return $bCodeIsValid; }
php
protected function isAntiSpamFieldValid() { $bCodeIsValid = false; $oCaptcha = TdbPkgCmsCaptcha::GetInstanceFromName('text-field-javascript-hidden'); if ($oCaptcha->CodeIsValid('question', '')) { $bCodeIsValid = true; } return $bCodeIsValid; }
[ "protected", "function", "isAntiSpamFieldValid", "(", ")", "{", "$", "bCodeIsValid", "=", "false", ";", "$", "oCaptcha", "=", "TdbPkgCmsCaptcha", "::", "GetInstanceFromName", "(", "'text-field-javascript-hidden'", ")", ";", "if", "(", "$", "oCaptcha", "->", "CodeI...
checks the anti spam field. @return bool
[ "checks", "the", "anti", "spam", "field", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleQuestionEndPoint.class.php#L100-L109
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethodList.class.php
TShopPaymentMethodList.&
public static function &GetAvailableMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
php
public static function &GetAvailableMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
[ "public", "static", "function", "&", "GetAvailableMethods", "(", "$", "iGroupId", ")", "{", "$", "query", "=", "self", "::", "getAvailableMethodsQuery", "(", "$", "iGroupId", ")", ";", "$", "oList", "=", "&", "TdbShopPaymentMethodList", "::", "GetList", "(", ...
return list of shipping types that match the given group, the current basket, the current portal and the current user. @param int $iGroupId @return TdbShopPaymentMethodList
[ "return", "list", "of", "shipping", "types", "that", "match", "the", "given", "group", "the", "current", "basket", "the", "current", "portal", "and", "the", "current", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethodList.class.php#L26-L34
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethodList.class.php
TShopPaymentMethodList.&
public static function &GetPublicPaymentMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
php
public static function &GetPublicPaymentMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
[ "public", "static", "function", "&", "GetPublicPaymentMethods", "(", "$", "iGroupId", ")", "{", "$", "query", "=", "self", "::", "getAvailableMethodsQuery", "(", "$", "iGroupId", ")", ";", "$", "oList", "=", "&", "TdbShopPaymentMethodList", "::", "GetList", "(...
return all public payment methods for a given shipping group. @param int $iGroupId @return TdbShopPaymentMethodList
[ "return", "all", "public", "payment", "methods", "for", "a", "given", "shipping", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethodList.class.php#L94-L103
train
chameleon-system/chameleon-shop
src/ShopRatingServiceBundle/objects/TPkgShopRatingService_EkomiEndPoint.class.php
TPkgShopRatingService_EkomiEndPoint.FetchCSVFile
protected function FetchCSVFile() { $bFileWritten = false; $sCSVData = file_get_contents($this->fieldRatingUrl); if (!empty($sCSVData)) { if (false !== file_put_contents($this->sCsvFilePath, $sCSVData)) { $bFileWritten = true; } else { $this->WriteLogEntry('Could not read CSV from '.$this->fieldRatingUrl, __LINE__); } } else { $this->WriteLogEntry($this->sCsvFilePath.' could not be written.', __LINE__); } return $bFileWritten; }
php
protected function FetchCSVFile() { $bFileWritten = false; $sCSVData = file_get_contents($this->fieldRatingUrl); if (!empty($sCSVData)) { if (false !== file_put_contents($this->sCsvFilePath, $sCSVData)) { $bFileWritten = true; } else { $this->WriteLogEntry('Could not read CSV from '.$this->fieldRatingUrl, __LINE__); } } else { $this->WriteLogEntry($this->sCsvFilePath.' could not be written.', __LINE__); } return $bFileWritten; }
[ "protected", "function", "FetchCSVFile", "(", ")", "{", "$", "bFileWritten", "=", "false", ";", "$", "sCSVData", "=", "file_get_contents", "(", "$", "this", "->", "fieldRatingUrl", ")", ";", "if", "(", "!", "empty", "(", "$", "sCSVData", ")", ")", "{", ...
Fetches the csv data from the api and saves it to the rating cache. @return bool
[ "Fetches", "the", "csv", "data", "from", "the", "api", "and", "saves", "it", "to", "the", "rating", "cache", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TPkgShopRatingService_EkomiEndPoint.class.php#L92-L109
train
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/objects/TPkgShopPaymentIPNManager.class.php
TPkgShopPaymentIPNManager.getIPNIdentifierFromOrder
private function getIPNIdentifierFromOrder(TdbShopOrder $oOrder) { $sIdentifier = null; $query = "SELECT `shop_payment_handler_group`.* FROM `shop_payment_handler_group` INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id` INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id` INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id` WHERE `shop_order`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' "; if ($aGroup = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $sIdentifier = trim($aGroup['ipn_group_identifier']); if ('' === $sIdentifier) { $sIdentifier = trim($aGroup['system_name']); } } return $sIdentifier; }
php
private function getIPNIdentifierFromOrder(TdbShopOrder $oOrder) { $sIdentifier = null; $query = "SELECT `shop_payment_handler_group`.* FROM `shop_payment_handler_group` INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id` INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id` INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id` WHERE `shop_order`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' "; if ($aGroup = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $sIdentifier = trim($aGroup['ipn_group_identifier']); if ('' === $sIdentifier) { $sIdentifier = trim($aGroup['system_name']); } } return $sIdentifier; }
[ "private", "function", "getIPNIdentifierFromOrder", "(", "TdbShopOrder", "$", "oOrder", ")", "{", "$", "sIdentifier", "=", "null", ";", "$", "query", "=", "\"SELECT `shop_payment_handler_group`.*\n FROM `shop_payment_handler_group`\n INNER JOIN `shop...
return the IPNIdentifier for an order passed. @param TdbShopOrder $oOrder @return string|null
[ "return", "the", "IPNIdentifier", "for", "an", "order", "passed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/TPkgShopPaymentIPNManager.class.php#L52-L70
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php
Message.getMandatoryField
public function getMandatoryField($fieldName) { $value = $this->getField($fieldName); if (is_null($value)) { throw new OffAmazonPaymentsNotifications_InvalidMessageException( "Error with json message - mandatory field " . $fieldName . " cannot be found" ); } return $value; }
php
public function getMandatoryField($fieldName) { $value = $this->getField($fieldName); if (is_null($value)) { throw new OffAmazonPaymentsNotifications_InvalidMessageException( "Error with json message - mandatory field " . $fieldName . " cannot be found" ); } return $value; }
[ "public", "function", "getMandatoryField", "(", "$", "fieldName", ")", "{", "$", "value", "=", "$", "this", "->", "getField", "(", "$", "fieldName", ")", ";", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "throw", "new", "OffAmazonPaymentsNotif...
Extract the mandatory field from the message and return the contents @param string $fieldName name of the field to extract @throws OffAmazonPaymentsNotifications_InvalidMessageException if not found @return string field contents if found
[ "Extract", "the", "mandatory", "field", "from", "the", "message", "and", "return", "the", "contents" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php#L100-L110
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php
Message.getField
public function getField($fieldName) { if (array_key_exists($fieldName, $this->_message)) { return $this->_message[$fieldName]; } else { return null; } }
php
public function getField($fieldName) { if (array_key_exists($fieldName, $this->_message)) { return $this->_message[$fieldName]; } else { return null; } }
[ "public", "function", "getField", "(", "$", "fieldName", ")", "{", "if", "(", "array_key_exists", "(", "$", "fieldName", ",", "$", "this", "->", "_message", ")", ")", "{", "return", "$", "this", "->", "_message", "[", "$", "fieldName", "]", ";", "}", ...
Extract the field if present, return null if not defined @param string $fieldName name of the field to extract @return string field contents if found, null otherwise
[ "Extract", "the", "field", "if", "present", "return", "null", "if", "not", "defined" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php#L119-L126
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php
MTShopPageMetaCore.GetSeoPatternString
protected function GetSeoPatternString($dont_replace = false) { //return ''; //why? //#7767 $sPattern = ''; //"[{PORTAL_NAME}] - [{PAGE_NAME}]"; /** @var $oSeoRenderer TCMSRenderSeoPattern */ $oSeoRenderer = new TCMSRenderSeoPattern(); $sTmpPattern = parent::GetSeoPatternString(true); if (strlen(trim($sTmpPattern)) > 0) { $sPattern = $sTmpPattern; } $oActiveArticle = TdbShop::GetActiveItem(); if ($oActiveArticle) { $arrRepl = $oActiveArticle->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } else { $oActiveCategory = TdbShop::GetActiveCategory(); if ($oActiveCategory) { $arrRepl = $oActiveCategory->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } } return parent::GetSeoPatternString(); }
php
protected function GetSeoPatternString($dont_replace = false) { //return ''; //why? //#7767 $sPattern = ''; //"[{PORTAL_NAME}] - [{PAGE_NAME}]"; /** @var $oSeoRenderer TCMSRenderSeoPattern */ $oSeoRenderer = new TCMSRenderSeoPattern(); $sTmpPattern = parent::GetSeoPatternString(true); if (strlen(trim($sTmpPattern)) > 0) { $sPattern = $sTmpPattern; } $oActiveArticle = TdbShop::GetActiveItem(); if ($oActiveArticle) { $arrRepl = $oActiveArticle->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } else { $oActiveCategory = TdbShop::GetActiveCategory(); if ($oActiveCategory) { $arrRepl = $oActiveCategory->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } } return parent::GetSeoPatternString(); }
[ "protected", "function", "GetSeoPatternString", "(", "$", "dont_replace", "=", "false", ")", "{", "//return ''; //why? //#7767", "$", "sPattern", "=", "''", ";", "//\"[{PORTAL_NAME}] - [{PAGE_NAME}]\";", "/** @var $oSeoRenderer TCMSRenderSeoPattern */", "$", "oSeoRenderer", "...
Get SEO pattern string. @param bool $dont_replace Do not replace pattern with values @return string
[ "Get", "SEO", "pattern", "string", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php#L175-L204
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php
MTShopPageMetaCore.GetMetaCanonical
protected function GetMetaCanonical() { $sCanonical = ''; $shopService = $this->getShopService(); $oShopItem = $shopService->getActiveProduct(); /** @var $oShopItem TdbShopArticle */ if ($oShopItem) { $oCat = $oShopItem->GetPrimaryCategory(); $iCat = ''; if ($oCat) { $iCat = $oCat->id; } $sCanonical = $oShopItem->GetDetailLink(true, $iCat); } else { $category = $shopService->getActiveCategory(); if ($category) { $currentPage = $this->getInputFilterUtil()->getFilteredInput(TdbShopArticleList::URL_LIST_CURRENT_PAGE, 0); $additionalParam = array(); if (0 !== $currentPage) { $additionalParam = array(TdbShopArticleList::URL_LIST_CURRENT_PAGE => $currentPage); } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($additionalParam, true); } $sCanonical = parent::GetMetaCanonical(); } return $sCanonical; }
php
protected function GetMetaCanonical() { $sCanonical = ''; $shopService = $this->getShopService(); $oShopItem = $shopService->getActiveProduct(); /** @var $oShopItem TdbShopArticle */ if ($oShopItem) { $oCat = $oShopItem->GetPrimaryCategory(); $iCat = ''; if ($oCat) { $iCat = $oCat->id; } $sCanonical = $oShopItem->GetDetailLink(true, $iCat); } else { $category = $shopService->getActiveCategory(); if ($category) { $currentPage = $this->getInputFilterUtil()->getFilteredInput(TdbShopArticleList::URL_LIST_CURRENT_PAGE, 0); $additionalParam = array(); if (0 !== $currentPage) { $additionalParam = array(TdbShopArticleList::URL_LIST_CURRENT_PAGE => $currentPage); } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($additionalParam, true); } $sCanonical = parent::GetMetaCanonical(); } return $sCanonical; }
[ "protected", "function", "GetMetaCanonical", "(", ")", "{", "$", "sCanonical", "=", "''", ";", "$", "shopService", "=", "$", "this", "->", "getShopService", "(", ")", ";", "$", "oShopItem", "=", "$", "shopService", "->", "getActiveProduct", "(", ")", ";", ...
return the canonical URL for the page. @return string
[ "return", "the", "canonical", "URL", "for", "the", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php#L211-L240
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php
TPkgShopListfilterItemVariant.GetVariantType
protected function GetVariantType($aRow) { $sKey = 'oVariantType_'.$aRow['shop_variant_set_id']; $oVariantType = &$this->GetFromInternalCache($sKey); if (null === $oVariantType) { $oVariantType = TdbShopVariantType::GetNewInstance(); if (!empty($aRow['shop_variant_set_id'])) { if (!$oVariantType->LoadFromFields(array('identifier' => $this->sVariantTypeIdentifier, 'shop_variant_set_id' => $aRow['shop_variant_set_id']))) { $oVariantType = false; } } else { $oVariantType = false; } $this->SetInternalCache($sKey, $oVariantType); } return $oVariantType; }
php
protected function GetVariantType($aRow) { $sKey = 'oVariantType_'.$aRow['shop_variant_set_id']; $oVariantType = &$this->GetFromInternalCache($sKey); if (null === $oVariantType) { $oVariantType = TdbShopVariantType::GetNewInstance(); if (!empty($aRow['shop_variant_set_id'])) { if (!$oVariantType->LoadFromFields(array('identifier' => $this->sVariantTypeIdentifier, 'shop_variant_set_id' => $aRow['shop_variant_set_id']))) { $oVariantType = false; } } else { $oVariantType = false; } $this->SetInternalCache($sKey, $oVariantType); } return $oVariantType; }
[ "protected", "function", "GetVariantType", "(", "$", "aRow", ")", "{", "$", "sKey", "=", "'oVariantType_'", ".", "$", "aRow", "[", "'shop_variant_set_id'", "]", ";", "$", "oVariantType", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "$", "sKey", ...
return the variant type matching "color". @param array $aRow - the data of the current article @return TdbShopVariantType
[ "return", "the", "variant", "type", "matching", "color", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php#L41-L58
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php
TPkgShopListfilterItemVariant.GetItemName
public function GetItemName($sFieldName, $sFieldValue, $aRow) { static $aLookupList = array(); if (!array_key_exists($aRow['id'], $aLookupList)) { $aLookupList[$aRow['id']] = array(); $oVariantType = $this->GetVariantType($aRow); if ($oVariantType) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aRow); $aResult = array(); $oVariantValues = $oArticle->GetVariantValuesAvailableForType($oVariantType); if ($oVariantValues) { while ($oVariantValue = $oVariantValues->Next()) { if (!empty($oVariantValue->fieldNameGrouped)) { $aResult[] = $oVariantValue->fieldNameGrouped; } else { $aResult[] = $oVariantValue->GetName(); } } } $aLookupList[$aRow['id']] = $aResult; } } return $aLookupList[$aRow['id']]; }
php
public function GetItemName($sFieldName, $sFieldValue, $aRow) { static $aLookupList = array(); if (!array_key_exists($aRow['id'], $aLookupList)) { $aLookupList[$aRow['id']] = array(); $oVariantType = $this->GetVariantType($aRow); if ($oVariantType) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aRow); $aResult = array(); $oVariantValues = $oArticle->GetVariantValuesAvailableForType($oVariantType); if ($oVariantValues) { while ($oVariantValue = $oVariantValues->Next()) { if (!empty($oVariantValue->fieldNameGrouped)) { $aResult[] = $oVariantValue->fieldNameGrouped; } else { $aResult[] = $oVariantValue->GetName(); } } } $aLookupList[$aRow['id']] = $aResult; } } return $aLookupList[$aRow['id']]; }
[ "public", "function", "GetItemName", "(", "$", "sFieldName", ",", "$", "sFieldValue", ",", "$", "aRow", ")", "{", "static", "$", "aLookupList", "=", "array", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "aRow", "[", "'id'", "]", ",", ...
return the item name for a given ID. @param string $sFieldName @param string $sFieldValue @param array $aRow @return string
[ "return", "the", "item", "name", "for", "a", "given", "ID", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php#L101-L128
train
comporu/compo-core
src/Compo/ImportBundle/Controller/DefaultController.php
DefaultController.getLetterArray
private function getLetterArray() { $array = range('A', 'Z'); $letters = $array; foreach ($array as $first) { foreach ($array as $second) { $letters[] = $first . $second; } } return $letters; }
php
private function getLetterArray() { $array = range('A', 'Z'); $letters = $array; foreach ($array as $first) { foreach ($array as $second) { $letters[] = $first . $second; } } return $letters; }
[ "private", "function", "getLetterArray", "(", ")", "{", "$", "array", "=", "range", "(", "'A'", ",", "'Z'", ")", ";", "$", "letters", "=", "$", "array", ";", "foreach", "(", "$", "array", "as", "$", "first", ")", "{", "foreach", "(", "$", "array", ...
get array from A to ZZ. @return array
[ "get", "array", "from", "A", "to", "ZZ", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Controller/DefaultController.php#L114-L125
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.GetResponseURL
protected function GetResponseURL($sResponse) { $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' === substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' !== substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } // remove http:// and https:// since these are set in the interface $sReturnURLBase = str_replace('https://', '', $sReturnURLBase); $sReturnURLBase = str_replace('http://', '', $sReturnURLBase); return $sReturnURLBase.self::URL_IDENTIFIER.$sResponse; }
php
protected function GetResponseURL($sResponse) { $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' === substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' !== substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } // remove http:// and https:// since these are set in the interface $sReturnURLBase = str_replace('https://', '', $sReturnURLBase); $sReturnURLBase = str_replace('http://', '', $sReturnURLBase); return $sReturnURLBase.self::URL_IDENTIFIER.$sResponse; }
[ "protected", "function", "GetResponseURL", "(", "$", "sResponse", ")", "{", "$", "sReturnURLBase", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", "->", "GetRealURLPlain", "(", "array", "(", ")", ",", "true", ")", ...
return SEO URL for the requested response. @param $sResponseName string
[ "return", "SEO", "URL", "for", "the", "requested", "response", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L131-L145
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.BuildIncomingHash
protected function BuildIncomingHash($aParameter) { $sHash = ''; $aBaseData = array(); if (false == $this->UsesAccountFromSofortBank()) { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', // 'status'=>'', // 'status_modified'=>'', 'notification_password' => $this->GetConfigParameter('notification_password'), ); } else { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', 'notification_password' => $this->GetConfigParameter('notification_password')); } foreach (array_keys($aBaseData) as $sBaseDataKey) { if (array_key_exists($sBaseDataKey, $aParameter)) { $aBaseData[$sBaseDataKey] = $aParameter[$sBaseDataKey]; } } $sRawHash = implode('|', array_values($aBaseData)); $sHash = hash('sha256', $sRawHash); return $sHash; }
php
protected function BuildIncomingHash($aParameter) { $sHash = ''; $aBaseData = array(); if (false == $this->UsesAccountFromSofortBank()) { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', // 'status'=>'', // 'status_modified'=>'', 'notification_password' => $this->GetConfigParameter('notification_password'), ); } else { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', 'notification_password' => $this->GetConfigParameter('notification_password')); } foreach (array_keys($aBaseData) as $sBaseDataKey) { if (array_key_exists($sBaseDataKey, $aParameter)) { $aBaseData[$sBaseDataKey] = $aParameter[$sBaseDataKey]; } } $sRawHash = implode('|', array_values($aBaseData)); $sHash = hash('sha256', $sRawHash); return $sHash; }
[ "protected", "function", "BuildIncomingHash", "(", "$", "aParameter", ")", "{", "$", "sHash", "=", "''", ";", "$", "aBaseData", "=", "array", "(", ")", ";", "if", "(", "false", "==", "$", "this", "->", "UsesAccountFromSofortBank", "(", ")", ")", "{", "...
build incoming hash string from data provided by sofortueberweisung. @param array $aParameter @return string
[ "build", "incoming", "hash", "string", "from", "data", "provided", "by", "sofortueberweisung", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L327-L348
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.NotifyPayloadIsValid
protected function NotifyPayloadIsValid($aParameter) { $bIsValid = true; $aMessage = array('msg' => '', 'line' => 0); // validate hash $sCalculatedHash = $this->BuildIncomingHash($aParameter); $sHash = (array_key_exists('hash', $aParameter)) ? $aParameter['hash'] : ''; if (0 != strcmp($sHash, $sCalculatedHash)) { $aMessage = array('msg' => "sofortueberweisung-notify: calculated hash [{$sCalculatedHash}] does not match hash passed [{$sHash}] for order", 'line' => __LINE__); $bIsValid = false; } /** @var $oOrder TdbShopOrder */ $oOrder = null; if ($bIsValid) { // order id exists? $sOrderId = (array_key_exists('user_variable_3', $aParameter)) ? $aParameter['user_variable_3'] : ''; $oOrder = TdbShopOrder::GetNewInstance(); if (false == $oOrder->Load($sOrderId)) { $aMessage = array('msg' => "sofortueberweisung-notify: order id passed [{$sOrderId}] was not found in database: ", 'line' => __LINE__); $bIsValid = false; } } if ($bIsValid) { // order amount matches? $dOrderAmount = (array_key_exists('amount', $aParameter)) ? $aParameter['amount'] : ''; if (0 != strcmp($dOrderAmount, $oOrder->fieldValueTotal)) { $aMessage = array('msg' => "sofortueberweisung-notify: amount paid [{$dOrderAmount}] for order [{$oOrder->id}] does not match order value [{$oOrder->fieldValueTotal}]: ", 'line' => __LINE__); $bIsValid = false; } } if (false == $bIsValid) { TTools::WriteLogEntry($aMessage['msg'].' DATA: '.print_r($aParameter, true), 1, __FILE__, $aMessage['line']); $bIsValid = $aMessage['msg']; } return $bIsValid; }
php
protected function NotifyPayloadIsValid($aParameter) { $bIsValid = true; $aMessage = array('msg' => '', 'line' => 0); // validate hash $sCalculatedHash = $this->BuildIncomingHash($aParameter); $sHash = (array_key_exists('hash', $aParameter)) ? $aParameter['hash'] : ''; if (0 != strcmp($sHash, $sCalculatedHash)) { $aMessage = array('msg' => "sofortueberweisung-notify: calculated hash [{$sCalculatedHash}] does not match hash passed [{$sHash}] for order", 'line' => __LINE__); $bIsValid = false; } /** @var $oOrder TdbShopOrder */ $oOrder = null; if ($bIsValid) { // order id exists? $sOrderId = (array_key_exists('user_variable_3', $aParameter)) ? $aParameter['user_variable_3'] : ''; $oOrder = TdbShopOrder::GetNewInstance(); if (false == $oOrder->Load($sOrderId)) { $aMessage = array('msg' => "sofortueberweisung-notify: order id passed [{$sOrderId}] was not found in database: ", 'line' => __LINE__); $bIsValid = false; } } if ($bIsValid) { // order amount matches? $dOrderAmount = (array_key_exists('amount', $aParameter)) ? $aParameter['amount'] : ''; if (0 != strcmp($dOrderAmount, $oOrder->fieldValueTotal)) { $aMessage = array('msg' => "sofortueberweisung-notify: amount paid [{$dOrderAmount}] for order [{$oOrder->id}] does not match order value [{$oOrder->fieldValueTotal}]: ", 'line' => __LINE__); $bIsValid = false; } } if (false == $bIsValid) { TTools::WriteLogEntry($aMessage['msg'].' DATA: '.print_r($aParameter, true), 1, __FILE__, $aMessage['line']); $bIsValid = $aMessage['msg']; } return $bIsValid; }
[ "protected", "function", "NotifyPayloadIsValid", "(", "$", "aParameter", ")", "{", "$", "bIsValid", "=", "true", ";", "$", "aMessage", "=", "array", "(", "'msg'", "=>", "''", ",", "'line'", "=>", "0", ")", ";", "// validate hash", "$", "sCalculatedHash", "...
validate input. return true if valid, or error string on error. @param array $aParameter @return bool
[ "validate", "input", ".", "return", "true", "if", "valid", "or", "error", "string", "on", "error", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L442-L482
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php
RefundExampleCLI._getRefundAmount
private function _getRefundAmount() { print PHP_EOL . "----------------------------------------------------------------------------" . PHP_EOL; print "Enter the amount to refund the customer (to 2 decimal places): "; do { $refundAmount = trim(fgets(STDIN)); } while (!is_numeric($refundAmount)); return $refundAmount; }
php
private function _getRefundAmount() { print PHP_EOL . "----------------------------------------------------------------------------" . PHP_EOL; print "Enter the amount to refund the customer (to 2 decimal places): "; do { $refundAmount = trim(fgets(STDIN)); } while (!is_numeric($refundAmount)); return $refundAmount; }
[ "private", "function", "_getRefundAmount", "(", ")", "{", "print", "PHP_EOL", ".", "\"----------------------------------------------------------------------------\"", ".", "PHP_EOL", ";", "print", "\"Enter the amount to refund the customer (to 2 decimal places): \"", ";", "do", "{"...
Get the amount to refund @return string refund amount, as a numeric string`
[ "Get", "the", "amount", "to", "refund" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php#L116-L126
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php
RefundExampleCLI._waitUntilRefundProcessingIsCompleted
private function _waitUntilRefundProcessingIsCompleted($amazonRefundReferenceId) { $response = $this->callStepAndCheckForException( 'waitUntilRefundProcessingIsCompleted', array($amazonRefundReferenceId) ); printGetRefundDetailsResponse($response); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); }
php
private function _waitUntilRefundProcessingIsCompleted($amazonRefundReferenceId) { $response = $this->callStepAndCheckForException( 'waitUntilRefundProcessingIsCompleted', array($amazonRefundReferenceId) ); printGetRefundDetailsResponse($response); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); }
[ "private", "function", "_waitUntilRefundProcessingIsCompleted", "(", "$", "amazonRefundReferenceId", ")", "{", "$", "response", "=", "$", "this", "->", "callStepAndCheckForException", "(", "'waitUntilRefundProcessingIsCompleted'", ",", "array", "(", "$", "amazonRefundRefere...
Poll the API for the status of the Refund Request, and continue once the status has been updated Throw an error if the status is not equal to OPEN @param string $amazonRefundReferenceId refund transaction to query @return No value
[ "Poll", "the", "API", "for", "the", "status", "of", "the", "Refund", "Request", "and", "continue", "once", "the", "status", "has", "been", "updated", "Throw", "an", "error", "if", "the", "status", "is", "not", "equal", "to", "OPEN" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php#L169-L178
train
chameleon-system/chameleon-shop
src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php
TShopWishlistDataExtranetUser.AddArticleIdToWishlist
public function AddArticleIdToWishlist($sArticleId, $dAmount = 1) { $dNewAmountOnList = 0; $oWishlist = &$this->GetWishlist(true); $dNewAmountOnList = $oWishlist->AddArticle($sArticleId, $dAmount); return $dNewAmountOnList; }
php
public function AddArticleIdToWishlist($sArticleId, $dAmount = 1) { $dNewAmountOnList = 0; $oWishlist = &$this->GetWishlist(true); $dNewAmountOnList = $oWishlist->AddArticle($sArticleId, $dAmount); return $dNewAmountOnList; }
[ "public", "function", "AddArticleIdToWishlist", "(", "$", "sArticleId", ",", "$", "dAmount", "=", "1", ")", "{", "$", "dNewAmountOnList", "=", "0", ";", "$", "oWishlist", "=", "&", "$", "this", "->", "GetWishlist", "(", "true", ")", ";", "$", "dNewAmount...
add an article to the wishlist. @param string $sArticleId @param float $dAmount @return float - new amount on list
[ "add", "an", "article", "to", "the", "wishlist", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php#L22-L29
train
chameleon-system/chameleon-shop
src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php
TShopWishlistDataExtranetUser.RemoveArticleFromWishlist
public function RemoveArticleFromWishlist($sPkgShopWishlistArticleId) { $oWishlist = &$this->GetWishlist(true); $oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance(); /** @var $oWishlistItem TdbPkgShopWishlistArticle */ if ($oWishlistItem->LoadFromFields(array('pkg_shop_wishlist_id' => $oWishlist->id, 'id' => $sPkgShopWishlistArticleId))) { $oWishlistItem->AllowEditByAll(true); $oWishlistItem->Delete(); } }
php
public function RemoveArticleFromWishlist($sPkgShopWishlistArticleId) { $oWishlist = &$this->GetWishlist(true); $oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance(); /** @var $oWishlistItem TdbPkgShopWishlistArticle */ if ($oWishlistItem->LoadFromFields(array('pkg_shop_wishlist_id' => $oWishlist->id, 'id' => $sPkgShopWishlistArticleId))) { $oWishlistItem->AllowEditByAll(true); $oWishlistItem->Delete(); } }
[ "public", "function", "RemoveArticleFromWishlist", "(", "$", "sPkgShopWishlistArticleId", ")", "{", "$", "oWishlist", "=", "&", "$", "this", "->", "GetWishlist", "(", "true", ")", ";", "$", "oWishlistItem", "=", "TdbPkgShopWishlistArticle", "::", "GetNewInstance", ...
remove an article form the wishlist. @param string $sPkgShopWishlistArticleId - the id of the item on the list
[ "remove", "an", "article", "form", "the", "wishlist", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php#L36-L45
train
chameleon-system/chameleon-shop
src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php
TShopWishlistDataExtranetUser.&
public function &GetWishlist($bCreateIfNotExists = false) { $oWishlist = &$this->GetFromInternalCache('oUserWishlist'); if (is_null($oWishlist)) { $oWishlists = $this->GetFieldPkgShopWishlistList(); if ($oWishlists->Length() > 0) { $oWishlist = $oWishlists->Current(); } if (is_null($oWishlist) && $bCreateIfNotExists) { $oWishlist = TdbPkgShopWishlist::GetNewInstance(); /** @var $oWishlist TdbPkgShopWishlist */ if (!$oWishlist->LoadFromField('data_extranet_user_id', $this->id)) { $aBaseData = array('data_extranet_user_id' => $this->id, 'is_public' => '0'); $oWishlist->LoadFromRow($aBaseData); $oWishlist->Save(); } } $this->SetInternalCache('oUserWishlist', $oWishlist); } return $oWishlist; }
php
public function &GetWishlist($bCreateIfNotExists = false) { $oWishlist = &$this->GetFromInternalCache('oUserWishlist'); if (is_null($oWishlist)) { $oWishlists = $this->GetFieldPkgShopWishlistList(); if ($oWishlists->Length() > 0) { $oWishlist = $oWishlists->Current(); } if (is_null($oWishlist) && $bCreateIfNotExists) { $oWishlist = TdbPkgShopWishlist::GetNewInstance(); /** @var $oWishlist TdbPkgShopWishlist */ if (!$oWishlist->LoadFromField('data_extranet_user_id', $this->id)) { $aBaseData = array('data_extranet_user_id' => $this->id, 'is_public' => '0'); $oWishlist->LoadFromRow($aBaseData); $oWishlist->Save(); } } $this->SetInternalCache('oUserWishlist', $oWishlist); } return $oWishlist; }
[ "public", "function", "&", "GetWishlist", "(", "$", "bCreateIfNotExists", "=", "false", ")", "{", "$", "oWishlist", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "'oUserWishlist'", ")", ";", "if", "(", "is_null", "(", "$", "oWishlist", ")", ")"...
return the users wishlist. if no wishlist exists, the method will return null - unless the option bCreateIfNotExists is set, then we will create a new on. @param bool $bCreateIfNotExists @return TdbPkgShopWishlist
[ "return", "the", "users", "wishlist", ".", "if", "no", "wishlist", "exists", "the", "method", "will", "return", "null", "-", "unless", "the", "option", "bCreateIfNotExists", "is", "set", "then", "we", "will", "create", "a", "new", "on", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/pkgExtranet/objects/db/TShopWishlistDataExtranetUser.class.php#L56-L77
train
chameleon-system/chameleon-shop
src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php
MTPkgImageHotspotCore.&
protected function &GetNextItem() { if (is_null($this->oNextItem)) { $oActiveItem = &$this->GetActiveItem(); $oItemList = &$this->GetHotspotConfig()->GetFieldPkgImageHotspotItemList(); if ($oItemList->Length() < 2) { $retValue = null; // write to variable to satisfy strict mode return $retValue; } $oItemList->GoToStart(); while (is_null($this->oNextItem) && ($oItem = $oItemList->Next())) { if ($oItem->IsSameAs($oActiveItem)) { $this->oNextItem = $oItemList->Next(); if (false == $this->oNextItem) { $oItemList->GoToStart(); $this->oNextItem = $oItemList->Next(); } } } if (!is_null($this->oNextItem) && $this->oNextItem->IsSameAs($oActiveItem)) { $this->oNextItem = null; } } return $this->oNextItem; }
php
protected function &GetNextItem() { if (is_null($this->oNextItem)) { $oActiveItem = &$this->GetActiveItem(); $oItemList = &$this->GetHotspotConfig()->GetFieldPkgImageHotspotItemList(); if ($oItemList->Length() < 2) { $retValue = null; // write to variable to satisfy strict mode return $retValue; } $oItemList->GoToStart(); while (is_null($this->oNextItem) && ($oItem = $oItemList->Next())) { if ($oItem->IsSameAs($oActiveItem)) { $this->oNextItem = $oItemList->Next(); if (false == $this->oNextItem) { $oItemList->GoToStart(); $this->oNextItem = $oItemList->Next(); } } } if (!is_null($this->oNextItem) && $this->oNextItem->IsSameAs($oActiveItem)) { $this->oNextItem = null; } } return $this->oNextItem; }
[ "protected", "function", "&", "GetNextItem", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oNextItem", ")", ")", "{", "$", "oActiveItem", "=", "&", "$", "this", "->", "GetActiveItem", "(", ")", ";", "$", "oItemList", "=", "&", "$", ...
return the hotspot following the current active spot. if the active spot is the last spot, then we will return the first step. @return TdbPkgImageHotspotItem|null
[ "return", "the", "hotspot", "following", "the", "current", "active", "spot", ".", "if", "the", "active", "spot", "is", "the", "last", "spot", "then", "we", "will", "return", "the", "first", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php#L144-L169
train
chameleon-system/chameleon-shop
src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php
MTPkgImageHotspotCore.&
protected function &GetHotspotConfig() { if (is_null($this->oHotspotConfig)) { $this->oHotspotConfig = TdbPkgImageHotspot::GetNewInstance(); if (!$this->oHotspotConfig->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) { $this->oHotspotConfig = null; } } return $this->oHotspotConfig; }
php
protected function &GetHotspotConfig() { if (is_null($this->oHotspotConfig)) { $this->oHotspotConfig = TdbPkgImageHotspot::GetNewInstance(); if (!$this->oHotspotConfig->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) { $this->oHotspotConfig = null; } } return $this->oHotspotConfig; }
[ "protected", "function", "&", "GetHotspotConfig", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oHotspotConfig", ")", ")", "{", "$", "this", "->", "oHotspotConfig", "=", "TdbPkgImageHotspot", "::", "GetNewInstance", "(", ")", ";", "if", "("...
return config for the instance. @return TdbPkgImageHotspot
[ "return", "config", "for", "the", "instance", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php#L176-L186
train
chameleon-system/chameleon-shop
src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php
MTPkgImageHotspotCore.&
protected function &GetActiveItem() { if (is_null($this->oActiveItem) && !is_null($this->sActiveItemId)) { $this->oActiveItem = TdbPkgImageHotspotItem::GetNewInstance(); $this->oActiveItem->Load($this->sActiveItemId); } return $this->oActiveItem; }
php
protected function &GetActiveItem() { if (is_null($this->oActiveItem) && !is_null($this->sActiveItemId)) { $this->oActiveItem = TdbPkgImageHotspotItem::GetNewInstance(); $this->oActiveItem->Load($this->sActiveItemId); } return $this->oActiveItem; }
[ "protected", "function", "&", "GetActiveItem", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oActiveItem", ")", "&&", "!", "is_null", "(", "$", "this", "->", "sActiveItemId", ")", ")", "{", "$", "this", "->", "oActiveItem", "=", "TdbPkg...
return the active item. @return TdbPkgImageHotspotItem
[ "return", "the", "active", "item", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/WebModules/MTPkgImageHotspotCore/MTPkgImageHotspotCore.class.php#L193-L201
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics._ExecuteCron
protected function _ExecuteCron() { $sQuery = "SELECT * FROM `shop_order_basket` WHERE `shop_order_basket`.`processed` != '1' ORDER BY `shop_order_basket`.`lastmodified` DESC"; $oOrderBasketList = TdbShopOrderBasketList::GetList($sQuery); $sStatistics = "#########################################################\r\n"; while ($oOrderBasket = $oOrderBasketList->Next()) { $sStatistics .= $this->GenerateStatisticsFromOrderBasket($oOrderBasket); $this->MarkOrderBasketAsProcessed($oOrderBasket); ++$this->sTotalBaskets; } if ($oOrderBasketList->Length() > 0) { $sTotalStatistics = $this->GetTotalStatistics().$sStatistics; $this->SendBasketStatistics($sTotalStatistics); } }
php
protected function _ExecuteCron() { $sQuery = "SELECT * FROM `shop_order_basket` WHERE `shop_order_basket`.`processed` != '1' ORDER BY `shop_order_basket`.`lastmodified` DESC"; $oOrderBasketList = TdbShopOrderBasketList::GetList($sQuery); $sStatistics = "#########################################################\r\n"; while ($oOrderBasket = $oOrderBasketList->Next()) { $sStatistics .= $this->GenerateStatisticsFromOrderBasket($oOrderBasket); $this->MarkOrderBasketAsProcessed($oOrderBasket); ++$this->sTotalBaskets; } if ($oOrderBasketList->Length() > 0) { $sTotalStatistics = $this->GetTotalStatistics().$sStatistics; $this->SendBasketStatistics($sTotalStatistics); } }
[ "protected", "function", "_ExecuteCron", "(", ")", "{", "$", "sQuery", "=", "\"SELECT * FROM `shop_order_basket`\n WHERE `shop_order_basket`.`processed` != '1'\n ORDER BY `shop_order_basket`.`lastmodified` DESC\"", ";", "$", "oOrderBasketList", ...
Get all none processed shop baskets and send generated statistics to shop owner.
[ "Get", "all", "none", "processed", "shop", "baskets", "and", "send", "generated", "statistics", "to", "shop", "owner", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L26-L42
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.MarkOrderBasketAsProcessed
protected function MarkOrderBasketAsProcessed($oOrderBasket) { $oOrderBasket->AllowEditByAll(true); $oOrderBasket->sqlData['processed'] = 1; $oOrderBasket->Save(); $oOrderBasket->AllowEditByAll(false); }
php
protected function MarkOrderBasketAsProcessed($oOrderBasket) { $oOrderBasket->AllowEditByAll(true); $oOrderBasket->sqlData['processed'] = 1; $oOrderBasket->Save(); $oOrderBasket->AllowEditByAll(false); }
[ "protected", "function", "MarkOrderBasketAsProcessed", "(", "$", "oOrderBasket", ")", "{", "$", "oOrderBasket", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oOrderBasket", "->", "sqlData", "[", "'processed'", "]", "=", "1", ";", "$", "oOrderBasket", "-...
Mark order basket as processed. So no statistics for this order basket will be generated next time. @param TdbShopOrderBasket $oOrderBasket
[ "Mark", "order", "basket", "as", "processed", ".", "So", "no", "statistics", "for", "this", "order", "basket", "will", "be", "generated", "next", "time", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L49-L55
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.GetTotalStatistics
protected function GetTotalStatistics() { $sTotalStatistics = "#########################################################\r\n"; $sTotalStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.headline')."\r\n"; $sTotalStatistics .= "------------------------------------\r\n"; foreach ($this->aCancelStep as $sStempName => $sValue) { $sPercent = round((100 / $this->sTotalBaskets) * $sValue); if ($sStempName != TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')) { $sTotalStatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.text_aborted', array( '%step%' => $sStempName, '%value%' => $sValue, '%totalBaskets%' => $this->sTotalBaskets, '%percent%' => $sPercent, ) )."\r\n"; } else { $sTotalStatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.text_completed', array( '%value%' => $sValue, '%totalBaskets%' => $this->sTotalBaskets, '%percent%' => $sPercent, ) )."\r\n"; } } $sTotalStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_total_aborted_orders').': '.$this->sTotalMoneyCanceled; return $sTotalStatistics."\r\n"; }
php
protected function GetTotalStatistics() { $sTotalStatistics = "#########################################################\r\n"; $sTotalStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.headline')."\r\n"; $sTotalStatistics .= "------------------------------------\r\n"; foreach ($this->aCancelStep as $sStempName => $sValue) { $sPercent = round((100 / $this->sTotalBaskets) * $sValue); if ($sStempName != TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')) { $sTotalStatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.text_aborted', array( '%step%' => $sStempName, '%value%' => $sValue, '%totalBaskets%' => $this->sTotalBaskets, '%percent%' => $sPercent, ) )."\r\n"; } else { $sTotalStatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.text_completed', array( '%value%' => $sValue, '%totalBaskets%' => $this->sTotalBaskets, '%percent%' => $sPercent, ) )."\r\n"; } } $sTotalStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_total_aborted_orders').': '.$this->sTotalMoneyCanceled; return $sTotalStatistics."\r\n"; }
[ "protected", "function", "GetTotalStatistics", "(", ")", "{", "$", "sTotalStatistics", "=", "\"#########################################################\\r\\n\"", ";", "$", "sTotalStatistics", ".=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.cron_send_basket_stats...
Get overfiew statistics of all processed order baskets. @return string
[ "Get", "overfiew", "statistics", "of", "all", "processed", "order", "baskets", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L62-L93
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.GenerateStatisticsFromOrderBasket
protected function GenerateStatisticsFromOrderBasket($oOrderBasket) { $sStatistics = ''; if (empty($oOrderBasket->fieldShopOrderId)) { $sStatistics = $this->GetCancelBasketInformation($oOrderBasket); $oUser = TdbDataExtranetUser::GetNewInstance(); $oUser = unserialize(base64_decode($oOrderBasket->fieldRawdataUser)); if (is_object($oUser)) { $sStatistics .= $this->GetUserStatistics($oUser); } $oBasket = new TShopBasket(); $oBasket = unserialize(base64_decode($oOrderBasket->fieldRawdataBasket)); if (is_object($oBasket)) { $sStatistics .= $this->GetBasketStatistics($oBasket); } $sStatistics .= "#########################################################\r\n"; } else { $this->AddCompleteOrderToStatistics(); } return $sStatistics; }
php
protected function GenerateStatisticsFromOrderBasket($oOrderBasket) { $sStatistics = ''; if (empty($oOrderBasket->fieldShopOrderId)) { $sStatistics = $this->GetCancelBasketInformation($oOrderBasket); $oUser = TdbDataExtranetUser::GetNewInstance(); $oUser = unserialize(base64_decode($oOrderBasket->fieldRawdataUser)); if (is_object($oUser)) { $sStatistics .= $this->GetUserStatistics($oUser); } $oBasket = new TShopBasket(); $oBasket = unserialize(base64_decode($oOrderBasket->fieldRawdataBasket)); if (is_object($oBasket)) { $sStatistics .= $this->GetBasketStatistics($oBasket); } $sStatistics .= "#########################################################\r\n"; } else { $this->AddCompleteOrderToStatistics(); } return $sStatistics; }
[ "protected", "function", "GenerateStatisticsFromOrderBasket", "(", "$", "oOrderBasket", ")", "{", "$", "sStatistics", "=", "''", ";", "if", "(", "empty", "(", "$", "oOrderBasket", "->", "fieldShopOrderId", ")", ")", "{", "$", "sStatistics", "=", "$", "this", ...
Generate user and basket statistics for given order basket. @param TdbShopOrderBasket $oOrderBasket @return string
[ "Generate", "user", "and", "basket", "statistics", "for", "given", "order", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L102-L123
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.AddCompleteOrderToStatistics
protected function AddCompleteOrderToStatistics() { if (array_key_exists(TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed'), $this->aCancelStep)) { ++$this->aCancelStep[TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')]; } else { $this->aCancelStep[TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')] = 1; } }
php
protected function AddCompleteOrderToStatistics() { if (array_key_exists(TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed'), $this->aCancelStep)) { ++$this->aCancelStep[TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')]; } else { $this->aCancelStep[TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.completed')] = 1; } }
[ "protected", "function", "AddCompleteOrderToStatistics", "(", ")", "{", "if", "(", "array_key_exists", "(", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.cron_send_basket_stats.completed'", ")", ",", "$", "this", "->", "aCancelStep", ")", ")", "{", "++", ...
If basket was finished completely add it to overfiew statistics.
[ "If", "basket", "was", "finished", "completely", "add", "it", "to", "overfiew", "statistics", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L128-L135
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.GetCancelBasketInformation
protected function GetCancelBasketInformation($oOrderBasket) { $sCancelBasketInformation = ''; $sCancelBasketInformation .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_general_info')."\r\n"; $sCancelBasketInformation .= "------------------------------------\r\n"; $oCancelStep = TdbShopOrderStep::GetStep($oOrderBasket->fieldUpdateStepname); $sCancelBasketInformation .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_general_aborted', array('%step%' => $oCancelStep->fieldName))."\r\n"; if (array_key_exists($oCancelStep->fieldName, $this->aCancelStep)) { ++$this->aCancelStep[$oCancelStep->fieldName]; } else { $this->aCancelStep[$oCancelStep->fieldName] = 1; } return $sCancelBasketInformation; }
php
protected function GetCancelBasketInformation($oOrderBasket) { $sCancelBasketInformation = ''; $sCancelBasketInformation .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_general_info')."\r\n"; $sCancelBasketInformation .= "------------------------------------\r\n"; $oCancelStep = TdbShopOrderStep::GetStep($oOrderBasket->fieldUpdateStepname); $sCancelBasketInformation .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_general_aborted', array('%step%' => $oCancelStep->fieldName))."\r\n"; if (array_key_exists($oCancelStep->fieldName, $this->aCancelStep)) { ++$this->aCancelStep[$oCancelStep->fieldName]; } else { $this->aCancelStep[$oCancelStep->fieldName] = 1; } return $sCancelBasketInformation; }
[ "protected", "function", "GetCancelBasketInformation", "(", "$", "oOrderBasket", ")", "{", "$", "sCancelBasketInformation", "=", "''", ";", "$", "sCancelBasketInformation", ".=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.cron_send_basket_stats.text_general_in...
Get statistics on which basket step the user canceled. @param TdbShopOrderBasket $oOrderBasket @return string
[ "Get", "statistics", "on", "which", "basket", "step", "the", "user", "canceled", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L144-L158
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.GetUserStatistics
protected function GetUserStatistics($oUser) { $sUserStatistics = ''; $sUserStatistics .= "------------------------------------\r\n\r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_user')."\r\n"; $sUserStatistics .= "------------------------------------\r\n"; if (count($oUser->sqlData) > 0) { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_name').': '.$oUser->fieldFirstname.' '.$oUser->fieldLastname." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_email').': '.$oUser->fieldName." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_street').': '.$oUser->fieldStreet.' '.$oUser->fieldStreetnr." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_zip').': '.$oUser->fieldPostalcode.' '.$oUser->fieldCity." \r\n"; $oCountry = TdbDataCountry::GetNewInstance(); if ($oCountry->Load($oUser->fieldDataCountryId)) { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_country').': '.$oCountry->GetName()." \r\n"; } $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_telefon').': '.$oUser->fieldTelefon." \r\n"; } else { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.guest_user')."\r\n"; } return $sUserStatistics; }
php
protected function GetUserStatistics($oUser) { $sUserStatistics = ''; $sUserStatistics .= "------------------------------------\r\n\r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.text_user')."\r\n"; $sUserStatistics .= "------------------------------------\r\n"; if (count($oUser->sqlData) > 0) { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_name').': '.$oUser->fieldFirstname.' '.$oUser->fieldLastname." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_email').': '.$oUser->fieldName." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_street').': '.$oUser->fieldStreet.' '.$oUser->fieldStreetnr." \r\n"; $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_zip').': '.$oUser->fieldPostalcode.' '.$oUser->fieldCity." \r\n"; $oCountry = TdbDataCountry::GetNewInstance(); if ($oCountry->Load($oUser->fieldDataCountryId)) { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_country').': '.$oCountry->GetName()." \r\n"; } $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.user_telefon').': '.$oUser->fieldTelefon." \r\n"; } else { $sUserStatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.guest_user')."\r\n"; } return $sUserStatistics; }
[ "protected", "function", "GetUserStatistics", "(", "$", "oUser", ")", "{", "$", "sUserStatistics", "=", "''", ";", "$", "sUserStatistics", ".=", "\"------------------------------------\\r\\n\\r\\n\"", ";", "$", "sUserStatistics", ".=", "TGlobal", "::", "Translate", "(...
Get user statistics for canceled basket step. @param TdbDataExtranetUser $oUser @return string
[ "Get", "user", "statistics", "for", "canceled", "basket", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L167-L188
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.GetBasketStatistics
protected function GetBasketStatistics($oBasket) { $sBasketstatistics = ''; $sBasketstatistics .= "------------------------------------\r\n\r\n"; $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content')."\r\n"; $sBasketstatistics .= "------------------------------------\r\n"; $oArticleList = $oBasket->GetBasketContents(); $oArticleList->GoToStart(); while ($oArticle = $oArticleList->Next()) { $sBasketstatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.basket_content_line', array( '%amount%' => '', '%name%' => '', '%price%' => '', '%totalPrice%' => '', ) )."\r\n"; } $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content_total', array('%basketTotal%' => $oBasket->dCostArticlesTotal))."\r\n"; $this->sTotalMoneyCanceled = $this->sTotalMoneyCanceled + $oBasket->dCostArticlesTotal; $sBasketstatistics .= "------------------------------------\r\n"; return $sBasketstatistics; }
php
protected function GetBasketStatistics($oBasket) { $sBasketstatistics = ''; $sBasketstatistics .= "------------------------------------\r\n\r\n"; $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content')."\r\n"; $sBasketstatistics .= "------------------------------------\r\n"; $oArticleList = $oBasket->GetBasketContents(); $oArticleList->GoToStart(); while ($oArticle = $oArticleList->Next()) { $sBasketstatistics .= TGlobal::Translate( 'chameleon_system_shop.cron_send_basket_stats.basket_content_line', array( '%amount%' => '', '%name%' => '', '%price%' => '', '%totalPrice%' => '', ) )."\r\n"; } $sBasketstatistics .= TGlobal::Translate('chameleon_system_shop.cron_send_basket_stats.basket_content_total', array('%basketTotal%' => $oBasket->dCostArticlesTotal))."\r\n"; $this->sTotalMoneyCanceled = $this->sTotalMoneyCanceled + $oBasket->dCostArticlesTotal; $sBasketstatistics .= "------------------------------------\r\n"; return $sBasketstatistics; }
[ "protected", "function", "GetBasketStatistics", "(", "$", "oBasket", ")", "{", "$", "sBasketstatistics", "=", "''", ";", "$", "sBasketstatistics", ".=", "\"------------------------------------\\r\\n\\r\\n\"", ";", "$", "sBasketstatistics", ".=", "TGlobal", "::", "Transl...
Get basket statistics for canceled basket step. @param TShopBasket $oBasket @return string
[ "Get", "basket", "statistics", "for", "canceled", "basket", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L197-L221
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php
TCMSCronJob_ShopSendBasketLogStatisics.SendBasketStatistics
protected function SendBasketStatistics($sStatistics) { $oMail = TDataMailProfile::GetProfile(self::MAIL_SYSTEM_NAME); $aMailData = array(); $aMailData['sStatistics'] = $sStatistics; $oMail->AddDataArray($aMailData); $oMail->SendUsingObjectView('emails', 'Customer'); }
php
protected function SendBasketStatistics($sStatistics) { $oMail = TDataMailProfile::GetProfile(self::MAIL_SYSTEM_NAME); $aMailData = array(); $aMailData['sStatistics'] = $sStatistics; $oMail->AddDataArray($aMailData); $oMail->SendUsingObjectView('emails', 'Customer'); }
[ "protected", "function", "SendBasketStatistics", "(", "$", "sStatistics", ")", "{", "$", "oMail", "=", "TDataMailProfile", "::", "GetProfile", "(", "self", "::", "MAIL_SYSTEM_NAME", ")", ";", "$", "aMailData", "=", "array", "(", ")", ";", "$", "aMailData", "...
Send complete statisticreport to shop owner. @param string $sStatistics
[ "Send", "complete", "statisticreport", "to", "shop", "owner", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/CronJobs/TCMSCronJob_ShopSendBasketLogStatisics.class.php#L228-L235
train
edmondscommerce/doctrine-static-meta
src/Entity/Savers/BulkEntityUpdater.php
BulkEntityUpdater.convertExtractedToSqlRow
private function convertExtractedToSqlRow(array $extracted): string { if ([] === $extracted) { throw new \RuntimeException('Extracted array is empty in ' . __METHOD__); } $primaryKeyCol = null; $primaryKey = null; $sql = "update `{$this->tableName}` set "; $sqls = []; foreach ($extracted as $key => $value) { if (null === $primaryKeyCol) { $primaryKeyCol = $key; $primaryKey = $this->convertUuidToSqlString($value); continue; } $value = $this->mysqli->escape_string((string)$value); $sqls[] = "`$key` = '$value'"; } $sql .= implode(",\n", $sqls); $sql .= " where `$primaryKeyCol` = $primaryKey; "; return $sql; }
php
private function convertExtractedToSqlRow(array $extracted): string { if ([] === $extracted) { throw new \RuntimeException('Extracted array is empty in ' . __METHOD__); } $primaryKeyCol = null; $primaryKey = null; $sql = "update `{$this->tableName}` set "; $sqls = []; foreach ($extracted as $key => $value) { if (null === $primaryKeyCol) { $primaryKeyCol = $key; $primaryKey = $this->convertUuidToSqlString($value); continue; } $value = $this->mysqli->escape_string((string)$value); $sqls[] = "`$key` = '$value'"; } $sql .= implode(",\n", $sqls); $sql .= " where `$primaryKeyCol` = $primaryKey; "; return $sql; }
[ "private", "function", "convertExtractedToSqlRow", "(", "array", "$", "extracted", ")", ":", "string", "{", "if", "(", "[", "]", "===", "$", "extracted", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Extracted array is empty in '", ".", "__METHOD__"...
Take the extracted array and build an update query @param array $extracted @return string
[ "Take", "the", "extracted", "array", "and", "build", "an", "update", "query" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Savers/BulkEntityUpdater.php#L174-L196
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Creation/AbstractCreator.php
AbstractCreator.updateRootDirOnTargetFile
private function updateRootDirOnTargetFile(): void { $realTemplateTestsPath = realpath(self::ROOT_TEMPLATE_PATH . self::TEST_DIR); if (0 === \strpos($this->templateFile->getPath(), $realTemplateTestsPath)) { $updatedPath = str_replace( '/src/', '/tests/', $this->targetFile->getPath() ); $this->targetFile->setPath($updatedPath); } }
php
private function updateRootDirOnTargetFile(): void { $realTemplateTestsPath = realpath(self::ROOT_TEMPLATE_PATH . self::TEST_DIR); if (0 === \strpos($this->templateFile->getPath(), $realTemplateTestsPath)) { $updatedPath = str_replace( '/src/', '/tests/', $this->targetFile->getPath() ); $this->targetFile->setPath($updatedPath); } }
[ "private", "function", "updateRootDirOnTargetFile", "(", ")", ":", "void", "{", "$", "realTemplateTestsPath", "=", "realpath", "(", "self", "::", "ROOT_TEMPLATE_PATH", ".", "self", "::", "TEST_DIR", ")", ";", "if", "(", "0", "===", "\\", "strpos", "(", "$", ...
Where the template file is in tests, we need to fix that in the target file
[ "Where", "the", "template", "file", "is", "in", "tests", "we", "need", "to", "fix", "that", "in", "the", "target", "file" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Creation/AbstractCreator.php#L134-L145
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Creation/AbstractCreator.php
AbstractCreator.configurePipeline
protected function configurePipeline(): void { $this->pipeline = new Pipeline($this->findReplaceFactory); $this->registerReplaceName(); $this->registerReplaceProjectRootNamespace(); }
php
protected function configurePipeline(): void { $this->pipeline = new Pipeline($this->findReplaceFactory); $this->registerReplaceName(); $this->registerReplaceProjectRootNamespace(); }
[ "protected", "function", "configurePipeline", "(", ")", ":", "void", "{", "$", "this", "->", "pipeline", "=", "new", "Pipeline", "(", "$", "this", "->", "findReplaceFactory", ")", ";", "$", "this", "->", "registerReplaceName", "(", ")", ";", "$", "this", ...
In this method we register all the process steps that we want to rnu against the file By default this registers the ReplaceNameProcess which is almost certainly required. Other processes can be registered as required
[ "In", "this", "method", "we", "register", "all", "the", "process", "steps", "that", "we", "want", "to", "rnu", "against", "the", "file" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Creation/AbstractCreator.php#L161-L166
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Creation/AbstractCreator.php
AbstractCreator.writeIfNotExists
public function writeIfNotExists(): string { if ($this->targetFile->exists()) { return $this->targetFile->getPath(); } return $this->write(); }
php
public function writeIfNotExists(): string { if ($this->targetFile->exists()) { return $this->targetFile->getPath(); } return $this->write(); }
[ "public", "function", "writeIfNotExists", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "targetFile", "->", "exists", "(", ")", ")", "{", "return", "$", "this", "->", "targetFile", "->", "getPath", "(", ")", ";", "}", "return", "$", "th...
Write the file only if it doesn't already exist @return string @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
[ "Write", "the", "file", "only", "if", "it", "doesn", "t", "already", "exist" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Creation/AbstractCreator.php#L193-L200
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Creation/AbstractCreator.php
AbstractCreator.write
public function write(): string { $this->targetFile->removeIfExists(); return $this->fileWriter->write($this->targetFile); }
php
public function write(): string { $this->targetFile->removeIfExists(); return $this->fileWriter->write($this->targetFile); }
[ "public", "function", "write", "(", ")", ":", "string", "{", "$", "this", "->", "targetFile", "->", "removeIfExists", "(", ")", ";", "return", "$", "this", "->", "fileWriter", "->", "write", "(", "$", "this", "->", "targetFile", ")", ";", "}" ]
Write the file and return the generated path @return string @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
[ "Write", "the", "file", "and", "return", "the", "generated", "path" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Creation/AbstractCreator.php#L208-L213
train
comporu/compo-core
src/Compo/Sonata/AdminBundle/Listener/LogRevisionsListenerExtend.php
LogRevisionsListenerExtend.getOriginalEntityData
private function getOriginalEntityData($entity) { $class = $this->em->getClassMetadata(\get_class($entity)); $data = $this->uow->getOriginalEntityData($entity); if ($class->isVersioned) { $versionField = $class->versionField; $data[$versionField] = $class->reflFields[$versionField]->getValue($entity); } return $data; }
php
private function getOriginalEntityData($entity) { $class = $this->em->getClassMetadata(\get_class($entity)); $data = $this->uow->getOriginalEntityData($entity); if ($class->isVersioned) { $versionField = $class->versionField; $data[$versionField] = $class->reflFields[$versionField]->getValue($entity); } return $data; }
[ "private", "function", "getOriginalEntityData", "(", "$", "entity", ")", "{", "$", "class", "=", "$", "this", "->", "em", "->", "getClassMetadata", "(", "\\", "get_class", "(", "$", "entity", ")", ")", ";", "$", "data", "=", "$", "this", "->", "uow", ...
get original entity data, including versioned field, if "version" constraint is used. @param mixed $entity @return array
[ "get", "original", "entity", "data", "including", "versioned", "field", "if", "version", "constraint", "is", "used", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/AdminBundle/Listener/LogRevisionsListenerExtend.php#L374-L384
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.setEntityHasRelationToEntity
public function setEntityHasRelationToEntity( string $owningEntityFqn, string $hasType, string $ownedEntityFqn, bool $requiredReciprocation = false, bool $internalUseOnly = true ): void { $reciprocate = $internalUseOnly; try { $this->validateHasType($hasType); list( $owningTraitPath, $owningInterfacePath, $reciprocatingInterfacePath, ) = $this->getPathsForOwningTraitsAndInterfaces( $hasType, $ownedEntityFqn ); list($owningClass, , $owningClassSubDirs) = $this->parseFullyQualifiedName($owningEntityFqn); $owningClassPath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $owningClass, $owningClassSubDirs ); $this->useRelationTraitInClass($owningClassPath, $owningTraitPath); $this->useRelationInterfaceInEntityInterface($owningClassPath, $owningInterfacePath); if (\in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) { $this->useRelationInterfaceInEntityInterface($owningClassPath, $reciprocatingInterfacePath); } if (true === $reciprocate && \in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) { $inverseType = $this->getInverseHasType($hasType); $inverseType = $this->updateHasTypeForPossibleRequired($inverseType, $requiredReciprocation); $this->setEntityHasRelationToEntity( $ownedEntityFqn, $inverseType, $owningEntityFqn, /** * Setting required reciprocation to false, * actually it is irrelevant because reciprocation is disabled */ false, false ); } } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
php
public function setEntityHasRelationToEntity( string $owningEntityFqn, string $hasType, string $ownedEntityFqn, bool $requiredReciprocation = false, bool $internalUseOnly = true ): void { $reciprocate = $internalUseOnly; try { $this->validateHasType($hasType); list( $owningTraitPath, $owningInterfacePath, $reciprocatingInterfacePath, ) = $this->getPathsForOwningTraitsAndInterfaces( $hasType, $ownedEntityFqn ); list($owningClass, , $owningClassSubDirs) = $this->parseFullyQualifiedName($owningEntityFqn); $owningClassPath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $owningClass, $owningClassSubDirs ); $this->useRelationTraitInClass($owningClassPath, $owningTraitPath); $this->useRelationInterfaceInEntityInterface($owningClassPath, $owningInterfacePath); if (\in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) { $this->useRelationInterfaceInEntityInterface($owningClassPath, $reciprocatingInterfacePath); } if (true === $reciprocate && \in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) { $inverseType = $this->getInverseHasType($hasType); $inverseType = $this->updateHasTypeForPossibleRequired($inverseType, $requiredReciprocation); $this->setEntityHasRelationToEntity( $ownedEntityFqn, $inverseType, $owningEntityFqn, /** * Setting required reciprocation to false, * actually it is irrelevant because reciprocation is disabled */ false, false ); } } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
[ "public", "function", "setEntityHasRelationToEntity", "(", "string", "$", "owningEntityFqn", ",", "string", "$", "hasType", ",", "string", "$", "ownedEntityFqn", ",", "bool", "$", "requiredReciprocation", "=", "false", ",", "bool", "$", "internalUseOnly", "=", "tr...
Set a relationship from one Entity to Another Entity. Also used internally to set the reciprocal side. Uses an undocumented 4th bool parameter to kill recursion. @param string $owningEntityFqn @param string $hasType @param string $ownedEntityFqn @param bool $requiredReciprocation You should never pass in this parameter, it is only used internally @param bool $internalUseOnly @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "Set", "a", "relationship", "from", "one", "Entity", "to", "Another", "Entity", "." ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L237-L288
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.getPathsForOwningTraitsAndInterfaces
protected function getPathsForOwningTraitsAndInterfaces( string $hasType, string $ownedEntityFqn ): array { try { $ownedHasName = $this->namespaceHelper->getOwnedHasName( $hasType, $ownedEntityFqn, $this->srcSubFolderName, $this->projectRootNamespace ); $reciprocatedHasName = $this->namespaceHelper->getReciprocatedHasName( $ownedEntityFqn, $this->srcSubFolderName, $this->projectRootNamespace ); $owningTraitFqn = $this->getOwningTraitFqn($hasType, $ownedEntityFqn); list($traitName, , $traitSubDirsNoEntities) = $this->parseFullyQualifiedName($owningTraitFqn); $owningTraitPath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $traitName, $traitSubDirsNoEntities ); if (!\file_exists($owningTraitPath)) { $this->generateRelationCodeForEntity($ownedEntityFqn); } $owningInterfaceFqn = $this->getOwningInterfaceFqn($hasType, $ownedEntityFqn); list($interfaceName, , $interfaceSubDirsNoEntities) = $this->parseFullyQualifiedName($owningInterfaceFqn); $owningInterfacePath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $interfaceName, $interfaceSubDirsNoEntities ); $reciprocatingInterfacePath = \preg_replace( '%Has(Required|)' . $ownedHasName . '%', 'Reciprocates' . $reciprocatedHasName, $owningInterfacePath ); return [ $owningTraitPath, $owningInterfacePath, $reciprocatingInterfacePath, ]; } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
php
protected function getPathsForOwningTraitsAndInterfaces( string $hasType, string $ownedEntityFqn ): array { try { $ownedHasName = $this->namespaceHelper->getOwnedHasName( $hasType, $ownedEntityFqn, $this->srcSubFolderName, $this->projectRootNamespace ); $reciprocatedHasName = $this->namespaceHelper->getReciprocatedHasName( $ownedEntityFqn, $this->srcSubFolderName, $this->projectRootNamespace ); $owningTraitFqn = $this->getOwningTraitFqn($hasType, $ownedEntityFqn); list($traitName, , $traitSubDirsNoEntities) = $this->parseFullyQualifiedName($owningTraitFqn); $owningTraitPath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $traitName, $traitSubDirsNoEntities ); if (!\file_exists($owningTraitPath)) { $this->generateRelationCodeForEntity($ownedEntityFqn); } $owningInterfaceFqn = $this->getOwningInterfaceFqn($hasType, $ownedEntityFqn); list($interfaceName, , $interfaceSubDirsNoEntities) = $this->parseFullyQualifiedName($owningInterfaceFqn); $owningInterfacePath = $this->pathHelper->getPathFromNameAndSubDirs( $this->pathToProjectRoot, $interfaceName, $interfaceSubDirsNoEntities ); $reciprocatingInterfacePath = \preg_replace( '%Has(Required|)' . $ownedHasName . '%', 'Reciprocates' . $reciprocatedHasName, $owningInterfacePath ); return [ $owningTraitPath, $owningInterfacePath, $reciprocatingInterfacePath, ]; } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
[ "protected", "function", "getPathsForOwningTraitsAndInterfaces", "(", "string", "$", "hasType", ",", "string", "$", "ownedEntityFqn", ")", ":", "array", "{", "try", "{", "$", "ownedHasName", "=", "$", "this", "->", "namespaceHelper", "->", "getOwnedHasName", "(", ...
Get the absolute paths for the owning traits and interfaces for the specified relation type Will ensure that the files exists @param string $hasType @param string $ownedEntityFqn @return array [ $owningTraitPath, $owningInterfacePath, $reciprocatingInterfacePath ] @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.StaticAccess) @SuppressWarnings(PHPMD.BooleanArgumentFlag)
[ "Get", "the", "absolute", "paths", "for", "the", "owning", "traits", "and", "interfaces", "for", "the", "specified", "relation", "type", "Will", "ensure", "that", "the", "files", "exists" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L321-L372
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.generateRelationCodeForEntity
public function generateRelationCodeForEntity(string $entityFqn): void { $invokable = new GenerateRelationCodeForEntity( $entityFqn, $this->pathToProjectRoot, $this->projectRootNamespace, $this->srcSubFolderName, $this->namespaceHelper, $this->pathHelper, $this->findAndReplaceHelper ); $invokable($this->getRelativePathRelationsGenerator()); }
php
public function generateRelationCodeForEntity(string $entityFqn): void { $invokable = new GenerateRelationCodeForEntity( $entityFqn, $this->pathToProjectRoot, $this->projectRootNamespace, $this->srcSubFolderName, $this->namespaceHelper, $this->pathHelper, $this->findAndReplaceHelper ); $invokable($this->getRelativePathRelationsGenerator()); }
[ "public", "function", "generateRelationCodeForEntity", "(", "string", "$", "entityFqn", ")", ":", "void", "{", "$", "invokable", "=", "new", "GenerateRelationCodeForEntity", "(", "$", "entityFqn", ",", "$", "this", "->", "pathToProjectRoot", ",", "$", "this", "-...
Generate the relation traits for specified Entity This works by copying the template traits folder over and then updating the file contents, name and path @param string $entityFqn Fully Qualified Name of Entity @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.StaticAccess)
[ "Generate", "the", "relation", "traits", "for", "specified", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L401-L413
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.getRelativePathRelationsGenerator
public function getRelativePathRelationsGenerator(): \Generator { try { $recursiveIterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( \realpath(AbstractGenerator::RELATIONS_TEMPLATE_PATH), \RecursiveDirectoryIterator::SKIP_DOTS ), \RecursiveIteratorIterator::SELF_FIRST ); foreach ($recursiveIterator as $path => $fileInfo) { $relativePath = rtrim( $this->getFilesystem()->makePathRelative( $path, \realpath(AbstractGenerator::RELATIONS_TEMPLATE_PATH) ), '/' ); yield $relativePath => $fileInfo; } } finally { $recursiveIterator = null; unset($recursiveIterator); } }
php
public function getRelativePathRelationsGenerator(): \Generator { try { $recursiveIterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( \realpath(AbstractGenerator::RELATIONS_TEMPLATE_PATH), \RecursiveDirectoryIterator::SKIP_DOTS ), \RecursiveIteratorIterator::SELF_FIRST ); foreach ($recursiveIterator as $path => $fileInfo) { $relativePath = rtrim( $this->getFilesystem()->makePathRelative( $path, \realpath(AbstractGenerator::RELATIONS_TEMPLATE_PATH) ), '/' ); yield $relativePath => $fileInfo; } } finally { $recursiveIterator = null; unset($recursiveIterator); } }
[ "public", "function", "getRelativePathRelationsGenerator", "(", ")", ":", "\\", "Generator", "{", "try", "{", "$", "recursiveIterator", "=", "new", "\\", "RecursiveIteratorIterator", "(", "new", "\\", "RecursiveDirectoryIterator", "(", "\\", "realpath", "(", "Abstra...
Generator that yields relative paths of all the files in the relations template path and the SplFileInfo objects Use a PHP Generator to iterate over a recursive iterator iterator and then yield: - key: string $relativePath - value: \SplFileInfo $fileInfo The `finally` step unsets the recursiveIterator once everything is done @return \Generator
[ "Generator", "that", "yields", "relative", "paths", "of", "all", "the", "files", "in", "the", "relations", "template", "path", "and", "the", "SplFileInfo", "objects" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L426-L450
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.useRelationTraitInClass
protected function useRelationTraitInClass(string $classPath, string $traitPath): void { try { $class = PhpClass::fromFile($classPath); } catch (Error $e) { throw new DoctrineStaticMetaException( 'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(), $e->getCode(), $e ); } try { $trait = PhpTrait::fromFile($traitPath); } catch (Error $e) { throw new DoctrineStaticMetaException( 'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(), $e->getCode(), $e ); } $class->addTrait($trait); $this->codeHelper->generate($class, $classPath); }
php
protected function useRelationTraitInClass(string $classPath, string $traitPath): void { try { $class = PhpClass::fromFile($classPath); } catch (Error $e) { throw new DoctrineStaticMetaException( 'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(), $e->getCode(), $e ); } try { $trait = PhpTrait::fromFile($traitPath); } catch (Error $e) { throw new DoctrineStaticMetaException( 'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(), $e->getCode(), $e ); } $class->addTrait($trait); $this->codeHelper->generate($class, $classPath); }
[ "protected", "function", "useRelationTraitInClass", "(", "string", "$", "classPath", ",", "string", "$", "traitPath", ")", ":", "void", "{", "try", "{", "$", "class", "=", "PhpClass", "::", "fromFile", "(", "$", "classPath", ")", ";", "}", "catch", "(", ...
Add the specified trait to the specified class @param string $classPath @param string $traitPath @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.StaticAccess)
[ "Add", "the", "specified", "trait", "to", "the", "specified", "class" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L478-L500
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.useRelationInterfaceInEntityInterface
protected function useRelationInterfaceInEntityInterface(string $classPath, string $interfacePath): void { $entityFqn = PhpClass::fromFile($classPath)->getQualifiedName(); $entityInterfaceFqn = $this->namespaceHelper->getEntityInterfaceFromEntityFqn($entityFqn); $entityInterfacePath = (new \ts\Reflection\ReflectionClass($entityInterfaceFqn))->getFileName(); $entityInterface = PhpInterface::fromFile($entityInterfacePath); $relationInterface = PhpInterface::fromFile($interfacePath); $entityInterface->addInterface($relationInterface); $this->codeHelper->generate($entityInterface, $entityInterfacePath); }
php
protected function useRelationInterfaceInEntityInterface(string $classPath, string $interfacePath): void { $entityFqn = PhpClass::fromFile($classPath)->getQualifiedName(); $entityInterfaceFqn = $this->namespaceHelper->getEntityInterfaceFromEntityFqn($entityFqn); $entityInterfacePath = (new \ts\Reflection\ReflectionClass($entityInterfaceFqn))->getFileName(); $entityInterface = PhpInterface::fromFile($entityInterfacePath); $relationInterface = PhpInterface::fromFile($interfacePath); $entityInterface->addInterface($relationInterface); $this->codeHelper->generate($entityInterface, $entityInterfacePath); }
[ "protected", "function", "useRelationInterfaceInEntityInterface", "(", "string", "$", "classPath", ",", "string", "$", "interfacePath", ")", ":", "void", "{", "$", "entityFqn", "=", "PhpClass", "::", "fromFile", "(", "$", "classPath", ")", "->", "getQualifiedName"...
Add the specified interface to the specified entity interface @param string $classPath @param string $interfacePath @throws \ReflectionException @SuppressWarnings(PHPMD.StaticAccess)
[ "Add", "the", "specified", "interface", "to", "the", "specified", "entity", "interface" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L511-L520
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.getInverseHasType
protected function getInverseHasType(string $hasType): string { switch ($hasType) { case self::HAS_ONE_TO_ONE: case self::HAS_REQUIRED_ONE_TO_ONE: case self::HAS_MANY_TO_MANY: case self::HAS_REQUIRED_MANY_TO_MANY: return \str_replace( self::PREFIX_OWNING, self::PREFIX_INVERSE, $hasType ); case self::HAS_INVERSE_ONE_TO_ONE: case self::HAS_REQUIRED_INVERSE_ONE_TO_ONE: case self::HAS_INVERSE_MANY_TO_MANY: case self::HAS_REQUIRED_INVERSE_MANY_TO_MANY: return \str_replace( self::PREFIX_INVERSE, self::PREFIX_OWNING, $hasType ); case self::HAS_MANY_TO_ONE: return self::HAS_ONE_TO_MANY; case self::HAS_REQUIRED_MANY_TO_ONE: return self::HAS_REQUIRED_ONE_TO_MANY; case self::HAS_ONE_TO_MANY: return self::HAS_MANY_TO_ONE; case self::HAS_REQUIRED_ONE_TO_MANY: return self::HAS_REQUIRED_MANY_TO_ONE; default: throw new DoctrineStaticMetaException( 'invalid $hasType ' . $hasType . ' when trying to get the inverted relation' ); } }
php
protected function getInverseHasType(string $hasType): string { switch ($hasType) { case self::HAS_ONE_TO_ONE: case self::HAS_REQUIRED_ONE_TO_ONE: case self::HAS_MANY_TO_MANY: case self::HAS_REQUIRED_MANY_TO_MANY: return \str_replace( self::PREFIX_OWNING, self::PREFIX_INVERSE, $hasType ); case self::HAS_INVERSE_ONE_TO_ONE: case self::HAS_REQUIRED_INVERSE_ONE_TO_ONE: case self::HAS_INVERSE_MANY_TO_MANY: case self::HAS_REQUIRED_INVERSE_MANY_TO_MANY: return \str_replace( self::PREFIX_INVERSE, self::PREFIX_OWNING, $hasType ); case self::HAS_MANY_TO_ONE: return self::HAS_ONE_TO_MANY; case self::HAS_REQUIRED_MANY_TO_ONE: return self::HAS_REQUIRED_ONE_TO_MANY; case self::HAS_ONE_TO_MANY: return self::HAS_MANY_TO_ONE; case self::HAS_REQUIRED_ONE_TO_MANY: return self::HAS_REQUIRED_MANY_TO_ONE; default: throw new DoctrineStaticMetaException( 'invalid $hasType ' . $hasType . ' when trying to get the inverted relation' ); } }
[ "protected", "function", "getInverseHasType", "(", "string", "$", "hasType", ")", ":", "string", "{", "switch", "(", "$", "hasType", ")", "{", "case", "self", "::", "HAS_ONE_TO_ONE", ":", "case", "self", "::", "HAS_REQUIRED_ONE_TO_ONE", ":", "case", "self", ...
Get the inverse of a hasType @param string $hasType @return string @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.CyclomaticComplexity)
[ "Get", "the", "inverse", "of", "a", "hasType" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L531-L571
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/RelationsGenerator.php
RelationsGenerator.updateHasTypeForPossibleRequired
private function updateHasTypeForPossibleRequired(string $relation, bool $required): string { $inverseIsRequired = \ts\stringContains($relation, self::PREFIX_REQUIRED); if (false === $required) { if (false === $inverseIsRequired) { return $relation; } return $this->removeRequiredToRelation($relation); } if (true === $required) { if (true === $inverseIsRequired) { return $relation; } return $this->addRequiredToRelation($relation); } }
php
private function updateHasTypeForPossibleRequired(string $relation, bool $required): string { $inverseIsRequired = \ts\stringContains($relation, self::PREFIX_REQUIRED); if (false === $required) { if (false === $inverseIsRequired) { return $relation; } return $this->removeRequiredToRelation($relation); } if (true === $required) { if (true === $inverseIsRequired) { return $relation; } return $this->addRequiredToRelation($relation); } }
[ "private", "function", "updateHasTypeForPossibleRequired", "(", "string", "$", "relation", ",", "bool", "$", "required", ")", ":", "string", "{", "$", "inverseIsRequired", "=", "\\", "ts", "\\", "stringContains", "(", "$", "relation", ",", "self", "::", "PREFI...
Take a relationship and a possibility of being required and ensure it is set as the correct relationship @param string $relation @param bool $required @return string
[ "Take", "a", "relationship", "and", "a", "possibility", "of", "being", "required", "and", "ensure", "it", "is", "set", "as", "the", "correct", "relationship" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/RelationsGenerator.php#L581-L598
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.setURIFactory
public function setURIFactory($factory) { $reflector = new \ReflectionClass($factory); if (!$reflector->implementsInterface('\\Erebot\\URIInterface')) { throw new \Erebot\InvalidValueException( 'The factory must implement \\Erebot\\URIInterface' ); } $this->uriFactory = $factory; }
php
public function setURIFactory($factory) { $reflector = new \ReflectionClass($factory); if (!$reflector->implementsInterface('\\Erebot\\URIInterface')) { throw new \Erebot\InvalidValueException( 'The factory must implement \\Erebot\\URIInterface' ); } $this->uriFactory = $factory; }
[ "public", "function", "setURIFactory", "(", "$", "factory", ")", "{", "$", "reflector", "=", "new", "\\", "ReflectionClass", "(", "$", "factory", ")", ";", "if", "(", "!", "$", "reflector", "->", "implementsInterface", "(", "'\\\\Erebot\\\\URIInterface'", ")",...
Sets the class to use as a factory to parse Uniform Resource Identifiers. \param string $factory Name of the class to use to parse an URI.
[ "Sets", "the", "class", "to", "use", "as", "a", "factory", "to", "parse", "Uniform", "Resource", "Identifiers", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L165-L174
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.realLoadModule
protected function realLoadModule( $module, $chan, $flags, &$plainModules, &$channelModules ) { if ($chan !== null) { if (isset($channelModules[$chan][$module])) { return $channelModules[$chan][$module]; } } elseif (isset($plainModules[$module])) { return $plainModules[$module]; } if (!class_exists($module, true)) { throw new \Erebot\InvalidValueException("No such class '$module'"); } if (!is_subclass_of($module, '\\Erebot\\Module\\Base')) { throw new \Erebot\InvalidValueException( "Invalid module! Not a subclass of \\Erebot\\Module\\Base." ); } $reflector = new \ReflectionClass($module); $instance = new $module($chan); if ($chan === null) { $plainModules[$module] = $instance; } else { $channelModules[$chan][$module] = $instance; } $instance->reloadModule($this, $flags); $logger = \Plop\Plop::getInstance(); $logger->info( $this->bot->gettext("Successfully loaded module '%(module)s' [%(source)s]"), array( 'module' => $module, 'source' => (substr($reflector->getFileName(), 0, 7) == 'phar://') ? $this->bot->gettext('PHP archive') : $this->bot->gettext('regular file'), ) ); return $instance; }
php
protected function realLoadModule( $module, $chan, $flags, &$plainModules, &$channelModules ) { if ($chan !== null) { if (isset($channelModules[$chan][$module])) { return $channelModules[$chan][$module]; } } elseif (isset($plainModules[$module])) { return $plainModules[$module]; } if (!class_exists($module, true)) { throw new \Erebot\InvalidValueException("No such class '$module'"); } if (!is_subclass_of($module, '\\Erebot\\Module\\Base')) { throw new \Erebot\InvalidValueException( "Invalid module! Not a subclass of \\Erebot\\Module\\Base." ); } $reflector = new \ReflectionClass($module); $instance = new $module($chan); if ($chan === null) { $plainModules[$module] = $instance; } else { $channelModules[$chan][$module] = $instance; } $instance->reloadModule($this, $flags); $logger = \Plop\Plop::getInstance(); $logger->info( $this->bot->gettext("Successfully loaded module '%(module)s' [%(source)s]"), array( 'module' => $module, 'source' => (substr($reflector->getFileName(), 0, 7) == 'phar://') ? $this->bot->gettext('PHP archive') : $this->bot->gettext('regular file'), ) ); return $instance; }
[ "protected", "function", "realLoadModule", "(", "$", "module", ",", "$", "chan", ",", "$", "flags", ",", "&", "$", "plainModules", ",", "&", "$", "channelModules", ")", "{", "if", "(", "$", "chan", "!==", "null", ")", "{", "if", "(", "isset", "(", ...
Load a single module for this connection. \param string $module Name of the module to load. If the module is already loaded, nothing will happen. \param string|null $chan Name of the IRC channel for which this module is being loaded. Pass \b null to load a module globally (for the whole connection) rather than for a specific IRC channel. \param opaque $flags Bitwise-OR combination of flags to pass to the module's initialization method. \param array $plainModules An associative array containing the global modules currently loaded. This array will be updated if it needs to be once the module has been successfully loaded. \param array $channelModules An associative array containing the modules currently loaded for the given IRC channel. This array will be updated if it needs to be once the module has been successfully loaded. \retval Erebot::Module::Base An instance of the module with the given name.
[ "Load", "a", "single", "module", "for", "this", "connection", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L621-L666
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.dispatchEvent
protected function dispatchEvent(\Erebot\Interfaces\Event\Base\Generic $event) { $logger = \Plop\Plop::getInstance(); $logger->debug( $this->bot->gettext('Dispatching "%(type)s" event.'), array('type' => get_class($event)) ); try { foreach ($this->events as $handler) { if ($handler->handleEvent($event) === false) { break; } } } catch (\Erebot\ErrorReportingException $e) { // This should help make the code a little more "bug-free" (TM). $logger->exception($this->bot->gettext('Code is not clean!'), $e); $this->disconnect($e->getMessage()); } }
php
protected function dispatchEvent(\Erebot\Interfaces\Event\Base\Generic $event) { $logger = \Plop\Plop::getInstance(); $logger->debug( $this->bot->gettext('Dispatching "%(type)s" event.'), array('type' => get_class($event)) ); try { foreach ($this->events as $handler) { if ($handler->handleEvent($event) === false) { break; } } } catch (\Erebot\ErrorReportingException $e) { // This should help make the code a little more "bug-free" (TM). $logger->exception($this->bot->gettext('Code is not clean!'), $e); $this->disconnect($e->getMessage()); } }
[ "protected", "function", "dispatchEvent", "(", "\\", "Erebot", "\\", "Interfaces", "\\", "Event", "\\", "Base", "\\", "Generic", "$", "event", ")", "{", "$", "logger", "=", "\\", "Plop", "\\", "Plop", "::", "getInstance", "(", ")", ";", "$", "logger", ...
Dispatches the given event to handlers which have been registered for this type of event. \param Erebot::Interfaces::Event::Base::Generic $event An event to dispatch.
[ "Dispatches", "the", "given", "event", "to", "handlers", "which", "have", "been", "registered", "for", "this", "type", "of", "event", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L755-L773
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.dispatchNumeric
protected function dispatchNumeric(\Erebot\Interfaces\Event\Numeric $numeric) { $logger = \Plop\Plop::getInstance(); $logger->debug( $this->bot->gettext('Dispatching numeric %(code)s.'), array('code' => sprintf('%03d', $numeric->getCode())) ); try { foreach ($this->numerics as $handler) { if ($handler->handleNumeric($numeric) === false) { break; } } } catch (\Erebot\ErrorReportingException $e) { // This should help make the code a little more "bug-free" (TM). $logger->exception($this->bot->gettext('Code is not clean!'), $e); $this->disconnect($e->getMessage()); } }
php
protected function dispatchNumeric(\Erebot\Interfaces\Event\Numeric $numeric) { $logger = \Plop\Plop::getInstance(); $logger->debug( $this->bot->gettext('Dispatching numeric %(code)s.'), array('code' => sprintf('%03d', $numeric->getCode())) ); try { foreach ($this->numerics as $handler) { if ($handler->handleNumeric($numeric) === false) { break; } } } catch (\Erebot\ErrorReportingException $e) { // This should help make the code a little more "bug-free" (TM). $logger->exception($this->bot->gettext('Code is not clean!'), $e); $this->disconnect($e->getMessage()); } }
[ "protected", "function", "dispatchNumeric", "(", "\\", "Erebot", "\\", "Interfaces", "\\", "Event", "\\", "Numeric", "$", "numeric", ")", "{", "$", "logger", "=", "\\", "Plop", "\\", "Plop", "::", "getInstance", "(", ")", ";", "$", "logger", "->", "debug...
Dispatches the given numeric event to handlers which have been registered for this type of numeric. \param Erebot::Interfaces::Event::Numeric $numeric A numeric message to dispatch.
[ "Dispatches", "the", "given", "numeric", "event", "to", "handlers", "which", "have", "been", "registered", "for", "this", "type", "of", "numeric", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L782-L800
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.handleCapabilities
public function handleCapabilities( \Erebot\Interfaces\EventHandler $handler, \Erebot\Event\ServerCapabilities $event ) { $module = $event->getModule(); $validMappings = array( // This is already the default value, but we still define it // in case setCollator() was called to change the default. 'rfc1459' => '\\Erebot\\IrcCollator\\RFC1459', 'strict-rfc1459' => '\\Erebot\\IrcCollator\\StrictRFC1459', 'ascii' => '\\Erebot\\IrcCollator\\ASCII', ); $caseMapping = strtolower($module->getCaseMapping()); if (in_array($caseMapping, array_keys($validMappings))) { $cls = $validMappings[$caseMapping]; $this->collator = new $cls(); } }
php
public function handleCapabilities( \Erebot\Interfaces\EventHandler $handler, \Erebot\Event\ServerCapabilities $event ) { $module = $event->getModule(); $validMappings = array( // This is already the default value, but we still define it // in case setCollator() was called to change the default. 'rfc1459' => '\\Erebot\\IrcCollator\\RFC1459', 'strict-rfc1459' => '\\Erebot\\IrcCollator\\StrictRFC1459', 'ascii' => '\\Erebot\\IrcCollator\\ASCII', ); $caseMapping = strtolower($module->getCaseMapping()); if (in_array($caseMapping, array_keys($validMappings))) { $cls = $validMappings[$caseMapping]; $this->collator = new $cls(); } }
[ "public", "function", "handleCapabilities", "(", "\\", "Erebot", "\\", "Interfaces", "\\", "EventHandler", "$", "handler", ",", "\\", "Erebot", "\\", "Event", "\\", "ServerCapabilities", "$", "event", ")", "{", "$", "module", "=", "$", "event", "->", "getMod...
Handles the "ServerCapabilities" event. \param Erebot::Interfaces::EventHandler $handler The event handler responsible for calling this method. \param Erebot::Event::ServerCapabilities $event The "ServerCapabilities" event to process.
[ "Handles", "the", "ServerCapabilities", "event", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L856-L873
train
Erebot/Erebot
src/IrcConnection.php
IrcConnection.handleConnect
public function handleConnect( \Erebot\Interfaces\EventHandler $handler, \Erebot\Interfaces\Event\Connect $event ) { $this->connected = true; }
php
public function handleConnect( \Erebot\Interfaces\EventHandler $handler, \Erebot\Interfaces\Event\Connect $event ) { $this->connected = true; }
[ "public", "function", "handleConnect", "(", "\\", "Erebot", "\\", "Interfaces", "\\", "EventHandler", "$", "handler", ",", "\\", "Erebot", "\\", "Interfaces", "\\", "Event", "\\", "Connect", "$", "event", ")", "{", "$", "this", "->", "connected", "=", "tru...
Handles the "Connect" event. \param Erebot::Interfaces::EventHandler $handler The event handler responsible for calling this method. \param Erebot::Interfaces::Event::Connect $event The "Connect" event to process.
[ "Handles", "the", "Connect", "event", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcConnection.php#L885-L890
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php
TShopCategoryTree.LoadChildTreeExecute
protected function LoadChildTreeExecute($sChildCategoryId) { $sSelect = $this->GetQuery($sChildCategoryId); $oChildCategoryList = TdbShopCategoryList::GetList($sSelect); if ($oChildCategoryList->Length() > 1) { $this->oChildCategoryTreeList = new TIterator(); } while ($oChildCategory = $oChildCategoryList->Next()) { if ($oChildCategory->id == $sChildCategoryId) { $this->oRealCategory = $oChildCategory; $this->iItemCount = 0; $this->iAllItemCount = 0; $this->id = $oChildCategory->id; } else { $oMainTree = new self(); $oMainTree->LoadChildTreeExecute($oChildCategory->id); $this->aContainingChildCategories = array_merge($this->aContainingChildCategories, $oMainTree->aContainingChildCategories); $this->iAllItemCount = $this->iAllItemCount + $oMainTree->iAllItemCount; $this->oChildCategoryTreeList->AddItem($oMainTree); $this->aContainingChildCategories[$oChildCategory->id] = $oChildCategory->GetName(); } } if (empty($this->id)) { $this->id = TTools::GetUUID(); } }
php
protected function LoadChildTreeExecute($sChildCategoryId) { $sSelect = $this->GetQuery($sChildCategoryId); $oChildCategoryList = TdbShopCategoryList::GetList($sSelect); if ($oChildCategoryList->Length() > 1) { $this->oChildCategoryTreeList = new TIterator(); } while ($oChildCategory = $oChildCategoryList->Next()) { if ($oChildCategory->id == $sChildCategoryId) { $this->oRealCategory = $oChildCategory; $this->iItemCount = 0; $this->iAllItemCount = 0; $this->id = $oChildCategory->id; } else { $oMainTree = new self(); $oMainTree->LoadChildTreeExecute($oChildCategory->id); $this->aContainingChildCategories = array_merge($this->aContainingChildCategories, $oMainTree->aContainingChildCategories); $this->iAllItemCount = $this->iAllItemCount + $oMainTree->iAllItemCount; $this->oChildCategoryTreeList->AddItem($oMainTree); $this->aContainingChildCategories[$oChildCategory->id] = $oChildCategory->GetName(); } } if (empty($this->id)) { $this->id = TTools::GetUUID(); } }
[ "protected", "function", "LoadChildTreeExecute", "(", "$", "sChildCategoryId", ")", "{", "$", "sSelect", "=", "$", "this", "->", "GetQuery", "(", "$", "sChildCategoryId", ")", ";", "$", "oChildCategoryList", "=", "TdbShopCategoryList", "::", "GetList", "(", "$",...
Loads Category tree from given master category id. @param $sChildCategoryId
[ "Loads", "Category", "tree", "from", "given", "master", "category", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L81-L106
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php
TShopCategoryTree.GetQuery
protected function GetQuery($sChildCategoryId) { $sSelect = "SELECT `shop_category`.* FROM `shop_category` WHERE `shop_category`.`shop_category_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sChildCategoryId)."' OR `shop_category`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sChildCategoryId)."' ORDER BY `shop_category`.`position`"; return $sSelect; }
php
protected function GetQuery($sChildCategoryId) { $sSelect = "SELECT `shop_category`.* FROM `shop_category` WHERE `shop_category`.`shop_category_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sChildCategoryId)."' OR `shop_category`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sChildCategoryId)."' ORDER BY `shop_category`.`position`"; return $sSelect; }
[ "protected", "function", "GetQuery", "(", "$", "sChildCategoryId", ")", "{", "$", "sSelect", "=", "\"SELECT `shop_category`.*\n FROM `shop_category`\n WHERE `shop_category`.`shop_category_id` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", ...
Returns query to get all child categories for given category id. If given category id is empty then returns query to get master categories. @param $sChildCategoryId @return string
[ "Returns", "query", "to", "get", "all", "child", "categories", "for", "given", "category", "id", ".", "If", "given", "category", "id", "is", "empty", "then", "returns", "query", "to", "get", "master", "categories", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L116-L125
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php
TShopCategoryTree.ResetCounter
public function ResetCounter() { $this->iAllItemCount = 0; $this->iItemCount = 0; if (!is_null($this->oChildCategoryTreeList)) { $this->oChildCategoryTreeList->GoToStart(); while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) { $oChildCategoryTree->ResetCounter(); } } }
php
public function ResetCounter() { $this->iAllItemCount = 0; $this->iItemCount = 0; if (!is_null($this->oChildCategoryTreeList)) { $this->oChildCategoryTreeList->GoToStart(); while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) { $oChildCategoryTree->ResetCounter(); } } }
[ "public", "function", "ResetCounter", "(", ")", "{", "$", "this", "->", "iAllItemCount", "=", "0", ";", "$", "this", "->", "iItemCount", "=", "0", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "oChildCategoryTreeList", ")", ")", "{", "$", "...
Resets all item count in all category trees.
[ "Resets", "all", "item", "count", "in", "all", "category", "trees", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L130-L140
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php
TShopCategoryTree.Render
public function Render($sListFilterItemId = false, $bHideEmptyCategories = false, $bShowArticleCount = false, $iLevelCount = 1) { $sHtml = ''; $sCategoryNameHtml = ''; if (!is_null($this->oRealCategory)) { $sCategoryNameHtml = $this->RenderCategoryName($sListFilterItemId, $bShowArticleCount, $iLevelCount); } $sChildCategoriesHtml = $this->RenderChildCategories($sListFilterItemId, $bHideEmptyCategories, $bShowArticleCount, $iLevelCount + 1); if (empty($sChildCategoriesHtml) && 0 == $this->iAllItemCount && $bHideEmptyCategories) { $sHtml = ''; } else { if (!is_null($this->oRealCategory)) { $aClass = array('CategoryLevel_'.$iLevelCount); if (!empty($sChildCategoriesHtml)) { $aClass[] = 'hasChildren'; } else { $aClass[] = 'isLeaflet'; } if ($this->bIsActive) { $aClass[] = 'active expanded'; } $sHtml .= '<ul>'; $sHtml .= '<li class="'.implode(' ', $aClass).'">'.$sCategoryNameHtml; } $sHtml .= $sChildCategoriesHtml; if (!is_null($this->oRealCategory)) { $sHtml .= '</li>'; $sHtml .= '</ul>'; } } return $sHtml; }
php
public function Render($sListFilterItemId = false, $bHideEmptyCategories = false, $bShowArticleCount = false, $iLevelCount = 1) { $sHtml = ''; $sCategoryNameHtml = ''; if (!is_null($this->oRealCategory)) { $sCategoryNameHtml = $this->RenderCategoryName($sListFilterItemId, $bShowArticleCount, $iLevelCount); } $sChildCategoriesHtml = $this->RenderChildCategories($sListFilterItemId, $bHideEmptyCategories, $bShowArticleCount, $iLevelCount + 1); if (empty($sChildCategoriesHtml) && 0 == $this->iAllItemCount && $bHideEmptyCategories) { $sHtml = ''; } else { if (!is_null($this->oRealCategory)) { $aClass = array('CategoryLevel_'.$iLevelCount); if (!empty($sChildCategoriesHtml)) { $aClass[] = 'hasChildren'; } else { $aClass[] = 'isLeaflet'; } if ($this->bIsActive) { $aClass[] = 'active expanded'; } $sHtml .= '<ul>'; $sHtml .= '<li class="'.implode(' ', $aClass).'">'.$sCategoryNameHtml; } $sHtml .= $sChildCategoriesHtml; if (!is_null($this->oRealCategory)) { $sHtml .= '</li>'; $sHtml .= '</ul>'; } } return $sHtml; }
[ "public", "function", "Render", "(", "$", "sListFilterItemId", "=", "false", ",", "$", "bHideEmptyCategories", "=", "false", ",", "$", "bShowArticleCount", "=", "false", ",", "$", "iLevelCount", "=", "1", ")", "{", "$", "sHtml", "=", "''", ";", "$", "sCa...
Renders the category tree. Function not uses external views. Html was rendered in class for better performance. If you want to change something on the html overwrite one of the render functions. @param bool $sListFilterItemId @param bool $bHideEmptyCategories @param bool $bShowArticleCount @param int $iLevelCount @return string
[ "Renders", "the", "category", "tree", ".", "Function", "not", "uses", "external", "views", ".", "Html", "was", "rendered", "in", "class", "for", "better", "performance", ".", "If", "you", "want", "to", "change", "something", "on", "the", "html", "overwrite",...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L154-L186
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php
TShopCategoryTree.RenderChildCategories
public function RenderChildCategories($sListFilterItemId = false, $bHideEmptyCategories = false, $bShowArticleCount = false, $iLevelCount = 1) { $sHtml = ''; if (!is_null($this->oChildCategoryTreeList)) { $this->oChildCategoryTreeList->GoToStart(); while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) { $sHtml .= $oChildCategoryTree->Render($sListFilterItemId, $bHideEmptyCategories, $bShowArticleCount, $iLevelCount); } } return $sHtml; }
php
public function RenderChildCategories($sListFilterItemId = false, $bHideEmptyCategories = false, $bShowArticleCount = false, $iLevelCount = 1) { $sHtml = ''; if (!is_null($this->oChildCategoryTreeList)) { $this->oChildCategoryTreeList->GoToStart(); while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) { $sHtml .= $oChildCategoryTree->Render($sListFilterItemId, $bHideEmptyCategories, $bShowArticleCount, $iLevelCount); } } return $sHtml; }
[ "public", "function", "RenderChildCategories", "(", "$", "sListFilterItemId", "=", "false", ",", "$", "bHideEmptyCategories", "=", "false", ",", "$", "bShowArticleCount", "=", "false", ",", "$", "iLevelCount", "=", "1", ")", "{", "$", "sHtml", "=", "''", ";"...
Renders list of child categories recursively. @param bool $sListFilterItemId @param bool $bHideEmptyCategories @param bool $bShowArticleCount @param int $iLevelCount @return string
[ "Renders", "list", "of", "child", "categories", "recursively", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L198-L209
train