id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,200 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketVoucherCoreList.class.php | TShopBasketVoucherCoreList.RemoveInvalidVouchers | public function RemoveInvalidVouchers($sMessangerName, $oBasket = null)
{
// since the min value of the basket for which a voucher may work is affected by other vouchers,
// we need to remove the vouchers first, and then add them one by one back to the basket
// we suppress the add messages, but keep the negative messages
if (is_null($oBasket)) {
$oBasket = TShopBasket::GetInstance();
}
$oMessageManager = TCMSMessageManager::GetInstance();
// get copy of vouchers
$aVoucherList = $this->_items;
$this->Destroy();
$bInvalidVouchersFound = false;
foreach ($aVoucherList as $iVoucherKey => $oVoucher) {
/** @var $oVoucher TdbShopVoucher */
$cVoucherAllowUseCode = $oVoucher->AllowUseOfVoucher();
if (TdbShopVoucher::ALLOW_USE == $cVoucherAllowUseCode) {
$this->AddItem($oVoucher);
} else {
$bInvalidVouchersFound = true;
$this->RemoveInvalidVoucherHook($oVoucher, $oBasket);
// send message that the voucher was removed
$aMessageData = $oVoucher->GetObjectPropertiesAsArray();
$aMessageData['iRemoveReasoneCode'] = $cVoucherAllowUseCode;
$oMessageManager->AddMessage($sMessangerName, 'VOUCHER-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData);
}
}
if ($bInvalidVouchersFound) {
// recalculate the basket
$oBasket->RecalculateBasket();
}
} | php | public function RemoveInvalidVouchers($sMessangerName, $oBasket = null)
{
// since the min value of the basket for which a voucher may work is affected by other vouchers,
// we need to remove the vouchers first, and then add them one by one back to the basket
// we suppress the add messages, but keep the negative messages
if (is_null($oBasket)) {
$oBasket = TShopBasket::GetInstance();
}
$oMessageManager = TCMSMessageManager::GetInstance();
// get copy of vouchers
$aVoucherList = $this->_items;
$this->Destroy();
$bInvalidVouchersFound = false;
foreach ($aVoucherList as $iVoucherKey => $oVoucher) {
/** @var $oVoucher TdbShopVoucher */
$cVoucherAllowUseCode = $oVoucher->AllowUseOfVoucher();
if (TdbShopVoucher::ALLOW_USE == $cVoucherAllowUseCode) {
$this->AddItem($oVoucher);
} else {
$bInvalidVouchersFound = true;
$this->RemoveInvalidVoucherHook($oVoucher, $oBasket);
// send message that the voucher was removed
$aMessageData = $oVoucher->GetObjectPropertiesAsArray();
$aMessageData['iRemoveReasoneCode'] = $cVoucherAllowUseCode;
$oMessageManager->AddMessage($sMessangerName, 'VOUCHER-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData);
}
}
if ($bInvalidVouchersFound) {
// recalculate the basket
$oBasket->RecalculateBasket();
}
} | [
"public",
"function",
"RemoveInvalidVouchers",
"(",
"$",
"sMessangerName",
",",
"$",
"oBasket",
"=",
"null",
")",
"{",
"// since the min value of the basket for which a voucher may work is affected by other vouchers,",
"// we need to remove the vouchers first, and then add them one by one back to the basket",
"// we suppress the add messages, but keep the negative messages",
"if",
"(",
"is_null",
"(",
"$",
"oBasket",
")",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"}",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"// get copy of vouchers",
"$",
"aVoucherList",
"=",
"$",
"this",
"->",
"_items",
";",
"$",
"this",
"->",
"Destroy",
"(",
")",
";",
"$",
"bInvalidVouchersFound",
"=",
"false",
";",
"foreach",
"(",
"$",
"aVoucherList",
"as",
"$",
"iVoucherKey",
"=>",
"$",
"oVoucher",
")",
"{",
"/** @var $oVoucher TdbShopVoucher */",
"$",
"cVoucherAllowUseCode",
"=",
"$",
"oVoucher",
"->",
"AllowUseOfVoucher",
"(",
")",
";",
"if",
"(",
"TdbShopVoucher",
"::",
"ALLOW_USE",
"==",
"$",
"cVoucherAllowUseCode",
")",
"{",
"$",
"this",
"->",
"AddItem",
"(",
"$",
"oVoucher",
")",
";",
"}",
"else",
"{",
"$",
"bInvalidVouchersFound",
"=",
"true",
";",
"$",
"this",
"->",
"RemoveInvalidVoucherHook",
"(",
"$",
"oVoucher",
",",
"$",
"oBasket",
")",
";",
"// send message that the voucher was removed",
"$",
"aMessageData",
"=",
"$",
"oVoucher",
"->",
"GetObjectPropertiesAsArray",
"(",
")",
";",
"$",
"aMessageData",
"[",
"'iRemoveReasoneCode'",
"]",
"=",
"$",
"cVoucherAllowUseCode",
";",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sMessangerName",
",",
"'VOUCHER-ERROR-NO-LONGER-VALID-FOR-BASKET'",
",",
"$",
"aMessageData",
")",
";",
"}",
"}",
"if",
"(",
"$",
"bInvalidVouchersFound",
")",
"{",
"// recalculate the basket",
"$",
"oBasket",
"->",
"RecalculateBasket",
"(",
")",
";",
"}",
"}"
] | Removes all vouchers from the basket, that are not valid based on the contents of the basket and the current user
Returns the number of vouchers removed.
@param string $sMessangerName
@param TShopBasket $oBasket
@return int | [
"Removes",
"all",
"vouchers",
"from",
"the",
"basket",
"that",
"are",
"not",
"valid",
"based",
"on",
"the",
"contents",
"of",
"the",
"basket",
"and",
"the",
"current",
"user",
"Returns",
"the",
"number",
"of",
"vouchers",
"removed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketVoucherCoreList.class.php#L97-L131 |
32,201 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketVoucherCoreList.class.php | TShopBasketVoucherCoreList.HasFreeShippingVoucher | public function HasFreeShippingVoucher()
{
$bHasFreeShipping = false;
$tmpCurrentPointer = $this->getItemPointer();
$this->GoToStart();
while (!$bHasFreeShipping && ($oItem = &$this->Next())) {
$oVoucherSeries = &$oItem->GetFieldShopVoucherSeries();
if ($oVoucherSeries->fieldFreeShipping) {
$bHasFreeShipping = true;
}
}
$this->setItemPointer($tmpCurrentPointer);
return $bHasFreeShipping;
} | php | public function HasFreeShippingVoucher()
{
$bHasFreeShipping = false;
$tmpCurrentPointer = $this->getItemPointer();
$this->GoToStart();
while (!$bHasFreeShipping && ($oItem = &$this->Next())) {
$oVoucherSeries = &$oItem->GetFieldShopVoucherSeries();
if ($oVoucherSeries->fieldFreeShipping) {
$bHasFreeShipping = true;
}
}
$this->setItemPointer($tmpCurrentPointer);
return $bHasFreeShipping;
} | [
"public",
"function",
"HasFreeShippingVoucher",
"(",
")",
"{",
"$",
"bHasFreeShipping",
"=",
"false",
";",
"$",
"tmpCurrentPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"!",
"$",
"bHasFreeShipping",
"&&",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
")",
"{",
"$",
"oVoucherSeries",
"=",
"&",
"$",
"oItem",
"->",
"GetFieldShopVoucherSeries",
"(",
")",
";",
"if",
"(",
"$",
"oVoucherSeries",
"->",
"fieldFreeShipping",
")",
"{",
"$",
"bHasFreeShipping",
"=",
"true",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"tmpCurrentPointer",
")",
";",
"return",
"$",
"bHasFreeShipping",
";",
"}"
] | returns true if at least one voucher has free shipping.
@return bool | [
"returns",
"true",
"if",
"at",
"least",
"one",
"voucher",
"has",
"free",
"shipping",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketVoucherCoreList.class.php#L149-L164 |
32,202 | chameleon-system/chameleon-shop | src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/db/TPkgExtranetRegistrationGuest_TDataExtranetUser.class.php | TPkgExtranetRegistrationGuest_TDataExtranetUser.RegistrationGuestIsAllowed | public function RegistrationGuestIsAllowed($oLastBoughtUser)
{
$bRegistrationGuestIsAllowed = false;
if (!is_null($oLastBoughtUser) && !$this->IsLoggedIn() && !$oLastBoughtUser->LoginExists()) {
$bRegistrationGuestIsAllowed = true;
}
return $bRegistrationGuestIsAllowed;
} | php | public function RegistrationGuestIsAllowed($oLastBoughtUser)
{
$bRegistrationGuestIsAllowed = false;
if (!is_null($oLastBoughtUser) && !$this->IsLoggedIn() && !$oLastBoughtUser->LoginExists()) {
$bRegistrationGuestIsAllowed = true;
}
return $bRegistrationGuestIsAllowed;
} | [
"public",
"function",
"RegistrationGuestIsAllowed",
"(",
"$",
"oLastBoughtUser",
")",
"{",
"$",
"bRegistrationGuestIsAllowed",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oLastBoughtUser",
")",
"&&",
"!",
"$",
"this",
"->",
"IsLoggedIn",
"(",
")",
"&&",
"!",
"$",
"oLastBoughtUser",
"->",
"LoginExists",
"(",
")",
")",
"{",
"$",
"bRegistrationGuestIsAllowed",
"=",
"true",
";",
"}",
"return",
"$",
"bRegistrationGuestIsAllowed",
";",
"}"
] | Checks if active user and given last bought user.
@param TdbDataExtranetUser $oLastBoughtUser
@return bool | [
"Checks",
"if",
"active",
"user",
"and",
"given",
"last",
"bought",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/db/TPkgExtranetRegistrationGuest_TDataExtranetUser.class.php#L23-L31 |
32,203 | chameleon-system/chameleon-shop | src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/db/TPkgExtranetRegistrationGuest_TDataExtranetUser.class.php | TPkgExtranetRegistrationGuest_TDataExtranetUser.GetLinkForRegistrationGuest | public function GetLinkForRegistrationGuest()
{
$oURLData = &TCMSSmartURLData::GetActive();
$oShop = &TdbShop::GetInstance($oURLData->iPortalId);
$sRegisterPath = $oShop->GetLinkToSystemPage(self::NAME_SYSTEM_PAGE);
return $sRegisterPath;
} | php | public function GetLinkForRegistrationGuest()
{
$oURLData = &TCMSSmartURLData::GetActive();
$oShop = &TdbShop::GetInstance($oURLData->iPortalId);
$sRegisterPath = $oShop->GetLinkToSystemPage(self::NAME_SYSTEM_PAGE);
return $sRegisterPath;
} | [
"public",
"function",
"GetLinkForRegistrationGuest",
"(",
")",
"{",
"$",
"oURLData",
"=",
"&",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
";",
"$",
"oShop",
"=",
"&",
"TdbShop",
"::",
"GetInstance",
"(",
"$",
"oURLData",
"->",
"iPortalId",
")",
";",
"$",
"sRegisterPath",
"=",
"$",
"oShop",
"->",
"GetLinkToSystemPage",
"(",
"self",
"::",
"NAME_SYSTEM_PAGE",
")",
";",
"return",
"$",
"sRegisterPath",
";",
"}"
] | Returns the link to registration guest page.
@return string | [
"Returns",
"the",
"link",
"to",
"registration",
"guest",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/db/TPkgExtranetRegistrationGuest_TDataExtranetUser.class.php#L38-L45 |
32,204 | edmondscommerce/doctrine-static-meta | src/Entity/Validation/EntityDataValidator.php | EntityDataValidator.getErrorsAsString | public function getErrorsAsString(): string
{
$errors = $this->getErrors();
if (0 === $errors->count()) {
return '';
}
$message = 'found ' . $errors->count() . ' errors validating '
. \get_class($this->dataObject);
foreach ($errors as $error) {
$message .= "\n\n" . $error->getPropertyPath() . ': ' . $error->getMessage();
}
return $message;
} | php | public function getErrorsAsString(): string
{
$errors = $this->getErrors();
if (0 === $errors->count()) {
return '';
}
$message = 'found ' . $errors->count() . ' errors validating '
. \get_class($this->dataObject);
foreach ($errors as $error) {
$message .= "\n\n" . $error->getPropertyPath() . ': ' . $error->getMessage();
}
return $message;
} | [
"public",
"function",
"getErrorsAsString",
"(",
")",
":",
"string",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"getErrors",
"(",
")",
";",
"if",
"(",
"0",
"===",
"$",
"errors",
"->",
"count",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"message",
"=",
"'found '",
".",
"$",
"errors",
"->",
"count",
"(",
")",
".",
"' errors validating '",
".",
"\\",
"get_class",
"(",
"$",
"this",
"->",
"dataObject",
")",
";",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"error",
")",
"{",
"$",
"message",
".=",
"\"\\n\\n\"",
".",
"$",
"error",
"->",
"getPropertyPath",
"(",
")",
".",
"': '",
".",
"$",
"error",
"->",
"getMessage",
"(",
")",
";",
"}",
"return",
"$",
"message",
";",
"}"
] | Perform validation and then return a message that details the number and the details of the errors
Will return an empty string if there are no errors
@return string | [
"Perform",
"validation",
"and",
"then",
"return",
"a",
"message",
"that",
"details",
"the",
"number",
"and",
"the",
"details",
"of",
"the",
"errors"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Validation/EntityDataValidator.php#L85-L98 |
32,205 | edmondscommerce/doctrine-static-meta | src/Entity/Validation/EntityDataValidator.php | EntityDataValidator.validateProperty | public function validateProperty(string $propertyName): void
{
$errors = $this->validator->validateProperty($this->dataObject, $propertyName);
$this->throwExceptionIfErrors($errors);
} | php | public function validateProperty(string $propertyName): void
{
$errors = $this->validator->validateProperty($this->dataObject, $propertyName);
$this->throwExceptionIfErrors($errors);
} | [
"public",
"function",
"validateProperty",
"(",
"string",
"$",
"propertyName",
")",
":",
"void",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"validator",
"->",
"validateProperty",
"(",
"$",
"this",
"->",
"dataObject",
",",
"$",
"propertyName",
")",
";",
"$",
"this",
"->",
"throwExceptionIfErrors",
"(",
"$",
"errors",
")",
";",
"}"
] | Validate a single entity property
@param string $propertyName
@throws ValidationException | [
"Validate",
"a",
"single",
"entity",
"property"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Validation/EntityDataValidator.php#L132-L136 |
32,206 | chameleon-system/chameleon-shop | src/ShopAffiliateBundle/objects/db/TPkgShopAffiliate.class.php | TPkgShopAffiliate.GetInstance | public static function GetInstance($sId)
{
$oElement = TdbPkgShopAffiliate::GetNewInstance();
$oElement->Load($sId);
if (!empty($oElement->sqlData['class'])) {
$sClassName = $oElement->sqlData['class'];
$oElementNew = new $sClassName();
$oElementNew->LoadFromRow($oElement->sqlData);
$oElement = $oElementNew;
}
return $oElement;
} | php | public static function GetInstance($sId)
{
$oElement = TdbPkgShopAffiliate::GetNewInstance();
$oElement->Load($sId);
if (!empty($oElement->sqlData['class'])) {
$sClassName = $oElement->sqlData['class'];
$oElementNew = new $sClassName();
$oElementNew->LoadFromRow($oElement->sqlData);
$oElement = $oElementNew;
}
return $oElement;
} | [
"public",
"static",
"function",
"GetInstance",
"(",
"$",
"sId",
")",
"{",
"$",
"oElement",
"=",
"TdbPkgShopAffiliate",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oElement",
"->",
"Load",
"(",
"$",
"sId",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"oElement",
"->",
"sqlData",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"sClassName",
"=",
"$",
"oElement",
"->",
"sqlData",
"[",
"'class'",
"]",
";",
"$",
"oElementNew",
"=",
"new",
"$",
"sClassName",
"(",
")",
";",
"$",
"oElementNew",
"->",
"LoadFromRow",
"(",
"$",
"oElement",
"->",
"sqlData",
")",
";",
"$",
"oElement",
"=",
"$",
"oElementNew",
";",
"}",
"return",
"$",
"oElement",
";",
"}"
] | return instance of class (casted as correct type.
@param string $sId
@return TdbPkgShopAffiliate | [
"return",
"instance",
"of",
"class",
"(",
"casted",
"as",
"correct",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopAffiliateBundle/objects/db/TPkgShopAffiliate.class.php#L28-L40 |
32,207 | chameleon-system/chameleon-shop | src/ShopAffiliateBundle/objects/db/TPkgShopAffiliate.class.php | TPkgShopAffiliate.RenderOrderSuccessHTMLCode | public static function RenderOrderSuccessHTMLCode()
{
$sHTML = '';
$oUserOrder = &TShopBasket::GetLastCreatedOrder();
$oProgram = TdbPkgShopAffiliate::GetActiveInstance();
if ($oUserOrder && $oProgram) {
$sHTML = $oProgram->RenderHTMLCode($oUserOrder);
}
return $sHTML;
} | php | public static function RenderOrderSuccessHTMLCode()
{
$sHTML = '';
$oUserOrder = &TShopBasket::GetLastCreatedOrder();
$oProgram = TdbPkgShopAffiliate::GetActiveInstance();
if ($oUserOrder && $oProgram) {
$sHTML = $oProgram->RenderHTMLCode($oUserOrder);
}
return $sHTML;
} | [
"public",
"static",
"function",
"RenderOrderSuccessHTMLCode",
"(",
")",
"{",
"$",
"sHTML",
"=",
"''",
";",
"$",
"oUserOrder",
"=",
"&",
"TShopBasket",
"::",
"GetLastCreatedOrder",
"(",
")",
";",
"$",
"oProgram",
"=",
"TdbPkgShopAffiliate",
"::",
"GetActiveInstance",
"(",
")",
";",
"if",
"(",
"$",
"oUserOrder",
"&&",
"$",
"oProgram",
")",
"{",
"$",
"sHTML",
"=",
"$",
"oProgram",
"->",
"RenderHTMLCode",
"(",
"$",
"oUserOrder",
")",
";",
"}",
"return",
"$",
"sHTML",
";",
"}"
] | call this method in the order success view to generate the success html for the partner program.
@return string | [
"call",
"this",
"method",
"in",
"the",
"order",
"success",
"view",
"to",
"generate",
"the",
"success",
"html",
"for",
"the",
"partner",
"program",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopAffiliateBundle/objects/db/TPkgShopAffiliate.class.php#L203-L213 |
32,208 | chameleon-system/chameleon-shop | src/ShopBundle/mappers/WizardStep/TCMSWizardStepMapper_UserProfile.class.php | TCMSWizardStepMapper_UserProfile.GetMessageForField | protected function GetMessageForField($sFieldName, $aFieldMessages)
{
$sMessage = '';
if (is_array($aFieldMessages) && isset($aFieldMessages[$sFieldName])) {
$sMessage = $aFieldMessages[$sFieldName];
}
return $sMessage;
} | php | protected function GetMessageForField($sFieldName, $aFieldMessages)
{
$sMessage = '';
if (is_array($aFieldMessages) && isset($aFieldMessages[$sFieldName])) {
$sMessage = $aFieldMessages[$sFieldName];
}
return $sMessage;
} | [
"protected",
"function",
"GetMessageForField",
"(",
"$",
"sFieldName",
",",
"$",
"aFieldMessages",
")",
"{",
"$",
"sMessage",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"aFieldMessages",
")",
"&&",
"isset",
"(",
"$",
"aFieldMessages",
"[",
"$",
"sFieldName",
"]",
")",
")",
"{",
"$",
"sMessage",
"=",
"$",
"aFieldMessages",
"[",
"$",
"sFieldName",
"]",
";",
"}",
"return",
"$",
"sMessage",
";",
"}"
] | Get field message for given field in given array.
@param string $sFieldName
@param array $aFieldMessages
@return string | [
"Get",
"field",
"message",
"for",
"given",
"field",
"in",
"given",
"array",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/WizardStep/TCMSWizardStepMapper_UserProfile.class.php#L52-L60 |
32,209 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticlelistOrderby.class.php | TShopModuleArticlelistOrderby.GetOrderByString | public function GetOrderByString($sDirection = null)
{
if (is_null($sDirection)) {
$sDirection = $this->fieldOrderDirection;
}
$sOrderBy = '';
if (!empty($this->fieldSqlOrderBy)) {
$sOrderBy = $this->fieldSqlOrderBy.' '.$sDirection;
}
if (!empty($this->fieldSqlSecondaryOrderByString)) {
$sOrderBy .= ', '.$this->fieldSqlSecondaryOrderByString;
}
return $sOrderBy;
} | php | public function GetOrderByString($sDirection = null)
{
if (is_null($sDirection)) {
$sDirection = $this->fieldOrderDirection;
}
$sOrderBy = '';
if (!empty($this->fieldSqlOrderBy)) {
$sOrderBy = $this->fieldSqlOrderBy.' '.$sDirection;
}
if (!empty($this->fieldSqlSecondaryOrderByString)) {
$sOrderBy .= ', '.$this->fieldSqlSecondaryOrderByString;
}
return $sOrderBy;
} | [
"public",
"function",
"GetOrderByString",
"(",
"$",
"sDirection",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sDirection",
")",
")",
"{",
"$",
"sDirection",
"=",
"$",
"this",
"->",
"fieldOrderDirection",
";",
"}",
"$",
"sOrderBy",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldSqlOrderBy",
")",
")",
"{",
"$",
"sOrderBy",
"=",
"$",
"this",
"->",
"fieldSqlOrderBy",
".",
"' '",
".",
"$",
"sDirection",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldSqlSecondaryOrderByString",
")",
")",
"{",
"$",
"sOrderBy",
".=",
"', '",
".",
"$",
"this",
"->",
"fieldSqlSecondaryOrderByString",
";",
"}",
"return",
"$",
"sOrderBy",
";",
"}"
] | return order by string.
@param string $sDirection - ASC or DESC. if set to NULL the value set in the class will be used
@return string | [
"return",
"order",
"by",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticlelistOrderby.class.php#L21-L36 |
32,210 | Erebot/Erebot | src/Event/Match/Type.php | Type.setType | public function setType($types)
{
if (!is_array($types)) {
$types = array($types);
}
$finalTypes = array();
foreach ($types as $type) {
if (is_object($type)) {
$type = get_class($type);
}
if (!is_string($type)) {
throw new \Erebot\InvalidValueException('Not a valid type');
}
$finalTypes[] = $type;
}
$this->type = $finalTypes;
} | php | public function setType($types)
{
if (!is_array($types)) {
$types = array($types);
}
$finalTypes = array();
foreach ($types as $type) {
if (is_object($type)) {
$type = get_class($type);
}
if (!is_string($type)) {
throw new \Erebot\InvalidValueException('Not a valid type');
}
$finalTypes[] = $type;
}
$this->type = $finalTypes;
} | [
"public",
"function",
"setType",
"(",
"$",
"types",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"types",
")",
")",
"{",
"$",
"types",
"=",
"array",
"(",
"$",
"types",
")",
";",
"}",
"$",
"finalTypes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"types",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",
"get_class",
"(",
"$",
"type",
")",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"\\",
"Erebot",
"\\",
"InvalidValueException",
"(",
"'Not a valid type'",
")",
";",
"}",
"$",
"finalTypes",
"[",
"]",
"=",
"$",
"type",
";",
"}",
"$",
"this",
"->",
"type",
"=",
"$",
"finalTypes",
";",
"}"
] | Sets the type used in comparisons.
\param $types string|object|array
Type(s) to match incoming events against,
either as a string or as an instance
of the type of match against.
An array of strings/objects may also be passed;
The filter will match if the incoming event
is of any of the types given.
\throw Erebot::InvalidValueException
The given type is invalid. | [
"Sets",
"the",
"type",
"used",
"in",
"comparisons",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Event/Match/Type.php#L68-L87 |
32,211 | chameleon-system/chameleon-shop | src/ShopBundle/mappers/article/TPkgShopMapper_ArticleTeaserBase.class.php | TPkgShopMapper_ArticleTeaserBase.GetVariantInfo | protected function GetVariantInfo($oArticle, $aData, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aColors = array();
$aVariantTypeList = array();
if ($oArticle->HasVariants()) {
$oVariantSet = $oArticle->GetFieldShopVariantSet();
if ($oVariantSet && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oVariantSet->table, $oVariantSet->id);
}
$oVariantTypes = $oVariantSet->GetFieldShopVariantTypeList();
$bLoadInactiveItems = false;
$oShop = TShop::GetInstance();
if (property_exists($oShop, 'fieldLoadInactiveVariants') && $oShop->fieldLoadInactiveVariants) {
$bLoadInactiveItems = true;
}
while ($oVariantType = $oVariantTypes->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oVariantType->table, $oVariantType->id);
}
if ($bLoadInactiveItems) {
$oAvailableValues = $oArticle->GetVariantValuesAvailableForTypeIncludingInActive($oVariantType);
} else {
$oAvailableValues = $oArticle->GetVariantValuesAvailableForType($oVariantType);
}
if (!$oAvailableValues) {
continue;
}
if ('color' == $oVariantType->fieldIdentifier) {
while ($oValue = $oAvailableValues->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oValue->table, $oValue->id);
}
$aColors[] = array(
'sLink' => $oValue->fieldUrlName,
'sHex' => '#'.$oValue->fieldColorCode,
'cms_media_id' => $oValue->fieldCmsMediaId,
);
}
} else {
$aType = array(
'sTitle' => $oVariantType->fieldName,
'sSystemName' => $oVariantType->fieldIdentifier,
'cms_media_id' => $oVariantType->fieldCmsMediaId,
'aItems' => array(),
'bAllowSelection' => true,
);
$aItems = array();
while ($oValue = $oAvailableValues->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oValue->table, $oValue->id);
}
$aItem = array(
'sTitle' => $oValue->fieldName,
'sColor' => $oValue->fieldColorCode,
'cms_media_id' => $oValue->fieldCmsMediaId,
'bIsActive' => false, // currently selected article variant (shows activate state)
'bArticleIsActive' => '1',
'sSelectLink' => '',
);
if ($bLoadInactiveItems) {
if (isset($oValue->sqlData['articleactive']) && $oValue->sqlData['articleactive'] > 0) {
$aItem['bArticleIsActive'] = '1'; // if 0 the variant is not active and the variant values should be rendered as non-available
} else {
$aItem['bArticleIsActive'] = '0';
}
}
$aItems[] = $aItem;
}
$aType['aItems'] = $aItems;
$aVariantTypeList[] = $aType;
}
}
}
$aData['aColors'] = $aColors;
$aData['aVariantTypes'] = $aVariantTypeList;
return $aData;
} | php | protected function GetVariantInfo($oArticle, $aData, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aColors = array();
$aVariantTypeList = array();
if ($oArticle->HasVariants()) {
$oVariantSet = $oArticle->GetFieldShopVariantSet();
if ($oVariantSet && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oVariantSet->table, $oVariantSet->id);
}
$oVariantTypes = $oVariantSet->GetFieldShopVariantTypeList();
$bLoadInactiveItems = false;
$oShop = TShop::GetInstance();
if (property_exists($oShop, 'fieldLoadInactiveVariants') && $oShop->fieldLoadInactiveVariants) {
$bLoadInactiveItems = true;
}
while ($oVariantType = $oVariantTypes->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oVariantType->table, $oVariantType->id);
}
if ($bLoadInactiveItems) {
$oAvailableValues = $oArticle->GetVariantValuesAvailableForTypeIncludingInActive($oVariantType);
} else {
$oAvailableValues = $oArticle->GetVariantValuesAvailableForType($oVariantType);
}
if (!$oAvailableValues) {
continue;
}
if ('color' == $oVariantType->fieldIdentifier) {
while ($oValue = $oAvailableValues->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oValue->table, $oValue->id);
}
$aColors[] = array(
'sLink' => $oValue->fieldUrlName,
'sHex' => '#'.$oValue->fieldColorCode,
'cms_media_id' => $oValue->fieldCmsMediaId,
);
}
} else {
$aType = array(
'sTitle' => $oVariantType->fieldName,
'sSystemName' => $oVariantType->fieldIdentifier,
'cms_media_id' => $oVariantType->fieldCmsMediaId,
'aItems' => array(),
'bAllowSelection' => true,
);
$aItems = array();
while ($oValue = $oAvailableValues->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oValue->table, $oValue->id);
}
$aItem = array(
'sTitle' => $oValue->fieldName,
'sColor' => $oValue->fieldColorCode,
'cms_media_id' => $oValue->fieldCmsMediaId,
'bIsActive' => false, // currently selected article variant (shows activate state)
'bArticleIsActive' => '1',
'sSelectLink' => '',
);
if ($bLoadInactiveItems) {
if (isset($oValue->sqlData['articleactive']) && $oValue->sqlData['articleactive'] > 0) {
$aItem['bArticleIsActive'] = '1'; // if 0 the variant is not active and the variant values should be rendered as non-available
} else {
$aItem['bArticleIsActive'] = '0';
}
}
$aItems[] = $aItem;
}
$aType['aItems'] = $aItems;
$aVariantTypeList[] = $aType;
}
}
}
$aData['aColors'] = $aColors;
$aData['aVariantTypes'] = $aVariantTypeList;
return $aData;
} | [
"protected",
"function",
"GetVariantInfo",
"(",
"$",
"oArticle",
",",
"$",
"aData",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
",",
"$",
"bCachingEnabled",
")",
"{",
"$",
"aColors",
"=",
"array",
"(",
")",
";",
"$",
"aVariantTypeList",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"oArticle",
"->",
"HasVariants",
"(",
")",
")",
"{",
"$",
"oVariantSet",
"=",
"$",
"oArticle",
"->",
"GetFieldShopVariantSet",
"(",
")",
";",
"if",
"(",
"$",
"oVariantSet",
"&&",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oVariantSet",
"->",
"table",
",",
"$",
"oVariantSet",
"->",
"id",
")",
";",
"}",
"$",
"oVariantTypes",
"=",
"$",
"oVariantSet",
"->",
"GetFieldShopVariantTypeList",
"(",
")",
";",
"$",
"bLoadInactiveItems",
"=",
"false",
";",
"$",
"oShop",
"=",
"TShop",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"oShop",
",",
"'fieldLoadInactiveVariants'",
")",
"&&",
"$",
"oShop",
"->",
"fieldLoadInactiveVariants",
")",
"{",
"$",
"bLoadInactiveItems",
"=",
"true",
";",
"}",
"while",
"(",
"$",
"oVariantType",
"=",
"$",
"oVariantTypes",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oVariantType",
"->",
"table",
",",
"$",
"oVariantType",
"->",
"id",
")",
";",
"}",
"if",
"(",
"$",
"bLoadInactiveItems",
")",
"{",
"$",
"oAvailableValues",
"=",
"$",
"oArticle",
"->",
"GetVariantValuesAvailableForTypeIncludingInActive",
"(",
"$",
"oVariantType",
")",
";",
"}",
"else",
"{",
"$",
"oAvailableValues",
"=",
"$",
"oArticle",
"->",
"GetVariantValuesAvailableForType",
"(",
"$",
"oVariantType",
")",
";",
"}",
"if",
"(",
"!",
"$",
"oAvailableValues",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"'color'",
"==",
"$",
"oVariantType",
"->",
"fieldIdentifier",
")",
"{",
"while",
"(",
"$",
"oValue",
"=",
"$",
"oAvailableValues",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oValue",
"->",
"table",
",",
"$",
"oValue",
"->",
"id",
")",
";",
"}",
"$",
"aColors",
"[",
"]",
"=",
"array",
"(",
"'sLink'",
"=>",
"$",
"oValue",
"->",
"fieldUrlName",
",",
"'sHex'",
"=>",
"'#'",
".",
"$",
"oValue",
"->",
"fieldColorCode",
",",
"'cms_media_id'",
"=>",
"$",
"oValue",
"->",
"fieldCmsMediaId",
",",
")",
";",
"}",
"}",
"else",
"{",
"$",
"aType",
"=",
"array",
"(",
"'sTitle'",
"=>",
"$",
"oVariantType",
"->",
"fieldName",
",",
"'sSystemName'",
"=>",
"$",
"oVariantType",
"->",
"fieldIdentifier",
",",
"'cms_media_id'",
"=>",
"$",
"oVariantType",
"->",
"fieldCmsMediaId",
",",
"'aItems'",
"=>",
"array",
"(",
")",
",",
"'bAllowSelection'",
"=>",
"true",
",",
")",
";",
"$",
"aItems",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"oValue",
"=",
"$",
"oAvailableValues",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oValue",
"->",
"table",
",",
"$",
"oValue",
"->",
"id",
")",
";",
"}",
"$",
"aItem",
"=",
"array",
"(",
"'sTitle'",
"=>",
"$",
"oValue",
"->",
"fieldName",
",",
"'sColor'",
"=>",
"$",
"oValue",
"->",
"fieldColorCode",
",",
"'cms_media_id'",
"=>",
"$",
"oValue",
"->",
"fieldCmsMediaId",
",",
"'bIsActive'",
"=>",
"false",
",",
"// currently selected article variant (shows activate state)",
"'bArticleIsActive'",
"=>",
"'1'",
",",
"'sSelectLink'",
"=>",
"''",
",",
")",
";",
"if",
"(",
"$",
"bLoadInactiveItems",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"oValue",
"->",
"sqlData",
"[",
"'articleactive'",
"]",
")",
"&&",
"$",
"oValue",
"->",
"sqlData",
"[",
"'articleactive'",
"]",
">",
"0",
")",
"{",
"$",
"aItem",
"[",
"'bArticleIsActive'",
"]",
"=",
"'1'",
";",
"// if 0 the variant is not active and the variant values should be rendered as non-available",
"}",
"else",
"{",
"$",
"aItem",
"[",
"'bArticleIsActive'",
"]",
"=",
"'0'",
";",
"}",
"}",
"$",
"aItems",
"[",
"]",
"=",
"$",
"aItem",
";",
"}",
"$",
"aType",
"[",
"'aItems'",
"]",
"=",
"$",
"aItems",
";",
"$",
"aVariantTypeList",
"[",
"]",
"=",
"$",
"aType",
";",
"}",
"}",
"}",
"$",
"aData",
"[",
"'aColors'",
"]",
"=",
"$",
"aColors",
";",
"$",
"aData",
"[",
"'aVariantTypes'",
"]",
"=",
"$",
"aVariantTypeList",
";",
"return",
"$",
"aData",
";",
"}"
] | Add color variant data if available for article
Add all other available article variants in separate data.
@param TdbShopArticle $oArticle
@param array $aData
@param IMapperCacheTriggerRestricted $oCacheTriggerManager
@param bool $bCachingEnabled
@return array | [
"Add",
"color",
"variant",
"data",
"if",
"available",
"for",
"article",
"Add",
"all",
"other",
"available",
"article",
"variants",
"in",
"separate",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/article/TPkgShopMapper_ArticleTeaserBase.class.php#L91-L174 |
32,212 | Erebot/Erebot | src/Core.php | Core.handleSignal | public function handleSignal($signum)
{
$consts = get_defined_constants(true);
$signame = '???';
foreach ($consts['pcntl'] as $name => $value) {
if (!strncmp($name, 'SIG', 3) &&
strncmp($name, 'SIG_', 4) &&
$signum == $value) {
$signame = $name;
break;
}
}
$logger = \Plop\Plop::getInstance();
$logger->info(
$this->gettext(
'Received signal #%(signum)d (%(signame)s)'
),
array(
'signum' => $signum,
'signame' => $signame,
)
);
// Print some statistics.
if (function_exists('memory_get_peak_usage')) {
$logger->debug($this->gettext('Memory usage:'));
$limit = trim(ini_get('memory_limit'));
$limit = \Erebot\Utils::parseHumanSize($limit."B");
$stats = array(
(string) $this->gettext("Allocated:") =>
\Erebot\Utils::humanSize(memory_get_peak_usage(true)),
(string) $this->gettext("Used:") =>
\Erebot\Utils::humanSize(memory_get_peak_usage(false)),
(string) $this->gettext("Limit:") =>
\Erebot\Utils::humanSize($limit),
);
foreach ($stats as $key => $value) {
$logger->debug(
'%(key)-16s%(value)10s',
array(
'key' => $key,
'value' => $value,
)
);
}
}
$this->stop();
} | php | public function handleSignal($signum)
{
$consts = get_defined_constants(true);
$signame = '???';
foreach ($consts['pcntl'] as $name => $value) {
if (!strncmp($name, 'SIG', 3) &&
strncmp($name, 'SIG_', 4) &&
$signum == $value) {
$signame = $name;
break;
}
}
$logger = \Plop\Plop::getInstance();
$logger->info(
$this->gettext(
'Received signal #%(signum)d (%(signame)s)'
),
array(
'signum' => $signum,
'signame' => $signame,
)
);
// Print some statistics.
if (function_exists('memory_get_peak_usage')) {
$logger->debug($this->gettext('Memory usage:'));
$limit = trim(ini_get('memory_limit'));
$limit = \Erebot\Utils::parseHumanSize($limit."B");
$stats = array(
(string) $this->gettext("Allocated:") =>
\Erebot\Utils::humanSize(memory_get_peak_usage(true)),
(string) $this->gettext("Used:") =>
\Erebot\Utils::humanSize(memory_get_peak_usage(false)),
(string) $this->gettext("Limit:") =>
\Erebot\Utils::humanSize($limit),
);
foreach ($stats as $key => $value) {
$logger->debug(
'%(key)-16s%(value)10s',
array(
'key' => $key,
'value' => $value,
)
);
}
}
$this->stop();
} | [
"public",
"function",
"handleSignal",
"(",
"$",
"signum",
")",
"{",
"$",
"consts",
"=",
"get_defined_constants",
"(",
"true",
")",
";",
"$",
"signame",
"=",
"'???'",
";",
"foreach",
"(",
"$",
"consts",
"[",
"'pcntl'",
"]",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"strncmp",
"(",
"$",
"name",
",",
"'SIG'",
",",
"3",
")",
"&&",
"strncmp",
"(",
"$",
"name",
",",
"'SIG_'",
",",
"4",
")",
"&&",
"$",
"signum",
"==",
"$",
"value",
")",
"{",
"$",
"signame",
"=",
"$",
"name",
";",
"break",
";",
"}",
"}",
"$",
"logger",
"=",
"\\",
"Plop",
"\\",
"Plop",
"::",
"getInstance",
"(",
")",
";",
"$",
"logger",
"->",
"info",
"(",
"$",
"this",
"->",
"gettext",
"(",
"'Received signal #%(signum)d (%(signame)s)'",
")",
",",
"array",
"(",
"'signum'",
"=>",
"$",
"signum",
",",
"'signame'",
"=>",
"$",
"signame",
",",
")",
")",
";",
"// Print some statistics.",
"if",
"(",
"function_exists",
"(",
"'memory_get_peak_usage'",
")",
")",
"{",
"$",
"logger",
"->",
"debug",
"(",
"$",
"this",
"->",
"gettext",
"(",
"'Memory usage:'",
")",
")",
";",
"$",
"limit",
"=",
"trim",
"(",
"ini_get",
"(",
"'memory_limit'",
")",
")",
";",
"$",
"limit",
"=",
"\\",
"Erebot",
"\\",
"Utils",
"::",
"parseHumanSize",
"(",
"$",
"limit",
".",
"\"B\"",
")",
";",
"$",
"stats",
"=",
"array",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"gettext",
"(",
"\"Allocated:\"",
")",
"=>",
"\\",
"Erebot",
"\\",
"Utils",
"::",
"humanSize",
"(",
"memory_get_peak_usage",
"(",
"true",
")",
")",
",",
"(",
"string",
")",
"$",
"this",
"->",
"gettext",
"(",
"\"Used:\"",
")",
"=>",
"\\",
"Erebot",
"\\",
"Utils",
"::",
"humanSize",
"(",
"memory_get_peak_usage",
"(",
"false",
")",
")",
",",
"(",
"string",
")",
"$",
"this",
"->",
"gettext",
"(",
"\"Limit:\"",
")",
"=>",
"\\",
"Erebot",
"\\",
"Utils",
"::",
"humanSize",
"(",
"$",
"limit",
")",
",",
")",
";",
"foreach",
"(",
"$",
"stats",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"logger",
"->",
"debug",
"(",
"'%(key)-16s%(value)10s'",
",",
"array",
"(",
"'key'",
"=>",
"$",
"key",
",",
"'value'",
"=>",
"$",
"value",
",",
")",
")",
";",
"}",
"}",
"$",
"this",
"->",
"stop",
"(",
")",
";",
"}"
] | Handles request for a graceful shutdown of the bot.
Such requests are received as signals.
\param int $signum
The number of the signal. | [
"Handles",
"request",
"for",
"a",
"graceful",
"shutdown",
"of",
"the",
"bot",
".",
"Such",
"requests",
"are",
"received",
"as",
"signals",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Core.php#L361-L412 |
32,213 | Erebot/Erebot | src/Core.php | Core.reload | public function reload(\Erebot\Interfaces\Config\Main $config = null)
{
$logger = \Plop\Plop::getInstance();
$msg = $this->gettext('Reloading the configuration');
$logger->info($msg);
if (!count($this->connections)) {
$logger->info($this->gettext('No active connections... Aborting.'));
return;
}
if ($config === null) {
$configFile = $this->mainCfg->getConfigFile();
if ($configFile === null) {
$msg = $this->gettext('No configuration file to reload');
$logger->info($msg);
return;
}
/// @TODO: dependency injection
$config = new \Erebot\Config\Main(
$configFile,
\Erebot\Interfaces\Config\Main::LOAD_FROM_FILE
);
}
$connectionCls = get_class($this->connections[0]);
$this->createConnections($connectionCls, $config);
$msg = $this->gettext('Successfully reloaded the configuration');
$logger->info($msg);
} | php | public function reload(\Erebot\Interfaces\Config\Main $config = null)
{
$logger = \Plop\Plop::getInstance();
$msg = $this->gettext('Reloading the configuration');
$logger->info($msg);
if (!count($this->connections)) {
$logger->info($this->gettext('No active connections... Aborting.'));
return;
}
if ($config === null) {
$configFile = $this->mainCfg->getConfigFile();
if ($configFile === null) {
$msg = $this->gettext('No configuration file to reload');
$logger->info($msg);
return;
}
/// @TODO: dependency injection
$config = new \Erebot\Config\Main(
$configFile,
\Erebot\Interfaces\Config\Main::LOAD_FROM_FILE
);
}
$connectionCls = get_class($this->connections[0]);
$this->createConnections($connectionCls, $config);
$msg = $this->gettext('Successfully reloaded the configuration');
$logger->info($msg);
} | [
"public",
"function",
"reload",
"(",
"\\",
"Erebot",
"\\",
"Interfaces",
"\\",
"Config",
"\\",
"Main",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"logger",
"=",
"\\",
"Plop",
"\\",
"Plop",
"::",
"getInstance",
"(",
")",
";",
"$",
"msg",
"=",
"$",
"this",
"->",
"gettext",
"(",
"'Reloading the configuration'",
")",
";",
"$",
"logger",
"->",
"info",
"(",
"$",
"msg",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"connections",
")",
")",
"{",
"$",
"logger",
"->",
"info",
"(",
"$",
"this",
"->",
"gettext",
"(",
"'No active connections... Aborting.'",
")",
")",
";",
"return",
";",
"}",
"if",
"(",
"$",
"config",
"===",
"null",
")",
"{",
"$",
"configFile",
"=",
"$",
"this",
"->",
"mainCfg",
"->",
"getConfigFile",
"(",
")",
";",
"if",
"(",
"$",
"configFile",
"===",
"null",
")",
"{",
"$",
"msg",
"=",
"$",
"this",
"->",
"gettext",
"(",
"'No configuration file to reload'",
")",
";",
"$",
"logger",
"->",
"info",
"(",
"$",
"msg",
")",
";",
"return",
";",
"}",
"/// @TODO: dependency injection",
"$",
"config",
"=",
"new",
"\\",
"Erebot",
"\\",
"Config",
"\\",
"Main",
"(",
"$",
"configFile",
",",
"\\",
"Erebot",
"\\",
"Interfaces",
"\\",
"Config",
"\\",
"Main",
"::",
"LOAD_FROM_FILE",
")",
";",
"}",
"$",
"connectionCls",
"=",
"get_class",
"(",
"$",
"this",
"->",
"connections",
"[",
"0",
"]",
")",
";",
"$",
"this",
"->",
"createConnections",
"(",
"$",
"connectionCls",
",",
"$",
"config",
")",
";",
"$",
"msg",
"=",
"$",
"this",
"->",
"gettext",
"(",
"'Successfully reloaded the configuration'",
")",
";",
"$",
"logger",
"->",
"info",
"(",
"$",
"msg",
")",
";",
"}"
] | Reload this instance of the bot.
This method makes the bot reload most of the data
it currently relies on, such as configuration files.
\param Erebot::Interfaces::Config::MainInterface $config
(optional) The new configuration to use.
If omitted, the configuration file currently in use
is reloaded. | [
"Reload",
"this",
"instance",
"of",
"the",
"bot",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Core.php#L505-L536 |
32,214 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/UsesPHPMetaDataTrait.php | UsesPHPMetaDataTrait.runInitMethods | private function runInitMethods(): void
{
$reflectionClass = self::getDoctrineStaticMeta()->getReflectionClass();
$methods = $reflectionClass->getMethods(\ReflectionMethod::IS_PRIVATE);
foreach ($methods as $method) {
if ($method instanceof ReflectionMethod) {
$method = $method->getName();
}
if (\ts\stringContains($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
&& \ts\stringStartsWith($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
) {
$this->$method();
}
}
} | php | private function runInitMethods(): void
{
$reflectionClass = self::getDoctrineStaticMeta()->getReflectionClass();
$methods = $reflectionClass->getMethods(\ReflectionMethod::IS_PRIVATE);
foreach ($methods as $method) {
if ($method instanceof ReflectionMethod) {
$method = $method->getName();
}
if (\ts\stringContains($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
&& \ts\stringStartsWith($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
) {
$this->$method();
}
}
} | [
"private",
"function",
"runInitMethods",
"(",
")",
":",
"void",
"{",
"$",
"reflectionClass",
"=",
"self",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"getReflectionClass",
"(",
")",
";",
"$",
"methods",
"=",
"$",
"reflectionClass",
"->",
"getMethods",
"(",
"\\",
"ReflectionMethod",
"::",
"IS_PRIVATE",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"method",
"instanceof",
"ReflectionMethod",
")",
"{",
"$",
"method",
"=",
"$",
"method",
"->",
"getName",
"(",
")",
";",
"}",
"if",
"(",
"\\",
"ts",
"\\",
"stringContains",
"(",
"$",
"method",
",",
"UsesPHPMetaDataInterface",
"::",
"METHOD_PREFIX_INIT",
")",
"&&",
"\\",
"ts",
"\\",
"stringStartsWith",
"(",
"$",
"method",
",",
"UsesPHPMetaDataInterface",
"::",
"METHOD_PREFIX_INIT",
")",
")",
"{",
"$",
"this",
"->",
"$",
"method",
"(",
")",
";",
"}",
"}",
"}"
] | Find and run all init methods
- defined in relationship traits and generally to init ArrayCollection properties
@throws \ReflectionException | [
"Find",
"and",
"run",
"all",
"init",
"methods",
"-",
"defined",
"in",
"relationship",
"traits",
"and",
"generally",
"to",
"init",
"ArrayCollection",
"properties"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/UsesPHPMetaDataTrait.php#L35-L49 |
32,215 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/UsesPHPMetaDataTrait.php | UsesPHPMetaDataTrait.loadMetadata | public static function loadMetadata(DoctrineClassMetaData $metaData): void
{
try {
self::getDoctrineStaticMeta()->setMetaData($metaData)->buildMetaData();
} catch (\Exception $e) {
throw new DoctrineStaticMetaException(
'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
$e->getCode(),
$e
);
}
} | php | public static function loadMetadata(DoctrineClassMetaData $metaData): void
{
try {
self::getDoctrineStaticMeta()->setMetaData($metaData)->buildMetaData();
} catch (\Exception $e) {
throw new DoctrineStaticMetaException(
'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
$e->getCode(),
$e
);
}
} | [
"public",
"static",
"function",
"loadMetadata",
"(",
"DoctrineClassMetaData",
"$",
"metaData",
")",
":",
"void",
"{",
"try",
"{",
"self",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"setMetaData",
"(",
"$",
"metaData",
")",
"->",
"buildMetaData",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"DoctrineStaticMetaException",
"(",
"'Exception in '",
".",
"__METHOD__",
".",
"': '",
".",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"$",
"e",
")",
";",
"}",
"}"
] | Loads the class and property meta data in the class
This is the method called by Doctrine to load the meta data
@param DoctrineClassMetaData $metaData
@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.StaticAccess) | [
"Loads",
"the",
"class",
"and",
"property",
"meta",
"data",
"in",
"the",
"class"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/UsesPHPMetaDataTrait.php#L79-L90 |
32,216 | PGB-LIV/php-ms | src/Writer/MzIdentMlWriter.php | MzIdentMlWriter.addCv | public function addCv($name, $version, $uri, $cvRef)
{
$this->cvList[] = array(
'fullName' => $name,
'version' => $version,
'uri' => $uri,
'id' => $cvRef
);
// read in obo file
$handle = fopen($uri, 'r');
$lineReader = new LineReader($handle);
// parse file
$parser = new Parser($lineReader);
$parser->retainTrailingComments(true);
$parser->getDocument()->mergeStanzas(false); // speed tip
$parser->parse();
$terms = array();
foreach ($parser->getDocument()->getStanzas('Term') as $term) {
$id = $term->get('id');
$name = $term->get('name');
$terms[$id] = $name;
}
$this->oboRef[$cvRef] = $terms;
} | php | public function addCv($name, $version, $uri, $cvRef)
{
$this->cvList[] = array(
'fullName' => $name,
'version' => $version,
'uri' => $uri,
'id' => $cvRef
);
// read in obo file
$handle = fopen($uri, 'r');
$lineReader = new LineReader($handle);
// parse file
$parser = new Parser($lineReader);
$parser->retainTrailingComments(true);
$parser->getDocument()->mergeStanzas(false); // speed tip
$parser->parse();
$terms = array();
foreach ($parser->getDocument()->getStanzas('Term') as $term) {
$id = $term->get('id');
$name = $term->get('name');
$terms[$id] = $name;
}
$this->oboRef[$cvRef] = $terms;
} | [
"public",
"function",
"addCv",
"(",
"$",
"name",
",",
"$",
"version",
",",
"$",
"uri",
",",
"$",
"cvRef",
")",
"{",
"$",
"this",
"->",
"cvList",
"[",
"]",
"=",
"array",
"(",
"'fullName'",
"=>",
"$",
"name",
",",
"'version'",
"=>",
"$",
"version",
",",
"'uri'",
"=>",
"$",
"uri",
",",
"'id'",
"=>",
"$",
"cvRef",
")",
";",
"// read in obo file",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"uri",
",",
"'r'",
")",
";",
"$",
"lineReader",
"=",
"new",
"LineReader",
"(",
"$",
"handle",
")",
";",
"// parse file",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"lineReader",
")",
";",
"$",
"parser",
"->",
"retainTrailingComments",
"(",
"true",
")",
";",
"$",
"parser",
"->",
"getDocument",
"(",
")",
"->",
"mergeStanzas",
"(",
"false",
")",
";",
"// speed tip",
"$",
"parser",
"->",
"parse",
"(",
")",
";",
"$",
"terms",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"parser",
"->",
"getDocument",
"(",
")",
"->",
"getStanzas",
"(",
"'Term'",
")",
"as",
"$",
"term",
")",
"{",
"$",
"id",
"=",
"$",
"term",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"name",
"=",
"$",
"term",
"->",
"get",
"(",
"'name'",
")",
";",
"$",
"terms",
"[",
"$",
"id",
"]",
"=",
"$",
"name",
";",
"}",
"$",
"this",
"->",
"oboRef",
"[",
"$",
"cvRef",
"]",
"=",
"$",
"terms",
";",
"}"
] | CV terms must be added prior to open being called
@param string $name
@param string $version
@param string $uri
@param string $id | [
"CV",
"terms",
"must",
"be",
"added",
"prior",
"to",
"open",
"being",
"called"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Writer/MzIdentMlWriter.php#L145-L172 |
32,217 | PGB-LIV/php-ms | src/Writer/MzIdentMlWriter.php | MzIdentMlWriter.writeAttributeNotNull | private function writeAttributeNotNull($attribute, $value)
{
if (is_null($value)) {
return;
}
$this->stream->writeAttribute($attribute, $value);
} | php | private function writeAttributeNotNull($attribute, $value)
{
if (is_null($value)) {
return;
}
$this->stream->writeAttribute($attribute, $value);
} | [
"private",
"function",
"writeAttributeNotNull",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"stream",
"->",
"writeAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
";",
"}"
] | Writes the attribute for as long as the value is not null
@param string $attribute
@param mixed $value | [
"Writes",
"the",
"attribute",
"for",
"as",
"long",
"as",
"the",
"value",
"is",
"not",
"null"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Writer/MzIdentMlWriter.php#L1002-L1009 |
32,218 | chameleon-system/chameleon-shop | src/ShopCurrencyBundle/pkgShop/objects/db/TPkgShopCurrency_ShopVoucher.class.php | TPkgShopCurrency_ShopVoucher.CommitVoucherUseForCurrentUserPreSaveHook | protected function CommitVoucherUseForCurrentUserPreSaveHook(&$aData)
{
// value used is converted to the base currency - euro
$oCurrency = TdbPkgShopCurrency::GetBaseCurrency();
$oActive = TdbPkgShopCurrency::GetActiveInstance();
$aData['value_used_in_order_currency'] = $aData['value_used'];
if (false !== $oCurrency) {
$aData['pkg_shop_currency_id'] = $oCurrency->id;
}
if ($oCurrency && $oActive && $oActive->id != $oCurrency->id) {
$aData['pkg_shop_currency_id'] = $oActive->id;
$aData['value_used'] = round($oCurrency->Convert($aData['value_used'], $oActive), 2);
}
} | php | protected function CommitVoucherUseForCurrentUserPreSaveHook(&$aData)
{
// value used is converted to the base currency - euro
$oCurrency = TdbPkgShopCurrency::GetBaseCurrency();
$oActive = TdbPkgShopCurrency::GetActiveInstance();
$aData['value_used_in_order_currency'] = $aData['value_used'];
if (false !== $oCurrency) {
$aData['pkg_shop_currency_id'] = $oCurrency->id;
}
if ($oCurrency && $oActive && $oActive->id != $oCurrency->id) {
$aData['pkg_shop_currency_id'] = $oActive->id;
$aData['value_used'] = round($oCurrency->Convert($aData['value_used'], $oActive), 2);
}
} | [
"protected",
"function",
"CommitVoucherUseForCurrentUserPreSaveHook",
"(",
"&",
"$",
"aData",
")",
"{",
"// value used is converted to the base currency - euro",
"$",
"oCurrency",
"=",
"TdbPkgShopCurrency",
"::",
"GetBaseCurrency",
"(",
")",
";",
"$",
"oActive",
"=",
"TdbPkgShopCurrency",
"::",
"GetActiveInstance",
"(",
")",
";",
"$",
"aData",
"[",
"'value_used_in_order_currency'",
"]",
"=",
"$",
"aData",
"[",
"'value_used'",
"]",
";",
"if",
"(",
"false",
"!==",
"$",
"oCurrency",
")",
"{",
"$",
"aData",
"[",
"'pkg_shop_currency_id'",
"]",
"=",
"$",
"oCurrency",
"->",
"id",
";",
"}",
"if",
"(",
"$",
"oCurrency",
"&&",
"$",
"oActive",
"&&",
"$",
"oActive",
"->",
"id",
"!=",
"$",
"oCurrency",
"->",
"id",
")",
"{",
"$",
"aData",
"[",
"'pkg_shop_currency_id'",
"]",
"=",
"$",
"oActive",
"->",
"id",
";",
"$",
"aData",
"[",
"'value_used'",
"]",
"=",
"round",
"(",
"$",
"oCurrency",
"->",
"Convert",
"(",
"$",
"aData",
"[",
"'value_used'",
"]",
",",
"$",
"oActive",
")",
",",
"2",
")",
";",
"}",
"}"
] | method can be used to process the use data before the commit is called
we use it here to convert the value of the voucher used back to the base currency (since that is what we want to store.
@param array $aData | [
"method",
"can",
"be",
"used",
"to",
"process",
"the",
"use",
"data",
"before",
"the",
"commit",
"is",
"called",
"we",
"use",
"it",
"here",
"to",
"convert",
"the",
"value",
"of",
"the",
"voucher",
"used",
"back",
"to",
"the",
"base",
"currency",
"(",
"since",
"that",
"is",
"what",
"we",
"want",
"to",
"store",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/pkgShop/objects/db/TPkgShopCurrency_ShopVoucher.class.php#L30-L43 |
32,219 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopSearchTagsCore/MTShopSearchTagsCore.class.php | MTShopSearchTagsCore.& | protected function &GetSearchKeywordCloud()
{
$iSize = 13;
$aCustomWords = array();
$oCustomList = &TdbShopSearchCloudWordList::GetList();
while ($oWord = &$oCustomList->Next()) {
$aCustomWords[$oWord->fieldName] = $oWord->fieldWeight;
}
$iSize = $iSize - count($aCustomWords);
if ($iSize < 0) {
$iSize = 0;
}
$activeLanguage = $this->getLanguageService()->getActiveLanguageId();
$query = 'SELECT COUNT(`shop_search_log`.`id`) AS '.TCMSTagCloud::QUERY_ITEM_COUNT_NAME.',
`shop_search_log`.`name` AS '.TCMSTagCloud::QUERY_ITEM_KEY_NAME.",
`shop_search_log`.*
FROM `shop_search_log`
WHERE `cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($activeLanguage)."' OR `cms_language_id` = ''
GROUP BY `shop_search_log`.`name`
HAVING ".TCMSTagCloud::QUERY_ITEM_COUNT_NAME.' > 0
ORDER BY '.TCMSTagCloud::QUERY_ITEM_COUNT_NAME." DESC
LIMIT 0,{$iSize}
";
// add custom words...
return TCMSTagCloud::GetCloud($query, 'TdbShopSearchLog', $aCustomWords);
} | php | protected function &GetSearchKeywordCloud()
{
$iSize = 13;
$aCustomWords = array();
$oCustomList = &TdbShopSearchCloudWordList::GetList();
while ($oWord = &$oCustomList->Next()) {
$aCustomWords[$oWord->fieldName] = $oWord->fieldWeight;
}
$iSize = $iSize - count($aCustomWords);
if ($iSize < 0) {
$iSize = 0;
}
$activeLanguage = $this->getLanguageService()->getActiveLanguageId();
$query = 'SELECT COUNT(`shop_search_log`.`id`) AS '.TCMSTagCloud::QUERY_ITEM_COUNT_NAME.',
`shop_search_log`.`name` AS '.TCMSTagCloud::QUERY_ITEM_KEY_NAME.",
`shop_search_log`.*
FROM `shop_search_log`
WHERE `cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($activeLanguage)."' OR `cms_language_id` = ''
GROUP BY `shop_search_log`.`name`
HAVING ".TCMSTagCloud::QUERY_ITEM_COUNT_NAME.' > 0
ORDER BY '.TCMSTagCloud::QUERY_ITEM_COUNT_NAME." DESC
LIMIT 0,{$iSize}
";
// add custom words...
return TCMSTagCloud::GetCloud($query, 'TdbShopSearchLog', $aCustomWords);
} | [
"protected",
"function",
"&",
"GetSearchKeywordCloud",
"(",
")",
"{",
"$",
"iSize",
"=",
"13",
";",
"$",
"aCustomWords",
"=",
"array",
"(",
")",
";",
"$",
"oCustomList",
"=",
"&",
"TdbShopSearchCloudWordList",
"::",
"GetList",
"(",
")",
";",
"while",
"(",
"$",
"oWord",
"=",
"&",
"$",
"oCustomList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aCustomWords",
"[",
"$",
"oWord",
"->",
"fieldName",
"]",
"=",
"$",
"oWord",
"->",
"fieldWeight",
";",
"}",
"$",
"iSize",
"=",
"$",
"iSize",
"-",
"count",
"(",
"$",
"aCustomWords",
")",
";",
"if",
"(",
"$",
"iSize",
"<",
"0",
")",
"{",
"$",
"iSize",
"=",
"0",
";",
"}",
"$",
"activeLanguage",
"=",
"$",
"this",
"->",
"getLanguageService",
"(",
")",
"->",
"getActiveLanguageId",
"(",
")",
";",
"$",
"query",
"=",
"'SELECT COUNT(`shop_search_log`.`id`) AS '",
".",
"TCMSTagCloud",
"::",
"QUERY_ITEM_COUNT_NAME",
".",
"',\n `shop_search_log`.`name` AS '",
".",
"TCMSTagCloud",
"::",
"QUERY_ITEM_KEY_NAME",
".",
"\",\n `shop_search_log`.*\n FROM `shop_search_log`\n WHERE `cms_language_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"activeLanguage",
")",
".",
"\"' OR `cms_language_id` = ''\n GROUP BY `shop_search_log`.`name`\n HAVING \"",
".",
"TCMSTagCloud",
"::",
"QUERY_ITEM_COUNT_NAME",
".",
"' > 0\n ORDER BY '",
".",
"TCMSTagCloud",
"::",
"QUERY_ITEM_COUNT_NAME",
".",
"\" DESC\n LIMIT 0,{$iSize}\n \"",
";",
"// add custom words...",
"return",
"TCMSTagCloud",
"::",
"GetCloud",
"(",
"$",
"query",
",",
"'TdbShopSearchLog'",
",",
"$",
"aCustomWords",
")",
";",
"}"
] | return cloud for search keywords.
@return TCMSTagCloud | [
"return",
"cloud",
"for",
"search",
"keywords",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopSearchTagsCore/MTShopSearchTagsCore.class.php#L36-L62 |
32,220 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/Factory/FileFactory.php | FileFactory.createFromExistingPath | public function createFromExistingPath(string $path): File
{
$file = new File($path);
if (false === $file->exists()) {
throw new DoctrineStaticMetaException('File does not exist at ' . $path);
}
return $file;
} | php | public function createFromExistingPath(string $path): File
{
$file = new File($path);
if (false === $file->exists()) {
throw new DoctrineStaticMetaException('File does not exist at ' . $path);
}
return $file;
} | [
"public",
"function",
"createFromExistingPath",
"(",
"string",
"$",
"path",
")",
":",
"File",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"path",
")",
";",
"if",
"(",
"false",
"===",
"$",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"DoctrineStaticMetaException",
"(",
"'File does not exist at '",
".",
"$",
"path",
")",
";",
"}",
"return",
"$",
"file",
";",
"}"
] | Create a new file object from an existing file path
@param string $path
@return File
@throws DoctrineStaticMetaException | [
"Create",
"a",
"new",
"file",
"object",
"from",
"an",
"existing",
"file",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/Factory/FileFactory.php#L54-L62 |
32,221 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/Factory/FileFactory.php | FileFactory.createFromNonExistantPath | public function createFromNonExistantPath(string $path): File
{
$file = new File($path);
if (true === $file->exists()) {
throw new DoctrineStaticMetaException('File exists at ' . $path);
}
return $file;
} | php | public function createFromNonExistantPath(string $path): File
{
$file = new File($path);
if (true === $file->exists()) {
throw new DoctrineStaticMetaException('File exists at ' . $path);
}
return $file;
} | [
"public",
"function",
"createFromNonExistantPath",
"(",
"string",
"$",
"path",
")",
":",
"File",
"{",
"$",
"file",
"=",
"new",
"File",
"(",
"$",
"path",
")",
";",
"if",
"(",
"true",
"===",
"$",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"DoctrineStaticMetaException",
"(",
"'File exists at '",
".",
"$",
"path",
")",
";",
"}",
"return",
"$",
"file",
";",
"}"
] | Create a new file object that should not already exist at the specified path
@param string $path
@return File
@throws DoctrineStaticMetaException | [
"Create",
"a",
"new",
"file",
"object",
"that",
"should",
"not",
"already",
"exist",
"at",
"the",
"specified",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/Factory/FileFactory.php#L72-L80 |
32,222 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/Factory/FileFactory.php | FileFactory.createFromFqn | public function createFromFqn(string $fqn, $srcOrTestSubFolder = CreatorInterface::SRC_FOLDER): File
{
list($className, , $subDirectories) = $this->namespaceHelper->parseFullyQualifiedName(
$fqn,
$srcOrTestSubFolder,
$this->projectRootNamespace
);
$path = $this->projectRootDirectory
. '/' . implode('/', $subDirectories) . '/' . $className . '.php';
return new File($path);
} | php | public function createFromFqn(string $fqn, $srcOrTestSubFolder = CreatorInterface::SRC_FOLDER): File
{
list($className, , $subDirectories) = $this->namespaceHelper->parseFullyQualifiedName(
$fqn,
$srcOrTestSubFolder,
$this->projectRootNamespace
);
$path = $this->projectRootDirectory
. '/' . implode('/', $subDirectories) . '/' . $className . '.php';
return new File($path);
} | [
"public",
"function",
"createFromFqn",
"(",
"string",
"$",
"fqn",
",",
"$",
"srcOrTestSubFolder",
"=",
"CreatorInterface",
"::",
"SRC_FOLDER",
")",
":",
"File",
"{",
"list",
"(",
"$",
"className",
",",
",",
"$",
"subDirectories",
")",
"=",
"$",
"this",
"->",
"namespaceHelper",
"->",
"parseFullyQualifiedName",
"(",
"$",
"fqn",
",",
"$",
"srcOrTestSubFolder",
",",
"$",
"this",
"->",
"projectRootNamespace",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"projectRootDirectory",
".",
"'/'",
".",
"implode",
"(",
"'/'",
",",
"$",
"subDirectories",
")",
".",
"'/'",
".",
"$",
"className",
".",
"'.php'",
";",
"return",
"new",
"File",
"(",
"$",
"path",
")",
";",
"}"
] | Create a new file object from a fully qualified name, may or may not exist
@param string $fqn
@param string $srcOrTestSubFolder
@return File
@throws DoctrineStaticMetaException | [
"Create",
"a",
"new",
"file",
"object",
"from",
"a",
"fully",
"qualified",
"name",
"may",
"or",
"may",
"not",
"exist"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/Factory/FileFactory.php#L91-L102 |
32,223 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/TPkgShopListfilter.class.php | TPkgShopListfilter.GetCurrentFilterAsArray | public function GetCurrentFilterAsArray()
{
$aFilterAsArray = $this->GetFromInternalCache('aFilterAsArray');
if (is_null($aFilterAsArray)) {
$oList = &$this->GetFieldPkgShopListfilterItemList();
$aFilterAsArray = $oList->GetListSettingAsArray();
$this->SetInternalCache('aFilterAsArray', $aFilterAsArray);
}
return $aFilterAsArray;
} | php | public function GetCurrentFilterAsArray()
{
$aFilterAsArray = $this->GetFromInternalCache('aFilterAsArray');
if (is_null($aFilterAsArray)) {
$oList = &$this->GetFieldPkgShopListfilterItemList();
$aFilterAsArray = $oList->GetListSettingAsArray();
$this->SetInternalCache('aFilterAsArray', $aFilterAsArray);
}
return $aFilterAsArray;
} | [
"public",
"function",
"GetCurrentFilterAsArray",
"(",
")",
"{",
"$",
"aFilterAsArray",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'aFilterAsArray'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aFilterAsArray",
")",
")",
"{",
"$",
"oList",
"=",
"&",
"$",
"this",
"->",
"GetFieldPkgShopListfilterItemList",
"(",
")",
";",
"$",
"aFilterAsArray",
"=",
"$",
"oList",
"->",
"GetListSettingAsArray",
"(",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'aFilterAsArray'",
",",
"$",
"aFilterAsArray",
")",
";",
"}",
"return",
"$",
"aFilterAsArray",
";",
"}"
] | return the current active filter as an array.
@return array | [
"return",
"the",
"current",
"active",
"filter",
"as",
"an",
"array",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/TPkgShopListfilter.class.php#L308-L318 |
32,224 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/TPkgShopListfilter.class.php | TPkgShopListfilter.GetFilterValuesForFilterType | public function GetFilterValuesForFilterType($sFilterSystemName)
{
$aActiveFilter = $this->GetFromInternalCache('aFilterDataAsArrayFor'.$sFilterSystemName);
if (is_null($aActiveFilter)) {
$aActiveFilter = false;
$aFilterData = $this->GetCurrentFilterAsArray();
if (is_array($aFilterData) && array_key_exists(TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA, $aFilterData) && is_array($aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) && count($aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) > 0) {
$aFilterData = $aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA];
$oFilterId = TdbPkgShopListfilterItem::GetNewInstance();
if ($oFilterId->LoadFromFields(array('pkg_shop_listfilter_id' => $this->id, 'systemname' => $sFilterSystemName))) {
if (is_array($aFilterData) && array_key_exists($oFilterId->id, $aFilterData)) {
if (is_array($aFilterData[$oFilterId->id]) && count($aFilterData[$oFilterId->id]) > 0) {
$aActiveFilter = $aFilterData[$oFilterId->id];
}
}
}
}
$this->SetInternalCache('aFilterDataAsArrayFor'.$sFilterSystemName, $aActiveFilter);
}
return $aActiveFilter;
} | php | public function GetFilterValuesForFilterType($sFilterSystemName)
{
$aActiveFilter = $this->GetFromInternalCache('aFilterDataAsArrayFor'.$sFilterSystemName);
if (is_null($aActiveFilter)) {
$aActiveFilter = false;
$aFilterData = $this->GetCurrentFilterAsArray();
if (is_array($aFilterData) && array_key_exists(TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA, $aFilterData) && is_array($aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) && count($aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) > 0) {
$aFilterData = $aFilterData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA];
$oFilterId = TdbPkgShopListfilterItem::GetNewInstance();
if ($oFilterId->LoadFromFields(array('pkg_shop_listfilter_id' => $this->id, 'systemname' => $sFilterSystemName))) {
if (is_array($aFilterData) && array_key_exists($oFilterId->id, $aFilterData)) {
if (is_array($aFilterData[$oFilterId->id]) && count($aFilterData[$oFilterId->id]) > 0) {
$aActiveFilter = $aFilterData[$oFilterId->id];
}
}
}
}
$this->SetInternalCache('aFilterDataAsArrayFor'.$sFilterSystemName, $aActiveFilter);
}
return $aActiveFilter;
} | [
"public",
"function",
"GetFilterValuesForFilterType",
"(",
"$",
"sFilterSystemName",
")",
"{",
"$",
"aActiveFilter",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'aFilterDataAsArrayFor'",
".",
"$",
"sFilterSystemName",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aActiveFilter",
")",
")",
"{",
"$",
"aActiveFilter",
"=",
"false",
";",
"$",
"aFilterData",
"=",
"$",
"this",
"->",
"GetCurrentFilterAsArray",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aFilterData",
")",
"&&",
"array_key_exists",
"(",
"TdbPkgShopListfilterItem",
"::",
"URL_PARAMETER_FILTER_DATA",
",",
"$",
"aFilterData",
")",
"&&",
"is_array",
"(",
"$",
"aFilterData",
"[",
"TdbPkgShopListfilterItem",
"::",
"URL_PARAMETER_FILTER_DATA",
"]",
")",
"&&",
"count",
"(",
"$",
"aFilterData",
"[",
"TdbPkgShopListfilterItem",
"::",
"URL_PARAMETER_FILTER_DATA",
"]",
")",
">",
"0",
")",
"{",
"$",
"aFilterData",
"=",
"$",
"aFilterData",
"[",
"TdbPkgShopListfilterItem",
"::",
"URL_PARAMETER_FILTER_DATA",
"]",
";",
"$",
"oFilterId",
"=",
"TdbPkgShopListfilterItem",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oFilterId",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'pkg_shop_listfilter_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'systemname'",
"=>",
"$",
"sFilterSystemName",
")",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aFilterData",
")",
"&&",
"array_key_exists",
"(",
"$",
"oFilterId",
"->",
"id",
",",
"$",
"aFilterData",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aFilterData",
"[",
"$",
"oFilterId",
"->",
"id",
"]",
")",
"&&",
"count",
"(",
"$",
"aFilterData",
"[",
"$",
"oFilterId",
"->",
"id",
"]",
")",
">",
"0",
")",
"{",
"$",
"aActiveFilter",
"=",
"$",
"aFilterData",
"[",
"$",
"oFilterId",
"->",
"id",
"]",
";",
"}",
"}",
"}",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'aFilterDataAsArrayFor'",
".",
"$",
"sFilterSystemName",
",",
"$",
"aActiveFilter",
")",
";",
"}",
"return",
"$",
"aActiveFilter",
";",
"}"
] | return the filter values set for the filter with the given system name. return false if none are set.
@param array $sFilterSystemName
@return array | [
"return",
"the",
"filter",
"values",
"set",
"for",
"the",
"filter",
"with",
"the",
"given",
"system",
"name",
".",
"return",
"false",
"if",
"none",
"are",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/TPkgShopListfilter.class.php#L327-L349 |
32,225 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/ReferenceIdMapping/AmazonReferenceIdManager.php | AmazonReferenceIdManager.createFromRecordList | public static function createFromRecordList(array $recordList)
{
$manager = null;
foreach ($recordList as $row) {
if (null === $manager) {
$manager = new self($row['amazon_order_reference_id'], $row['shop_order_id']);
}
$item = self::createItemFromRow($row);
$manager->idLists[$item->getType()]->addItem($item);
}
return $manager;
} | php | public static function createFromRecordList(array $recordList)
{
$manager = null;
foreach ($recordList as $row) {
if (null === $manager) {
$manager = new self($row['amazon_order_reference_id'], $row['shop_order_id']);
}
$item = self::createItemFromRow($row);
$manager->idLists[$item->getType()]->addItem($item);
}
return $manager;
} | [
"public",
"static",
"function",
"createFromRecordList",
"(",
"array",
"$",
"recordList",
")",
"{",
"$",
"manager",
"=",
"null",
";",
"foreach",
"(",
"$",
"recordList",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"manager",
")",
"{",
"$",
"manager",
"=",
"new",
"self",
"(",
"$",
"row",
"[",
"'amazon_order_reference_id'",
"]",
",",
"$",
"row",
"[",
"'shop_order_id'",
"]",
")",
";",
"}",
"$",
"item",
"=",
"self",
"::",
"createItemFromRow",
"(",
"$",
"row",
")",
";",
"$",
"manager",
"->",
"idLists",
"[",
"$",
"item",
"->",
"getType",
"(",
")",
"]",
"->",
"addItem",
"(",
"$",
"item",
")",
";",
"}",
"return",
"$",
"manager",
";",
"}"
] | the items are loaded in the order they are passed - so make sure to provide them in the correct order.
@param array $recordList
@return AmazonReferenceIdManager|null | [
"the",
"items",
"are",
"loaded",
"in",
"the",
"order",
"they",
"are",
"passed",
"-",
"so",
"make",
"sure",
"to",
"provide",
"them",
"in",
"the",
"correct",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/ReferenceIdMapping/AmazonReferenceIdManager.php#L247-L259 |
32,226 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/ReferenceIdMapping/AmazonReferenceIdManager.php | AmazonReferenceIdManager.getListOfAuthorizations | public function getListOfAuthorizations()
{
if (0 === count($this->idLists[IAmazonReferenceId::TYPE_AUTHORIZE])) {
return null;
}
return $this->idLists[IAmazonReferenceId::TYPE_AUTHORIZE];
} | php | public function getListOfAuthorizations()
{
if (0 === count($this->idLists[IAmazonReferenceId::TYPE_AUTHORIZE])) {
return null;
}
return $this->idLists[IAmazonReferenceId::TYPE_AUTHORIZE];
} | [
"public",
"function",
"getListOfAuthorizations",
"(",
")",
"{",
"if",
"(",
"0",
"===",
"count",
"(",
"$",
"this",
"->",
"idLists",
"[",
"IAmazonReferenceId",
"::",
"TYPE_AUTHORIZE",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"idLists",
"[",
"IAmazonReferenceId",
"::",
"TYPE_AUTHORIZE",
"]",
";",
"}"
] | returns a list of all authorizations for which there are no captures.
@return IAmazonReferenceIdList | [
"returns",
"a",
"list",
"of",
"all",
"authorizations",
"for",
"which",
"there",
"are",
"no",
"captures",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/ReferenceIdMapping/AmazonReferenceIdManager.php#L322-L329 |
32,227 | Erebot/Erebot | src/Identd/Worker.php | Worker.handleMessage | protected function handleMessage($line)
{
if (!is_string($line)) {
return false;
}
$parts = array_map('trim', explode(',', $line));
if (count($parts) != 2) {
return false;
}
$line = implode(" , ", $parts);
if (!ctype_digit($parts[0]) || !ctype_digit($parts[1])) {
return $line . " : ERROR : INVALID-PORT";
}
$cport = (int) $parts[0];
$sport = (int) $parts[1];
if ($sport <= 0 || $sport > 65535 || $cport <= 0 || $cport > 65535) {
return $line . " : ERROR : INVALID-PORT";
}
foreach ($this->bot->getConnections() as $connection) {
if ($connection == $this) {
continue;
}
$socket = $connection->getSocket();
$rport = (int) substr(strrchr(stream_socket_get_name($socket, true), ':'), 1);
if ($rport != $sport) {
continue;
}
$lport = (int) substr(strrchr(stream_socket_get_name($socket, false), ':'), 1);
if ($lport != $cport) {
continue;
}
try {
$config = $connection->getConfig(null);
$identity = $config->parseString(
'\\Erebot\\Module\\IrcConnector',
'identity',
''
);
return $line . " : USERID : UNIX : " . $identity;
} catch (\Erebot\Exception $e) {
return $line . " : ERROR : HIDDEN-USER ";
}
}
return $line . " : ERROR : NO-USER";
} | php | protected function handleMessage($line)
{
if (!is_string($line)) {
return false;
}
$parts = array_map('trim', explode(',', $line));
if (count($parts) != 2) {
return false;
}
$line = implode(" , ", $parts);
if (!ctype_digit($parts[0]) || !ctype_digit($parts[1])) {
return $line . " : ERROR : INVALID-PORT";
}
$cport = (int) $parts[0];
$sport = (int) $parts[1];
if ($sport <= 0 || $sport > 65535 || $cport <= 0 || $cport > 65535) {
return $line . " : ERROR : INVALID-PORT";
}
foreach ($this->bot->getConnections() as $connection) {
if ($connection == $this) {
continue;
}
$socket = $connection->getSocket();
$rport = (int) substr(strrchr(stream_socket_get_name($socket, true), ':'), 1);
if ($rport != $sport) {
continue;
}
$lport = (int) substr(strrchr(stream_socket_get_name($socket, false), ':'), 1);
if ($lport != $cport) {
continue;
}
try {
$config = $connection->getConfig(null);
$identity = $config->parseString(
'\\Erebot\\Module\\IrcConnector',
'identity',
''
);
return $line . " : USERID : UNIX : " . $identity;
} catch (\Erebot\Exception $e) {
return $line . " : ERROR : HIDDEN-USER ";
}
}
return $line . " : ERROR : NO-USER";
} | [
"protected",
"function",
"handleMessage",
"(",
"$",
"line",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"line",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"parts",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
",",
"$",
"line",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"!=",
"2",
")",
"{",
"return",
"false",
";",
"}",
"$",
"line",
"=",
"implode",
"(",
"\" , \"",
",",
"$",
"parts",
")",
";",
"if",
"(",
"!",
"ctype_digit",
"(",
"$",
"parts",
"[",
"0",
"]",
")",
"||",
"!",
"ctype_digit",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
")",
"{",
"return",
"$",
"line",
".",
"\" : ERROR : INVALID-PORT\"",
";",
"}",
"$",
"cport",
"=",
"(",
"int",
")",
"$",
"parts",
"[",
"0",
"]",
";",
"$",
"sport",
"=",
"(",
"int",
")",
"$",
"parts",
"[",
"1",
"]",
";",
"if",
"(",
"$",
"sport",
"<=",
"0",
"||",
"$",
"sport",
">",
"65535",
"||",
"$",
"cport",
"<=",
"0",
"||",
"$",
"cport",
">",
"65535",
")",
"{",
"return",
"$",
"line",
".",
"\" : ERROR : INVALID-PORT\"",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"bot",
"->",
"getConnections",
"(",
")",
"as",
"$",
"connection",
")",
"{",
"if",
"(",
"$",
"connection",
"==",
"$",
"this",
")",
"{",
"continue",
";",
"}",
"$",
"socket",
"=",
"$",
"connection",
"->",
"getSocket",
"(",
")",
";",
"$",
"rport",
"=",
"(",
"int",
")",
"substr",
"(",
"strrchr",
"(",
"stream_socket_get_name",
"(",
"$",
"socket",
",",
"true",
")",
",",
"':'",
")",
",",
"1",
")",
";",
"if",
"(",
"$",
"rport",
"!=",
"$",
"sport",
")",
"{",
"continue",
";",
"}",
"$",
"lport",
"=",
"(",
"int",
")",
"substr",
"(",
"strrchr",
"(",
"stream_socket_get_name",
"(",
"$",
"socket",
",",
"false",
")",
",",
"':'",
")",
",",
"1",
")",
";",
"if",
"(",
"$",
"lport",
"!=",
"$",
"cport",
")",
"{",
"continue",
";",
"}",
"try",
"{",
"$",
"config",
"=",
"$",
"connection",
"->",
"getConfig",
"(",
"null",
")",
";",
"$",
"identity",
"=",
"$",
"config",
"->",
"parseString",
"(",
"'\\\\Erebot\\\\Module\\\\IrcConnector'",
",",
"'identity'",
",",
"''",
")",
";",
"return",
"$",
"line",
".",
"\" : USERID : UNIX : \"",
".",
"$",
"identity",
";",
"}",
"catch",
"(",
"\\",
"Erebot",
"\\",
"Exception",
"$",
"e",
")",
"{",
"return",
"$",
"line",
".",
"\" : ERROR : HIDDEN-USER \"",
";",
"}",
"}",
"return",
"$",
"line",
".",
"\" : ERROR : NO-USER\"",
";",
"}"
] | Handles an IdentD request.
\param string $line
IdentD request to handle.
\retval string
Message to send as the response
to this request.
\retval false
The request was malformed. | [
"Handles",
"an",
"IdentD",
"request",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Identd/Worker.php#L123-L177 |
32,228 | PGB-LIV/php-ms | src/Reader/HupoPsi/PsiXmlTrait.php | PsiXmlTrait.getCvParam | protected function getCvParam($xml)
{
$cvParam = array();
// Required fields
$cvParam['cvRef'] = (string) $xml->attributes()->cvRef;
$cvParam[PsiVerb::CV_ACCESSION] = (string) $xml->attributes()->accession;
$cvParam[PsiVerb::CV_NAME] = (string) $xml->attributes()->name;
if (! isset($this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]])) {
$this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]] = $cvParam['name'];
}
// Optional fields
if (isset($xml->attributes()->value)) {
$cvParam[PsiVerb::CV_VALUE] = (string) $xml->attributes()->value;
}
if (isset($xml->attributes()->unitAccession)) {
$cvParam[PsiVerb::CV_UNITACCESSION] = (string) $xml->attributes()->unitAccession;
}
if (isset($xml->attributes()->unitName)) {
$cvParam['unitName'] = (string) $xml->attributes()->unitName;
}
if (isset($xml->attributes()->unitCvRef)) {
$cvParam['unitCvRef'] = (string) $xml->attributes()->unitCvRef;
}
return $cvParam;
} | php | protected function getCvParam($xml)
{
$cvParam = array();
// Required fields
$cvParam['cvRef'] = (string) $xml->attributes()->cvRef;
$cvParam[PsiVerb::CV_ACCESSION] = (string) $xml->attributes()->accession;
$cvParam[PsiVerb::CV_NAME] = (string) $xml->attributes()->name;
if (! isset($this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]])) {
$this->cvParamIndex[$cvParam[PsiVerb::CV_ACCESSION]] = $cvParam['name'];
}
// Optional fields
if (isset($xml->attributes()->value)) {
$cvParam[PsiVerb::CV_VALUE] = (string) $xml->attributes()->value;
}
if (isset($xml->attributes()->unitAccession)) {
$cvParam[PsiVerb::CV_UNITACCESSION] = (string) $xml->attributes()->unitAccession;
}
if (isset($xml->attributes()->unitName)) {
$cvParam['unitName'] = (string) $xml->attributes()->unitName;
}
if (isset($xml->attributes()->unitCvRef)) {
$cvParam['unitCvRef'] = (string) $xml->attributes()->unitCvRef;
}
return $cvParam;
} | [
"protected",
"function",
"getCvParam",
"(",
"$",
"xml",
")",
"{",
"$",
"cvParam",
"=",
"array",
"(",
")",
";",
"// Required fields",
"$",
"cvParam",
"[",
"'cvRef'",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"cvRef",
";",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSION",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"accession",
";",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_NAME",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"name",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cvParamIndex",
"[",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSION",
"]",
"]",
")",
")",
"{",
"$",
"this",
"->",
"cvParamIndex",
"[",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSION",
"]",
"]",
"=",
"$",
"cvParam",
"[",
"'name'",
"]",
";",
"}",
"// Optional fields",
"if",
"(",
"isset",
"(",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"value",
")",
")",
"{",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_VALUE",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"value",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitAccession",
")",
")",
"{",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_UNITACCESSION",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitAccession",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitName",
")",
")",
"{",
"$",
"cvParam",
"[",
"'unitName'",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitName",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitCvRef",
")",
")",
"{",
"$",
"cvParam",
"[",
"'unitCvRef'",
"]",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"unitCvRef",
";",
"}",
"return",
"$",
"cvParam",
";",
"}"
] | Creates an array object from a CvParam object
@param \SimpleXMLElement $xml | [
"Creates",
"an",
"array",
"object",
"from",
"a",
"CvParam",
"object"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/HupoPsi/PsiXmlTrait.php#L57-L88 |
32,229 | chameleon-system/chameleon-shop | src/ShopOrderStatusBundle/objects/data/TPkgShopOrderStatusDataEndPoint.class.php | TPkgShopOrderStatusDataEndPoint.getDataAsTdbArray | public function getDataAsTdbArray()
{
$data = (null === $this->getStatusData()) ? array() : $this->getStatusData()->all();
$data = serialize($data);
return array(
'shop_order_id' => $this->getOrder()->id,
'shop_order_status_code_id' => $this->getShopOrderStatusCodeObject()->id,
'status_date' => date('Y-m-d H:i:s', $this->getStatusTimestamp()),
'info' => $this->getInfo(),
'data' => $data,
);
} | php | public function getDataAsTdbArray()
{
$data = (null === $this->getStatusData()) ? array() : $this->getStatusData()->all();
$data = serialize($data);
return array(
'shop_order_id' => $this->getOrder()->id,
'shop_order_status_code_id' => $this->getShopOrderStatusCodeObject()->id,
'status_date' => date('Y-m-d H:i:s', $this->getStatusTimestamp()),
'info' => $this->getInfo(),
'data' => $data,
);
} | [
"public",
"function",
"getDataAsTdbArray",
"(",
")",
"{",
"$",
"data",
"=",
"(",
"null",
"===",
"$",
"this",
"->",
"getStatusData",
"(",
")",
")",
"?",
"array",
"(",
")",
":",
"$",
"this",
"->",
"getStatusData",
"(",
")",
"->",
"all",
"(",
")",
";",
"$",
"data",
"=",
"serialize",
"(",
"$",
"data",
")",
";",
"return",
"array",
"(",
"'shop_order_id'",
"=>",
"$",
"this",
"->",
"getOrder",
"(",
")",
"->",
"id",
",",
"'shop_order_status_code_id'",
"=>",
"$",
"this",
"->",
"getShopOrderStatusCodeObject",
"(",
")",
"->",
"id",
",",
"'status_date'",
"=>",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"$",
"this",
"->",
"getStatusTimestamp",
"(",
")",
")",
",",
"'info'",
"=>",
"$",
"this",
"->",
"getInfo",
"(",
")",
",",
"'data'",
"=>",
"$",
"data",
",",
")",
";",
"}"
] | returns an assoc array with the data of the object mapped to to the tdb fields.
@return array | [
"returns",
"an",
"assoc",
"array",
"with",
"the",
"data",
"of",
"the",
"object",
"mapped",
"to",
"to",
"the",
"tdb",
"fields",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopOrderStatusBundle/objects/data/TPkgShopOrderStatusDataEndPoint.class.php#L226-L238 |
32,230 | chameleon-system/chameleon-shop | src/ShopBundle/objects/BackendModules/CMSShopArticleIndex/CMSShopArticleIndex.class.php | CMSShopArticleIndex.ClearSearchCacheTables | public function ClearSearchCacheTables()
{
$sQuery = 'TRUNCATE TABLE `shop_search_cache_item`';
\MySqlLegacySupport::getInstance()->query($sQuery);
$sQuery = 'TRUNCATE TABLE `shop_search_cache`';
\MySqlLegacySupport::getInstance()->query($sQuery);
} | php | public function ClearSearchCacheTables()
{
$sQuery = 'TRUNCATE TABLE `shop_search_cache_item`';
\MySqlLegacySupport::getInstance()->query($sQuery);
$sQuery = 'TRUNCATE TABLE `shop_search_cache`';
\MySqlLegacySupport::getInstance()->query($sQuery);
} | [
"public",
"function",
"ClearSearchCacheTables",
"(",
")",
"{",
"$",
"sQuery",
"=",
"'TRUNCATE TABLE `shop_search_cache_item`'",
";",
"\\",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"$",
"sQuery",
"=",
"'TRUNCATE TABLE `shop_search_cache`'",
";",
"\\",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"}"
] | Deletes the system's search cache tables. This method is called after
the successfull creation of the shop's search article index. | [
"Deletes",
"the",
"system",
"s",
"search",
"cache",
"tables",
".",
"This",
"method",
"is",
"called",
"after",
"the",
"successfull",
"creation",
"of",
"the",
"shop",
"s",
"search",
"article",
"index",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/BackendModules/CMSShopArticleIndex/CMSShopArticleIndex.class.php#L64-L70 |
32,231 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSInterface/TShopInterface_ImportOrderStatus.class.php | TShopInterface_ImportOrderStatus.ProcessRow | protected function ProcessRow($aRow)
{
// update order
$sOrderNr = '';
$sStatusCode = '';
if (array_key_exists($this->GetParameter('sFieldOrderNr'), $aRow)) {
$sOrderNr = $aRow[$this->GetParameter('sFieldOrderNr')];
}
if (array_key_exists($this->GetParameter('sFieldStatusCode'), $aRow)) {
$sStatusCode = $aRow[$this->GetParameter('sFieldStatusCode')];
}
if (!empty($sOrderNr) && !empty($sStatusCode)) {
$sDate = date('Y-m-d H:i:s');
$oOrder = TdbShopOrder::GetNewInstance();
if ($oOrder->LoadFromField('ordernumber', $sOrderNr)) { // order found.
$oStatusData = new TPkgShopOrderStatusData($oOrder, $sStatusCode, time());
$oStatus = new TPkgShopOrderStatusManager();
$oStatus->addStatus($oStatusData);
}
}
} | php | protected function ProcessRow($aRow)
{
// update order
$sOrderNr = '';
$sStatusCode = '';
if (array_key_exists($this->GetParameter('sFieldOrderNr'), $aRow)) {
$sOrderNr = $aRow[$this->GetParameter('sFieldOrderNr')];
}
if (array_key_exists($this->GetParameter('sFieldStatusCode'), $aRow)) {
$sStatusCode = $aRow[$this->GetParameter('sFieldStatusCode')];
}
if (!empty($sOrderNr) && !empty($sStatusCode)) {
$sDate = date('Y-m-d H:i:s');
$oOrder = TdbShopOrder::GetNewInstance();
if ($oOrder->LoadFromField('ordernumber', $sOrderNr)) { // order found.
$oStatusData = new TPkgShopOrderStatusData($oOrder, $sStatusCode, time());
$oStatus = new TPkgShopOrderStatusManager();
$oStatus->addStatus($oStatusData);
}
}
} | [
"protected",
"function",
"ProcessRow",
"(",
"$",
"aRow",
")",
"{",
"// update order",
"$",
"sOrderNr",
"=",
"''",
";",
"$",
"sStatusCode",
"=",
"''",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"GetParameter",
"(",
"'sFieldOrderNr'",
")",
",",
"$",
"aRow",
")",
")",
"{",
"$",
"sOrderNr",
"=",
"$",
"aRow",
"[",
"$",
"this",
"->",
"GetParameter",
"(",
"'sFieldOrderNr'",
")",
"]",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"GetParameter",
"(",
"'sFieldStatusCode'",
")",
",",
"$",
"aRow",
")",
")",
"{",
"$",
"sStatusCode",
"=",
"$",
"aRow",
"[",
"$",
"this",
"->",
"GetParameter",
"(",
"'sFieldStatusCode'",
")",
"]",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"sOrderNr",
")",
"&&",
"!",
"empty",
"(",
"$",
"sStatusCode",
")",
")",
"{",
"$",
"sDate",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"oOrder",
"=",
"TdbShopOrder",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oOrder",
"->",
"LoadFromField",
"(",
"'ordernumber'",
",",
"$",
"sOrderNr",
")",
")",
"{",
"// order found.",
"$",
"oStatusData",
"=",
"new",
"TPkgShopOrderStatusData",
"(",
"$",
"oOrder",
",",
"$",
"sStatusCode",
",",
"time",
"(",
")",
")",
";",
"$",
"oStatus",
"=",
"new",
"TPkgShopOrderStatusManager",
"(",
")",
";",
"$",
"oStatus",
"->",
"addStatus",
"(",
"$",
"oStatusData",
")",
";",
"}",
"}",
"}"
] | process one row from the file.
@param array $aRow | [
"process",
"one",
"row",
"from",
"the",
"file",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSInterface/TShopInterface_ImportOrderStatus.class.php#L63-L83 |
32,232 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSInterface/TShopInterface_ImportOrderStatus.class.php | TShopInterface_ImportOrderStatus.GetLine | protected function GetLine()
{
$sLine = fgets($this->fp, 2048 * 16);
if (false === $sLine) {
return $sLine;
}
// find out if the line contains an uneven number of '"'. if so, we assume, that the line contains a line break
$sLine = trim($sLine);
$aTmpParts = explode('"', $sLine);
if (1 != (count($aTmpParts) % 2)) {
// need to read until we find the first '"'...
$bDone = false;
do {
$sTmpLine = fgets($this->fp, 2048 * 16);
if (false === $sTmpLine) {
$bDone = true;
} else {
$sTmpLine = trim($sTmpLine);
$sLine .= "\n".$sTmpLine;
$aTmpParts = explode('"', $sTmpLine);
if (1 != (count($aTmpParts) % 2)) {
$bDone = true;
}
}
} while (!$bDone);
}
$sLine = utf8_encode($sLine);
$aParts = explode($this->sLineSplit, $sLine);
// strip quotes
foreach (array_keys($aParts) as $sIndex) {
$aParts[$sIndex] = trim($aParts[$sIndex]);
if ('"' == substr($aParts[$sIndex], 0, 1) && '"' == substr($aParts[$sIndex], -1)) {
$aParts[$sIndex] = substr($aParts[$sIndex], 1, -1);
}
}
reset($aParts);
return $aParts;
} | php | protected function GetLine()
{
$sLine = fgets($this->fp, 2048 * 16);
if (false === $sLine) {
return $sLine;
}
// find out if the line contains an uneven number of '"'. if so, we assume, that the line contains a line break
$sLine = trim($sLine);
$aTmpParts = explode('"', $sLine);
if (1 != (count($aTmpParts) % 2)) {
// need to read until we find the first '"'...
$bDone = false;
do {
$sTmpLine = fgets($this->fp, 2048 * 16);
if (false === $sTmpLine) {
$bDone = true;
} else {
$sTmpLine = trim($sTmpLine);
$sLine .= "\n".$sTmpLine;
$aTmpParts = explode('"', $sTmpLine);
if (1 != (count($aTmpParts) % 2)) {
$bDone = true;
}
}
} while (!$bDone);
}
$sLine = utf8_encode($sLine);
$aParts = explode($this->sLineSplit, $sLine);
// strip quotes
foreach (array_keys($aParts) as $sIndex) {
$aParts[$sIndex] = trim($aParts[$sIndex]);
if ('"' == substr($aParts[$sIndex], 0, 1) && '"' == substr($aParts[$sIndex], -1)) {
$aParts[$sIndex] = substr($aParts[$sIndex], 1, -1);
}
}
reset($aParts);
return $aParts;
} | [
"protected",
"function",
"GetLine",
"(",
")",
"{",
"$",
"sLine",
"=",
"fgets",
"(",
"$",
"this",
"->",
"fp",
",",
"2048",
"*",
"16",
")",
";",
"if",
"(",
"false",
"===",
"$",
"sLine",
")",
"{",
"return",
"$",
"sLine",
";",
"}",
"// find out if the line contains an uneven number of '\"'. if so, we assume, that the line contains a line break",
"$",
"sLine",
"=",
"trim",
"(",
"$",
"sLine",
")",
";",
"$",
"aTmpParts",
"=",
"explode",
"(",
"'\"'",
",",
"$",
"sLine",
")",
";",
"if",
"(",
"1",
"!=",
"(",
"count",
"(",
"$",
"aTmpParts",
")",
"%",
"2",
")",
")",
"{",
"// need to read until we find the first '\"'...",
"$",
"bDone",
"=",
"false",
";",
"do",
"{",
"$",
"sTmpLine",
"=",
"fgets",
"(",
"$",
"this",
"->",
"fp",
",",
"2048",
"*",
"16",
")",
";",
"if",
"(",
"false",
"===",
"$",
"sTmpLine",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"sTmpLine",
"=",
"trim",
"(",
"$",
"sTmpLine",
")",
";",
"$",
"sLine",
".=",
"\"\\n\"",
".",
"$",
"sTmpLine",
";",
"$",
"aTmpParts",
"=",
"explode",
"(",
"'\"'",
",",
"$",
"sTmpLine",
")",
";",
"if",
"(",
"1",
"!=",
"(",
"count",
"(",
"$",
"aTmpParts",
")",
"%",
"2",
")",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"}",
"}",
"while",
"(",
"!",
"$",
"bDone",
")",
";",
"}",
"$",
"sLine",
"=",
"utf8_encode",
"(",
"$",
"sLine",
")",
";",
"$",
"aParts",
"=",
"explode",
"(",
"$",
"this",
"->",
"sLineSplit",
",",
"$",
"sLine",
")",
";",
"// strip quotes",
"foreach",
"(",
"array_keys",
"(",
"$",
"aParts",
")",
"as",
"$",
"sIndex",
")",
"{",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
"=",
"trim",
"(",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
")",
";",
"if",
"(",
"'\"'",
"==",
"substr",
"(",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
",",
"0",
",",
"1",
")",
"&&",
"'\"'",
"==",
"substr",
"(",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
",",
"-",
"1",
")",
")",
"{",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
"=",
"substr",
"(",
"$",
"aParts",
"[",
"$",
"sIndex",
"]",
",",
"1",
",",
"-",
"1",
")",
";",
"}",
"}",
"reset",
"(",
"$",
"aParts",
")",
";",
"return",
"$",
"aParts",
";",
"}"
] | get a line from the file.
@return array | [
"get",
"a",
"line",
"from",
"the",
"file",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSInterface/TShopInterface_ImportOrderStatus.class.php#L90-L129 |
32,233 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportXMLEndPoint.class.php | TPkgShopProductExportXMLEndPoint.CleanContent | protected function CleanContent($sValue)
{
$sValue = parent::CleanContent($sValue);
$sValue = str_replace('"', '"', $sValue);
$sValue = str_replace('&', '&', $sValue);
$sValue = str_replace('>', '>', $sValue);
$sValue = str_replace('<', '<', $sValue);
$sValue = str_replace("'", ''', $sValue);
return $sValue;
} | php | protected function CleanContent($sValue)
{
$sValue = parent::CleanContent($sValue);
$sValue = str_replace('"', '"', $sValue);
$sValue = str_replace('&', '&', $sValue);
$sValue = str_replace('>', '>', $sValue);
$sValue = str_replace('<', '<', $sValue);
$sValue = str_replace("'", ''', $sValue);
return $sValue;
} | [
"protected",
"function",
"CleanContent",
"(",
"$",
"sValue",
")",
"{",
"$",
"sValue",
"=",
"parent",
"::",
"CleanContent",
"(",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"str_replace",
"(",
"'\"'",
",",
"'"'",
",",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"str_replace",
"(",
"'>'",
",",
"'>'",
",",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"str_replace",
"(",
"'<'",
",",
"'<'",
",",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"str_replace",
"(",
"\"'\"",
",",
"'''",
",",
"$",
"sValue",
")",
";",
"return",
"$",
"sValue",
";",
"}"
] | clean up the content replace all characters that could cause errors in the xml.
@param $sValue
@return string | [
"clean",
"up",
"the",
"content",
"replace",
"all",
"characters",
"that",
"could",
"cause",
"errors",
"in",
"the",
"xml",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportXMLEndPoint.class.php#L51-L62 |
32,234 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/TypeHelper.php | TypeHelper.normaliseValueToType | public function normaliseValueToType($value, string $expectedType)
{
if (null === $value) {
return null;
}
switch ($expectedType) {
case 'string':
return $this->normaliseString($value);
case 'bool':
return $this->normaliseBool($value);
case 'int':
return $this->normaliseInt($value);
case 'float':
return $this->normaliseFloat($value);
case MappingHelper::PHP_TYPE_DATETIME:
return $this->normaliseDateTime($value);
default:
throw new \RuntimeException('hit unexpected type ' . $expectedType . ' in ' . __METHOD__);
}
} | php | public function normaliseValueToType($value, string $expectedType)
{
if (null === $value) {
return null;
}
switch ($expectedType) {
case 'string':
return $this->normaliseString($value);
case 'bool':
return $this->normaliseBool($value);
case 'int':
return $this->normaliseInt($value);
case 'float':
return $this->normaliseFloat($value);
case MappingHelper::PHP_TYPE_DATETIME:
return $this->normaliseDateTime($value);
default:
throw new \RuntimeException('hit unexpected type ' . $expectedType . ' in ' . __METHOD__);
}
} | [
"public",
"function",
"normaliseValueToType",
"(",
"$",
"value",
",",
"string",
"$",
"expectedType",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"$",
"expectedType",
")",
"{",
"case",
"'string'",
":",
"return",
"$",
"this",
"->",
"normaliseString",
"(",
"$",
"value",
")",
";",
"case",
"'bool'",
":",
"return",
"$",
"this",
"->",
"normaliseBool",
"(",
"$",
"value",
")",
";",
"case",
"'int'",
":",
"return",
"$",
"this",
"->",
"normaliseInt",
"(",
"$",
"value",
")",
";",
"case",
"'float'",
":",
"return",
"$",
"this",
"->",
"normaliseFloat",
"(",
"$",
"value",
")",
";",
"case",
"MappingHelper",
"::",
"PHP_TYPE_DATETIME",
":",
"return",
"$",
"this",
"->",
"normaliseDateTime",
"(",
"$",
"value",
")",
";",
"default",
":",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'hit unexpected type '",
".",
"$",
"expectedType",
".",
"' in '",
".",
"__METHOD__",
")",
";",
"}",
"}"
] | When a default is passed in via CLI then the type can not be expected to be set correctly
This function takes the string value and normalises it into the correct value based on the expected type
@param mixed $value
@param string $expectedType
@return mixed | [
"When",
"a",
"default",
"is",
"passed",
"in",
"via",
"CLI",
"then",
"the",
"type",
"can",
"not",
"be",
"expected",
"to",
"be",
"set",
"correctly"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/TypeHelper.php#L46-L65 |
32,235 | CHH/sirel | lib/Sirel/Table.php | Table.project | function project($projections)
{
$select = $this->from();
if (1 === func_num_args() and is_array($projections)) {
return $select->project($projections);
} else {
return $select->project(func_get_args());
}
} | php | function project($projections)
{
$select = $this->from();
if (1 === func_num_args() and is_array($projections)) {
return $select->project($projections);
} else {
return $select->project(func_get_args());
}
} | [
"function",
"project",
"(",
"$",
"projections",
")",
"{",
"$",
"select",
"=",
"$",
"this",
"->",
"from",
"(",
")",
";",
"if",
"(",
"1",
"===",
"func_num_args",
"(",
")",
"and",
"is_array",
"(",
"$",
"projections",
")",
")",
"{",
"return",
"$",
"select",
"->",
"project",
"(",
"$",
"projections",
")",
";",
"}",
"else",
"{",
"return",
"$",
"select",
"->",
"project",
"(",
"func_get_args",
"(",
")",
")",
";",
"}",
"}"
] | Returns a new Select Manager and adds the given expressions as projections
@param array $projections|mixed $projection,...
@return SelectManager | [
"Returns",
"a",
"new",
"Select",
"Manager",
"and",
"adds",
"the",
"given",
"expressions",
"as",
"projections"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L137-L145 |
32,236 | CHH/sirel | lib/Sirel/Table.php | Table.where | function where($expr)
{
$select = $this->from();
foreach (func_get_args() as $expr) {
$select->where($expr);
}
return $select;
} | php | function where($expr)
{
$select = $this->from();
foreach (func_get_args() as $expr) {
$select->where($expr);
}
return $select;
} | [
"function",
"where",
"(",
"$",
"expr",
")",
"{",
"$",
"select",
"=",
"$",
"this",
"->",
"from",
"(",
")",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"expr",
")",
"{",
"$",
"select",
"->",
"where",
"(",
"$",
"expr",
")",
";",
"}",
"return",
"$",
"select",
";",
"}"
] | Create a new Select Manager and add the given expressions
to its restrictions.
@param mixed $expr,...
@return SelectManager | [
"Create",
"a",
"new",
"Select",
"Manager",
"and",
"add",
"the",
"given",
"expressions",
"to",
"its",
"restrictions",
"."
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L165-L172 |
32,237 | CHH/sirel | lib/Sirel/Table.php | Table.order | function order($expr, $direction = \Sirel\Node\Order::ASC)
{
return $this->from()->order($expr, $direction);
} | php | function order($expr, $direction = \Sirel\Node\Order::ASC)
{
return $this->from()->order($expr, $direction);
} | [
"function",
"order",
"(",
"$",
"expr",
",",
"$",
"direction",
"=",
"\\",
"Sirel",
"\\",
"Node",
"\\",
"Order",
"::",
"ASC",
")",
"{",
"return",
"$",
"this",
"->",
"from",
"(",
")",
"->",
"order",
"(",
"$",
"expr",
",",
"$",
"direction",
")",
";",
"}"
] | Create a new Select Manager and with an Order Expression
@param mixed $expr Order Expression or Sort Column
@param string $direction Optional, Order Direction if an Sort Column
is given as first argument
@return SelectManager | [
"Create",
"a",
"new",
"Select",
"Manager",
"and",
"with",
"an",
"Order",
"Expression"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L182-L185 |
32,238 | CHH/sirel | lib/Sirel/Table.php | Table.addAttribute | function addAttribute(Attribute $attribute)
{
$attribute->setRelation($this);
$this->attributes[$attribute->getName()] = $attribute;
return $this;
} | php | function addAttribute(Attribute $attribute)
{
$attribute->setRelation($this);
$this->attributes[$attribute->getName()] = $attribute;
return $this;
} | [
"function",
"addAttribute",
"(",
"Attribute",
"$",
"attribute",
")",
"{",
"$",
"attribute",
"->",
"setRelation",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"attribute",
";",
"return",
"$",
"this",
";",
"}"
] | Predefine an Attribute with the given Instance
@param Attribute $attribute
@return Table | [
"Predefine",
"an",
"Attribute",
"with",
"the",
"given",
"Instance"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L238-L243 |
32,239 | CHH/sirel | lib/Sirel/Table.php | Table.offsetGet | function offsetGet($offset)
{
if (empty($this->attributes[$offset])) {
if ($this->strictScheme) {
throw new UnexpectedValueException(
"Strict Scheme: Attribute $offset is not defined."
);
}
$this->attributes[$offset] = new Attribute($offset, $this);
}
return $this->attributes[$offset];
} | php | function offsetGet($offset)
{
if (empty($this->attributes[$offset])) {
if ($this->strictScheme) {
throw new UnexpectedValueException(
"Strict Scheme: Attribute $offset is not defined."
);
}
$this->attributes[$offset] = new Attribute($offset, $this);
}
return $this->attributes[$offset];
} | [
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"strictScheme",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"\"Strict Scheme: Attribute $offset is not defined.\"",
")",
";",
"}",
"$",
"this",
"->",
"attributes",
"[",
"$",
"offset",
"]",
"=",
"new",
"Attribute",
"(",
"$",
"offset",
",",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"attributes",
"[",
"$",
"offset",
"]",
";",
"}"
] | Allow to access Table Attributes as array offsets on the table object
@thorws UnexpectedValueException If $strictScheme is ON and the
Offset is not defined
@return Attribute | [
"Allow",
"to",
"access",
"Table",
"Attributes",
"as",
"array",
"offsets",
"on",
"the",
"table",
"object"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L287-L298 |
32,240 | CHH/sirel | lib/Sirel/Table.php | Table.offsetSet | function offsetSet($offset, $value)
{
if (!$value instanceof Attribute) {
throw new InvalidArgumentException(
"Value is not an instance of \\Sirel\\Attribute"
);
}
$this->attributes[$offset] = $value;
} | php | function offsetSet($offset, $value)
{
if (!$value instanceof Attribute) {
throw new InvalidArgumentException(
"Value is not an instance of \\Sirel\\Attribute"
);
}
$this->attributes[$offset] = $value;
} | [
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"Attribute",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Value is not an instance of \\\\Sirel\\\\Attribute\"",
")",
";",
"}",
"$",
"this",
"->",
"attributes",
"[",
"$",
"offset",
"]",
"=",
"$",
"value",
";",
"}"
] | Define the given Attribute on the Table
@param string $offset
@param Attribute $value | [
"Define",
"the",
"given",
"Attribute",
"on",
"the",
"Table"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Table.php#L306-L314 |
32,241 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/ShopauskunftXmlStreamer.class.php | ShopauskunftXmlStreamer.checkIfRatingExists | private function checkIfRatingExists($ratingId)
{
$ratingId = MySqlLegacySupport::getInstance()->real_escape_string($ratingId);
$sQuery = "SELECT COUNT(*) AS item_count FROM pkg_shop_rating_service_rating WHERE remote_key = '".$ratingId."' ";
$result = MySqlLegacySupport::getInstance()->query($sQuery);
if ($result) {
$row = MySqlLegacySupport::getInstance()->fetch_object($result);
if ($row->item_count < 1) {
return false;
}
}
return true;
} | php | private function checkIfRatingExists($ratingId)
{
$ratingId = MySqlLegacySupport::getInstance()->real_escape_string($ratingId);
$sQuery = "SELECT COUNT(*) AS item_count FROM pkg_shop_rating_service_rating WHERE remote_key = '".$ratingId."' ";
$result = MySqlLegacySupport::getInstance()->query($sQuery);
if ($result) {
$row = MySqlLegacySupport::getInstance()->fetch_object($result);
if ($row->item_count < 1) {
return false;
}
}
return true;
} | [
"private",
"function",
"checkIfRatingExists",
"(",
"$",
"ratingId",
")",
"{",
"$",
"ratingId",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"ratingId",
")",
";",
"$",
"sQuery",
"=",
"\"SELECT COUNT(*) AS item_count FROM pkg_shop_rating_service_rating WHERE remote_key = '\"",
".",
"$",
"ratingId",
".",
"\"' \"",
";",
"$",
"result",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"$",
"row",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_object",
"(",
"$",
"result",
")",
";",
"if",
"(",
"$",
"row",
"->",
"item_count",
"<",
"1",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | checks if an rating exists.
@param $ratingId
@return bool | [
"checks",
"if",
"an",
"rating",
"exists",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/ShopauskunftXmlStreamer.class.php#L59-L73 |
32,242 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/ShopauskunftXmlStreamer.class.php | ShopauskunftXmlStreamer.getCriterionsAverageScore | protected function getCriterionsAverageScore(\SimpleXMLElement $rating)
{
$criterions = array('criterion1', 'criterion2', 'criterion3', 'criterion4', 'criterion5', 'criterion6');
$sum = 0;
$divider = 0;
foreach ($criterions as $criterion) {
$criterionValue = (float) $rating->$criterion;
if ($criterionValue > 0) {
++$divider;
$sum += $criterionValue;
}
}
$divider = (0 == $divider) ? count($criterions) : $divider;
return $sum / $divider;
} | php | protected function getCriterionsAverageScore(\SimpleXMLElement $rating)
{
$criterions = array('criterion1', 'criterion2', 'criterion3', 'criterion4', 'criterion5', 'criterion6');
$sum = 0;
$divider = 0;
foreach ($criterions as $criterion) {
$criterionValue = (float) $rating->$criterion;
if ($criterionValue > 0) {
++$divider;
$sum += $criterionValue;
}
}
$divider = (0 == $divider) ? count($criterions) : $divider;
return $sum / $divider;
} | [
"protected",
"function",
"getCriterionsAverageScore",
"(",
"\\",
"SimpleXMLElement",
"$",
"rating",
")",
"{",
"$",
"criterions",
"=",
"array",
"(",
"'criterion1'",
",",
"'criterion2'",
",",
"'criterion3'",
",",
"'criterion4'",
",",
"'criterion5'",
",",
"'criterion6'",
")",
";",
"$",
"sum",
"=",
"0",
";",
"$",
"divider",
"=",
"0",
";",
"foreach",
"(",
"$",
"criterions",
"as",
"$",
"criterion",
")",
"{",
"$",
"criterionValue",
"=",
"(",
"float",
")",
"$",
"rating",
"->",
"$",
"criterion",
";",
"if",
"(",
"$",
"criterionValue",
">",
"0",
")",
"{",
"++",
"$",
"divider",
";",
"$",
"sum",
"+=",
"$",
"criterionValue",
";",
"}",
"}",
"$",
"divider",
"=",
"(",
"0",
"==",
"$",
"divider",
")",
"?",
"count",
"(",
"$",
"criterions",
")",
":",
"$",
"divider",
";",
"return",
"$",
"sum",
"/",
"$",
"divider",
";",
"}"
] | Calculates the average score over all criterions.
@param SimpleXMLElement $rating The rating
@return float The average score | [
"Calculates",
"the",
"average",
"score",
"over",
"all",
"criterions",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/ShopauskunftXmlStreamer.class.php#L82-L97 |
32,243 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExampleCLI.php | AutomaticPaymentsSimpleCheckoutExampleCLI._calculatePaymentAmountBasedOnBuyerDestinationAddress | private function _calculatePaymentAmountBasedOnBuyerDestinationAddress ()
{
$response = $this->callStepAndCheckForException('getBillingAgreementDetails');
printGetBillingAgreementDetailsResponse($response);
$orderTotalPreTaxAndShipping = $this->_getPreTaxAndShippingOrderAmountFromStdIn();
$shippingType = $this->_getShippingTypeFromStdIn();
return $this->exampleClass->calculatePaymentAmountBasedOnBuyerDetails(
$response->getGetBillingAgreementDetailsResult()
->getBillingAgreementDetails(), $orderTotalPreTaxAndShipping, $shippingType);
} | php | private function _calculatePaymentAmountBasedOnBuyerDestinationAddress ()
{
$response = $this->callStepAndCheckForException('getBillingAgreementDetails');
printGetBillingAgreementDetailsResponse($response);
$orderTotalPreTaxAndShipping = $this->_getPreTaxAndShippingOrderAmountFromStdIn();
$shippingType = $this->_getShippingTypeFromStdIn();
return $this->exampleClass->calculatePaymentAmountBasedOnBuyerDetails(
$response->getGetBillingAgreementDetailsResult()
->getBillingAgreementDetails(), $orderTotalPreTaxAndShipping, $shippingType);
} | [
"private",
"function",
"_calculatePaymentAmountBasedOnBuyerDestinationAddress",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"callStepAndCheckForException",
"(",
"'getBillingAgreementDetails'",
")",
";",
"printGetBillingAgreementDetailsResponse",
"(",
"$",
"response",
")",
";",
"$",
"orderTotalPreTaxAndShipping",
"=",
"$",
"this",
"->",
"_getPreTaxAndShippingOrderAmountFromStdIn",
"(",
")",
";",
"$",
"shippingType",
"=",
"$",
"this",
"->",
"_getShippingTypeFromStdIn",
"(",
")",
";",
"return",
"$",
"this",
"->",
"exampleClass",
"->",
"calculatePaymentAmountBasedOnBuyerDetails",
"(",
"$",
"response",
"->",
"getGetBillingAgreementDetailsResult",
"(",
")",
"->",
"getBillingAgreementDetails",
"(",
")",
",",
"$",
"orderTotalPreTaxAndShipping",
",",
"$",
"shippingType",
")",
";",
"}"
] | Retreive the current information about the billing agreement as indicated
by the buyer and calculate amount for each payment to charge, based on
address destination state and country
@return string total amount for the order that the merchant will charge
the buyer | [
"Retreive",
"the",
"current",
"information",
"about",
"the",
"billing",
"agreement",
"as",
"indicated",
"by",
"the",
"buyer",
"and",
"calculate",
"amount",
"for",
"each",
"payment",
"to",
"charge",
"based",
"on",
"address",
"destination",
"state",
"and",
"country"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExampleCLI.php#L135-L146 |
32,244 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExampleCLI.php | AutomaticPaymentsSimpleCheckoutExampleCLI._authorizePaymentAmount | private function _authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$response = $this->callStepAndCheckForException('authorizePaymentAmount',
array(
$authorizationAmount,
$authorizationReferenceId
));
printAuthorizeOnBillingAgreementResponse($response);
return $response->getAuthorizeOnBillingAgreementResult()
->getAuthorizationDetails()
->getAmazonAuthorizationId();
} | php | private function _authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$response = $this->callStepAndCheckForException('authorizePaymentAmount',
array(
$authorizationAmount,
$authorizationReferenceId
));
printAuthorizeOnBillingAgreementResponse($response);
return $response->getAuthorizeOnBillingAgreementResult()
->getAuthorizationDetails()
->getAmazonAuthorizationId();
} | [
"private",
"function",
"_authorizePaymentAmount",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"callStepAndCheckForException",
"(",
"'authorizePaymentAmount'",
",",
"array",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
")",
";",
"printAuthorizeOnBillingAgreementResponse",
"(",
"$",
"response",
")",
";",
"return",
"$",
"response",
"->",
"getAuthorizeOnBillingAgreementResult",
"(",
")",
"->",
"getAuthorizationDetails",
"(",
")",
"->",
"getAmazonAuthorizationId",
"(",
")",
";",
"}"
] | Perform the authorize call for the billing agreement
@param float $authorizationAmount
amount to authorize from the buyer
@return string amazonAuthorizationId amazon generated authorization id
reference | [
"Perform",
"the",
"authorize",
"call",
"for",
"the",
"billing",
"agreement"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExampleCLI.php#L188-L199 |
32,245 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/ValidatedEntityTrait.php | ValidatedEntityTrait.getValidatorStaticMeta | private static function getValidatorStaticMeta(): ValidatorStaticMeta
{
if (null === self::$validatorStaticMeta) {
self::$validatorStaticMeta = new ValidatorStaticMeta(self::getDoctrineStaticMeta());
}
return self::$validatorStaticMeta;
} | php | private static function getValidatorStaticMeta(): ValidatorStaticMeta
{
if (null === self::$validatorStaticMeta) {
self::$validatorStaticMeta = new ValidatorStaticMeta(self::getDoctrineStaticMeta());
}
return self::$validatorStaticMeta;
} | [
"private",
"static",
"function",
"getValidatorStaticMeta",
"(",
")",
":",
"ValidatorStaticMeta",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"validatorStaticMeta",
")",
"{",
"self",
"::",
"$",
"validatorStaticMeta",
"=",
"new",
"ValidatorStaticMeta",
"(",
"self",
"::",
"getDoctrineStaticMeta",
"(",
")",
")",
";",
"}",
"return",
"self",
"::",
"$",
"validatorStaticMeta",
";",
"}"
] | Get an instance of the ValidatorStaticMeta object for this Entity
@return ValidatorStaticMeta | [
"Get",
"an",
"instance",
"of",
"the",
"ValidatorStaticMeta",
"object",
"for",
"this",
"Entity"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ValidatedEntityTrait.php#L42-L49 |
32,246 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataCore.class.php | TShopStepUserDataCore.AllowedMethods | public function AllowedMethods()
{
$externalFunctions = parent::AllowedMethods();
$externalFunctions[] = 'ShowShippingAddressInput';
$externalFunctions[] = 'HideShippingAddressInput';
$externalFunctions[] = 'UpdateUser';
$externalFunctions[] = 'Register';
$externalFunctions[] = 'UpdateUserAddress';
$externalFunctions[] = 'Login';
$externalFunctions[] = 'SelectBillingAddress';
$externalFunctions[] = 'SelectShippingAddress';
$externalFunctions[] = 'DeleteShippingAddress';
return $externalFunctions;
} | php | public function AllowedMethods()
{
$externalFunctions = parent::AllowedMethods();
$externalFunctions[] = 'ShowShippingAddressInput';
$externalFunctions[] = 'HideShippingAddressInput';
$externalFunctions[] = 'UpdateUser';
$externalFunctions[] = 'Register';
$externalFunctions[] = 'UpdateUserAddress';
$externalFunctions[] = 'Login';
$externalFunctions[] = 'SelectBillingAddress';
$externalFunctions[] = 'SelectShippingAddress';
$externalFunctions[] = 'DeleteShippingAddress';
return $externalFunctions;
} | [
"public",
"function",
"AllowedMethods",
"(",
")",
"{",
"$",
"externalFunctions",
"=",
"parent",
"::",
"AllowedMethods",
"(",
")",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'ShowShippingAddressInput'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'HideShippingAddressInput'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'UpdateUser'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'Register'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'UpdateUserAddress'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'Login'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'SelectBillingAddress'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'SelectShippingAddress'",
";",
"$",
"externalFunctions",
"[",
"]",
"=",
"'DeleteShippingAddress'",
";",
"return",
"$",
"externalFunctions",
";",
"}"
] | define any methods of the class that may be called via get or post.
@return array | [
"define",
"any",
"methods",
"of",
"the",
"class",
"that",
"may",
"be",
"called",
"via",
"get",
"or",
"post",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataCore.class.php#L150-L166 |
32,247 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataCore.class.php | TShopStepUserDataCore.& | protected function &LoadNewsletterSignup()
{
if (is_null($this->oNewsletterSignup)) {
$this->oNewsletterSignup = TdbPkgNewsletterUser::GetNewInstance();
$oNewslettter = &TdbPkgNewsletterUser::GetInstanceForActiveUser();
if (!is_null($oNewslettter)) {
$this->oNewsletterSignup = $oNewslettter;
}
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists(self::INPUT_DATA_NAME)) {
$aData = $oGlobal->GetUserData(self::INPUT_DATA_NAME);
if (is_array($aData)) {
// $aData['id'] = $this->oNewsletterSignup->id;
$aData = $this->CreateNewsletterArry($aData);
$this->oNewsletterSignup->LoadFromRowProtected($aData);
if ('1' == $aData['optin']) {
$this->oNewsletterSignup->sqlData['optin'] = '1';
$this->oNewsletterSignup->sqlData['optin_date'] = date('Y-m-d H:i:s');
$this->oNewsletterSignup->sqlData['signup_date'] = date('Y-m-d H:i:s');
}
}
}
}
return $this->oNewsletterSignup;
} | php | protected function &LoadNewsletterSignup()
{
if (is_null($this->oNewsletterSignup)) {
$this->oNewsletterSignup = TdbPkgNewsletterUser::GetNewInstance();
$oNewslettter = &TdbPkgNewsletterUser::GetInstanceForActiveUser();
if (!is_null($oNewslettter)) {
$this->oNewsletterSignup = $oNewslettter;
}
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists(self::INPUT_DATA_NAME)) {
$aData = $oGlobal->GetUserData(self::INPUT_DATA_NAME);
if (is_array($aData)) {
// $aData['id'] = $this->oNewsletterSignup->id;
$aData = $this->CreateNewsletterArry($aData);
$this->oNewsletterSignup->LoadFromRowProtected($aData);
if ('1' == $aData['optin']) {
$this->oNewsletterSignup->sqlData['optin'] = '1';
$this->oNewsletterSignup->sqlData['optin_date'] = date('Y-m-d H:i:s');
$this->oNewsletterSignup->sqlData['signup_date'] = date('Y-m-d H:i:s');
}
}
}
}
return $this->oNewsletterSignup;
} | [
"protected",
"function",
"&",
"LoadNewsletterSignup",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oNewsletterSignup",
")",
")",
"{",
"$",
"this",
"->",
"oNewsletterSignup",
"=",
"TdbPkgNewsletterUser",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oNewslettter",
"=",
"&",
"TdbPkgNewsletterUser",
"::",
"GetInstanceForActiveUser",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oNewslettter",
")",
")",
"{",
"$",
"this",
"->",
"oNewsletterSignup",
"=",
"$",
"oNewslettter",
";",
"}",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"self",
"::",
"INPUT_DATA_NAME",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"self",
"::",
"INPUT_DATA_NAME",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aData",
")",
")",
"{",
"// $aData['id'] = $this->oNewsletterSignup->id;",
"$",
"aData",
"=",
"$",
"this",
"->",
"CreateNewsletterArry",
"(",
"$",
"aData",
")",
";",
"$",
"this",
"->",
"oNewsletterSignup",
"->",
"LoadFromRowProtected",
"(",
"$",
"aData",
")",
";",
"if",
"(",
"'1'",
"==",
"$",
"aData",
"[",
"'optin'",
"]",
")",
"{",
"$",
"this",
"->",
"oNewsletterSignup",
"->",
"sqlData",
"[",
"'optin'",
"]",
"=",
"'1'",
";",
"$",
"this",
"->",
"oNewsletterSignup",
"->",
"sqlData",
"[",
"'optin_date'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"this",
"->",
"oNewsletterSignup",
"->",
"sqlData",
"[",
"'signup_date'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"this",
"->",
"oNewsletterSignup",
";",
"}"
] | lazzy load newsletter object.
@return TdbPkgNewsletterUser | [
"lazzy",
"load",
"newsletter",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataCore.class.php#L361-L387 |
32,248 | CHH/sirel | lib/Sirel/UpdateManager.php | UpdateManager.set | function set(array $values)
{
array_walk($values, function(&$val, $key) {
$key = new Node\UnqualifiedColumn($key);
$val = new Node\Assignment($key, $val);
});
$this->nodes->values = $values;
return $this;
} | php | function set(array $values)
{
array_walk($values, function(&$val, $key) {
$key = new Node\UnqualifiedColumn($key);
$val = new Node\Assignment($key, $val);
});
$this->nodes->values = $values;
return $this;
} | [
"function",
"set",
"(",
"array",
"$",
"values",
")",
"{",
"array_walk",
"(",
"$",
"values",
",",
"function",
"(",
"&",
"$",
"val",
",",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"new",
"Node",
"\\",
"UnqualifiedColumn",
"(",
"$",
"key",
")",
";",
"$",
"val",
"=",
"new",
"Node",
"\\",
"Assignment",
"(",
"$",
"key",
",",
"$",
"val",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"nodes",
"->",
"values",
"=",
"$",
"values",
";",
"return",
"$",
"this",
";",
"}"
] | Values for the Update
@param array $values Column-Value-Pairs
@return UpdateManager | [
"Values",
"for",
"the",
"Update"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/UpdateManager.php#L44-L53 |
32,249 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/AbstractFilesystemItem.php | AbstractFilesystemItem.create | public function create()
{
$this->assertPathIsSet();
$this->assertNotExists();
$this->doCreate();
$this->setPermissions();
return $this;
} | php | public function create()
{
$this->assertPathIsSet();
$this->assertNotExists();
$this->doCreate();
$this->setPermissions();
return $this;
} | [
"public",
"function",
"create",
"(",
")",
"{",
"$",
"this",
"->",
"assertPathIsSet",
"(",
")",
";",
"$",
"this",
"->",
"assertNotExists",
"(",
")",
";",
"$",
"this",
"->",
"doCreate",
"(",
")",
";",
"$",
"this",
"->",
"setPermissions",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Create the filesystem item, asserting that it does not already exist
@return static
@throws DoctrineStaticMetaException | [
"Create",
"the",
"filesystem",
"item",
"asserting",
"that",
"it",
"does",
"not",
"already",
"exist"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/AbstractFilesystemItem.php#L64-L72 |
32,250 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/AbstractFilesystemItem.php | AbstractFilesystemItem.exists | public function exists(): bool
{
$realPath = \realpath($this->path);
if (false === $realPath) {
return false;
}
$this->path = $realPath;
$this->assertCorrectType();
return true;
} | php | public function exists(): bool
{
$realPath = \realpath($this->path);
if (false === $realPath) {
return false;
}
$this->path = $realPath;
$this->assertCorrectType();
return true;
} | [
"public",
"function",
"exists",
"(",
")",
":",
"bool",
"{",
"$",
"realPath",
"=",
"\\",
"realpath",
"(",
"$",
"this",
"->",
"path",
")",
";",
"if",
"(",
"false",
"===",
"$",
"realPath",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"path",
"=",
"$",
"realPath",
";",
"$",
"this",
"->",
"assertCorrectType",
"(",
")",
";",
"return",
"true",
";",
"}"
] | Check if something exists at the real path
@return bool | [
"Check",
"if",
"something",
"exists",
"at",
"the",
"real",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/AbstractFilesystemItem.php#L101-L111 |
32,251 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/AbstractFilesystemItem.php | AbstractFilesystemItem.getSplFileInfo | public function getSplFileInfo(): \SplFileInfo
{
if (null !== $this->splFileInfo && $this->path === $this->splFileInfo->getRealPath()) {
return $this->splFileInfo;
}
$this->assertExists();
return $this->createSplFileInfo();
} | php | public function getSplFileInfo(): \SplFileInfo
{
if (null !== $this->splFileInfo && $this->path === $this->splFileInfo->getRealPath()) {
return $this->splFileInfo;
}
$this->assertExists();
return $this->createSplFileInfo();
} | [
"public",
"function",
"getSplFileInfo",
"(",
")",
":",
"\\",
"SplFileInfo",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"splFileInfo",
"&&",
"$",
"this",
"->",
"path",
"===",
"$",
"this",
"->",
"splFileInfo",
"->",
"getRealPath",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"splFileInfo",
";",
"}",
"$",
"this",
"->",
"assertExists",
"(",
")",
";",
"return",
"$",
"this",
"->",
"createSplFileInfo",
"(",
")",
";",
"}"
] | Provide an SplFileInfo object, asserting that the path exists
@return \SplFileInfo
@throws DoctrineStaticMetaException | [
"Provide",
"an",
"SplFileInfo",
"object",
"asserting",
"that",
"the",
"path",
"exists"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/AbstractFilesystemItem.php#L167-L175 |
32,252 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/AbstractFilesystemItem.php | AbstractFilesystemItem.createSplFileInfo | protected function createSplFileInfo(): \SplFileInfo
{
if (null !== $this->splFileInfo && $this->path === $this->splFileInfo->getRealPath()) {
return $this->splFileInfo;
}
$this->splFileInfo = new \SplFileInfo($this->path);
return $this->splFileInfo;
} | php | protected function createSplFileInfo(): \SplFileInfo
{
if (null !== $this->splFileInfo && $this->path === $this->splFileInfo->getRealPath()) {
return $this->splFileInfo;
}
$this->splFileInfo = new \SplFileInfo($this->path);
return $this->splFileInfo;
} | [
"protected",
"function",
"createSplFileInfo",
"(",
")",
":",
"\\",
"SplFileInfo",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"splFileInfo",
"&&",
"$",
"this",
"->",
"path",
"===",
"$",
"this",
"->",
"splFileInfo",
"->",
"getRealPath",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"splFileInfo",
";",
"}",
"$",
"this",
"->",
"splFileInfo",
"=",
"new",
"\\",
"SplFileInfo",
"(",
"$",
"this",
"->",
"path",
")",
";",
"return",
"$",
"this",
"->",
"splFileInfo",
";",
"}"
] | Create an SplFileInfo, assuming the path already exists
@return \SplFileInfo | [
"Create",
"an",
"SplFileInfo",
"assuming",
"the",
"path",
"already",
"exists"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/AbstractFilesystemItem.php#L190-L198 |
32,253 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/ErrorResponse.php | OffAmazonPaymentsService_Model_ErrorResponse.setError | public function setError($error)
{
if (!$this->_isNumericArray($error)) {
$error = array ($error);
}
$this->_fields['Error']['FieldValue'] = $error;
return $this;
} | php | public function setError($error)
{
if (!$this->_isNumericArray($error)) {
$error = array ($error);
}
$this->_fields['Error']['FieldValue'] = $error;
return $this;
} | [
"public",
"function",
"setError",
"(",
"$",
"error",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isNumericArray",
"(",
"$",
"error",
")",
")",
"{",
"$",
"error",
"=",
"array",
"(",
"$",
"error",
")",
";",
"}",
"$",
"this",
"->",
"_fields",
"[",
"'Error'",
"]",
"[",
"'FieldValue'",
"]",
"=",
"$",
"error",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the value of the Error.
@param mixed Error or an array of Error Error
@return this instance | [
"Sets",
"the",
"value",
"of",
"the",
"Error",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/ErrorResponse.php#L101-L108 |
32,254 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.setDestinationDirectory | private function setDestinationDirectory(
string $className,
array $subDirsNoEntities
): void {
$subDirsNoEntities = \array_slice($subDirsNoEntities, 2);
$this->destinationDirectory = $this->pathHelper->resolvePath(
$this->pathToProjectRoot
. '/' . $this->srcSubFolderName
. AbstractGenerator::ENTITY_RELATIONS_FOLDER_NAME
. \implode(
'/',
$subDirsNoEntities
)
. '/' . $className
);
} | php | private function setDestinationDirectory(
string $className,
array $subDirsNoEntities
): void {
$subDirsNoEntities = \array_slice($subDirsNoEntities, 2);
$this->destinationDirectory = $this->pathHelper->resolvePath(
$this->pathToProjectRoot
. '/' . $this->srcSubFolderName
. AbstractGenerator::ENTITY_RELATIONS_FOLDER_NAME
. \implode(
'/',
$subDirsNoEntities
)
. '/' . $className
);
} | [
"private",
"function",
"setDestinationDirectory",
"(",
"string",
"$",
"className",
",",
"array",
"$",
"subDirsNoEntities",
")",
":",
"void",
"{",
"$",
"subDirsNoEntities",
"=",
"\\",
"array_slice",
"(",
"$",
"subDirsNoEntities",
",",
"2",
")",
";",
"$",
"this",
"->",
"destinationDirectory",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"resolvePath",
"(",
"$",
"this",
"->",
"pathToProjectRoot",
".",
"'/'",
".",
"$",
"this",
"->",
"srcSubFolderName",
".",
"AbstractGenerator",
"::",
"ENTITY_RELATIONS_FOLDER_NAME",
".",
"\\",
"implode",
"(",
"'/'",
",",
"$",
"subDirsNoEntities",
")",
".",
"'/'",
".",
"$",
"className",
")",
";",
"}"
] | Calculate and set the destination full path to the destination directory for the generated relations files
@param string $className
@param array $subDirsNoEntities
@return void | [
"Calculate",
"and",
"set",
"the",
"destination",
"full",
"path",
"to",
"the",
"destination",
"directory",
"for",
"the",
"generated",
"relations",
"files"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L163-L180 |
32,255 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.copyRelationsTemplateToDestinationDirectory | private function copyRelationsTemplateToDestinationDirectory(): void
{
$this->pathHelper->copyTemplateDirectoryAndGetPath(
$this->pathToProjectRoot,
AbstractGenerator::RELATIONS_TEMPLATE_PATH,
$this->destinationDirectory
);
} | php | private function copyRelationsTemplateToDestinationDirectory(): void
{
$this->pathHelper->copyTemplateDirectoryAndGetPath(
$this->pathToProjectRoot,
AbstractGenerator::RELATIONS_TEMPLATE_PATH,
$this->destinationDirectory
);
} | [
"private",
"function",
"copyRelationsTemplateToDestinationDirectory",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"pathHelper",
"->",
"copyTemplateDirectoryAndGetPath",
"(",
"$",
"this",
"->",
"pathToProjectRoot",
",",
"AbstractGenerator",
"::",
"RELATIONS_TEMPLATE_PATH",
",",
"$",
"this",
"->",
"destinationDirectory",
")",
";",
"}"
] | Copy all the relations code templates into the destination directory read for processing
@throws DoctrineStaticMetaException | [
"Copy",
"all",
"the",
"relations",
"code",
"templates",
"into",
"the",
"destination",
"directory",
"read",
"for",
"processing"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L187-L194 |
32,256 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.processPaths | private function processPaths(\Generator $relativePathRelationsGenerator): void
{
foreach ($relativePathRelationsGenerator as $path => $fileInfo) {
$fullPath = $this->destinationDirectory . "/$path";
$path = \realpath($fullPath);
if (false === $path) {
throw new \RuntimeException("path $fullPath does not exist");
}
if ($fileInfo->isDir()) {
$this->dirsToRename[] = $path;
continue;
}
$this->performFindAndReplaceInFile($path);
$this->filesCreated[] = $path;
}
} | php | private function processPaths(\Generator $relativePathRelationsGenerator): void
{
foreach ($relativePathRelationsGenerator as $path => $fileInfo) {
$fullPath = $this->destinationDirectory . "/$path";
$path = \realpath($fullPath);
if (false === $path) {
throw new \RuntimeException("path $fullPath does not exist");
}
if ($fileInfo->isDir()) {
$this->dirsToRename[] = $path;
continue;
}
$this->performFindAndReplaceInFile($path);
$this->filesCreated[] = $path;
}
} | [
"private",
"function",
"processPaths",
"(",
"\\",
"Generator",
"$",
"relativePathRelationsGenerator",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"relativePathRelationsGenerator",
"as",
"$",
"path",
"=>",
"$",
"fileInfo",
")",
"{",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"destinationDirectory",
".",
"\"/$path\"",
";",
"$",
"path",
"=",
"\\",
"realpath",
"(",
"$",
"fullPath",
")",
";",
"if",
"(",
"false",
"===",
"$",
"path",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"path $fullPath does not exist\"",
")",
";",
"}",
"if",
"(",
"$",
"fileInfo",
"->",
"isDir",
"(",
")",
")",
"{",
"$",
"this",
"->",
"dirsToRename",
"[",
"]",
"=",
"$",
"path",
";",
"continue",
";",
"}",
"$",
"this",
"->",
"performFindAndReplaceInFile",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"filesCreated",
"[",
"]",
"=",
"$",
"path",
";",
"}",
"}"
] | Loop through the iterator paths and process each item
@param \Generator $relativePathRelationsGenerator | [
"Loop",
"through",
"the",
"iterator",
"paths",
"and",
"process",
"each",
"item"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L201-L216 |
32,257 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.performFindAndReplaceInFile | private function performFindAndReplaceInFile(
string $path
): void {
$this->findAndReplaceHelper->findReplace(
'use ' . RelationsGenerator::FIND_ENTITIES_NAMESPACE . '\\' . RelationsGenerator::FIND_ENTITY_NAME,
"use {$this->entityFqn}",
$path
);
$this->findAndReplaceHelper->findReplace(
'use ' .
RelationsGenerator::FIND_ENTITY_INTERFACE_NAMESPACE .
'\\' .
RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
"use {$this->entityInterfaceFqn}",
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%use(.+?)Relations\\\TemplateEntity(.+?);%',
'use ${1}Relations\\' . $this->singularNamespace . '${2};',
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%use(.+?)Relations\\\TemplateEntity(.+?);%',
'use ${1}Relations\\' . $this->pluralNamespace . '${2};',
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%(Has|Reciprocates)(Required|)TemplateEntity%',
'${1}${2}' . $this->singularNamespacedName,
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%(Has|Reciprocates)(Required|)TemplateEntities%',
'${1}${2}' . $this->pluralNamespacedName,
$path
);
$this->findAndReplaceHelper->findReplace(
RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
$this->namespaceHelper->basename($this->entityInterfaceFqn),
$path
);
$this->findAndReplaceHelper->replaceName($this->singularNamespacedName, $path);
$this->findAndReplaceHelper->replacePluralName($this->pluralNamespacedName, $path);
$this->findAndReplaceHelper->replaceProjectNamespace($this->projectRootNamespace, $path);
} | php | private function performFindAndReplaceInFile(
string $path
): void {
$this->findAndReplaceHelper->findReplace(
'use ' . RelationsGenerator::FIND_ENTITIES_NAMESPACE . '\\' . RelationsGenerator::FIND_ENTITY_NAME,
"use {$this->entityFqn}",
$path
);
$this->findAndReplaceHelper->findReplace(
'use ' .
RelationsGenerator::FIND_ENTITY_INTERFACE_NAMESPACE .
'\\' .
RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
"use {$this->entityInterfaceFqn}",
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%use(.+?)Relations\\\TemplateEntity(.+?);%',
'use ${1}Relations\\' . $this->singularNamespace . '${2};',
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%use(.+?)Relations\\\TemplateEntity(.+?);%',
'use ${1}Relations\\' . $this->pluralNamespace . '${2};',
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%(Has|Reciprocates)(Required|)TemplateEntity%',
'${1}${2}' . $this->singularNamespacedName,
$path
);
$this->findAndReplaceHelper->findReplaceRegex(
'%(Has|Reciprocates)(Required|)TemplateEntities%',
'${1}${2}' . $this->pluralNamespacedName,
$path
);
$this->findAndReplaceHelper->findReplace(
RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,
$this->namespaceHelper->basename($this->entityInterfaceFqn),
$path
);
$this->findAndReplaceHelper->replaceName($this->singularNamespacedName, $path);
$this->findAndReplaceHelper->replacePluralName($this->pluralNamespacedName, $path);
$this->findAndReplaceHelper->replaceProjectNamespace($this->projectRootNamespace, $path);
} | [
"private",
"function",
"performFindAndReplaceInFile",
"(",
"string",
"$",
"path",
")",
":",
"void",
"{",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplace",
"(",
"'use '",
".",
"RelationsGenerator",
"::",
"FIND_ENTITIES_NAMESPACE",
".",
"'\\\\'",
".",
"RelationsGenerator",
"::",
"FIND_ENTITY_NAME",
",",
"\"use {$this->entityFqn}\"",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplace",
"(",
"'use '",
".",
"RelationsGenerator",
"::",
"FIND_ENTITY_INTERFACE_NAMESPACE",
".",
"'\\\\'",
".",
"RelationsGenerator",
"::",
"FIND_ENTITY_INTERFACE_NAME",
",",
"\"use {$this->entityInterfaceFqn}\"",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplaceRegex",
"(",
"'%use(.+?)Relations\\\\\\TemplateEntity(.+?);%'",
",",
"'use ${1}Relations\\\\'",
".",
"$",
"this",
"->",
"singularNamespace",
".",
"'${2};'",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplaceRegex",
"(",
"'%use(.+?)Relations\\\\\\TemplateEntity(.+?);%'",
",",
"'use ${1}Relations\\\\'",
".",
"$",
"this",
"->",
"pluralNamespace",
".",
"'${2};'",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplaceRegex",
"(",
"'%(Has|Reciprocates)(Required|)TemplateEntity%'",
",",
"'${1}${2}'",
".",
"$",
"this",
"->",
"singularNamespacedName",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplaceRegex",
"(",
"'%(Has|Reciprocates)(Required|)TemplateEntities%'",
",",
"'${1}${2}'",
".",
"$",
"this",
"->",
"pluralNamespacedName",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"findReplace",
"(",
"RelationsGenerator",
"::",
"FIND_ENTITY_INTERFACE_NAME",
",",
"$",
"this",
"->",
"namespaceHelper",
"->",
"basename",
"(",
"$",
"this",
"->",
"entityInterfaceFqn",
")",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"replaceName",
"(",
"$",
"this",
"->",
"singularNamespacedName",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"replacePluralName",
"(",
"$",
"this",
"->",
"pluralNamespacedName",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"replaceProjectNamespace",
"(",
"$",
"this",
"->",
"projectRootNamespace",
",",
"$",
"path",
")",
";",
"}"
] | Perform the find and replace operations on the specified file
@param string $path | [
"Perform",
"the",
"find",
"and",
"replace",
"operations",
"on",
"the",
"specified",
"file"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L223-L267 |
32,258 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.renamePathsForCreatedFiles | private function renamePathsForCreatedFiles(): void
{
foreach ($this->filesCreated as $key => $realPath) {
$this->filesCreated[$key] = $this->pathHelper->renamePathBasenameSingularOrPlural(
$realPath,
$this->singularNamespacedName,
$this->pluralNamespacedName
);
}
} | php | private function renamePathsForCreatedFiles(): void
{
foreach ($this->filesCreated as $key => $realPath) {
$this->filesCreated[$key] = $this->pathHelper->renamePathBasenameSingularOrPlural(
$realPath,
$this->singularNamespacedName,
$this->pluralNamespacedName
);
}
} | [
"private",
"function",
"renamePathsForCreatedFiles",
"(",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filesCreated",
"as",
"$",
"key",
"=>",
"$",
"realPath",
")",
"{",
"$",
"this",
"->",
"filesCreated",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"renamePathBasenameSingularOrPlural",
"(",
"$",
"realPath",
",",
"$",
"this",
"->",
"singularNamespacedName",
",",
"$",
"this",
"->",
"pluralNamespacedName",
")",
";",
"}",
"}"
] | Loop through the created files and rename the paths
@throws DoctrineStaticMetaException | [
"Loop",
"through",
"the",
"created",
"files",
"and",
"rename",
"the",
"paths"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L274-L283 |
32,259 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.renameDirectories | private function renameDirectories(): void
{
//update directory names and update file created paths accordingly
foreach ($this->dirsToRename as $dirPath) {
$updateDirPath = $this->pathHelper->renamePathBasenameSingularOrPlural(
$dirPath,
$this->singularNamespacedName,
$this->pluralNamespacedName
);
foreach ($this->filesCreated as $k => $filePath) {
$this->filesCreated[$k] = \str_replace($dirPath, $updateDirPath, $filePath);
}
}
} | php | private function renameDirectories(): void
{
//update directory names and update file created paths accordingly
foreach ($this->dirsToRename as $dirPath) {
$updateDirPath = $this->pathHelper->renamePathBasenameSingularOrPlural(
$dirPath,
$this->singularNamespacedName,
$this->pluralNamespacedName
);
foreach ($this->filesCreated as $k => $filePath) {
$this->filesCreated[$k] = \str_replace($dirPath, $updateDirPath, $filePath);
}
}
} | [
"private",
"function",
"renameDirectories",
"(",
")",
":",
"void",
"{",
"//update directory names and update file created paths accordingly",
"foreach",
"(",
"$",
"this",
"->",
"dirsToRename",
"as",
"$",
"dirPath",
")",
"{",
"$",
"updateDirPath",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"renamePathBasenameSingularOrPlural",
"(",
"$",
"dirPath",
",",
"$",
"this",
"->",
"singularNamespacedName",
",",
"$",
"this",
"->",
"pluralNamespacedName",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"filesCreated",
"as",
"$",
"k",
"=>",
"$",
"filePath",
")",
"{",
"$",
"this",
"->",
"filesCreated",
"[",
"$",
"k",
"]",
"=",
"\\",
"str_replace",
"(",
"$",
"dirPath",
",",
"$",
"updateDirPath",
",",
"$",
"filePath",
")",
";",
"}",
"}",
"}"
] | Loop through all the directories to rename and then rename them
@throws DoctrineStaticMetaException | [
"Loop",
"through",
"all",
"the",
"directories",
"to",
"rename",
"and",
"then",
"rename",
"them"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L290-L303 |
32,260 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php | GenerateRelationCodeForEntity.updateNamespace | private function updateNamespace(): void
{
//now path is totally sorted, update namespace based on path
foreach ($this->filesCreated as $filePath) {
$this->findAndReplaceHelper->setNamespaceFromPath(
$filePath,
$this->srcSubFolderName,
$this->projectRootNamespace
);
}
} | php | private function updateNamespace(): void
{
//now path is totally sorted, update namespace based on path
foreach ($this->filesCreated as $filePath) {
$this->findAndReplaceHelper->setNamespaceFromPath(
$filePath,
$this->srcSubFolderName,
$this->projectRootNamespace
);
}
} | [
"private",
"function",
"updateNamespace",
"(",
")",
":",
"void",
"{",
"//now path is totally sorted, update namespace based on path",
"foreach",
"(",
"$",
"this",
"->",
"filesCreated",
"as",
"$",
"filePath",
")",
"{",
"$",
"this",
"->",
"findAndReplaceHelper",
"->",
"setNamespaceFromPath",
"(",
"$",
"filePath",
",",
"$",
"this",
"->",
"srcSubFolderName",
",",
"$",
"this",
"->",
"projectRootNamespace",
")",
";",
"}",
"}"
] | Update the namespace in all the created files
@throws DoctrineStaticMetaException | [
"Update",
"the",
"namespace",
"in",
"all",
"the",
"created",
"files"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Relations/GenerateRelationCodeForEntity.php#L310-L320 |
32,261 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.join | function join($relation, $expr = null, $mode = Join::INNER)
{
if (null !== $expr) {
$expr = new On(new AndX(array($expr)));
}
$join = new Join($relation, $expr);
$join->mode = $mode;
$this->nodes->source->right[] = $join;
return $this;
} | php | function join($relation, $expr = null, $mode = Join::INNER)
{
if (null !== $expr) {
$expr = new On(new AndX(array($expr)));
}
$join = new Join($relation, $expr);
$join->mode = $mode;
$this->nodes->source->right[] = $join;
return $this;
} | [
"function",
"join",
"(",
"$",
"relation",
",",
"$",
"expr",
"=",
"null",
",",
"$",
"mode",
"=",
"Join",
"::",
"INNER",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"expr",
")",
"{",
"$",
"expr",
"=",
"new",
"On",
"(",
"new",
"AndX",
"(",
"array",
"(",
"$",
"expr",
")",
")",
")",
";",
"}",
"$",
"join",
"=",
"new",
"Join",
"(",
"$",
"relation",
",",
"$",
"expr",
")",
";",
"$",
"join",
"->",
"mode",
"=",
"$",
"mode",
";",
"$",
"this",
"->",
"nodes",
"->",
"source",
"->",
"right",
"[",
"]",
"=",
"$",
"join",
";",
"return",
"$",
"this",
";",
"}"
] | Joins the selected relation with another relation, in the
given mode
@param mixed $relation
@param mixed $expr ON Expression
@param int $mode Join Mode (INNER, OUTER, LEFT)
@return SelectManager | [
"Joins",
"the",
"selected",
"relation",
"with",
"another",
"relation",
"in",
"the",
"given",
"mode"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L63-L74 |
32,262 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.leftJoin | function leftJoin($relation, $expr = null)
{
return $this->join($relation, $expr, Join::LEFT);
} | php | function leftJoin($relation, $expr = null)
{
return $this->join($relation, $expr, Join::LEFT);
} | [
"function",
"leftJoin",
"(",
"$",
"relation",
",",
"$",
"expr",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"join",
"(",
"$",
"relation",
",",
"$",
"expr",
",",
"Join",
"::",
"LEFT",
")",
";",
"}"
] | Convenience Method for creating LEFT JOINs | [
"Convenience",
"Method",
"for",
"creating",
"LEFT",
"JOINs"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L87-L90 |
32,263 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.on | function on($expr)
{
$lastJoin = $this->getLastJoinSource();
// Join all given expressions with AND
if ($lastJoin->right instanceof On) {
// Merge the new ON Expressions with the
// old if there exists an ON Expression
$lastJoin->right->expression = $expr;
} else {
// Otherwise create a new ON Expression
$lastJoin->right = new On($expr);
}
return $this;
} | php | function on($expr)
{
$lastJoin = $this->getLastJoinSource();
// Join all given expressions with AND
if ($lastJoin->right instanceof On) {
// Merge the new ON Expressions with the
// old if there exists an ON Expression
$lastJoin->right->expression = $expr;
} else {
// Otherwise create a new ON Expression
$lastJoin->right = new On($expr);
}
return $this;
} | [
"function",
"on",
"(",
"$",
"expr",
")",
"{",
"$",
"lastJoin",
"=",
"$",
"this",
"->",
"getLastJoinSource",
"(",
")",
";",
"// Join all given expressions with AND",
"if",
"(",
"$",
"lastJoin",
"->",
"right",
"instanceof",
"On",
")",
"{",
"// Merge the new ON Expressions with the ",
"// old if there exists an ON Expression",
"$",
"lastJoin",
"->",
"right",
"->",
"expression",
"=",
"$",
"expr",
";",
"}",
"else",
"{",
"// Otherwise create a new ON Expression",
"$",
"lastJoin",
"->",
"right",
"=",
"new",
"On",
"(",
"$",
"expr",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds Join Constraints to the last added Join Source
@param Node $expr,...
@return SelectManager | [
"Adds",
"Join",
"Constraints",
"to",
"the",
"last",
"added",
"Join",
"Source"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L110-L124 |
32,264 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.using | function using($columns)
{
$lastJoin = $this->getLastJoinSource();
if (null === $columns) {
$lastJoin->right = null;
return $this;
}
$columns = is_array($columns) ? $columns : func_get_args();
if ($lastJoin->right instanceof Using) {
$lastJoin->right->expression = array_merge(
$lastJoin->right->expression,
$columns
);
} else {
$lastJoin->right = new Grouping($columns);
}
return $this;
} | php | function using($columns)
{
$lastJoin = $this->getLastJoinSource();
if (null === $columns) {
$lastJoin->right = null;
return $this;
}
$columns = is_array($columns) ? $columns : func_get_args();
if ($lastJoin->right instanceof Using) {
$lastJoin->right->expression = array_merge(
$lastJoin->right->expression,
$columns
);
} else {
$lastJoin->right = new Grouping($columns);
}
return $this;
} | [
"function",
"using",
"(",
"$",
"columns",
")",
"{",
"$",
"lastJoin",
"=",
"$",
"this",
"->",
"getLastJoinSource",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"columns",
")",
"{",
"$",
"lastJoin",
"->",
"right",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}",
"$",
"columns",
"=",
"is_array",
"(",
"$",
"columns",
")",
"?",
"$",
"columns",
":",
"func_get_args",
"(",
")",
";",
"if",
"(",
"$",
"lastJoin",
"->",
"right",
"instanceof",
"Using",
")",
"{",
"$",
"lastJoin",
"->",
"right",
"->",
"expression",
"=",
"array_merge",
"(",
"$",
"lastJoin",
"->",
"right",
"->",
"expression",
",",
"$",
"columns",
")",
";",
"}",
"else",
"{",
"$",
"lastJoin",
"->",
"right",
"=",
"new",
"Grouping",
"(",
"$",
"columns",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds an USING Clause to the last Join
@param mixed $columns,... Either list of columns as first
argument or the columns as multiple arguments
@return SelectManager | [
"Adds",
"an",
"USING",
"Clause",
"to",
"the",
"last",
"Join"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L134-L154 |
32,265 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.project | function project($projections)
{
if (func_get_args() === 1) {
$projections = (array) $projections;
}
if (!is_array($projections)) {
$projections = func_get_args();
}
foreach ($projections as $projection) {
$this->nodes->projections[] = $projection;
}
return $this;
} | php | function project($projections)
{
if (func_get_args() === 1) {
$projections = (array) $projections;
}
if (!is_array($projections)) {
$projections = func_get_args();
}
foreach ($projections as $projection) {
$this->nodes->projections[] = $projection;
}
return $this;
} | [
"function",
"project",
"(",
"$",
"projections",
")",
"{",
"if",
"(",
"func_get_args",
"(",
")",
"===",
"1",
")",
"{",
"$",
"projections",
"=",
"(",
"array",
")",
"$",
"projections",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"projections",
")",
")",
"{",
"$",
"projections",
"=",
"func_get_args",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"projections",
"as",
"$",
"projection",
")",
"{",
"$",
"this",
"->",
"nodes",
"->",
"projections",
"[",
"]",
"=",
"$",
"projection",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds the given nodes to the list of projections for this Query
@param array $projections|Node $projection,...
@return SelectManager | [
"Adds",
"the",
"given",
"nodes",
"to",
"the",
"list",
"of",
"projections",
"for",
"this",
"Query"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L162-L176 |
32,266 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.group | function group($expr)
{
if (null === $expr) {
$this->nodes->groups = array();
} else {
$this->nodes->groups[] = new Group($expr);
}
return $this;
} | php | function group($expr)
{
if (null === $expr) {
$this->nodes->groups = array();
} else {
$this->nodes->groups[] = new Group($expr);
}
return $this;
} | [
"function",
"group",
"(",
"$",
"expr",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"expr",
")",
"{",
"$",
"this",
"->",
"nodes",
"->",
"groups",
"=",
"array",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"nodes",
"->",
"groups",
"[",
"]",
"=",
"new",
"Group",
"(",
"$",
"expr",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds a Group expression
@param mixed $expr
@return SelectManager | [
"Adds",
"a",
"Group",
"expression"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L183-L191 |
32,267 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.compileUpdate | function compileUpdate()
{
$updateManager = new UpdateManager;
$updateManager->table($this->nodes->source->getLeft());
foreach ($this->nodes->restrictions as $expr) {
$updateManager->where($expr);
}
foreach ($this->nodes->orders as $order) {
$updateManager->order($order);
}
empty($this->nodes->limit) ?:
$updateManager->take($this->nodes->limit->getExpression());
empty($this->nodes->offset) ?:
$updateManager->skip($this->nodes->offset->getExpression());
return $updateManager;
} | php | function compileUpdate()
{
$updateManager = new UpdateManager;
$updateManager->table($this->nodes->source->getLeft());
foreach ($this->nodes->restrictions as $expr) {
$updateManager->where($expr);
}
foreach ($this->nodes->orders as $order) {
$updateManager->order($order);
}
empty($this->nodes->limit) ?:
$updateManager->take($this->nodes->limit->getExpression());
empty($this->nodes->offset) ?:
$updateManager->skip($this->nodes->offset->getExpression());
return $updateManager;
} | [
"function",
"compileUpdate",
"(",
")",
"{",
"$",
"updateManager",
"=",
"new",
"UpdateManager",
";",
"$",
"updateManager",
"->",
"table",
"(",
"$",
"this",
"->",
"nodes",
"->",
"source",
"->",
"getLeft",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"->",
"restrictions",
"as",
"$",
"expr",
")",
"{",
"$",
"updateManager",
"->",
"where",
"(",
"$",
"expr",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"->",
"orders",
"as",
"$",
"order",
")",
"{",
"$",
"updateManager",
"->",
"order",
"(",
"$",
"order",
")",
";",
"}",
"empty",
"(",
"$",
"this",
"->",
"nodes",
"->",
"limit",
")",
"?",
":",
"$",
"updateManager",
"->",
"take",
"(",
"$",
"this",
"->",
"nodes",
"->",
"limit",
"->",
"getExpression",
"(",
")",
")",
";",
"empty",
"(",
"$",
"this",
"->",
"nodes",
"->",
"offset",
")",
"?",
":",
"$",
"updateManager",
"->",
"skip",
"(",
"$",
"this",
"->",
"nodes",
"->",
"offset",
"->",
"getExpression",
"(",
")",
")",
";",
"return",
"$",
"updateManager",
";",
"}"
] | Compiles an Update Query from the restrictions, orders, limits,
and offsets of this Select Query.
@return UpdateManager | [
"Compiles",
"an",
"Update",
"Query",
"from",
"the",
"restrictions",
"orders",
"limits",
"and",
"offsets",
"of",
"this",
"Select",
"Query",
"."
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L199-L219 |
32,268 | CHH/sirel | lib/Sirel/SelectManager.php | SelectManager.getLastJoinSource | protected function getLastJoinSource()
{
$lastJoin = current(array_slice($this->nodes->source->right, -1, 1));
if (!$lastJoin instanceof Join) {
throw new UnexpectedValueException(
"You are not in a Join Operation. Call join() first"
);
}
return $lastJoin;
} | php | protected function getLastJoinSource()
{
$lastJoin = current(array_slice($this->nodes->source->right, -1, 1));
if (!$lastJoin instanceof Join) {
throw new UnexpectedValueException(
"You are not in a Join Operation. Call join() first"
);
}
return $lastJoin;
} | [
"protected",
"function",
"getLastJoinSource",
"(",
")",
"{",
"$",
"lastJoin",
"=",
"current",
"(",
"array_slice",
"(",
"$",
"this",
"->",
"nodes",
"->",
"source",
"->",
"right",
",",
"-",
"1",
",",
"1",
")",
")",
";",
"if",
"(",
"!",
"$",
"lastJoin",
"instanceof",
"Join",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"\"You are not in a Join Operation. Call join() first\"",
")",
";",
"}",
"return",
"$",
"lastJoin",
";",
"}"
] | Returns the last Join Node
@throws UnexpectedValueException If no Join Node was found
@return Join | [
"Returns",
"the",
"last",
"Join",
"Node"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/SelectManager.php#L249-L260 |
32,269 | PGB-LIV/php-ms | src/Reader/FastaReader.php | FastaReader.parseEntry | private function parseEntry()
{
// Scan to first entry
do {
$line = trim($this->peekLine());
if (strpos($line, '>') === 0) {
break;
}
} while ($this->getLine());
$identifier = '';
while ($line = $this->getLine()) {
$line = trim($line);
$identifier .= substr($line, 1);
$nextLine = trim($this->peekLine());
if (strpos($nextLine, '>') !== 0) {
break;
}
}
$description = '';
$separator = strpos($identifier, ' ');
if ($separator !== false) {
$description = substr($identifier, $separator + 1);
$identifier = substr($identifier, 0, $separator);
}
try {
if ($this->format == null || $this->format instanceof DefaultFastaEntry) {
$this->format = FastaEntryFactory::getParser($identifier);
}
$protein = $this->format->getProtein($identifier, $description);
} catch (Exception $e) {
$this->format = FastaEntryFactory::getParser($identifier);
$protein = $this->format->getProtein($identifier, $description);
}
$protein->setIdentifier($identifier);
$protein->setSequence($this->parseSequence());
$this->key ++;
return $protein;
} | php | private function parseEntry()
{
// Scan to first entry
do {
$line = trim($this->peekLine());
if (strpos($line, '>') === 0) {
break;
}
} while ($this->getLine());
$identifier = '';
while ($line = $this->getLine()) {
$line = trim($line);
$identifier .= substr($line, 1);
$nextLine = trim($this->peekLine());
if (strpos($nextLine, '>') !== 0) {
break;
}
}
$description = '';
$separator = strpos($identifier, ' ');
if ($separator !== false) {
$description = substr($identifier, $separator + 1);
$identifier = substr($identifier, 0, $separator);
}
try {
if ($this->format == null || $this->format instanceof DefaultFastaEntry) {
$this->format = FastaEntryFactory::getParser($identifier);
}
$protein = $this->format->getProtein($identifier, $description);
} catch (Exception $e) {
$this->format = FastaEntryFactory::getParser($identifier);
$protein = $this->format->getProtein($identifier, $description);
}
$protein->setIdentifier($identifier);
$protein->setSequence($this->parseSequence());
$this->key ++;
return $protein;
} | [
"private",
"function",
"parseEntry",
"(",
")",
"{",
"// Scan to first entry",
"do",
"{",
"$",
"line",
"=",
"trim",
"(",
"$",
"this",
"->",
"peekLine",
"(",
")",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"line",
",",
"'>'",
")",
"===",
"0",
")",
"{",
"break",
";",
"}",
"}",
"while",
"(",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
";",
"$",
"identifier",
"=",
"''",
";",
"while",
"(",
"$",
"line",
"=",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
"{",
"$",
"line",
"=",
"trim",
"(",
"$",
"line",
")",
";",
"$",
"identifier",
".=",
"substr",
"(",
"$",
"line",
",",
"1",
")",
";",
"$",
"nextLine",
"=",
"trim",
"(",
"$",
"this",
"->",
"peekLine",
"(",
")",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"nextLine",
",",
"'>'",
")",
"!==",
"0",
")",
"{",
"break",
";",
"}",
"}",
"$",
"description",
"=",
"''",
";",
"$",
"separator",
"=",
"strpos",
"(",
"$",
"identifier",
",",
"' '",
")",
";",
"if",
"(",
"$",
"separator",
"!==",
"false",
")",
"{",
"$",
"description",
"=",
"substr",
"(",
"$",
"identifier",
",",
"$",
"separator",
"+",
"1",
")",
";",
"$",
"identifier",
"=",
"substr",
"(",
"$",
"identifier",
",",
"0",
",",
"$",
"separator",
")",
";",
"}",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"format",
"==",
"null",
"||",
"$",
"this",
"->",
"format",
"instanceof",
"DefaultFastaEntry",
")",
"{",
"$",
"this",
"->",
"format",
"=",
"FastaEntryFactory",
"::",
"getParser",
"(",
"$",
"identifier",
")",
";",
"}",
"$",
"protein",
"=",
"$",
"this",
"->",
"format",
"->",
"getProtein",
"(",
"$",
"identifier",
",",
"$",
"description",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"format",
"=",
"FastaEntryFactory",
"::",
"getParser",
"(",
"$",
"identifier",
")",
";",
"$",
"protein",
"=",
"$",
"this",
"->",
"format",
"->",
"getProtein",
"(",
"$",
"identifier",
",",
"$",
"description",
")",
";",
"}",
"$",
"protein",
"->",
"setIdentifier",
"(",
"$",
"identifier",
")",
";",
"$",
"protein",
"->",
"setSequence",
"(",
"$",
"this",
"->",
"parseSequence",
"(",
")",
")",
";",
"$",
"this",
"->",
"key",
"++",
";",
"return",
"$",
"protein",
";",
"}"
] | Parses the current chunk into a Protein object
@return Protein | [
"Parses",
"the",
"current",
"chunk",
"into",
"a",
"Protein",
"object"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/FastaReader.php#L153-L200 |
32,270 | PGB-LIV/php-ms | src/Reader/FastaReader.php | FastaReader.parseSequence | private function parseSequence()
{
$sequence = '';
while ($line = $this->getLine()) {
$sequence .= trim($line);
$nextLine = trim($this->peekLine());
if (strpos($nextLine, '>') === 0) {
break;
}
}
// Remove stop codon in IRGSP FASTA
if (strrpos($sequence, '*', - 1) !== false) {
$sequence = substr($sequence, 0, - 1);
}
return $sequence;
} | php | private function parseSequence()
{
$sequence = '';
while ($line = $this->getLine()) {
$sequence .= trim($line);
$nextLine = trim($this->peekLine());
if (strpos($nextLine, '>') === 0) {
break;
}
}
// Remove stop codon in IRGSP FASTA
if (strrpos($sequence, '*', - 1) !== false) {
$sequence = substr($sequence, 0, - 1);
}
return $sequence;
} | [
"private",
"function",
"parseSequence",
"(",
")",
"{",
"$",
"sequence",
"=",
"''",
";",
"while",
"(",
"$",
"line",
"=",
"$",
"this",
"->",
"getLine",
"(",
")",
")",
"{",
"$",
"sequence",
".=",
"trim",
"(",
"$",
"line",
")",
";",
"$",
"nextLine",
"=",
"trim",
"(",
"$",
"this",
"->",
"peekLine",
"(",
")",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"nextLine",
",",
"'>'",
")",
"===",
"0",
")",
"{",
"break",
";",
"}",
"}",
"// Remove stop codon in IRGSP FASTA",
"if",
"(",
"strrpos",
"(",
"$",
"sequence",
",",
"'*'",
",",
"-",
"1",
")",
"!==",
"false",
")",
"{",
"$",
"sequence",
"=",
"substr",
"(",
"$",
"sequence",
",",
"0",
",",
"-",
"1",
")",
";",
"}",
"return",
"$",
"sequence",
";",
"}"
] | Parses the sequence block from the FASTA file and returns the sequence without any line ending or formatting
@return string | [
"Parses",
"the",
"sequence",
"block",
"from",
"the",
"FASTA",
"file",
"and",
"returns",
"the",
"sequence",
"without",
"any",
"line",
"ending",
"or",
"formatting"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/FastaReader.php#L207-L227 |
32,271 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleCatalogConf.class.php | TShopArticleCatalogConf.GetDefaultOrderBy | public function GetDefaultOrderBy(TdbShopCategory $oActiveCategory)
{
$sDefaultOrderBy = $this->fieldShopModuleArticlelistOrderbyId;
$bDone = false;
$sActiveCategoryId = $oActiveCategory->id;
do {
// is there another order by set for this category or any of its parents
$query = "SELECT `shop_category`.`id`, `shop_category`.`url_path`, `shop_category`.`shop_category_id`,
`shop_article_catalog_conf_default_order`.`shop_module_articlelist_orderby_id`
FROM `shop_category`
LEFT JOIN `shop_article_catalog_conf_default_order_shop_category_mlt` ON `shop_category`.`id` = `shop_article_catalog_conf_default_order_shop_category_mlt`.`target_id`
LEFT JOIN `shop_article_catalog_conf_default_order` ON (`shop_article_catalog_conf_default_order_shop_category_mlt`.`source_id` = `shop_article_catalog_conf_default_order`.`id` AND `shop_article_catalog_conf_default_order`.`shop_article_catalog_conf_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."')
WHERE `shop_category`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sActiveCategoryId)."'
";
if ($aCategoryDetails = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
if (isset($aCategoryDetails['shop_module_articlelist_orderby_id']) && !empty($aCategoryDetails['shop_module_articlelist_orderby_id'])) {
$bDone = true;
$sDefaultOrderBy = $aCategoryDetails['shop_module_articlelist_orderby_id'];
}
$sActiveCategoryId = $aCategoryDetails['shop_category_id'];
if (empty($sActiveCategoryId)) {
$bDone = true;
}
} else {
$bDone = true;
}
} while (!$bDone);
return $sDefaultOrderBy;
} | php | public function GetDefaultOrderBy(TdbShopCategory $oActiveCategory)
{
$sDefaultOrderBy = $this->fieldShopModuleArticlelistOrderbyId;
$bDone = false;
$sActiveCategoryId = $oActiveCategory->id;
do {
// is there another order by set for this category or any of its parents
$query = "SELECT `shop_category`.`id`, `shop_category`.`url_path`, `shop_category`.`shop_category_id`,
`shop_article_catalog_conf_default_order`.`shop_module_articlelist_orderby_id`
FROM `shop_category`
LEFT JOIN `shop_article_catalog_conf_default_order_shop_category_mlt` ON `shop_category`.`id` = `shop_article_catalog_conf_default_order_shop_category_mlt`.`target_id`
LEFT JOIN `shop_article_catalog_conf_default_order` ON (`shop_article_catalog_conf_default_order_shop_category_mlt`.`source_id` = `shop_article_catalog_conf_default_order`.`id` AND `shop_article_catalog_conf_default_order`.`shop_article_catalog_conf_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."')
WHERE `shop_category`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sActiveCategoryId)."'
";
if ($aCategoryDetails = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
if (isset($aCategoryDetails['shop_module_articlelist_orderby_id']) && !empty($aCategoryDetails['shop_module_articlelist_orderby_id'])) {
$bDone = true;
$sDefaultOrderBy = $aCategoryDetails['shop_module_articlelist_orderby_id'];
}
$sActiveCategoryId = $aCategoryDetails['shop_category_id'];
if (empty($sActiveCategoryId)) {
$bDone = true;
}
} else {
$bDone = true;
}
} while (!$bDone);
return $sDefaultOrderBy;
} | [
"public",
"function",
"GetDefaultOrderBy",
"(",
"TdbShopCategory",
"$",
"oActiveCategory",
")",
"{",
"$",
"sDefaultOrderBy",
"=",
"$",
"this",
"->",
"fieldShopModuleArticlelistOrderbyId",
";",
"$",
"bDone",
"=",
"false",
";",
"$",
"sActiveCategoryId",
"=",
"$",
"oActiveCategory",
"->",
"id",
";",
"do",
"{",
"// is there another order by set for this category or any of its parents",
"$",
"query",
"=",
"\"SELECT `shop_category`.`id`, `shop_category`.`url_path`, `shop_category`.`shop_category_id`,\n `shop_article_catalog_conf_default_order`.`shop_module_articlelist_orderby_id`\n FROM `shop_category`\n LEFT JOIN `shop_article_catalog_conf_default_order_shop_category_mlt` ON `shop_category`.`id` = `shop_article_catalog_conf_default_order_shop_category_mlt`.`target_id`\n LEFT JOIN `shop_article_catalog_conf_default_order` ON (`shop_article_catalog_conf_default_order_shop_category_mlt`.`source_id` = `shop_article_catalog_conf_default_order`.`id` AND `shop_article_catalog_conf_default_order`.`shop_article_catalog_conf_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"')\n WHERE `shop_category`.`id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sActiveCategoryId",
")",
".",
"\"'\n \"",
";",
"if",
"(",
"$",
"aCategoryDetails",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"aCategoryDetails",
"[",
"'shop_module_articlelist_orderby_id'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"aCategoryDetails",
"[",
"'shop_module_articlelist_orderby_id'",
"]",
")",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"$",
"sDefaultOrderBy",
"=",
"$",
"aCategoryDetails",
"[",
"'shop_module_articlelist_orderby_id'",
"]",
";",
"}",
"$",
"sActiveCategoryId",
"=",
"$",
"aCategoryDetails",
"[",
"'shop_category_id'",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"sActiveCategoryId",
")",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"}",
"while",
"(",
"!",
"$",
"bDone",
")",
";",
"return",
"$",
"sDefaultOrderBy",
";",
"}"
] | Returns the active order by for the given category.
@param TdbShopCategory $oActiveCategory
@return string | [
"Returns",
"the",
"active",
"order",
"by",
"for",
"the",
"given",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleCatalogConf.class.php#L23-L54 |
32,272 | martin-pettersson/chalk | src/Chalk.php | Chalk.style | public static function style($string, $style)
{
$escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
$resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);
return $escapeSequence . $string . $resetSequence;
} | php | public static function style($string, $style)
{
$escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
$resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);
return $escapeSequence . $string . $resetSequence;
} | [
"public",
"static",
"function",
"style",
"(",
"$",
"string",
",",
"$",
"style",
")",
"{",
"$",
"escapeSequence",
"=",
"(",
"$",
"style",
"instanceof",
"Style",
")",
"?",
"$",
"style",
"->",
"getEscapeSequence",
"(",
")",
":",
"self",
"::",
"getEscapeSequence",
"(",
"$",
"style",
")",
";",
"$",
"resetSequence",
"=",
"(",
"$",
"style",
"instanceof",
"Style",
")",
"?",
"Style",
"::",
"getResetSequence",
"(",
")",
":",
"self",
"::",
"getResetSequence",
"(",
"$",
"style",
")",
";",
"return",
"$",
"escapeSequence",
".",
"$",
"string",
".",
"$",
"resetSequence",
";",
"}"
] | Gives the given string the given style
@param string $string
@param int|Style $style
@return string | [
"Gives",
"the",
"given",
"string",
"the",
"given",
"style"
] | a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5 | https://github.com/martin-pettersson/chalk/blob/a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5/src/Chalk.php#L60-L66 |
32,273 | martin-pettersson/chalk | src/Chalk.php | Chalk.parse | public static function parse($string, array $styles)
{
// style the entire string if no tags are found
if (false === strpos($string, '{')) {
return self::style($string, reset($styles));
}
$i = 0;
// loop through each tag in the string
while (false !== $openTag = strpos($string, '{')) {
$style = array_key_exists($i, $styles) ? $styles[$i] : end($styles);
$escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
$resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);
// replace opening tag
$string = substr_replace($string, $escapeSequence, $openTag, 1);
if (false === $closeTag = strpos($string, '}')) {
$closeTag = strlen($string);
}
// don't produce multiple identical reset tags next to each other
if (substr($string, $closeTag - strlen($resetSequence), strlen($resetSequence)) !== $resetSequence) {
$string = substr_replace($string, $resetSequence, $closeTag, 1);
}
$i++;
}
return $string;
} | php | public static function parse($string, array $styles)
{
// style the entire string if no tags are found
if (false === strpos($string, '{')) {
return self::style($string, reset($styles));
}
$i = 0;
// loop through each tag in the string
while (false !== $openTag = strpos($string, '{')) {
$style = array_key_exists($i, $styles) ? $styles[$i] : end($styles);
$escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
$resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);
// replace opening tag
$string = substr_replace($string, $escapeSequence, $openTag, 1);
if (false === $closeTag = strpos($string, '}')) {
$closeTag = strlen($string);
}
// don't produce multiple identical reset tags next to each other
if (substr($string, $closeTag - strlen($resetSequence), strlen($resetSequence)) !== $resetSequence) {
$string = substr_replace($string, $resetSequence, $closeTag, 1);
}
$i++;
}
return $string;
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"string",
",",
"array",
"$",
"styles",
")",
"{",
"// style the entire string if no tags are found",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"string",
",",
"'{'",
")",
")",
"{",
"return",
"self",
"::",
"style",
"(",
"$",
"string",
",",
"reset",
"(",
"$",
"styles",
")",
")",
";",
"}",
"$",
"i",
"=",
"0",
";",
"// loop through each tag in the string",
"while",
"(",
"false",
"!==",
"$",
"openTag",
"=",
"strpos",
"(",
"$",
"string",
",",
"'{'",
")",
")",
"{",
"$",
"style",
"=",
"array_key_exists",
"(",
"$",
"i",
",",
"$",
"styles",
")",
"?",
"$",
"styles",
"[",
"$",
"i",
"]",
":",
"end",
"(",
"$",
"styles",
")",
";",
"$",
"escapeSequence",
"=",
"(",
"$",
"style",
"instanceof",
"Style",
")",
"?",
"$",
"style",
"->",
"getEscapeSequence",
"(",
")",
":",
"self",
"::",
"getEscapeSequence",
"(",
"$",
"style",
")",
";",
"$",
"resetSequence",
"=",
"(",
"$",
"style",
"instanceof",
"Style",
")",
"?",
"Style",
"::",
"getResetSequence",
"(",
")",
":",
"self",
"::",
"getResetSequence",
"(",
"$",
"style",
")",
";",
"// replace opening tag",
"$",
"string",
"=",
"substr_replace",
"(",
"$",
"string",
",",
"$",
"escapeSequence",
",",
"$",
"openTag",
",",
"1",
")",
";",
"if",
"(",
"false",
"===",
"$",
"closeTag",
"=",
"strpos",
"(",
"$",
"string",
",",
"'}'",
")",
")",
"{",
"$",
"closeTag",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"}",
"// don't produce multiple identical reset tags next to each other",
"if",
"(",
"substr",
"(",
"$",
"string",
",",
"$",
"closeTag",
"-",
"strlen",
"(",
"$",
"resetSequence",
")",
",",
"strlen",
"(",
"$",
"resetSequence",
")",
")",
"!==",
"$",
"resetSequence",
")",
"{",
"$",
"string",
"=",
"substr_replace",
"(",
"$",
"string",
",",
"$",
"resetSequence",
",",
"$",
"closeTag",
",",
"1",
")",
";",
"}",
"$",
"i",
"++",
";",
"}",
"return",
"$",
"string",
";",
"}"
] | Parses the given string and inserts the color tags replacing the placeholders
@param string $string
@param array $styles
@return string | [
"Parses",
"the",
"given",
"string",
"and",
"inserts",
"the",
"color",
"tags",
"replacing",
"the",
"placeholders"
] | a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5 | https://github.com/martin-pettersson/chalk/blob/a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5/src/Chalk.php#L76-L108 |
32,274 | martin-pettersson/chalk | src/Chalk.php | Chalk.getResetSequence | public static function getResetSequence($style = null)
{
$resetSequence = Style::getResetSequence();
if (!is_null($style)) {
switch (true) {
case in_array($style, Color::enum()):
$resetSequence = Color::getResetSequence();
break;
case in_array($style, BackgroundColor::enum()):
$resetSequence = BackgroundColor::getResetSequence();
break;
}
}
return $resetSequence;
} | php | public static function getResetSequence($style = null)
{
$resetSequence = Style::getResetSequence();
if (!is_null($style)) {
switch (true) {
case in_array($style, Color::enum()):
$resetSequence = Color::getResetSequence();
break;
case in_array($style, BackgroundColor::enum()):
$resetSequence = BackgroundColor::getResetSequence();
break;
}
}
return $resetSequence;
} | [
"public",
"static",
"function",
"getResetSequence",
"(",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"resetSequence",
"=",
"Style",
"::",
"getResetSequence",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"style",
")",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"in_array",
"(",
"$",
"style",
",",
"Color",
"::",
"enum",
"(",
")",
")",
":",
"$",
"resetSequence",
"=",
"Color",
"::",
"getResetSequence",
"(",
")",
";",
"break",
";",
"case",
"in_array",
"(",
"$",
"style",
",",
"BackgroundColor",
"::",
"enum",
"(",
")",
")",
":",
"$",
"resetSequence",
"=",
"BackgroundColor",
"::",
"getResetSequence",
"(",
")",
";",
"break",
";",
"}",
"}",
"return",
"$",
"resetSequence",
";",
"}"
] | Returns the reset sequence for the given style
@param int|null $style
@return string | [
"Returns",
"the",
"reset",
"sequence",
"for",
"the",
"given",
"style"
] | a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5 | https://github.com/martin-pettersson/chalk/blob/a4726d6835bdc7eb3c8c77b2df69fa1b9fddb4c5/src/Chalk.php#L129-L145 |
32,275 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStatus.class.php | TShopOrderStatus.GetStatusText | public function GetStatusText($bPrepareTextForRemoteUsage = false)
{
$sHTML = '';
$oOrder = $this->GetFieldShopOrder();
$oCode = $this->GetFieldShopOrderStatusCode();
$aData = $oOrder->GetSQLWithTablePrefix();
$aTmpData = $this->GetSQLWithTablePrefix();
$aData = array_merge($aData, $aTmpData);
$aData['data'] = $this->fieldData;
if ($bPrepareTextForRemoteUsage) {
$sHTML .= $oCode->GetTextForExternalUsage('info_text', 600, true, $aData);
} else {
$sHTML .= $oCode->GetTextField('info_text', 600, true, $aData);
}
if ($bPrepareTextForRemoteUsage) {
$sHTML .= $this->GetTextForExternalUsage('info', 600, true, $aData);
} else {
$sHTML .= $this->GetTextField('info', 600, true, $aData);
}
return $sHTML;
} | php | public function GetStatusText($bPrepareTextForRemoteUsage = false)
{
$sHTML = '';
$oOrder = $this->GetFieldShopOrder();
$oCode = $this->GetFieldShopOrderStatusCode();
$aData = $oOrder->GetSQLWithTablePrefix();
$aTmpData = $this->GetSQLWithTablePrefix();
$aData = array_merge($aData, $aTmpData);
$aData['data'] = $this->fieldData;
if ($bPrepareTextForRemoteUsage) {
$sHTML .= $oCode->GetTextForExternalUsage('info_text', 600, true, $aData);
} else {
$sHTML .= $oCode->GetTextField('info_text', 600, true, $aData);
}
if ($bPrepareTextForRemoteUsage) {
$sHTML .= $this->GetTextForExternalUsage('info', 600, true, $aData);
} else {
$sHTML .= $this->GetTextField('info', 600, true, $aData);
}
return $sHTML;
} | [
"public",
"function",
"GetStatusText",
"(",
"$",
"bPrepareTextForRemoteUsage",
"=",
"false",
")",
"{",
"$",
"sHTML",
"=",
"''",
";",
"$",
"oOrder",
"=",
"$",
"this",
"->",
"GetFieldShopOrder",
"(",
")",
";",
"$",
"oCode",
"=",
"$",
"this",
"->",
"GetFieldShopOrderStatusCode",
"(",
")",
";",
"$",
"aData",
"=",
"$",
"oOrder",
"->",
"GetSQLWithTablePrefix",
"(",
")",
";",
"$",
"aTmpData",
"=",
"$",
"this",
"->",
"GetSQLWithTablePrefix",
"(",
")",
";",
"$",
"aData",
"=",
"array_merge",
"(",
"$",
"aData",
",",
"$",
"aTmpData",
")",
";",
"$",
"aData",
"[",
"'data'",
"]",
"=",
"$",
"this",
"->",
"fieldData",
";",
"if",
"(",
"$",
"bPrepareTextForRemoteUsage",
")",
"{",
"$",
"sHTML",
".=",
"$",
"oCode",
"->",
"GetTextForExternalUsage",
"(",
"'info_text'",
",",
"600",
",",
"true",
",",
"$",
"aData",
")",
";",
"}",
"else",
"{",
"$",
"sHTML",
".=",
"$",
"oCode",
"->",
"GetTextField",
"(",
"'info_text'",
",",
"600",
",",
"true",
",",
"$",
"aData",
")",
";",
"}",
"if",
"(",
"$",
"bPrepareTextForRemoteUsage",
")",
"{",
"$",
"sHTML",
".=",
"$",
"this",
"->",
"GetTextForExternalUsage",
"(",
"'info'",
",",
"600",
",",
"true",
",",
"$",
"aData",
")",
";",
"}",
"else",
"{",
"$",
"sHTML",
".=",
"$",
"this",
"->",
"GetTextField",
"(",
"'info'",
",",
"600",
",",
"true",
",",
"$",
"aData",
")",
";",
"}",
"return",
"$",
"sHTML",
";",
"}"
] | retun the status text.
@param bool $bPrepareTextForRemoteUsage
@return string | [
"retun",
"the",
"status",
"text",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStatus.class.php#L21-L43 |
32,276 | PGB-LIV/php-ms | src/Utility/Digest/DigestFactory.php | DigestFactory.getDigest | public static function getDigest($digestName)
{
$enzymes = self::getEnzymes();
$digestUp = strtoupper($digestName);
foreach (array_keys($enzymes) as $key) {
if (strtoupper($key) == $digestUp) {
$classPath = __NAMESPACE__ . '\\Digest' . $key;
return new $classPath();
}
}
throw new \InvalidArgumentException('Unknown digest algorithm - ' . $digestName);
} | php | public static function getDigest($digestName)
{
$enzymes = self::getEnzymes();
$digestUp = strtoupper($digestName);
foreach (array_keys($enzymes) as $key) {
if (strtoupper($key) == $digestUp) {
$classPath = __NAMESPACE__ . '\\Digest' . $key;
return new $classPath();
}
}
throw new \InvalidArgumentException('Unknown digest algorithm - ' . $digestName);
} | [
"public",
"static",
"function",
"getDigest",
"(",
"$",
"digestName",
")",
"{",
"$",
"enzymes",
"=",
"self",
"::",
"getEnzymes",
"(",
")",
";",
"$",
"digestUp",
"=",
"strtoupper",
"(",
"$",
"digestName",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"enzymes",
")",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"strtoupper",
"(",
"$",
"key",
")",
"==",
"$",
"digestUp",
")",
"{",
"$",
"classPath",
"=",
"__NAMESPACE__",
".",
"'\\\\Digest'",
".",
"$",
"key",
";",
"return",
"new",
"$",
"classPath",
"(",
")",
";",
"}",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Unknown digest algorithm - '",
".",
"$",
"digestName",
")",
";",
"}"
] | Gets the digest object associated with the enzyme
@param string $digestName
Name of the enzyme
@return \pgb_liv\php_ms\Utility\Digest\DigestTrypsin | [
"Gets",
"the",
"digest",
"object",
"associated",
"with",
"the",
"enzyme"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Digest/DigestFactory.php#L34-L47 |
32,277 | PGB-LIV/php-ms | src/Search/Parameters/AbstractSearchParameters.php | AbstractSearchParameters.setSpectraPath | public function setSpectraPath($filePath, $ignoreValidation = false)
{
if (! $ignoreValidation && ! file_exists($filePath)) {
throw new \InvalidArgumentException('Argument 1 must specify a valid file');
}
$this->spectraPath = $filePath;
} | php | public function setSpectraPath($filePath, $ignoreValidation = false)
{
if (! $ignoreValidation && ! file_exists($filePath)) {
throw new \InvalidArgumentException('Argument 1 must specify a valid file');
}
$this->spectraPath = $filePath;
} | [
"public",
"function",
"setSpectraPath",
"(",
"$",
"filePath",
",",
"$",
"ignoreValidation",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"ignoreValidation",
"&&",
"!",
"file_exists",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must specify a valid file'",
")",
";",
"}",
"$",
"this",
"->",
"spectraPath",
"=",
"$",
"filePath",
";",
"}"
] | Sets the spectra file location
@param string $filePath
Path to the spectra file
@param bool $ignoreValidation
If true will disable validation that the file must exist
@throws \InvalidArgumentException Thrown if $ignoreValidation is false and the file does not exist | [
"Sets",
"the",
"spectra",
"file",
"location"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/Parameters/AbstractSearchParameters.php#L119-L126 |
32,278 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model.php | OffAmazonPaymentsService_Model._toXMLFragment | protected function _toXMLFragment()
{
$xml = "";
foreach ($this->_fields as $fieldName => $field) {
$fieldValue = $field['FieldValue'];
if (!is_null($fieldValue)) {
$fieldType = $field['FieldType'];
if (is_array($fieldType)) {
if ($this->_isComplexType($fieldType[0])) {
foreach ($fieldValue as $item) {
$xml .= "<$fieldName>";
$xml .= $item->_toXMLFragment();
$xml .= "</$fieldName>";
}
} else {
foreach ($fieldValue as $item) {
$xml .= "<$fieldName>";
$xml .= $this->_escapeXML($item);
$xml .= "</$fieldName>";
}
}
} else {
if ($this->_isComplexType($fieldType)) {
$xml .= "<$fieldName>";
$xml .= $fieldValue->_toXMLFragment();
$xml .= "</$fieldName>";
} else {
$xml .= "<$fieldName>";
$xml .= $this->_escapeXML($fieldValue);
$xml .= "</$fieldName>";
}
}
}
}
return $xml;
} | php | protected function _toXMLFragment()
{
$xml = "";
foreach ($this->_fields as $fieldName => $field) {
$fieldValue = $field['FieldValue'];
if (!is_null($fieldValue)) {
$fieldType = $field['FieldType'];
if (is_array($fieldType)) {
if ($this->_isComplexType($fieldType[0])) {
foreach ($fieldValue as $item) {
$xml .= "<$fieldName>";
$xml .= $item->_toXMLFragment();
$xml .= "</$fieldName>";
}
} else {
foreach ($fieldValue as $item) {
$xml .= "<$fieldName>";
$xml .= $this->_escapeXML($item);
$xml .= "</$fieldName>";
}
}
} else {
if ($this->_isComplexType($fieldType)) {
$xml .= "<$fieldName>";
$xml .= $fieldValue->_toXMLFragment();
$xml .= "</$fieldName>";
} else {
$xml .= "<$fieldName>";
$xml .= $this->_escapeXML($fieldValue);
$xml .= "</$fieldName>";
}
}
}
}
return $xml;
} | [
"protected",
"function",
"_toXMLFragment",
"(",
")",
"{",
"$",
"xml",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"_fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fieldValue",
"=",
"$",
"field",
"[",
"'FieldValue'",
"]",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"fieldValue",
")",
")",
"{",
"$",
"fieldType",
"=",
"$",
"field",
"[",
"'FieldType'",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"fieldType",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isComplexType",
"(",
"$",
"fieldType",
"[",
"0",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"fieldValue",
"as",
"$",
"item",
")",
"{",
"$",
"xml",
".=",
"\"<$fieldName>\"",
";",
"$",
"xml",
".=",
"$",
"item",
"->",
"_toXMLFragment",
"(",
")",
";",
"$",
"xml",
".=",
"\"</$fieldName>\"",
";",
"}",
"}",
"else",
"{",
"foreach",
"(",
"$",
"fieldValue",
"as",
"$",
"item",
")",
"{",
"$",
"xml",
".=",
"\"<$fieldName>\"",
";",
"$",
"xml",
".=",
"$",
"this",
"->",
"_escapeXML",
"(",
"$",
"item",
")",
";",
"$",
"xml",
".=",
"\"</$fieldName>\"",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"_isComplexType",
"(",
"$",
"fieldType",
")",
")",
"{",
"$",
"xml",
".=",
"\"<$fieldName>\"",
";",
"$",
"xml",
".=",
"$",
"fieldValue",
"->",
"_toXMLFragment",
"(",
")",
";",
"$",
"xml",
".=",
"\"</$fieldName>\"",
";",
"}",
"else",
"{",
"$",
"xml",
".=",
"\"<$fieldName>\"",
";",
"$",
"xml",
".=",
"$",
"this",
"->",
"_escapeXML",
"(",
"$",
"fieldValue",
")",
";",
"$",
"xml",
".=",
"\"</$fieldName>\"",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"xml",
";",
"}"
] | XML fragment representation of this object
Note, name of the root determined by caller
This fragment returns inner fields representation only
@return string XML fragment for this object | [
"XML",
"fragment",
"representation",
"of",
"this",
"object",
"Note",
"name",
"of",
"the",
"root",
"determined",
"by",
"caller",
"This",
"fragment",
"returns",
"inner",
"fields",
"representation",
"only"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model.php#L94-L129 |
32,279 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php | SnsMessageValidator.validateMessage | public function validateMessage(Message $snsMessage)
{
switch($snsMessage->getMandatoryField("SignatureVersion")) {
case "1":
$this->_verifySignatureWithVersionOneAlgorithm($snsMessage);
break;
default:
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with signature verification - " .
"unable to handle signature version " .
$snsMessage->getMandatoryField("SignatureVersion")
);
}
} | php | public function validateMessage(Message $snsMessage)
{
switch($snsMessage->getMandatoryField("SignatureVersion")) {
case "1":
$this->_verifySignatureWithVersionOneAlgorithm($snsMessage);
break;
default:
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with signature verification - " .
"unable to handle signature version " .
$snsMessage->getMandatoryField("SignatureVersion")
);
}
} | [
"public",
"function",
"validateMessage",
"(",
"Message",
"$",
"snsMessage",
")",
"{",
"switch",
"(",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"SignatureVersion\"",
")",
")",
"{",
"case",
"\"1\"",
":",
"$",
"this",
"->",
"_verifySignatureWithVersionOneAlgorithm",
"(",
"$",
"snsMessage",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"OffAmazonPaymentsNotifications_InvalidMessageException",
"(",
"\"Error with signature verification - \"",
".",
"\"unable to handle signature version \"",
".",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"SignatureVersion\"",
")",
")",
";",
"}",
"}"
] | Validate that the given sns message is valid
defined as being signed by Amazon and that the
signature matches the message contents
@param Message $snsMessage sns message to check
@throws OffAmazonPaymentsNotifications_InvalidMessageException if the
validation
fails
@return void | [
"Validate",
"that",
"the",
"given",
"sns",
"message",
"is",
"valid",
"defined",
"as",
"being",
"signed",
"by",
"Amazon",
"and",
"that",
"the",
"signature",
"matches",
"the",
"message",
"contents"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php#L65-L78 |
32,280 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php | SnsMessageValidator._verifySignatureWithVersionOneAlgorithm | private function _verifySignatureWithVersionOneAlgorithm(Message $snsMessage)
{
$result = $this->_verifySignature->verifySignatureIsCorrect(
$this->_constructSignatureFromSnsMessage($snsMessage),
base64_decode($snsMessage->getMandatoryField("Signature")),
$snsMessage->getMandatoryField("SigningCertURL")
);
if (!$result) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Unable to match signature from remote server: signature of " .
$this->_constructSignatureFromSnsMessage($snsMessage) .
" , SigningCertURL of " .
$snsMessage->getMandatoryField("SigningCertURL") .
" , SignatureOf " .
$snsMessage->getMandatoryField("Signature")
);
}
} | php | private function _verifySignatureWithVersionOneAlgorithm(Message $snsMessage)
{
$result = $this->_verifySignature->verifySignatureIsCorrect(
$this->_constructSignatureFromSnsMessage($snsMessage),
base64_decode($snsMessage->getMandatoryField("Signature")),
$snsMessage->getMandatoryField("SigningCertURL")
);
if (!$result) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Unable to match signature from remote server: signature of " .
$this->_constructSignatureFromSnsMessage($snsMessage) .
" , SigningCertURL of " .
$snsMessage->getMandatoryField("SigningCertURL") .
" , SignatureOf " .
$snsMessage->getMandatoryField("Signature")
);
}
} | [
"private",
"function",
"_verifySignatureWithVersionOneAlgorithm",
"(",
"Message",
"$",
"snsMessage",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_verifySignature",
"->",
"verifySignatureIsCorrect",
"(",
"$",
"this",
"->",
"_constructSignatureFromSnsMessage",
"(",
"$",
"snsMessage",
")",
",",
"base64_decode",
"(",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"Signature\"",
")",
")",
",",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"SigningCertURL\"",
")",
")",
";",
"if",
"(",
"!",
"$",
"result",
")",
"{",
"throw",
"new",
"OffAmazonPaymentsNotifications_InvalidMessageException",
"(",
"\"Unable to match signature from remote server: signature of \"",
".",
"$",
"this",
"->",
"_constructSignatureFromSnsMessage",
"(",
"$",
"snsMessage",
")",
".",
"\" , SigningCertURL of \"",
".",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"SigningCertURL\"",
")",
".",
"\" , SignatureOf \"",
".",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"Signature\"",
")",
")",
";",
"}",
"}"
] | Implement the version one signature verification algorithm
@param Message $snsMessage sns message
@throws OffAmazonPaymentsNotifications_InvalidMessageException if the
validation
fails
@return void | [
"Implement",
"the",
"version",
"one",
"signature",
"verification",
"algorithm"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php#L91-L109 |
32,281 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php | SnsMessageValidator._constructSignatureFromSnsMessage | private function _constructSignatureFromSnsMessage(Message $snsMessage)
{
if (strcmp($snsMessage->getMandatoryField("Type"), "Notification") != 0) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with signature verification - unable to verify " .
$snsMessage->getMandatoryField("Type") . " message"
);
}
// get the list of fields that we are interested in
$fields = array(
"Timestamp" => true,
"Message" => true,
"MessageId" => true,
"Subject" => false,
"TopicArn" => true,
"Type" => true
);
// sort the fields into byte order based on the key name(A-Za-z)
ksort($fields);
// extract the key value pairs and sort in byte order
$signatureFields = array();
foreach ($fields as $fieldName => $mandatoryField) {
if ($mandatoryField) {
$value = $snsMessage->getMandatoryField($fieldName);
} else {
$value = $snsMessage->getField($fieldName);
}
if (!is_null($value)) {
array_push($signatureFields, $fieldName);
array_push($signatureFields, $value);
}
}
// create the signature string - key / value in byte order
// delimited by newline character + ending with a new line character
return implode("\n", $signatureFields) . "\n";
} | php | private function _constructSignatureFromSnsMessage(Message $snsMessage)
{
if (strcmp($snsMessage->getMandatoryField("Type"), "Notification") != 0) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with signature verification - unable to verify " .
$snsMessage->getMandatoryField("Type") . " message"
);
}
// get the list of fields that we are interested in
$fields = array(
"Timestamp" => true,
"Message" => true,
"MessageId" => true,
"Subject" => false,
"TopicArn" => true,
"Type" => true
);
// sort the fields into byte order based on the key name(A-Za-z)
ksort($fields);
// extract the key value pairs and sort in byte order
$signatureFields = array();
foreach ($fields as $fieldName => $mandatoryField) {
if ($mandatoryField) {
$value = $snsMessage->getMandatoryField($fieldName);
} else {
$value = $snsMessage->getField($fieldName);
}
if (!is_null($value)) {
array_push($signatureFields, $fieldName);
array_push($signatureFields, $value);
}
}
// create the signature string - key / value in byte order
// delimited by newline character + ending with a new line character
return implode("\n", $signatureFields) . "\n";
} | [
"private",
"function",
"_constructSignatureFromSnsMessage",
"(",
"Message",
"$",
"snsMessage",
")",
"{",
"if",
"(",
"strcmp",
"(",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"Type\"",
")",
",",
"\"Notification\"",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"OffAmazonPaymentsNotifications_InvalidMessageException",
"(",
"\"Error with signature verification - unable to verify \"",
".",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"\"Type\"",
")",
".",
"\" message\"",
")",
";",
"}",
"// get the list of fields that we are interested in",
"$",
"fields",
"=",
"array",
"(",
"\"Timestamp\"",
"=>",
"true",
",",
"\"Message\"",
"=>",
"true",
",",
"\"MessageId\"",
"=>",
"true",
",",
"\"Subject\"",
"=>",
"false",
",",
"\"TopicArn\"",
"=>",
"true",
",",
"\"Type\"",
"=>",
"true",
")",
";",
"// sort the fields into byte order based on the key name(A-Za-z)",
"ksort",
"(",
"$",
"fields",
")",
";",
"// extract the key value pairs and sort in byte order",
"$",
"signatureFields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"mandatoryField",
")",
"{",
"if",
"(",
"$",
"mandatoryField",
")",
"{",
"$",
"value",
"=",
"$",
"snsMessage",
"->",
"getMandatoryField",
"(",
"$",
"fieldName",
")",
";",
"}",
"else",
"{",
"$",
"value",
"=",
"$",
"snsMessage",
"->",
"getField",
"(",
"$",
"fieldName",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"array_push",
"(",
"$",
"signatureFields",
",",
"$",
"fieldName",
")",
";",
"array_push",
"(",
"$",
"signatureFields",
",",
"$",
"value",
")",
";",
"}",
"}",
"// create the signature string - key / value in byte order",
"// delimited by newline character + ending with a new line character",
"return",
"implode",
"(",
"\"\\n\"",
",",
"$",
"signatureFields",
")",
".",
"\"\\n\"",
";",
"}"
] | Recreate the signature based on the field values for the
sns message
@param Message $snsMessage sns message
@throws OffAmazonPaymentsNotifications_InvalidMessageException if the
validation
fails
@return string signature string | [
"Recreate",
"the",
"signature",
"based",
"on",
"the",
"field",
"values",
"for",
"the",
"sns",
"message"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageValidator.php#L123-L163 |
32,282 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.GetTransactionStatus | protected function GetTransactionStatus($sPayId = null)
{
$aParameter = array('PSPID' => $this->GetConfigParameter('user_id'), //required
'USERID' => $this->GetConfigParameter('api_user_id'), //required
'PSWD' => $this->GetConfigParameter('pswd'), //required
);
if (null !== $sPayId) {
$aParameter['PAYID'] = $sPayId;
} else {
$aParameter = array_merge($aParameter, $this->GetOrderOrPayIdAuthenticationArray());
}
$sExternalHandlerURL = $this->GetDirectQueryURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
TTools::WriteLogEntry('OGONE DirectLink: called url: '.$sExternalHandlerURL, 4, __FILE__, __LINE__);
$sResult = file_get_contents($sExternalHandlerURL);
TTools::WriteLogEntry('OGONE DirectLink: XML response from DirectLink call: '.$sResult, 1, __FILE__, __LINE__);
if (false !== $sResult) {
$this->ParseXMLResponse($sResult);
}
return $this->PaymentSuccess();
} | php | protected function GetTransactionStatus($sPayId = null)
{
$aParameter = array('PSPID' => $this->GetConfigParameter('user_id'), //required
'USERID' => $this->GetConfigParameter('api_user_id'), //required
'PSWD' => $this->GetConfigParameter('pswd'), //required
);
if (null !== $sPayId) {
$aParameter['PAYID'] = $sPayId;
} else {
$aParameter = array_merge($aParameter, $this->GetOrderOrPayIdAuthenticationArray());
}
$sExternalHandlerURL = $this->GetDirectQueryURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
TTools::WriteLogEntry('OGONE DirectLink: called url: '.$sExternalHandlerURL, 4, __FILE__, __LINE__);
$sResult = file_get_contents($sExternalHandlerURL);
TTools::WriteLogEntry('OGONE DirectLink: XML response from DirectLink call: '.$sResult, 1, __FILE__, __LINE__);
if (false !== $sResult) {
$this->ParseXMLResponse($sResult);
}
return $this->PaymentSuccess();
} | [
"protected",
"function",
"GetTransactionStatus",
"(",
"$",
"sPayId",
"=",
"null",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
"'PSPID'",
"=>",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'user_id'",
")",
",",
"//required",
"'USERID'",
"=>",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'api_user_id'",
")",
",",
"//required",
"'PSWD'",
"=>",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'pswd'",
")",
",",
"//required",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"sPayId",
")",
"{",
"$",
"aParameter",
"[",
"'PAYID'",
"]",
"=",
"$",
"sPayId",
";",
"}",
"else",
"{",
"$",
"aParameter",
"=",
"array_merge",
"(",
"$",
"aParameter",
",",
"$",
"this",
"->",
"GetOrderOrPayIdAuthenticationArray",
"(",
")",
")",
";",
"}",
"$",
"sExternalHandlerURL",
"=",
"$",
"this",
"->",
"GetDirectQueryURL",
"(",
")",
".",
"'?'",
".",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"TTools",
"::",
"GetArrayAsURL",
"(",
"$",
"aParameter",
")",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE DirectLink: called url: '",
".",
"$",
"sExternalHandlerURL",
",",
"4",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"$",
"sResult",
"=",
"file_get_contents",
"(",
"$",
"sExternalHandlerURL",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE DirectLink: XML response from DirectLink call: '",
".",
"$",
"sResult",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"sResult",
")",
"{",
"$",
"this",
"->",
"ParseXMLResponse",
"(",
"$",
"sResult",
")",
";",
"}",
"return",
"$",
"this",
"->",
"PaymentSuccess",
"(",
")",
";",
"}"
] | Fetch status of the current transaction an write it to aXMLResponseData.
@param string|null $sPayId
@return bool | [
"Fetch",
"status",
"of",
"the",
"current",
"transaction",
"an",
"write",
"it",
"to",
"aXMLResponseData",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L190-L213 |
32,283 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.ExecuteExternalPaymentCall | protected function ExecuteExternalPaymentCall()
{
$aParameter = $this->GetPaymentParameter();
$sExternalHandlerURL = $this->GetPaymentURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
TTools::WriteLogEntry('OGONE DirectLink: called url: '.$sExternalHandlerURL, 4, __FILE__, __LINE__);
$sResult = file_get_contents($sExternalHandlerURL);
TTools::WriteLogEntry('OGONE DirectLink: XML response from DirectLink call: '.$sResult, 1, __FILE__, __LINE__);
if (false !== $sResult) {
$this->ParseXMLResponse($sResult);
}
return $this->PaymentSuccess();
} | php | protected function ExecuteExternalPaymentCall()
{
$aParameter = $this->GetPaymentParameter();
$sExternalHandlerURL = $this->GetPaymentURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
TTools::WriteLogEntry('OGONE DirectLink: called url: '.$sExternalHandlerURL, 4, __FILE__, __LINE__);
$sResult = file_get_contents($sExternalHandlerURL);
TTools::WriteLogEntry('OGONE DirectLink: XML response from DirectLink call: '.$sResult, 1, __FILE__, __LINE__);
if (false !== $sResult) {
$this->ParseXMLResponse($sResult);
}
return $this->PaymentSuccess();
} | [
"protected",
"function",
"ExecuteExternalPaymentCall",
"(",
")",
"{",
"$",
"aParameter",
"=",
"$",
"this",
"->",
"GetPaymentParameter",
"(",
")",
";",
"$",
"sExternalHandlerURL",
"=",
"$",
"this",
"->",
"GetPaymentURL",
"(",
")",
".",
"'?'",
".",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"TTools",
"::",
"GetArrayAsURL",
"(",
"$",
"aParameter",
")",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE DirectLink: called url: '",
".",
"$",
"sExternalHandlerURL",
",",
"4",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"$",
"sResult",
"=",
"file_get_contents",
"(",
"$",
"sExternalHandlerURL",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE DirectLink: XML response from DirectLink call: '",
".",
"$",
"sResult",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"sResult",
")",
"{",
"$",
"this",
"->",
"ParseXMLResponse",
"(",
"$",
"sResult",
")",
";",
"}",
"return",
"$",
"this",
"->",
"PaymentSuccess",
"(",
")",
";",
"}"
] | Send payment call to external payment provider and check if payment was successfully done.
@return bool | [
"Send",
"payment",
"call",
"to",
"external",
"payment",
"provider",
"and",
"check",
"if",
"payment",
"was",
"successfully",
"done",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L263-L276 |
32,284 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.ParseXMLResponse | protected function ParseXMLResponse($sResult)
{
$oXMLResponse = new SimpleXMLElement($sResult);
foreach ($oXMLResponse->attributes() as $sAttributeName => $sAttributeValue) {
$sAttributeName = strtoupper($sAttributeName);
$this->aXMLResponseData[$sAttributeName] = (string) $sAttributeValue;
}
if (isset($oXMLResponse->HTML_ANSWER)) {
$this->aXMLResponseData['HTML_ANSWER'] = (string) $oXMLResponse->HTML_ANSWER;
}
} | php | protected function ParseXMLResponse($sResult)
{
$oXMLResponse = new SimpleXMLElement($sResult);
foreach ($oXMLResponse->attributes() as $sAttributeName => $sAttributeValue) {
$sAttributeName = strtoupper($sAttributeName);
$this->aXMLResponseData[$sAttributeName] = (string) $sAttributeValue;
}
if (isset($oXMLResponse->HTML_ANSWER)) {
$this->aXMLResponseData['HTML_ANSWER'] = (string) $oXMLResponse->HTML_ANSWER;
}
} | [
"protected",
"function",
"ParseXMLResponse",
"(",
"$",
"sResult",
")",
"{",
"$",
"oXMLResponse",
"=",
"new",
"SimpleXMLElement",
"(",
"$",
"sResult",
")",
";",
"foreach",
"(",
"$",
"oXMLResponse",
"->",
"attributes",
"(",
")",
"as",
"$",
"sAttributeName",
"=>",
"$",
"sAttributeValue",
")",
"{",
"$",
"sAttributeName",
"=",
"strtoupper",
"(",
"$",
"sAttributeName",
")",
";",
"$",
"this",
"->",
"aXMLResponseData",
"[",
"$",
"sAttributeName",
"]",
"=",
"(",
"string",
")",
"$",
"sAttributeValue",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"oXMLResponse",
"->",
"HTML_ANSWER",
")",
")",
"{",
"$",
"this",
"->",
"aXMLResponseData",
"[",
"'HTML_ANSWER'",
"]",
"=",
"(",
"string",
")",
"$",
"oXMLResponse",
"->",
"HTML_ANSWER",
";",
"}",
"}"
] | parse the xml response from the DirectLink API.
@param string $sResult - xml response as string | [
"parse",
"the",
"xml",
"response",
"from",
"the",
"DirectLink",
"API",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L309-L319 |
32,285 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.GetDirectLinkResponsePaymentUserDataFields | public static function GetDirectLinkResponsePaymentUserDataFields()
{
return array(self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'PAYID', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'STATUS', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'AMOUNT', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'CURRENCY', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'PM', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'BRAND', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'HTML_ANSWER');
} | php | public static function GetDirectLinkResponsePaymentUserDataFields()
{
return array(self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'PAYID', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'STATUS', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'AMOUNT', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'CURRENCY', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'PM', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'BRAND', self::GetDirectLinkResponsePaymentUserDataFieldPrefix().'HTML_ANSWER');
} | [
"public",
"static",
"function",
"GetDirectLinkResponsePaymentUserDataFields",
"(",
")",
"{",
"return",
"array",
"(",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'PAYID'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'STATUS'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'AMOUNT'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'CURRENCY'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'PM'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'BRAND'",
",",
"self",
"::",
"GetDirectLinkResponsePaymentUserDataFieldPrefix",
"(",
")",
".",
"'HTML_ANSWER'",
")",
";",
"}"
] | return list of fields from the parsed response xml that will be saved to the order.
@return array | [
"return",
"list",
"of",
"fields",
"from",
"the",
"parsed",
"response",
"xml",
"that",
"will",
"be",
"saved",
"to",
"the",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L365-L368 |
32,286 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.Get3DSecureParameter | protected function Get3DSecureParameter()
{
$aParameter = array();
if ('true' == $this->GetConfigParameter('3DS_ENABLED')) {
$oActivePage = $this->getActivePageService()->getActivePage();
$oGlobal = TGlobal::instance();
$aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook'));
$sSuccessURL = urldecode(str_replace('&', '&', $oActivePage->GetRealURLPlain($aSuccessCall, true)));
$aParameter = array('FLAG3D' => 'Y', 'WIN3DS' => $this->GetConfigParameter('3DS_WIN3DS'), 'ACCEPTURL' => $sSuccessURL, 'DECLINEURL' => $this->GetErrorURL('confirm'), 'EXCEPTIONURL' => $this->GetErrorURL('confirm'), 'HTTP_ACCEPT' => 'Accept: '.$_SERVER['HTTP_ACCEPT'], 'HTTP_USER_AGENT' => 'User-Agent: '.$_SERVER['HTTP_USER_AGENT'], 'LANGUAGE' => 'de_DE');
}
return $aParameter;
} | php | protected function Get3DSecureParameter()
{
$aParameter = array();
if ('true' == $this->GetConfigParameter('3DS_ENABLED')) {
$oActivePage = $this->getActivePageService()->getActivePage();
$oGlobal = TGlobal::instance();
$aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook'));
$sSuccessURL = urldecode(str_replace('&', '&', $oActivePage->GetRealURLPlain($aSuccessCall, true)));
$aParameter = array('FLAG3D' => 'Y', 'WIN3DS' => $this->GetConfigParameter('3DS_WIN3DS'), 'ACCEPTURL' => $sSuccessURL, 'DECLINEURL' => $this->GetErrorURL('confirm'), 'EXCEPTIONURL' => $this->GetErrorURL('confirm'), 'HTTP_ACCEPT' => 'Accept: '.$_SERVER['HTTP_ACCEPT'], 'HTTP_USER_AGENT' => 'User-Agent: '.$_SERVER['HTTP_USER_AGENT'], 'LANGUAGE' => 'de_DE');
}
return $aParameter;
} | [
"protected",
"function",
"Get3DSecureParameter",
"(",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"if",
"(",
"'true'",
"==",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'3DS_ENABLED'",
")",
")",
"{",
"$",
"oActivePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aSuccessCall",
"=",
"array",
"(",
"'module_fnc'",
"=>",
"array",
"(",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
"->",
"sModuleSpotName",
"=>",
"'PostProcessExternalPaymentHandlerHook'",
")",
")",
";",
"$",
"sSuccessURL",
"=",
"urldecode",
"(",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"$",
"oActivePage",
"->",
"GetRealURLPlain",
"(",
"$",
"aSuccessCall",
",",
"true",
")",
")",
")",
";",
"$",
"aParameter",
"=",
"array",
"(",
"'FLAG3D'",
"=>",
"'Y'",
",",
"'WIN3DS'",
"=>",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'3DS_WIN3DS'",
")",
",",
"'ACCEPTURL'",
"=>",
"$",
"sSuccessURL",
",",
"'DECLINEURL'",
"=>",
"$",
"this",
"->",
"GetErrorURL",
"(",
"'confirm'",
")",
",",
"'EXCEPTIONURL'",
"=>",
"$",
"this",
"->",
"GetErrorURL",
"(",
"'confirm'",
")",
",",
"'HTTP_ACCEPT'",
"=>",
"'Accept: '",
".",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT'",
"]",
",",
"'HTTP_USER_AGENT'",
"=>",
"'User-Agent: '",
".",
"$",
"_SERVER",
"[",
"'HTTP_USER_AGENT'",
"]",
",",
"'LANGUAGE'",
"=>",
"'de_DE'",
")",
";",
"}",
"return",
"$",
"aParameter",
";",
"}"
] | get parameters for 3D Secure payment if enabled via config parameter.
@return array | [
"get",
"parameters",
"for",
"3D",
"Secure",
"payment",
"if",
"enabled",
"via",
"config",
"parameter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L415-L429 |
32,287 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.GetDirectQueryURL | protected function GetDirectQueryURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectQueryURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectQueryURLTest');
}
return $sPaymentURL;
} | php | protected function GetDirectQueryURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectQueryURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectQueryURLTest');
}
return $sPaymentURL;
} | [
"protected",
"function",
"GetDirectQueryURL",
"(",
")",
"{",
"if",
"(",
"IPkgShopOrderPaymentConfig",
"::",
"ENVIRONMENT_PRODUCTION",
"===",
"$",
"this",
"->",
"getEnvironment",
"(",
")",
")",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgoneDirectQueryURLLive'",
")",
";",
"}",
"else",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgoneDirectQueryURLTest'",
")",
";",
"}",
"return",
"$",
"sPaymentURL",
";",
"}"
] | Get the direct query service URL - this is the endpoint to fetch data for
the current transaction.
@return string | [
"Get",
"the",
"direct",
"query",
"service",
"URL",
"-",
"this",
"is",
"the",
"endpoint",
"to",
"fetch",
"data",
"for",
"the",
"current",
"transaction",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L437-L446 |
32,288 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.GetDirectMaintenanceURL | protected function GetDirectMaintenanceURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectMaintenanceURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectMaintenanceURLTest');
}
return $sPaymentURL;
} | php | protected function GetDirectMaintenanceURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectMaintenanceURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgoneDirectMaintenanceURLTest');
}
return $sPaymentURL;
} | [
"protected",
"function",
"GetDirectMaintenanceURL",
"(",
")",
"{",
"if",
"(",
"IPkgShopOrderPaymentConfig",
"::",
"ENVIRONMENT_PRODUCTION",
"===",
"$",
"this",
"->",
"getEnvironment",
"(",
")",
")",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgoneDirectMaintenanceURLLive'",
")",
";",
"}",
"else",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgoneDirectMaintenanceURLTest'",
")",
";",
"}",
"return",
"$",
"sPaymentURL",
";",
"}"
] | Get the maintenance service URL - this is the endpoint to edit the
current transaction, to commit it for example.
@return string | [
"Get",
"the",
"maintenance",
"service",
"URL",
"-",
"this",
"is",
"the",
"endpoint",
"to",
"edit",
"the",
"current",
"transaction",
"to",
"commit",
"it",
"for",
"example",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L454-L463 |
32,289 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php | TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.GetOrderOrPayIdAuthenticationArray | protected function GetOrderOrPayIdAuthenticationArray()
{
$aAuthArray = array();
if (isset($this->aXMLResponseData['PAYID']) && !empty($this->aXMLResponseData['PAYID'])) {
$aAuthArray = array('PAYID' => $this->aXMLResponseData['PAYID']);
} elseif (isset($this->aPaymentUserData['ORDERID']) && !empty($this->aPaymentUserData['ORDERID'])) {
$aAuthArray = array('ORDERID' => $this->aPaymentUserData['ORDERID']);
}
return $aAuthArray;
} | php | protected function GetOrderOrPayIdAuthenticationArray()
{
$aAuthArray = array();
if (isset($this->aXMLResponseData['PAYID']) && !empty($this->aXMLResponseData['PAYID'])) {
$aAuthArray = array('PAYID' => $this->aXMLResponseData['PAYID']);
} elseif (isset($this->aPaymentUserData['ORDERID']) && !empty($this->aPaymentUserData['ORDERID'])) {
$aAuthArray = array('ORDERID' => $this->aPaymentUserData['ORDERID']);
}
return $aAuthArray;
} | [
"protected",
"function",
"GetOrderOrPayIdAuthenticationArray",
"(",
")",
"{",
"$",
"aAuthArray",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aXMLResponseData",
"[",
"'PAYID'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"aXMLResponseData",
"[",
"'PAYID'",
"]",
")",
")",
"{",
"$",
"aAuthArray",
"=",
"array",
"(",
"'PAYID'",
"=>",
"$",
"this",
"->",
"aXMLResponseData",
"[",
"'PAYID'",
"]",
")",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
")",
")",
"{",
"$",
"aAuthArray",
"=",
"array",
"(",
"'ORDERID'",
"=>",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
")",
";",
"}",
"return",
"$",
"aAuthArray",
";",
"}"
] | Return an array with PayId or OrderId, if one is set. Most API-Calls need at least
one of them to select the right transaction.
@return array | [
"Return",
"an",
"array",
"with",
"PayId",
"or",
"OrderId",
"if",
"one",
"is",
"set",
".",
"Most",
"API",
"-",
"Calls",
"need",
"at",
"least",
"one",
"of",
"them",
"to",
"select",
"the",
"right",
"transaction",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneDirectLinkWithAliasGateway.class.php#L471-L481 |
32,290 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.PostInsertHook | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an order number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new order number to the shop class
$oShop = TdbShop::GetInstance();
$iOrderNumber = $oShop->GetNextFreeOrderNumber();
$aData = $this->sqlData;
$aData['ordernumber'] = $iOrderNumber;
$this->LoadFromRow($aData);
$this->Save();
} | php | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an order number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new order number to the shop class
$oShop = TdbShop::GetInstance();
$iOrderNumber = $oShop->GetNextFreeOrderNumber();
$aData = $this->sqlData;
$aData['ordernumber'] = $iOrderNumber;
$this->LoadFromRow($aData);
$this->Save();
} | [
"protected",
"function",
"PostInsertHook",
"(",
")",
"{",
"parent",
"::",
"PostInsertHook",
"(",
")",
";",
"// we need to add an order number to the order... since generation of this number may differ",
"// from shop to shop, we have added the method to fetch a new order number to the shop class",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"iOrderNumber",
"=",
"$",
"oShop",
"->",
"GetNextFreeOrderNumber",
"(",
")",
";",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'ordernumber'",
"]",
"=",
"$",
"iOrderNumber",
";",
"$",
"this",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"}"
] | we use the post insert hook to set the ordernumber for the order. | [
"we",
"use",
"the",
"post",
"insert",
"hook",
"to",
"set",
"the",
"ordernumber",
"for",
"the",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L28-L39 |
32,291 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.& | protected function &SaveArticle(TShopBasketArticle $oBasketItem)
{
$oVat = $oBasketItem->GetVat();
$oOrderItem = TdbShopOrderItem::GetNewInstance();
/** @var $oOrderItem TdbShopOrderItem */
$oManufacturer = TdbShopManufacturer::GetNewInstance();
$oManufacturer->Load($oBasketItem->fieldShopManufacturerId);
$aData = array(
'shop_order_id' => $this->id,
'basket_item_key' => $oBasketItem->sBasketItemKey,
'shop_article_id' => $oBasketItem->id,
'name' => $oBasketItem->fieldName,
'name_variant_info' => $oBasketItem->fieldNameVariantInfo,
'articlenumber' => $oBasketItem->fieldArticlenumber,
'description_short' => $oBasketItem->fieldDescriptionShort,
'description' => $oBasketItem->fieldDescription,
'shop_manufacturer_id' => $oBasketItem->fieldShopManufacturerId,
'shop_manufacturer_name' => $oManufacturer->GetName(),
'price' => $oBasketItem->fieldPrice,
'price_reference' => $oBasketItem->fieldPriceReference,
'vat_percent' => $oVat->fieldVatPercent,
'size_weight' => $oBasketItem->fieldSizeWeight,
'size_width' => $oBasketItem->fieldSizeWidth,
'size_height' => $oBasketItem->fieldSizeHeight,
'size_length' => $oBasketItem->fieldSizeLength,
'stock' => $oBasketItem->getAvailableStock(),
'virtual_article' => $oBasketItem->sqlData['virtual_article'],
'exclude_from_vouchers' => $oBasketItem->sqlData['exclude_from_vouchers'],
'subtitle' => $oBasketItem->fieldSubtitle,
'is_new' => $oBasketItem->sqlData['is_new'],
'usp' => $oBasketItem->fieldUsp,
'is_bundle' => $oBasketItem->sqlData['is_bundle'],
'order_amount' => $oBasketItem->dAmount,
'order_price' => $oBasketItem->dPrice,
'order_price_total' => $oBasketItem->dPriceTotal,
'order_price_after_discounts' => $oBasketItem->dPriceTotalAfterDiscount,
'order_total_weight' => $oBasketItem->dTotalWeight,
'order_total_volume' => $oBasketItem->dTotalVolume,
'download' => $oBasketItem->fieldDownload,
'price_discounted' => $oBasketItem->dPriceAfterDiscount,
'exclude_from_discounts' => $oBasketItem->sqlData['exclude_from_discounts'],
'quantity_in_units' => $oBasketItem->fieldQuantityInUnits,
'shop_unit_of_measurement_id' => $oBasketItem->fieldShopUnitOfMeasurementId,
'custom_data' => $oBasketItem->getCustomData(),
);
$this->PrepareArticleDataForSave($oBasketItem, $aData);
$oOrderItem->LoadFromRow($aData);
$oOrderItem->AllowEditByAll(true);
$iInsertedOrderArticleId = $oOrderItem->Save();
//Linking the downloads from BasketItem to OrderItem
$oDownloadFilesList = $oBasketItem->GetDownloads('download');
while ($oDownloadFile = $oDownloadFilesList->Next()) {
$sQuery = "INSERT INTO `shop_order_item_download_cms_document_mlt`
SET `source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iInsertedOrderArticleId)."',
`target_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oDownloadFile->id)."'";
MySqlLegacySupport::getInstance()->query($sQuery);
}
if ($oBasketItem->fieldIsBundle) {
// also save bundle articles
$oBundleArticles = $oBasketItem->GetFieldShopBundleArticleList();
while ($oBundleArticle = $oBundleArticles->Next()) {
$this->SaveBundleArticle($oBasketItem, $oOrderItem, $oBundleArticle);
}
}
return $oOrderItem;
} | php | protected function &SaveArticle(TShopBasketArticle $oBasketItem)
{
$oVat = $oBasketItem->GetVat();
$oOrderItem = TdbShopOrderItem::GetNewInstance();
/** @var $oOrderItem TdbShopOrderItem */
$oManufacturer = TdbShopManufacturer::GetNewInstance();
$oManufacturer->Load($oBasketItem->fieldShopManufacturerId);
$aData = array(
'shop_order_id' => $this->id,
'basket_item_key' => $oBasketItem->sBasketItemKey,
'shop_article_id' => $oBasketItem->id,
'name' => $oBasketItem->fieldName,
'name_variant_info' => $oBasketItem->fieldNameVariantInfo,
'articlenumber' => $oBasketItem->fieldArticlenumber,
'description_short' => $oBasketItem->fieldDescriptionShort,
'description' => $oBasketItem->fieldDescription,
'shop_manufacturer_id' => $oBasketItem->fieldShopManufacturerId,
'shop_manufacturer_name' => $oManufacturer->GetName(),
'price' => $oBasketItem->fieldPrice,
'price_reference' => $oBasketItem->fieldPriceReference,
'vat_percent' => $oVat->fieldVatPercent,
'size_weight' => $oBasketItem->fieldSizeWeight,
'size_width' => $oBasketItem->fieldSizeWidth,
'size_height' => $oBasketItem->fieldSizeHeight,
'size_length' => $oBasketItem->fieldSizeLength,
'stock' => $oBasketItem->getAvailableStock(),
'virtual_article' => $oBasketItem->sqlData['virtual_article'],
'exclude_from_vouchers' => $oBasketItem->sqlData['exclude_from_vouchers'],
'subtitle' => $oBasketItem->fieldSubtitle,
'is_new' => $oBasketItem->sqlData['is_new'],
'usp' => $oBasketItem->fieldUsp,
'is_bundle' => $oBasketItem->sqlData['is_bundle'],
'order_amount' => $oBasketItem->dAmount,
'order_price' => $oBasketItem->dPrice,
'order_price_total' => $oBasketItem->dPriceTotal,
'order_price_after_discounts' => $oBasketItem->dPriceTotalAfterDiscount,
'order_total_weight' => $oBasketItem->dTotalWeight,
'order_total_volume' => $oBasketItem->dTotalVolume,
'download' => $oBasketItem->fieldDownload,
'price_discounted' => $oBasketItem->dPriceAfterDiscount,
'exclude_from_discounts' => $oBasketItem->sqlData['exclude_from_discounts'],
'quantity_in_units' => $oBasketItem->fieldQuantityInUnits,
'shop_unit_of_measurement_id' => $oBasketItem->fieldShopUnitOfMeasurementId,
'custom_data' => $oBasketItem->getCustomData(),
);
$this->PrepareArticleDataForSave($oBasketItem, $aData);
$oOrderItem->LoadFromRow($aData);
$oOrderItem->AllowEditByAll(true);
$iInsertedOrderArticleId = $oOrderItem->Save();
//Linking the downloads from BasketItem to OrderItem
$oDownloadFilesList = $oBasketItem->GetDownloads('download');
while ($oDownloadFile = $oDownloadFilesList->Next()) {
$sQuery = "INSERT INTO `shop_order_item_download_cms_document_mlt`
SET `source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iInsertedOrderArticleId)."',
`target_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oDownloadFile->id)."'";
MySqlLegacySupport::getInstance()->query($sQuery);
}
if ($oBasketItem->fieldIsBundle) {
// also save bundle articles
$oBundleArticles = $oBasketItem->GetFieldShopBundleArticleList();
while ($oBundleArticle = $oBundleArticles->Next()) {
$this->SaveBundleArticle($oBasketItem, $oOrderItem, $oBundleArticle);
}
}
return $oOrderItem;
} | [
"protected",
"function",
"&",
"SaveArticle",
"(",
"TShopBasketArticle",
"$",
"oBasketItem",
")",
"{",
"$",
"oVat",
"=",
"$",
"oBasketItem",
"->",
"GetVat",
"(",
")",
";",
"$",
"oOrderItem",
"=",
"TdbShopOrderItem",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oOrderItem TdbShopOrderItem */",
"$",
"oManufacturer",
"=",
"TdbShopManufacturer",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oManufacturer",
"->",
"Load",
"(",
"$",
"oBasketItem",
"->",
"fieldShopManufacturerId",
")",
";",
"$",
"aData",
"=",
"array",
"(",
"'shop_order_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'basket_item_key'",
"=>",
"$",
"oBasketItem",
"->",
"sBasketItemKey",
",",
"'shop_article_id'",
"=>",
"$",
"oBasketItem",
"->",
"id",
",",
"'name'",
"=>",
"$",
"oBasketItem",
"->",
"fieldName",
",",
"'name_variant_info'",
"=>",
"$",
"oBasketItem",
"->",
"fieldNameVariantInfo",
",",
"'articlenumber'",
"=>",
"$",
"oBasketItem",
"->",
"fieldArticlenumber",
",",
"'description_short'",
"=>",
"$",
"oBasketItem",
"->",
"fieldDescriptionShort",
",",
"'description'",
"=>",
"$",
"oBasketItem",
"->",
"fieldDescription",
",",
"'shop_manufacturer_id'",
"=>",
"$",
"oBasketItem",
"->",
"fieldShopManufacturerId",
",",
"'shop_manufacturer_name'",
"=>",
"$",
"oManufacturer",
"->",
"GetName",
"(",
")",
",",
"'price'",
"=>",
"$",
"oBasketItem",
"->",
"fieldPrice",
",",
"'price_reference'",
"=>",
"$",
"oBasketItem",
"->",
"fieldPriceReference",
",",
"'vat_percent'",
"=>",
"$",
"oVat",
"->",
"fieldVatPercent",
",",
"'size_weight'",
"=>",
"$",
"oBasketItem",
"->",
"fieldSizeWeight",
",",
"'size_width'",
"=>",
"$",
"oBasketItem",
"->",
"fieldSizeWidth",
",",
"'size_height'",
"=>",
"$",
"oBasketItem",
"->",
"fieldSizeHeight",
",",
"'size_length'",
"=>",
"$",
"oBasketItem",
"->",
"fieldSizeLength",
",",
"'stock'",
"=>",
"$",
"oBasketItem",
"->",
"getAvailableStock",
"(",
")",
",",
"'virtual_article'",
"=>",
"$",
"oBasketItem",
"->",
"sqlData",
"[",
"'virtual_article'",
"]",
",",
"'exclude_from_vouchers'",
"=>",
"$",
"oBasketItem",
"->",
"sqlData",
"[",
"'exclude_from_vouchers'",
"]",
",",
"'subtitle'",
"=>",
"$",
"oBasketItem",
"->",
"fieldSubtitle",
",",
"'is_new'",
"=>",
"$",
"oBasketItem",
"->",
"sqlData",
"[",
"'is_new'",
"]",
",",
"'usp'",
"=>",
"$",
"oBasketItem",
"->",
"fieldUsp",
",",
"'is_bundle'",
"=>",
"$",
"oBasketItem",
"->",
"sqlData",
"[",
"'is_bundle'",
"]",
",",
"'order_amount'",
"=>",
"$",
"oBasketItem",
"->",
"dAmount",
",",
"'order_price'",
"=>",
"$",
"oBasketItem",
"->",
"dPrice",
",",
"'order_price_total'",
"=>",
"$",
"oBasketItem",
"->",
"dPriceTotal",
",",
"'order_price_after_discounts'",
"=>",
"$",
"oBasketItem",
"->",
"dPriceTotalAfterDiscount",
",",
"'order_total_weight'",
"=>",
"$",
"oBasketItem",
"->",
"dTotalWeight",
",",
"'order_total_volume'",
"=>",
"$",
"oBasketItem",
"->",
"dTotalVolume",
",",
"'download'",
"=>",
"$",
"oBasketItem",
"->",
"fieldDownload",
",",
"'price_discounted'",
"=>",
"$",
"oBasketItem",
"->",
"dPriceAfterDiscount",
",",
"'exclude_from_discounts'",
"=>",
"$",
"oBasketItem",
"->",
"sqlData",
"[",
"'exclude_from_discounts'",
"]",
",",
"'quantity_in_units'",
"=>",
"$",
"oBasketItem",
"->",
"fieldQuantityInUnits",
",",
"'shop_unit_of_measurement_id'",
"=>",
"$",
"oBasketItem",
"->",
"fieldShopUnitOfMeasurementId",
",",
"'custom_data'",
"=>",
"$",
"oBasketItem",
"->",
"getCustomData",
"(",
")",
",",
")",
";",
"$",
"this",
"->",
"PrepareArticleDataForSave",
"(",
"$",
"oBasketItem",
",",
"$",
"aData",
")",
";",
"$",
"oOrderItem",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"oOrderItem",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"iInsertedOrderArticleId",
"=",
"$",
"oOrderItem",
"->",
"Save",
"(",
")",
";",
"//Linking the downloads from BasketItem to OrderItem",
"$",
"oDownloadFilesList",
"=",
"$",
"oBasketItem",
"->",
"GetDownloads",
"(",
"'download'",
")",
";",
"while",
"(",
"$",
"oDownloadFile",
"=",
"$",
"oDownloadFilesList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"sQuery",
"=",
"\"INSERT INTO `shop_order_item_download_cms_document_mlt`\n SET `source_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iInsertedOrderArticleId",
")",
".",
"\"',\n `target_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oDownloadFile",
"->",
"id",
")",
".",
"\"'\"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"}",
"if",
"(",
"$",
"oBasketItem",
"->",
"fieldIsBundle",
")",
"{",
"// also save bundle articles",
"$",
"oBundleArticles",
"=",
"$",
"oBasketItem",
"->",
"GetFieldShopBundleArticleList",
"(",
")",
";",
"while",
"(",
"$",
"oBundleArticle",
"=",
"$",
"oBundleArticles",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"this",
"->",
"SaveBundleArticle",
"(",
"$",
"oBasketItem",
",",
"$",
"oOrderItem",
",",
"$",
"oBundleArticle",
")",
";",
"}",
"}",
"return",
"$",
"oOrderItem",
";",
"}"
] | store one article with order.
@param TShopBasketArticle $oBasketItem
@return TdbShopOrderItem | [
"store",
"one",
"article",
"with",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L223-L291 |
32,292 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.& | public function &GetPaymentHandler()
{
$oPaymentHandler = $this->GetFromInternalCache('oOrderPaymentHandler');
if (is_null($oPaymentHandler)) {
$oPaymentMethod = $this->GetFieldShopPaymentMethod();
if ($oPaymentMethod) {
$aParameter = array();
$oPaymentParameterList = $this->GetFieldShopOrderPaymentMethodParameterList();
while ($oParam = $oPaymentParameterList->Next()) {
$aParameter[$oParam->fieldName] = $oParam->fieldValue;
}
try {
$oPaymentHandler = $this->getShopPaymentHandlerFactory()->createPaymentHandler($oPaymentMethod->fieldShopPaymentHandlerId, $this->fieldCmsPortalId, $aParameter);
$this->SetInternalCache('oOrderPaymentHandler', $oPaymentHandler);
} catch (ConfigurationException $e) {
$this->getLogger()->error(
sprintf('Unable to create payment handler: %s', $e->getMessage()),
[
'paymentHandlerId' => $oPaymentMethod->fieldShopPaymentHandlerId,
'portalId' => $this->fieldCmsPortalId,
]
);
}
}
}
return $oPaymentHandler;
} | php | public function &GetPaymentHandler()
{
$oPaymentHandler = $this->GetFromInternalCache('oOrderPaymentHandler');
if (is_null($oPaymentHandler)) {
$oPaymentMethod = $this->GetFieldShopPaymentMethod();
if ($oPaymentMethod) {
$aParameter = array();
$oPaymentParameterList = $this->GetFieldShopOrderPaymentMethodParameterList();
while ($oParam = $oPaymentParameterList->Next()) {
$aParameter[$oParam->fieldName] = $oParam->fieldValue;
}
try {
$oPaymentHandler = $this->getShopPaymentHandlerFactory()->createPaymentHandler($oPaymentMethod->fieldShopPaymentHandlerId, $this->fieldCmsPortalId, $aParameter);
$this->SetInternalCache('oOrderPaymentHandler', $oPaymentHandler);
} catch (ConfigurationException $e) {
$this->getLogger()->error(
sprintf('Unable to create payment handler: %s', $e->getMessage()),
[
'paymentHandlerId' => $oPaymentMethod->fieldShopPaymentHandlerId,
'portalId' => $this->fieldCmsPortalId,
]
);
}
}
}
return $oPaymentHandler;
} | [
"public",
"function",
"&",
"GetPaymentHandler",
"(",
")",
"{",
"$",
"oPaymentHandler",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oOrderPaymentHandler'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oPaymentHandler",
")",
")",
"{",
"$",
"oPaymentMethod",
"=",
"$",
"this",
"->",
"GetFieldShopPaymentMethod",
"(",
")",
";",
"if",
"(",
"$",
"oPaymentMethod",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"$",
"oPaymentParameterList",
"=",
"$",
"this",
"->",
"GetFieldShopOrderPaymentMethodParameterList",
"(",
")",
";",
"while",
"(",
"$",
"oParam",
"=",
"$",
"oPaymentParameterList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aParameter",
"[",
"$",
"oParam",
"->",
"fieldName",
"]",
"=",
"$",
"oParam",
"->",
"fieldValue",
";",
"}",
"try",
"{",
"$",
"oPaymentHandler",
"=",
"$",
"this",
"->",
"getShopPaymentHandlerFactory",
"(",
")",
"->",
"createPaymentHandler",
"(",
"$",
"oPaymentMethod",
"->",
"fieldShopPaymentHandlerId",
",",
"$",
"this",
"->",
"fieldCmsPortalId",
",",
"$",
"aParameter",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oOrderPaymentHandler'",
",",
"$",
"oPaymentHandler",
")",
";",
"}",
"catch",
"(",
"ConfigurationException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"error",
"(",
"sprintf",
"(",
"'Unable to create payment handler: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"[",
"'paymentHandlerId'",
"=>",
"$",
"oPaymentMethod",
"->",
"fieldShopPaymentHandlerId",
",",
"'portalId'",
"=>",
"$",
"this",
"->",
"fieldCmsPortalId",
",",
"]",
")",
";",
"}",
"}",
"}",
"return",
"$",
"oPaymentHandler",
";",
"}"
] | return the payment handler for the order - the handler is initialized
with the payment data from the order object.
@return TdbShopPaymentHandler|null | [
"return",
"the",
"payment",
"handler",
"for",
"the",
"order",
"-",
"the",
"handler",
"is",
"initialized",
"with",
"the",
"payment",
"data",
"from",
"the",
"order",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L385-L412 |
32,293 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.SendOrderNotification | public function SendOrderNotification($sSendToMail = null, $sSendToName = null)
{
$bOrderSend = false;
if (is_null($sSendToMail)) {
$sSendToMail = $this->fieldUserEmail;
}
if (is_null($sSendToName)) {
$sSendToName = $this->fieldAdrBillingFirstname.' '.$this->fieldAdrBillingLastname;
}
$oMail = $this->GetOrderNotificationEmailProfile(self::MAIL_CONFIRM_ORDER);
TCMSImage::ForceNonSSLURLs(true); // force image urls to non ssl for use in order email
if (is_null($oMail)) {
$bOrderSend = TGlobal::Translate('chameleon_system_shop.order_notification.error_mail_template_not_found', array('%emailTemplate%' => self::MAIL_CONFIRM_ORDER));
} else {
$aMailData = $this->sqlData;
$aMailData = $this->AddOrderNotificationEmailData($aMailData);
$aMailData = $this->AddOrderNotificationEmailComplexData($aMailData);
$oMail->AddDataArray($aMailData);
$aOrderDetails = $this->GetSQLWithTablePrefix();
$oMail->AddDataArray($aOrderDetails);
$oMail->ChangeToAddress($sSendToMail, $sSendToName);
$bOrderSend = $oMail->SendUsingObjectView('emails', 'Customer');
$this->SaveOrderNotificationDataToOrder($bOrderSend, $oMail, $sSendToMail);
}
TCMSImage::ForceNonSSLURLs(false); // reset - force non ssl urls
return $bOrderSend;
} | php | public function SendOrderNotification($sSendToMail = null, $sSendToName = null)
{
$bOrderSend = false;
if (is_null($sSendToMail)) {
$sSendToMail = $this->fieldUserEmail;
}
if (is_null($sSendToName)) {
$sSendToName = $this->fieldAdrBillingFirstname.' '.$this->fieldAdrBillingLastname;
}
$oMail = $this->GetOrderNotificationEmailProfile(self::MAIL_CONFIRM_ORDER);
TCMSImage::ForceNonSSLURLs(true); // force image urls to non ssl for use in order email
if (is_null($oMail)) {
$bOrderSend = TGlobal::Translate('chameleon_system_shop.order_notification.error_mail_template_not_found', array('%emailTemplate%' => self::MAIL_CONFIRM_ORDER));
} else {
$aMailData = $this->sqlData;
$aMailData = $this->AddOrderNotificationEmailData($aMailData);
$aMailData = $this->AddOrderNotificationEmailComplexData($aMailData);
$oMail->AddDataArray($aMailData);
$aOrderDetails = $this->GetSQLWithTablePrefix();
$oMail->AddDataArray($aOrderDetails);
$oMail->ChangeToAddress($sSendToMail, $sSendToName);
$bOrderSend = $oMail->SendUsingObjectView('emails', 'Customer');
$this->SaveOrderNotificationDataToOrder($bOrderSend, $oMail, $sSendToMail);
}
TCMSImage::ForceNonSSLURLs(false); // reset - force non ssl urls
return $bOrderSend;
} | [
"public",
"function",
"SendOrderNotification",
"(",
"$",
"sSendToMail",
"=",
"null",
",",
"$",
"sSendToName",
"=",
"null",
")",
"{",
"$",
"bOrderSend",
"=",
"false",
";",
"if",
"(",
"is_null",
"(",
"$",
"sSendToMail",
")",
")",
"{",
"$",
"sSendToMail",
"=",
"$",
"this",
"->",
"fieldUserEmail",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sSendToName",
")",
")",
"{",
"$",
"sSendToName",
"=",
"$",
"this",
"->",
"fieldAdrBillingFirstname",
".",
"' '",
".",
"$",
"this",
"->",
"fieldAdrBillingLastname",
";",
"}",
"$",
"oMail",
"=",
"$",
"this",
"->",
"GetOrderNotificationEmailProfile",
"(",
"self",
"::",
"MAIL_CONFIRM_ORDER",
")",
";",
"TCMSImage",
"::",
"ForceNonSSLURLs",
"(",
"true",
")",
";",
"// force image urls to non ssl for use in order email",
"if",
"(",
"is_null",
"(",
"$",
"oMail",
")",
")",
"{",
"$",
"bOrderSend",
"=",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.order_notification.error_mail_template_not_found'",
",",
"array",
"(",
"'%emailTemplate%'",
"=>",
"self",
"::",
"MAIL_CONFIRM_ORDER",
")",
")",
";",
"}",
"else",
"{",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailData",
"(",
"$",
"aMailData",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailComplexData",
"(",
"$",
"aMailData",
")",
";",
"$",
"oMail",
"->",
"AddDataArray",
"(",
"$",
"aMailData",
")",
";",
"$",
"aOrderDetails",
"=",
"$",
"this",
"->",
"GetSQLWithTablePrefix",
"(",
")",
";",
"$",
"oMail",
"->",
"AddDataArray",
"(",
"$",
"aOrderDetails",
")",
";",
"$",
"oMail",
"->",
"ChangeToAddress",
"(",
"$",
"sSendToMail",
",",
"$",
"sSendToName",
")",
";",
"$",
"bOrderSend",
"=",
"$",
"oMail",
"->",
"SendUsingObjectView",
"(",
"'emails'",
",",
"'Customer'",
")",
";",
"$",
"this",
"->",
"SaveOrderNotificationDataToOrder",
"(",
"$",
"bOrderSend",
",",
"$",
"oMail",
",",
"$",
"sSendToMail",
")",
";",
"}",
"TCMSImage",
"::",
"ForceNonSSLURLs",
"(",
"false",
")",
";",
"// reset - force non ssl urls",
"return",
"$",
"bOrderSend",
";",
"}"
] | send an order notification for this order. | [
"send",
"an",
"order",
"notification",
"for",
"this",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L489-L519 |
32,294 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.SaveOrderNotificationDataToOrder | protected function SaveOrderNotificationDataToOrder($bOrderSend, $oMail, $sSendToMail)
{
$aData = $this->sqlData;
if ($bOrderSend && !TGlobal::IsCMSMode()) {
$aData = $this->AddOrderNotificationDataForOrderSuccess($aData);
} elseif (!$bOrderSend && !TGlobal::IsCMSMode()) {
$aData = $this->AddOrderNotificationDataForOrderFailure($aData, $oMail, $sSendToMail);
}
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | php | protected function SaveOrderNotificationDataToOrder($bOrderSend, $oMail, $sSendToMail)
{
$aData = $this->sqlData;
if ($bOrderSend && !TGlobal::IsCMSMode()) {
$aData = $this->AddOrderNotificationDataForOrderSuccess($aData);
} elseif (!$bOrderSend && !TGlobal::IsCMSMode()) {
$aData = $this->AddOrderNotificationDataForOrderFailure($aData, $oMail, $sSendToMail);
}
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | [
"protected",
"function",
"SaveOrderNotificationDataToOrder",
"(",
"$",
"bOrderSend",
",",
"$",
"oMail",
",",
"$",
"sSendToMail",
")",
"{",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"if",
"(",
"$",
"bOrderSend",
"&&",
"!",
"TGlobal",
"::",
"IsCMSMode",
"(",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"this",
"->",
"AddOrderNotificationDataForOrderSuccess",
"(",
"$",
"aData",
")",
";",
"}",
"elseif",
"(",
"!",
"$",
"bOrderSend",
"&&",
"!",
"TGlobal",
"::",
"IsCMSMode",
"(",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"this",
"->",
"AddOrderNotificationDataForOrderFailure",
"(",
"$",
"aData",
",",
"$",
"oMail",
",",
"$",
"sSendToMail",
")",
";",
"}",
"$",
"this",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"false",
")",
";",
"}"
] | Save additional information to the order for successfully sent notification
email and incorrect sent notification email.
@param bool $bOrderSend
@param TdbDataMailProfile $oMail
@param string $sSendToMail | [
"Save",
"additional",
"information",
"to",
"the",
"order",
"for",
"successfully",
"sent",
"notification",
"email",
"and",
"incorrect",
"sent",
"notification",
"email",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L529-L541 |
32,295 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.AddOrderNotificationDataForOrderFailure | protected function AddOrderNotificationDataForOrderFailure($aData, $oMail, $sSendToMail)
{
$aAdditionalMailData = array('iAttemptsToSend' => 1, 'sSendToMail' => $sSendToMail);
$oMail->AddDataArray($aAdditionalMailData);
if (!is_array($aData)) {
$aData = array();
}
$aData['object_mail'] = base64_encode(serialize($oMail));
return $aData;
} | php | protected function AddOrderNotificationDataForOrderFailure($aData, $oMail, $sSendToMail)
{
$aAdditionalMailData = array('iAttemptsToSend' => 1, 'sSendToMail' => $sSendToMail);
$oMail->AddDataArray($aAdditionalMailData);
if (!is_array($aData)) {
$aData = array();
}
$aData['object_mail'] = base64_encode(serialize($oMail));
return $aData;
} | [
"protected",
"function",
"AddOrderNotificationDataForOrderFailure",
"(",
"$",
"aData",
",",
"$",
"oMail",
",",
"$",
"sSendToMail",
")",
"{",
"$",
"aAdditionalMailData",
"=",
"array",
"(",
"'iAttemptsToSend'",
"=>",
"1",
",",
"'sSendToMail'",
"=>",
"$",
"sSendToMail",
")",
";",
"$",
"oMail",
"->",
"AddDataArray",
"(",
"$",
"aAdditionalMailData",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aData",
")",
")",
"{",
"$",
"aData",
"=",
"array",
"(",
")",
";",
"}",
"$",
"aData",
"[",
"'object_mail'",
"]",
"=",
"base64_encode",
"(",
"serialize",
"(",
"$",
"oMail",
")",
")",
";",
"return",
"$",
"aData",
";",
"}"
] | Add additional data for the order if notification email was send incorrectly
to given array. Add info to the email profile that the notification email was
not send correctly. And add the incorrectly sent email profile to the given array.
@param array $aData
@param TdbDataMailProfile $oMail
@param string $sSendToMail - target email
@return array | [
"Add",
"additional",
"data",
"for",
"the",
"order",
"if",
"notification",
"email",
"was",
"send",
"incorrectly",
"to",
"given",
"array",
".",
"Add",
"info",
"to",
"the",
"email",
"profile",
"that",
"the",
"notification",
"email",
"was",
"not",
"send",
"correctly",
".",
"And",
"add",
"the",
"incorrectly",
"sent",
"email",
"profile",
"to",
"the",
"given",
"array",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L570-L580 |
32,296 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.AddOrderNotificationEmailData | protected function AddOrderNotificationEmailData($aMailData)
{
$oLocal = TCMSLocal::GetActive();
$oTmp = $this->GetFieldAdrBillingCountry();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_country_name');
$oTmp = $this->GetFieldAdrBillingSalutation();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_salutation_name');
$oTmp = $this->GetFieldAdrShippingCountry();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_country_name');
$oTmp = $this->GetFieldAdrShippingSalutation();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_salutation_name');
$oTmp = $this->GetFieldDataExtranetUser();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'data_extranet_user_name');
$oTmp = $this->GetFieldShop();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'shop_name');
$oTmp = $this->GetFieldShopPaymentMethod();
if (null !== $oTmp) {
$aMailData['shop_payment_method_name'] = $oTmp->fieldName;
}
$oTmp = $this->GetFieldShopShippingGroup();
if (null !== $oTmp) {
$aMailData['shop_shipping_group_name'] = $oTmp->fieldName;
}
$aMailData['datecreated'] = $oLocal->FormatDate($this->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);
return $aMailData;
} | php | protected function AddOrderNotificationEmailData($aMailData)
{
$oLocal = TCMSLocal::GetActive();
$oTmp = $this->GetFieldAdrBillingCountry();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_country_name');
$oTmp = $this->GetFieldAdrBillingSalutation();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_salutation_name');
$oTmp = $this->GetFieldAdrShippingCountry();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_country_name');
$oTmp = $this->GetFieldAdrShippingSalutation();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_salutation_name');
$oTmp = $this->GetFieldDataExtranetUser();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'data_extranet_user_name');
$oTmp = $this->GetFieldShop();
$aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'shop_name');
$oTmp = $this->GetFieldShopPaymentMethod();
if (null !== $oTmp) {
$aMailData['shop_payment_method_name'] = $oTmp->fieldName;
}
$oTmp = $this->GetFieldShopShippingGroup();
if (null !== $oTmp) {
$aMailData['shop_shipping_group_name'] = $oTmp->fieldName;
}
$aMailData['datecreated'] = $oLocal->FormatDate($this->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);
return $aMailData;
} | [
"protected",
"function",
"AddOrderNotificationEmailData",
"(",
"$",
"aMailData",
")",
"{",
"$",
"oLocal",
"=",
"TCMSLocal",
"::",
"GetActive",
"(",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldAdrBillingCountry",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'adr_billing_country_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldAdrBillingSalutation",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'adr_billing_salutation_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldAdrShippingCountry",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'adr_shipping_country_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldAdrShippingSalutation",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'adr_shipping_salutation_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldDataExtranetUser",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'data_extranet_user_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldShop",
"(",
")",
";",
"$",
"aMailData",
"=",
"$",
"this",
"->",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oTmp",
",",
"'shop_name'",
")",
";",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldShopPaymentMethod",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oTmp",
")",
"{",
"$",
"aMailData",
"[",
"'shop_payment_method_name'",
"]",
"=",
"$",
"oTmp",
"->",
"fieldName",
";",
"}",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"GetFieldShopShippingGroup",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oTmp",
")",
"{",
"$",
"aMailData",
"[",
"'shop_shipping_group_name'",
"]",
"=",
"$",
"oTmp",
"->",
"fieldName",
";",
"}",
"$",
"aMailData",
"[",
"'datecreated'",
"]",
"=",
"$",
"oLocal",
"->",
"FormatDate",
"(",
"$",
"this",
"->",
"fieldDatecreated",
",",
"TCMSLocal",
"::",
"DATEFORMAT_SHOW_DATE",
")",
";",
"return",
"$",
"aMailData",
";",
"}"
] | Add values for name parameter to email data array.
@param array $aMailData
@return array | [
"Add",
"values",
"for",
"name",
"parameter",
"to",
"email",
"data",
"array",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L603-L630 |
32,297 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.AddOrderNotificationEmailDataArray | protected function AddOrderNotificationEmailDataArray($aMailData, $oNameObject, $sSaveFieldName)
{
$aMailData[$sSaveFieldName] = '';
if (!is_null($oNameObject)) {
$aMailData[$sSaveFieldName] = $oNameObject->GetName();
}
return $aMailData;
} | php | protected function AddOrderNotificationEmailDataArray($aMailData, $oNameObject, $sSaveFieldName)
{
$aMailData[$sSaveFieldName] = '';
if (!is_null($oNameObject)) {
$aMailData[$sSaveFieldName] = $oNameObject->GetName();
}
return $aMailData;
} | [
"protected",
"function",
"AddOrderNotificationEmailDataArray",
"(",
"$",
"aMailData",
",",
"$",
"oNameObject",
",",
"$",
"sSaveFieldName",
")",
"{",
"$",
"aMailData",
"[",
"$",
"sSaveFieldName",
"]",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oNameObject",
")",
")",
"{",
"$",
"aMailData",
"[",
"$",
"sSaveFieldName",
"]",
"=",
"$",
"oNameObject",
"->",
"GetName",
"(",
")",
";",
"}",
"return",
"$",
"aMailData",
";",
"}"
] | add name value from given object to given array with given field name as key if object is not null.
@param array $aMailData
@param TCMSRecord $oNameObject
@param string $sSaveFieldName
@return array | [
"add",
"name",
"value",
"from",
"given",
"object",
"to",
"given",
"array",
"with",
"given",
"field",
"name",
"as",
"key",
"if",
"object",
"is",
"not",
"null",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L641-L649 |
32,298 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.ExecutePayment | public function ExecutePayment(&$oPaymentHandler, $sMessageConsumer = '')
{
$bPaymentOk = false;
$bAllowEdit = $this->bAllowEditByAll;
$this->AllowEditByAll(true);
$aData = $this->sqlData;
$aData['system_order_payment_method_executed'] = '0';
$aData['system_order_payment_method_executed_date'] = date('Y-m-d H:i:s');
$this->LoadFromRow($aData);
$this->Save();
$bPaymentOk = $this->ExecutePaymentHook($oPaymentHandler, $sMessageConsumer);
$this->AllowEditByAll($bAllowEdit);
return $bPaymentOk;
} | php | public function ExecutePayment(&$oPaymentHandler, $sMessageConsumer = '')
{
$bPaymentOk = false;
$bAllowEdit = $this->bAllowEditByAll;
$this->AllowEditByAll(true);
$aData = $this->sqlData;
$aData['system_order_payment_method_executed'] = '0';
$aData['system_order_payment_method_executed_date'] = date('Y-m-d H:i:s');
$this->LoadFromRow($aData);
$this->Save();
$bPaymentOk = $this->ExecutePaymentHook($oPaymentHandler, $sMessageConsumer);
$this->AllowEditByAll($bAllowEdit);
return $bPaymentOk;
} | [
"public",
"function",
"ExecutePayment",
"(",
"&",
"$",
"oPaymentHandler",
",",
"$",
"sMessageConsumer",
"=",
"''",
")",
"{",
"$",
"bPaymentOk",
"=",
"false",
";",
"$",
"bAllowEdit",
"=",
"$",
"this",
"->",
"bAllowEditByAll",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'system_order_payment_method_executed'",
"]",
"=",
"'0'",
";",
"$",
"aData",
"[",
"'system_order_payment_method_executed_date'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"this",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"this",
"->",
"Save",
"(",
")",
";",
"$",
"bPaymentOk",
"=",
"$",
"this",
"->",
"ExecutePaymentHook",
"(",
"$",
"oPaymentHandler",
",",
"$",
"sMessageConsumer",
")",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
"$",
"bAllowEdit",
")",
";",
"return",
"$",
"bPaymentOk",
";",
"}"
] | executes payment for order and given payment handler.
@param TdbShopPaymentHandler $oPaymentHandler
@param string $sMessageConsumer - message consummer to send errors to
@return bool | [
"executes",
"payment",
"for",
"order",
"and",
"given",
"payment",
"handler",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L699-L715 |
32,299 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrder.class.php | TShopOrder.getUserTypeOrdered | public static function getUserTypeOrdered($sDBValue, $aOrderRow)
{
$sUserType = TGlobal::Translate('chameleon_system_shop.order_list.user_type_guest');
if ('' != $sDBValue) {
$sUserType = TGlobal::Translate('chameleon_system_shop.order_list.user_type_customer');
}
return $sUserType;
} | php | public static function getUserTypeOrdered($sDBValue, $aOrderRow)
{
$sUserType = TGlobal::Translate('chameleon_system_shop.order_list.user_type_guest');
if ('' != $sDBValue) {
$sUserType = TGlobal::Translate('chameleon_system_shop.order_list.user_type_customer');
}
return $sUserType;
} | [
"public",
"static",
"function",
"getUserTypeOrdered",
"(",
"$",
"sDBValue",
",",
"$",
"aOrderRow",
")",
"{",
"$",
"sUserType",
"=",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.order_list.user_type_guest'",
")",
";",
"if",
"(",
"''",
"!=",
"$",
"sDBValue",
")",
"{",
"$",
"sUserType",
"=",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.order_list.user_type_customer'",
")",
";",
"}",
"return",
"$",
"sUserType",
";",
"}"
] | get info if ordered from registered user or guest user.
Was used for cms list. | [
"get",
"info",
"if",
"ordered",
"from",
"registered",
"user",
"or",
"guest",
"user",
".",
"Was",
"used",
"for",
"cms",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L736-L744 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.