repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
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\"", ")", ";", "}", ...
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
train
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_coun...
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
train
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'...
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
train
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", "(", "$", "respons...
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", "countr...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExampleCLI.php#L135-L146
train
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", "(", "$", "author...
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
train
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", "(", ...
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
train
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", "[", "]", "=", "'HideShip...
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
train
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", "(", ")", ";", ...
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
train
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", ")", ";", "$...
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
train
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", "(", ")", ";",...
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
train
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", "->", "p...
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
train
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", "(", ")", ")", "...
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
train
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", "(", ")", ")...
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
train
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", "["...
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
train
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"...
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
train
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_PAT...
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
train
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", "=", "$", "...
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
train
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", ".", "'\\\\'", ".", ...
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
train
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", "]", "=", "$", "t...
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
train
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", "...
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
train
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", "->", ...
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
train
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", ...
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
train
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
train
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 E...
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
train
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", "$", "t...
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
train
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", ")", ...
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
train
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", "[", "]", ...
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
train
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", ...
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
train
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",...
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
train
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", ")", "{",...
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
train
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", ...
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
train
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", "=", "$", "o...
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
train
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", "::", "getEscapeSequ...
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
train
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", "::",...
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
train
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...
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
train
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", "->", "GetFiel...
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
train
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", "(", "$", ...
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
train
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", "\\", "InvalidArgume...
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
train
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'", "]", ...
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
train
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", "->", "_verifySignatureWithVersionOneA...
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
train
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", "(", ...
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
train
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", "...
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
train
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('&amp;', '&', 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('&amp;', '&', 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...
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
train
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('&amp;', '&', 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('&amp;', '&', 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"...
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
train
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", "=...
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
train
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"...
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
train
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('&amp;', '&', $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('&amp;', '&', $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", ...
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
train
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", ...
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
train
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", "->", "GetConfigParame...
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
train
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", ...
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
train
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...
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
train
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", "(", ")", ";", "/**...
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
train
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", ")", ")", "{", "$", "oPaymentMeth...
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
train
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", "...
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
train
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", "::", "IsCM...
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
train
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'", "=>", "$", "sSendToMai...
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", "corre...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L570-L580
train
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", "...
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
train
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", "(", "$", "oNam...
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
train
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", "->", "AllowE...
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
train
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", "(", "''", "!=", "$", "sD...
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
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.getCountryName
public static function getCountryName($sDBValue, $aOrderRow) { $oCountry = TdbDataCountry::GetNewInstance(); $sCountry = '-'; if ($oCountry->Load($sDBValue)) { $sCountry = $oCountry->fieldName; } return $sCountry; }
php
public static function getCountryName($sDBValue, $aOrderRow) { $oCountry = TdbDataCountry::GetNewInstance(); $sCountry = '-'; if ($oCountry->Load($sDBValue)) { $sCountry = $oCountry->fieldName; } return $sCountry; }
[ "public", "static", "function", "getCountryName", "(", "$", "sDBValue", ",", "$", "aOrderRow", ")", "{", "$", "oCountry", "=", "TdbDataCountry", "::", "GetNewInstance", "(", ")", ";", "$", "sCountry", "=", "'-'", ";", "if", "(", "$", "oCountry", "->", "L...
Get country name for value. Was used for cms list.
[ "Get", "country", "name", "for", "value", ".", "Was", "used", "for", "cms", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L750-L759
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.getShippingCountryName
public static function getShippingCountryName($sDBValue, $aOrderRow) { if ('' == $sDBValue) { $sCountry = TdbShopOrder::getCountryName($aOrderRow['adr_billing_country_id'], $aOrderRow); } else { $sCountry = TdbShopOrder::getCountryName($sDBValue, $aOrderRow); } return $sCountry; }
php
public static function getShippingCountryName($sDBValue, $aOrderRow) { if ('' == $sDBValue) { $sCountry = TdbShopOrder::getCountryName($aOrderRow['adr_billing_country_id'], $aOrderRow); } else { $sCountry = TdbShopOrder::getCountryName($sDBValue, $aOrderRow); } return $sCountry; }
[ "public", "static", "function", "getShippingCountryName", "(", "$", "sDBValue", ",", "$", "aOrderRow", ")", "{", "if", "(", "''", "==", "$", "sDBValue", ")", "{", "$", "sCountry", "=", "TdbShopOrder", "::", "getCountryName", "(", "$", "aOrderRow", "[", "'a...
Get shipping country from value. If value was empty get billing country Was used for cms list.
[ "Get", "shipping", "country", "from", "value", ".", "If", "value", "was", "empty", "get", "billing", "country", "Was", "used", "for", "cms", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L766-L775
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.UpdateStock
public function UpdateStock($bRemoveFromStock) { $oOrderItemList = $this->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $oItem = $oOrderItem->GetFieldShopArticle(); if ($oItem) { $dAmount = $oOrderItem->fieldOrderAmount; if ($bRemoveFromStock) { $dAmount = -1 * $dAmount; } $oItem->UpdateStock($dAmount, true, true); } } $oOrderItemList->GoToStart(); }
php
public function UpdateStock($bRemoveFromStock) { $oOrderItemList = $this->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $oItem = $oOrderItem->GetFieldShopArticle(); if ($oItem) { $dAmount = $oOrderItem->fieldOrderAmount; if ($bRemoveFromStock) { $dAmount = -1 * $dAmount; } $oItem->UpdateStock($dAmount, true, true); } } $oOrderItemList->GoToStart(); }
[ "public", "function", "UpdateStock", "(", "$", "bRemoveFromStock", ")", "{", "$", "oOrderItemList", "=", "$", "this", "->", "GetFieldShopOrderItemList", "(", ")", ";", "$", "oOrderItemList", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oOrderItem", ...
remove or add the stock of the order back into the product pool. @param bool $bRemoveFromStock
[ "remove", "or", "add", "the", "stock", "of", "the", "order", "back", "into", "the", "product", "pool", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L1018-L1033
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php
TPkgShopListfilterItemMultiselect.IsSelected
public function IsSelected($sItemName) { $bIsSelected = false; if (is_array($this->aActiveFilterData)) { $bIsSelected = in_array($sItemName, $this->aActiveFilterData); } elseif (!empty($this->aActiveFilterData) && is_string($this->aActiveFilterData)) { $bIsSelected = ($sItemName == $this->aActiveFilterData); } return $bIsSelected; }
php
public function IsSelected($sItemName) { $bIsSelected = false; if (is_array($this->aActiveFilterData)) { $bIsSelected = in_array($sItemName, $this->aActiveFilterData); } elseif (!empty($this->aActiveFilterData) && is_string($this->aActiveFilterData)) { $bIsSelected = ($sItemName == $this->aActiveFilterData); } return $bIsSelected; }
[ "public", "function", "IsSelected", "(", "$", "sItemName", ")", "{", "$", "bIsSelected", "=", "false", ";", "if", "(", "is_array", "(", "$", "this", "->", "aActiveFilterData", ")", ")", "{", "$", "bIsSelected", "=", "in_array", "(", "$", "sItemName", ","...
return true if the item is selected. @param string $sItemName @return bool
[ "return", "true", "if", "the", "item", "is", "selected", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php#L36-L46
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php
TPkgShopListfilterItemMultiselect.GetTargetTableNameField
protected function GetTargetTableNameField() { static $sTargetTableName = null; if (is_null($sTargetTableName)) { $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ $oTargetTableConf->LoadFromField('name', $this->sItemTableName); $sTargetTableName = $oTargetTableConf->GetNameColumn(); $sClassName = TCMSTableToClass::GetClassName(TCMSTableToClass::PREFIX_CLASS, $oTargetTableConf->fieldName); if (call_user_func(array($sClassName, 'CMSFieldIsTranslated'), $sTargetTableName)) { $sLanguagePrefix = TGlobal::GetLanguagePrefix(); if (!empty($sLanguagePrefix)) { $sTargetTableName = $sTargetTableName.'__'.$sLanguagePrefix; } } } return $sTargetTableName; }
php
protected function GetTargetTableNameField() { static $sTargetTableName = null; if (is_null($sTargetTableName)) { $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ $oTargetTableConf->LoadFromField('name', $this->sItemTableName); $sTargetTableName = $oTargetTableConf->GetNameColumn(); $sClassName = TCMSTableToClass::GetClassName(TCMSTableToClass::PREFIX_CLASS, $oTargetTableConf->fieldName); if (call_user_func(array($sClassName, 'CMSFieldIsTranslated'), $sTargetTableName)) { $sLanguagePrefix = TGlobal::GetLanguagePrefix(); if (!empty($sLanguagePrefix)) { $sTargetTableName = $sTargetTableName.'__'.$sLanguagePrefix; } } } return $sTargetTableName; }
[ "protected", "function", "GetTargetTableNameField", "(", ")", "{", "static", "$", "sTargetTableName", "=", "null", ";", "if", "(", "is_null", "(", "$", "sTargetTableName", ")", ")", "{", "$", "oTargetTableConf", "=", "TdbCmsTblConf", "::", "GetNewInstance", "(",...
returns the name field of the target table. @return string
[ "returns", "the", "name", "field", "of", "the", "target", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php#L207-L225
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/pkgShop/AmazonPaymentHandler.php
AmazonPaymentHandler.isCaptureOnShipment
public function isCaptureOnShipment() { $isPaymentOnShipmentStored = $this->GetUserPaymentDataItem(self::PARAMETER_IS_PAYMENT_ON_SHIPMENT); if (false !== $isPaymentOnShipmentStored) { return '1' === $isPaymentOnShipmentStored; } $config = $this->getAmazonPaymentGroupConfig($this->getActivePortalId()); return $config->isCaptureOnShipment(); }
php
public function isCaptureOnShipment() { $isPaymentOnShipmentStored = $this->GetUserPaymentDataItem(self::PARAMETER_IS_PAYMENT_ON_SHIPMENT); if (false !== $isPaymentOnShipmentStored) { return '1' === $isPaymentOnShipmentStored; } $config = $this->getAmazonPaymentGroupConfig($this->getActivePortalId()); return $config->isCaptureOnShipment(); }
[ "public", "function", "isCaptureOnShipment", "(", ")", "{", "$", "isPaymentOnShipmentStored", "=", "$", "this", "->", "GetUserPaymentDataItem", "(", "self", "::", "PARAMETER_IS_PAYMENT_ON_SHIPMENT", ")", ";", "if", "(", "false", "!==", "$", "isPaymentOnShipmentStored"...
return true if capture on shipment is active. @return bool
[ "return", "true", "if", "capture", "on", "shipment", "is", "active", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/pkgShop/AmazonPaymentHandler.php#L130-L140
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopDiscountList.class.php
TShopDiscountList.GetActiveDiscountList
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`') { static $aActiveDiscountList = array(); $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder); $sKey = TCacheManager::GetKey($aKey); if (!array_key_exists($sKey, $aActiveDiscountList)) { $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s')); if (!empty($sOrder)) { $sOrder = "ORDER BY {$sOrder}"; } if (is_null($sFilter)) { $sFilter = ''; } else { $sFilter = " AND ({$sFilter})"; } $query = "SELECT * FROM `shop_discount` WHERE `shop_discount`.`active` = '1' AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00')) {$sFilter} {$sOrder} "; $aActiveDiscountList[$sKey] = parent::GetList($query); $aActiveDiscountList[$sKey]->bAllowItemCache = true; } else { $aActiveDiscountList[$sKey]->GoToStart(); } return $aActiveDiscountList[$sKey]; }
php
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`') { static $aActiveDiscountList = array(); $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder); $sKey = TCacheManager::GetKey($aKey); if (!array_key_exists($sKey, $aActiveDiscountList)) { $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s')); if (!empty($sOrder)) { $sOrder = "ORDER BY {$sOrder}"; } if (is_null($sFilter)) { $sFilter = ''; } else { $sFilter = " AND ({$sFilter})"; } $query = "SELECT * FROM `shop_discount` WHERE `shop_discount`.`active` = '1' AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00')) {$sFilter} {$sOrder} "; $aActiveDiscountList[$sKey] = parent::GetList($query); $aActiveDiscountList[$sKey]->bAllowItemCache = true; } else { $aActiveDiscountList[$sKey]->GoToStart(); } return $aActiveDiscountList[$sKey]; }
[ "public", "static", "function", "GetActiveDiscountList", "(", "$", "sFilter", "=", "null", ",", "$", "sOrder", "=", "'`shop_discount`.`position`'", ")", "{", "static", "$", "aActiveDiscountList", "=", "array", "(", ")", ";", "$", "aKey", "=", "array", "(", "...
return all discounts that are currently set to active. @param string $sFilter @param string $sOrder @return TdbShopDiscountList
[ "return", "all", "discounts", "that", "are", "currently", "set", "to", "active", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopDiscountList.class.php#L22-L51
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.init
protected function init($data) { $i = 0; foreach ($data as $header => $value) { $column = self::formatColumnName($i); $this->setHeader($column, $header); ++$i; } $this->setBoldLabels(); }
php
protected function init($data) { $i = 0; foreach ($data as $header => $value) { $column = self::formatColumnName($i); $this->setHeader($column, $header); ++$i; } $this->setBoldLabels(); }
[ "protected", "function", "init", "(", "$", "data", ")", "{", "$", "i", "=", "0", ";", "foreach", "(", "$", "data", "as", "$", "header", "=>", "$", "value", ")", "{", "$", "column", "=", "self", "::", "formatColumnName", "(", "$", "i", ")", ";", ...
Set labels. @param array $data
[ "Set", "labels", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L121-L131
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.close
public function close() { $writer = IOFactory::createWriter($this->phpExcelObject, 'Xlsx'); //\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007'); $writer->save($this->filename); }
php
public function close() { $writer = IOFactory::createWriter($this->phpExcelObject, 'Xlsx'); //\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007'); $writer->save($this->filename); }
[ "public", "function", "close", "(", ")", "{", "$", "writer", "=", "IOFactory", "::", "createWriter", "(", "$", "this", "->", "phpExcelObject", ",", "'Xlsx'", ")", ";", "//\\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007');", "$", "writer", "->", ...
Save Excel file.
[ "Save", "Excel", "file", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L136-L141
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.formatColumnName
public static function formatColumnName($number) { for ($char = ''; $number >= 0; $number = (int) ($number / 26) - 1) { $char = \chr($number % 26 + 0x41) . $char; } return $char; }
php
public static function formatColumnName($number) { for ($char = ''; $number >= 0; $number = (int) ($number / 26) - 1) { $char = \chr($number % 26 + 0x41) . $char; } return $char; }
[ "public", "static", "function", "formatColumnName", "(", "$", "number", ")", "{", "for", "(", "$", "char", "=", "''", ";", "$", "number", ">=", "0", ";", "$", "number", "=", "(", "int", ")", "(", "$", "number", "/", "26", ")", "-", "1", ")", "{...
Returns letter for number based on Excel columns. @param int $number @return string
[ "Returns", "letter", "for", "number", "based", "on", "Excel", "columns", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L150-L157
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setBoldLabels
private function setBoldLabels() { $this->getActiveSheet()->getStyle( sprintf( '%s1:%s1', reset($this->headerColumns), end($this->headerColumns) ) )->getFont()->setBold(true); }
php
private function setBoldLabels() { $this->getActiveSheet()->getStyle( sprintf( '%s1:%s1', reset($this->headerColumns), end($this->headerColumns) ) )->getFont()->setBold(true); }
[ "private", "function", "setBoldLabels", "(", ")", "{", "$", "this", "->", "getActiveSheet", "(", ")", "->", "getStyle", "(", "sprintf", "(", "'%s1:%s1'", ",", "reset", "(", "$", "this", "->", "headerColumns", ")", ",", "end", "(", "$", "this", "->", "h...
Makes header bold.
[ "Makes", "header", "bold", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L170-L179
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setCellValue
private function setCellValue($column, $value) { $cellValue = $value; if (\is_bool($value)) { if ($value) { $cellValue = 1; } else { $cellValue = 0; } } $this->getActiveSheet()->setCellValue($column, $cellValue); }
php
private function setCellValue($column, $value) { $cellValue = $value; if (\is_bool($value)) { if ($value) { $cellValue = 1; } else { $cellValue = 0; } } $this->getActiveSheet()->setCellValue($column, $cellValue); }
[ "private", "function", "setCellValue", "(", "$", "column", ",", "$", "value", ")", "{", "$", "cellValue", "=", "$", "value", ";", "if", "(", "\\", "is_bool", "(", "$", "value", ")", ")", "{", "if", "(", "$", "value", ")", "{", "$", "cellValue", "...
Sets cell value. @param string $column @param string|bool $value
[ "Sets", "cell", "value", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L187-L200
train
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setHeader
private function setHeader($column, $value) { $this->setCellValue($column . self::LABEL_COLUMN, $value); $this->getActiveSheet()->getColumnDimension($column)->setAutoSize(true); $this->headerColumns[$value] = $column; }
php
private function setHeader($column, $value) { $this->setCellValue($column . self::LABEL_COLUMN, $value); $this->getActiveSheet()->getColumnDimension($column)->setAutoSize(true); $this->headerColumns[$value] = $column; }
[ "private", "function", "setHeader", "(", "$", "column", ",", "$", "value", ")", "{", "$", "this", "->", "setCellValue", "(", "$", "column", ".", "self", "::", "LABEL_COLUMN", ",", "$", "value", ")", ";", "$", "this", "->", "getActiveSheet", "(", ")", ...
Set column label and make column auto size. @param string $column @param string $value
[ "Set", "column", "label", "and", "make", "column", "auto", "size", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L208-L213
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.ProcessFieldsBeforeDisplay
public function ProcessFieldsBeforeDisplay(&$oFields) { /** @var TdbShopArticle $product */ $product = $this->oTable; if ($product->IsVariant()) { $oParent = &$product->GetFieldVariantParent(); if (null != $oParent) { $oVariantSet = &$oParent->GetFieldShopVariantSet(); if (!is_null($oVariantSet)) { $aPermittedFields = $oVariantSet->GetMLTIdList('cms_field_conf', 'cms_field_conf_mlt'); $oPermittedFields = new TIterator(); $oFields->GoToStart(); while ($oField = $oFields->Next()) { /** @var $oField TCMSField */ if (in_array($oField->oDefinition->id, $aPermittedFields)) { $oPermittedFields->AddItem($oField); } } $oFields = $oPermittedFields; } } } }
php
public function ProcessFieldsBeforeDisplay(&$oFields) { /** @var TdbShopArticle $product */ $product = $this->oTable; if ($product->IsVariant()) { $oParent = &$product->GetFieldVariantParent(); if (null != $oParent) { $oVariantSet = &$oParent->GetFieldShopVariantSet(); if (!is_null($oVariantSet)) { $aPermittedFields = $oVariantSet->GetMLTIdList('cms_field_conf', 'cms_field_conf_mlt'); $oPermittedFields = new TIterator(); $oFields->GoToStart(); while ($oField = $oFields->Next()) { /** @var $oField TCMSField */ if (in_array($oField->oDefinition->id, $aPermittedFields)) { $oPermittedFields->AddItem($oField); } } $oFields = $oPermittedFields; } } } }
[ "public", "function", "ProcessFieldsBeforeDisplay", "(", "&", "$", "oFields", ")", "{", "/** @var TdbShopArticle $product */", "$", "product", "=", "$", "this", "->", "oTable", ";", "if", "(", "$", "product", "->", "IsVariant", "(", ")", ")", "{", "$", "oPar...
if the current article is a variant AND a variant set has been defined, then mark all fields as hidden that are NOT activated through the set. @param TIterator $oFields
[ "if", "the", "current", "article", "is", "a", "variant", "AND", "a", "variant", "set", "has", "been", "defined", "then", "mark", "all", "fields", "as", "hidden", "that", "are", "NOT", "activated", "through", "the", "set", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L26-L48
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.PrepareDataForSave
protected function PrepareDataForSave($postData) { if (array_key_exists('active', $postData)) { if (!array_key_exists('variant_parent_id', $postData) || empty($postData['variant_parent_id'])) { $postData['variant_parent_is_active'] = $postData['active']; } } return $postData; }
php
protected function PrepareDataForSave($postData) { if (array_key_exists('active', $postData)) { if (!array_key_exists('variant_parent_id', $postData) || empty($postData['variant_parent_id'])) { $postData['variant_parent_is_active'] = $postData['active']; } } return $postData; }
[ "protected", "function", "PrepareDataForSave", "(", "$", "postData", ")", "{", "if", "(", "array_key_exists", "(", "'active'", ",", "$", "postData", ")", ")", "{", "if", "(", "!", "array_key_exists", "(", "'variant_parent_id'", ",", "$", "postData", ")", "||...
here you can modify, clean or filter data before saving. @var array $postData @return array
[ "here", "you", "can", "modify", "clean", "or", "filter", "data", "before", "saving", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L148-L157
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.isNewVariant
protected function isNewVariant() { $bIsNewVariant = false; if (!is_null($this->sRestriction) && !is_null($this->sRestrictionField) && '_id' == substr($this->sRestrictionField, -3)) { if ('variant_parent_id' == $this->sRestrictionField) { $bIsNewVariant = true; } } return $bIsNewVariant; }
php
protected function isNewVariant() { $bIsNewVariant = false; if (!is_null($this->sRestriction) && !is_null($this->sRestrictionField) && '_id' == substr($this->sRestrictionField, -3)) { if ('variant_parent_id' == $this->sRestrictionField) { $bIsNewVariant = true; } } return $bIsNewVariant; }
[ "protected", "function", "isNewVariant", "(", ")", "{", "$", "bIsNewVariant", "=", "false", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "sRestriction", ")", "&&", "!", "is_null", "(", "$", "this", "->", "sRestrictionField", ")", "&&", "'_id'"...
determine if the current loaded record is a variant or a parent. @return bool
[ "determine", "if", "the", "current", "loaded", "record", "is", "a", "variant", "or", "a", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L164-L174
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.Insert
public function Insert() { if ($this->isNewVariant()) { $this->sId = $this->sRestriction; $variant = $this->DatabaseCopy(); /** @var TdbShopArticle $product */ $product = $this->oTable; if (!$product->fieldActive) { $variantTableEditor = TTools::GetTableEditorManager('shop_article', $variant->id); $variantTableEditor->SaveField('variant_parent_is_active', '0'); } } else { parent::Insert(); } }
php
public function Insert() { if ($this->isNewVariant()) { $this->sId = $this->sRestriction; $variant = $this->DatabaseCopy(); /** @var TdbShopArticle $product */ $product = $this->oTable; if (!$product->fieldActive) { $variantTableEditor = TTools::GetTableEditorManager('shop_article', $variant->id); $variantTableEditor->SaveField('variant_parent_is_active', '0'); } } else { parent::Insert(); } }
[ "public", "function", "Insert", "(", ")", "{", "if", "(", "$", "this", "->", "isNewVariant", "(", ")", ")", "{", "$", "this", "->", "sId", "=", "$", "this", "->", "sRestriction", ";", "$", "variant", "=", "$", "this", "->", "DatabaseCopy", "(", ")"...
we overwrite the insert method, so that when inserting variants, we realy perform a copy of the parent.
[ "we", "overwrite", "the", "insert", "method", "so", "that", "when", "inserting", "variants", "we", "realy", "perform", "a", "copy", "of", "the", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L180-L194
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.CopyPropertyRecords
public function CopyPropertyRecords($oField, $sourceRecordID) { if (!$this->isNewVariant() || 'shop_article_variants' != $oField->name) { parent::CopyPropertyRecords($oField, $sourceRecordID); } }
php
public function CopyPropertyRecords($oField, $sourceRecordID) { if (!$this->isNewVariant() || 'shop_article_variants' != $oField->name) { parent::CopyPropertyRecords($oField, $sourceRecordID); } }
[ "public", "function", "CopyPropertyRecords", "(", "$", "oField", ",", "$", "sourceRecordID", ")", "{", "if", "(", "!", "$", "this", "->", "isNewVariant", "(", ")", "||", "'shop_article_variants'", "!=", "$", "oField", "->", "name", ")", "{", "parent", "::"...
if we are creating a variant, do NOT copy the parents variants. @param TCMSField $oField @param int $sourceRecordID
[ "if", "we", "are", "creating", "a", "variant", "do", "NOT", "copy", "the", "parents", "variants", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L210-L215
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.UpdatePriceToLowestVariant
public function UpdatePriceToLowestVariant() { /** @var TdbShopArticle $product */ $product = $this->oTable; $oLowestPriceVariant = $product->GetLowestPricedVariant(); if ($oLowestPriceVariant) { $aData = array('price' => $oLowestPriceVariant->fieldPriceFormated, 'price_reference' => $oLowestPriceVariant->fieldPriceReferenceFormated); $this->SaveFields($aData, false); } }
php
public function UpdatePriceToLowestVariant() { /** @var TdbShopArticle $product */ $product = $this->oTable; $oLowestPriceVariant = $product->GetLowestPricedVariant(); if ($oLowestPriceVariant) { $aData = array('price' => $oLowestPriceVariant->fieldPriceFormated, 'price_reference' => $oLowestPriceVariant->fieldPriceReferenceFormated); $this->SaveFields($aData, false); } }
[ "public", "function", "UpdatePriceToLowestVariant", "(", ")", "{", "/** @var TdbShopArticle $product */", "$", "product", "=", "$", "this", "->", "oTable", ";", "$", "oLowestPriceVariant", "=", "$", "product", "->", "GetLowestPricedVariant", "(", ")", ";", "if", "...
changes price of parent article to lowest variant.
[ "changes", "price", "of", "parent", "article", "to", "lowest", "variant", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L220-L229
train
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/AdapterFactory.php
AdapterFactory.createAdapterFromResource
public static function createAdapterFromResource($resource) { if (is_scalar($resource) || is_array($resource)) { throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)"); } if ($resource instanceof \PDO) { $adapter = self::getAdapterFromPdo($resource); } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) { $adapter = new Adapter\MysqliAdapter($resource); } else { throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli'); } return $adapter; }
php
public static function createAdapterFromResource($resource) { if (is_scalar($resource) || is_array($resource)) { throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)"); } if ($resource instanceof \PDO) { $adapter = self::getAdapterFromPdo($resource); } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) { $adapter = new Adapter\MysqliAdapter($resource); } else { throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli'); } return $adapter; }
[ "public", "static", "function", "createAdapterFromResource", "(", "$", "resource", ")", "{", "if", "(", "is_scalar", "(", "$", "resource", ")", "||", "is_array", "(", "$", "resource", ")", ")", "{", "throw", "new", "Exception", "\\", "InvalidArgumentException"...
Create adapter from an existing connection resource. @param mixed $resource database connection object (mysqli, pdo_mysql,...) @throws Exception\InvalidArgumentException @throws Exception\UnsupportedDriverException @return Adapter\AdapterInterface
[ "Create", "adapter", "from", "an", "existing", "connection", "resource", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/AdapterFactory.php#L55-L69
train
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/AdapterFactory.php
AdapterFactory.getAdapterFromPdo
protected static function getAdapterFromPdo(\PDO $resource) { $driver = mb_strtolower($resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); switch ($driver) { case 'mysql': $adapter = new Adapter\PdoMysqlAdapter($resource); break; case 'sqlite': $adapter = new Adapter\PdoSqliteAdapter($resource); break; default: $msg = "Driver 'PDO_$driver' is not currently supported."; throw new Exception\UnsupportedDriverException($msg); } return $adapter; }
php
protected static function getAdapterFromPdo(\PDO $resource) { $driver = mb_strtolower($resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); switch ($driver) { case 'mysql': $adapter = new Adapter\PdoMysqlAdapter($resource); break; case 'sqlite': $adapter = new Adapter\PdoSqliteAdapter($resource); break; default: $msg = "Driver 'PDO_$driver' is not currently supported."; throw new Exception\UnsupportedDriverException($msg); } return $adapter; }
[ "protected", "static", "function", "getAdapterFromPdo", "(", "\\", "PDO", "$", "resource", ")", "{", "$", "driver", "=", "mb_strtolower", "(", "$", "resource", "->", "getAttribute", "(", "\\", "PDO", "::", "ATTR_DRIVER_NAME", ")", ")", ";", "switch", "(", ...
Get an adapter from an existing connection resource. @param \PDO $resource database connection object @throws Exception\UnsupportedDriverException @return Adapter\AdapterInterface
[ "Get", "an", "adapter", "from", "an", "existing", "connection", "resource", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/AdapterFactory.php#L80-L96
train
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.getClient
protected function getClient($namespace) { $path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s', $this->conf['path'], $this->conf['appid'], $this->conf['cluster'], $this->conf['namespace'], $this->last_key); if ($this->conf['with_ip']) { $cidr = Container::getInstance()->get(CIDRmatch::class); foreach (swoole_get_local_ip() as $v) { if ($cidr->match($v, $this->conf['with_ip'])) { $path .= '&ip=' . $v; break; } } } $cli = new Client($this->conf['host'], $this->conf['port']); $cli->set([ 'timeout' => 1 ]); $cli->setDefer(); $cli->get($path); return $cli; }
php
protected function getClient($namespace) { $path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s', $this->conf['path'], $this->conf['appid'], $this->conf['cluster'], $this->conf['namespace'], $this->last_key); if ($this->conf['with_ip']) { $cidr = Container::getInstance()->get(CIDRmatch::class); foreach (swoole_get_local_ip() as $v) { if ($cidr->match($v, $this->conf['with_ip'])) { $path .= '&ip=' . $v; break; } } } $cli = new Client($this->conf['host'], $this->conf['port']); $cli->set([ 'timeout' => 1 ]); $cli->setDefer(); $cli->get($path); return $cli; }
[ "protected", "function", "getClient", "(", "$", "namespace", ")", "{", "$", "path", "=", "sprintf", "(", "'%s/configs/%s/%s/%s?releaseKey=%s'", ",", "$", "this", "->", "conf", "[", "'path'", "]", ",", "$", "this", "->", "conf", "[", "'appid'", "]", ",", ...
Get HTTP Client @access protected @param string $namespace @return object
[ "Get", "HTTP", "Client" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L76-L99
train
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.update
protected function update($namespace, $config) { foreach ($config as $k => $v) { if (strpos($k, '.') === false) { $this->cache[$namespace][$k] = $v; continue; } $keys = explode('.', $k); $total = count($keys) - 1; $parent = &$this->cache[$namespace]; foreach ($keys as $kk => $vv) { if ($total === $kk) { $parent[$vv] = $v; } else { if (!isset($parent[$vv])) { $parent[$vv] = []; } $parent = &$parent[$vv]; } } } }
php
protected function update($namespace, $config) { foreach ($config as $k => $v) { if (strpos($k, '.') === false) { $this->cache[$namespace][$k] = $v; continue; } $keys = explode('.', $k); $total = count($keys) - 1; $parent = &$this->cache[$namespace]; foreach ($keys as $kk => $vv) { if ($total === $kk) { $parent[$vv] = $v; } else { if (!isset($parent[$vv])) { $parent[$vv] = []; } $parent = &$parent[$vv]; } } } }
[ "protected", "function", "update", "(", "$", "namespace", ",", "$", "config", ")", "{", "foreach", "(", "$", "config", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "strpos", "(", "$", "k", ",", "'.'", ")", "===", "false", ")", "{", "$",...
Update cache with result @access protected @param string $namespace @param array $config
[ "Update", "cache", "with", "result" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L107-L127
train
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.refresh
public function refresh($force = false) { if (!$force && time() - $this->last_fetch < $this->config['refresh_interval']) { return; } $clis = []; foreach ($this->conf['namespace'] as $v) { $clis[] = $this->getClient($v); } foreach ($clis as $cli) { $cli->recv(); if ($cli->statusCode === 304) { continue; } $res = json_decode($cli->body, true); $ns = $res['namespaceName']; $this->last_key[$ns] = $res['releaseKey']; $this->update($ns, $res['configurations']); } $this->last_fetch = time(); }
php
public function refresh($force = false) { if (!$force && time() - $this->last_fetch < $this->config['refresh_interval']) { return; } $clis = []; foreach ($this->conf['namespace'] as $v) { $clis[] = $this->getClient($v); } foreach ($clis as $cli) { $cli->recv(); if ($cli->statusCode === 304) { continue; } $res = json_decode($cli->body, true); $ns = $res['namespaceName']; $this->last_key[$ns] = $res['releaseKey']; $this->update($ns, $res['configurations']); } $this->last_fetch = time(); }
[ "public", "function", "refresh", "(", "$", "force", "=", "false", ")", "{", "if", "(", "!", "$", "force", "&&", "time", "(", ")", "-", "$", "this", "->", "last_fetch", "<", "$", "this", "->", "config", "[", "'refresh_interval'", "]", ")", "{", "ret...
Refresh all configs @access public @param bool $force Is force refresh or not
[ "Refresh", "all", "configs" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L134-L153
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerEasyCash/TShopPaymentHandlerEasyCash_Debit.class.php
TShopPaymentHandlerEasyCash_Debit.ConfirmEasyCashResponse
protected function ConfirmEasyCashResponse($sPayId, $sXID) { $bConfirmed = false; $aParam = array('PayID' => $sPayId, 'XID' => $sXID); $aResponse = $this->SendRequestToEasyCash(self::EASY_CASH_CONFIRM_PATH, $aParam); if (is_array($aResponse) && stristr($aResponse['header'], 'HTTP/1.1 200 OK')) { $bConfirmed = true; } else { TTools::WriteLogEntry("EasyCash ConfirmEasyCashResponse Error: UNABLE TO CONFIRM; sPayId: {$sPayId}; sXID: {$sXID}".print_r($aResponse, true), 1, __FILE__, __LINE__); } return $bConfirmed; }
php
protected function ConfirmEasyCashResponse($sPayId, $sXID) { $bConfirmed = false; $aParam = array('PayID' => $sPayId, 'XID' => $sXID); $aResponse = $this->SendRequestToEasyCash(self::EASY_CASH_CONFIRM_PATH, $aParam); if (is_array($aResponse) && stristr($aResponse['header'], 'HTTP/1.1 200 OK')) { $bConfirmed = true; } else { TTools::WriteLogEntry("EasyCash ConfirmEasyCashResponse Error: UNABLE TO CONFIRM; sPayId: {$sPayId}; sXID: {$sXID}".print_r($aResponse, true), 1, __FILE__, __LINE__); } return $bConfirmed; }
[ "protected", "function", "ConfirmEasyCashResponse", "(", "$", "sPayId", ",", "$", "sXID", ")", "{", "$", "bConfirmed", "=", "false", ";", "$", "aParam", "=", "array", "(", "'PayID'", "=>", "$", "sPayId", ",", "'XID'", "=>", "$", "sXID", ")", ";", "$", ...
returns true if the transaction confirmation was successfully send to EasyCash. @param $sPayId @param $sXID @return bool
[ "returns", "true", "if", "the", "transaction", "confirmation", "was", "successfully", "send", "to", "EasyCash", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerEasyCash/TShopPaymentHandlerEasyCash_Debit.class.php#L121-L133
train
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/pkgShopPaymentTransaction/objects/TPkgShopPaymentIPN_TransactionDetails.class.php
TPkgShopPaymentIPN_TransactionDetails.getAdditionalData
public function getAdditionalData($key) { if (true === isset($this->additionalData[$key])) { return $this->additionalData[$key]; } return null; }
php
public function getAdditionalData($key) { if (true === isset($this->additionalData[$key])) { return $this->additionalData[$key]; } return null; }
[ "public", "function", "getAdditionalData", "(", "$", "key", ")", "{", "if", "(", "true", "===", "isset", "(", "$", "this", "->", "additionalData", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "additionalData", "[", "$", "key", "]...
here you can get additional data like the transaction id from the transaction details, If key not exists return null. @param $key @return mixed|null
[ "here", "you", "can", "get", "additional", "data", "like", "the", "transaction", "id", "from", "the", "transaction", "details", "If", "key", "not", "exists", "return", "null", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/pkgShopPaymentTransaction/objects/TPkgShopPaymentIPN_TransactionDetails.class.php#L116-L123
train
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.setMonoisotopicMassCharge
public function setMonoisotopicMassCharge($massCharge, $charge) { $this->setMonoisotopicMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
php
public function setMonoisotopicMassCharge($massCharge, $charge) { $this->setMonoisotopicMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
[ "public", "function", "setMonoisotopicMassCharge", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "$", "this", "->", "setMonoisotopicMass", "(", "$", "this", "->", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", ")", ";", "$", "th...
Sets the monoisotopic mass-to-charge ratio for this instance. @param float $massCharge The mass-to-charge ratio to set to @param int $charge The charge associated with the $massCharge @throws \InvalidArgumentException If $mz is not a valid floating point value
[ "Sets", "the", "monoisotopic", "mass", "-", "to", "-", "charge", "ratio", "for", "this", "instance", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L47-L51
train
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.setAverageMassCharge
public function setAverageMassCharge($massCharge, $charge) { $this->setAverageMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
php
public function setAverageMassCharge($massCharge, $charge) { $this->setAverageMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
[ "public", "function", "setAverageMassCharge", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "$", "this", "->", "setAverageMass", "(", "$", "this", "->", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", ")", ";", "$", "this", "->...
Sets the average mass-to-charge ratio for this instance @param float $massCharge The mass-to-charge ratio to set to @param int $charge The charge associated with the $massCharge @throws \InvalidArgumentException If $mz is not a valid floating point value
[ "Sets", "the", "average", "mass", "-", "to", "-", "charge", "ratio", "for", "this", "instance" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L62-L66
train
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.getMassCharge
public static function getMassCharge($mass, $charge) { if (! is_float($mass)) { throw new \InvalidArgumentException('Argument 1 must be of type float. Value is of type ' . gettype($mass)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $mass; } return ($mass + ($charge * PhysicalConstants::PROTON_MASS)) / $charge; }
php
public static function getMassCharge($mass, $charge) { if (! is_float($mass)) { throw new \InvalidArgumentException('Argument 1 must be of type float. Value is of type ' . gettype($mass)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $mass; } return ($mass + ($charge * PhysicalConstants::PROTON_MASS)) / $charge; }
[ "public", "static", "function", "getMassCharge", "(", "$", "mass", ",", "$", "charge", ")", "{", "if", "(", "!", "is_float", "(", "$", "mass", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be of type float. Value is of t...
Gets the mass-to-charge value for the specified mass and charge @param float $mass @param int $charge @return float
[ "Gets", "the", "mass", "-", "to", "-", "charge", "value", "for", "the", "specified", "mass", "and", "charge" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L116-L131
train
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.getNeutralMass
public static function getNeutralMass($massCharge, $charge) { if (! is_float($massCharge)) { throw new \InvalidArgumentException( 'Argument 1 must be of type float. Value is of type ' . gettype($massCharge)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $massCharge; } return ($massCharge * $charge) - (PhysicalConstants::PROTON_MASS * $charge); }
php
public static function getNeutralMass($massCharge, $charge) { if (! is_float($massCharge)) { throw new \InvalidArgumentException( 'Argument 1 must be of type float. Value is of type ' . gettype($massCharge)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $massCharge; } return ($massCharge * $charge) - (PhysicalConstants::PROTON_MASS * $charge); }
[ "public", "static", "function", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "if", "(", "!", "is_float", "(", "$", "massCharge", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be of type float. ...
gets the neutral mass for the specified mass-to-charge ratio and charge @param float $massCharge @param int $charge @throws \InvalidArgumentException @return float
[ "gets", "the", "neutral", "mass", "for", "the", "specified", "mass", "-", "to", "-", "charge", "ratio", "and", "charge" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L141-L157
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/ArticleList/Module.php
Module.getRenderedList
protected function getRenderedList() { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); $results = $this->getResults($enrichedState); $oResponse = new MTShopArticleListResponse(); $oResponse->bHasNextPage = ($results->getNumberOfPages() > $results->getPage() + 1); $oResponse->bHasPreviousPage = ($results->getPage() > 0); $oResponse->iListKey = $this->sModuleSpotName; $oResponse->iNumberOfResults = $results->getTotalNumberOfResults(); $template = $this->getListTemplateFromConfigName($this->aModuleConfig['view']); $oResponse->sItemPage = $this->renderProducts($template); return $oResponse; }
php
protected function getRenderedList() { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); $results = $this->getResults($enrichedState); $oResponse = new MTShopArticleListResponse(); $oResponse->bHasNextPage = ($results->getNumberOfPages() > $results->getPage() + 1); $oResponse->bHasPreviousPage = ($results->getPage() > 0); $oResponse->iListKey = $this->sModuleSpotName; $oResponse->iNumberOfResults = $results->getTotalNumberOfResults(); $template = $this->getListTemplateFromConfigName($this->aModuleConfig['view']); $oResponse->sItemPage = $this->renderProducts($template); return $oResponse; }
[ "protected", "function", "getRenderedList", "(", ")", "{", "$", "enrichedState", "=", "$", "this", "->", "enrichStateWithDefaultsFromConfiguration", "(", ")", ";", "$", "results", "=", "$", "this", "->", "getResults", "(", "$", "enrichedState", ")", ";", "$", ...
returns a fully rendered list - used to page via ajax. @return MTShopArticleListResponse
[ "returns", "a", "fully", "rendered", "list", "-", "used", "to", "page", "via", "ajax", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/ArticleList/Module.php#L533-L548
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/ArticleList/Module.php
Module.renderProducts
protected function renderProducts($viewName, ResultDataInterface $results = null, StateInterface $enrichedState = null) { // need to cache this $cacheKey = null; if ($this->_AllowCache()) { $cacheKeyData = $this->_GetCacheParameters(); $cacheKeyData['is_article_list_content'] = true; $cacheKey = $this->cache->getKey($cacheKeyData); $resultHTML = $this->cache->get($cacheKey); if (null !== $resultHTML) { return $resultHTML; } } if (null === $enrichedState) { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); } if (null === $results) { $results = $this->getResults($enrichedState); } $items = $results->asArray(); $inputData = array( 'activePageNumber' => $results->getPage(), 'itemMapperBaseData' => $this->getItemMapperBaseData(), 'items' => $items, 'results' => $results, 'listPagerUrl' => $this->getListPageUrl(), 'listPageSizeChangeUrl' => $this->getListPageSizeUrl(), 'numberOfPages' => $results->getNumberOfPages(), 'state' => $enrichedState->getStateArrayWithoutQueryParameter(), 'stateObject' => $enrichedState, 'sortList' => $this->getSortList(), 'sortFieldName' => $this->getSortFieldName(), 'sortFormAction' => $this->getSortFormAction(), 'sortFormStateInputFields' => $this->getSortFormStateInputFields(), 'activeSortId' => $this->getActiveSortId(), 'listConfiguration' => $this->getConfiguration(), 'sModuleSpotName' => $this->sModuleSpotName, 'local' => $this->getActiveLocal(), 'currency' => $this->getActiveCurrency(), 'shop' => $this->getActiveShop(), ); $inputData = array_merge($inputData, $this->getListInformationFromConfiguration()); $resultHTML = $this->render($viewName, $inputData); if ($this->_AllowCache()) { $cacheTrigger = new \MapperCacheTrigger(); $cacheTriggerRestricted = new \MapperCacheTriggerRestrictedProxy($cacheTrigger); $this->configureCacheTrigger($cacheTriggerRestricted); $trigger = $cacheTrigger->getTrigger(); $this->cache->set($cacheKey, $resultHTML, $trigger); } return $resultHTML; }
php
protected function renderProducts($viewName, ResultDataInterface $results = null, StateInterface $enrichedState = null) { // need to cache this $cacheKey = null; if ($this->_AllowCache()) { $cacheKeyData = $this->_GetCacheParameters(); $cacheKeyData['is_article_list_content'] = true; $cacheKey = $this->cache->getKey($cacheKeyData); $resultHTML = $this->cache->get($cacheKey); if (null !== $resultHTML) { return $resultHTML; } } if (null === $enrichedState) { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); } if (null === $results) { $results = $this->getResults($enrichedState); } $items = $results->asArray(); $inputData = array( 'activePageNumber' => $results->getPage(), 'itemMapperBaseData' => $this->getItemMapperBaseData(), 'items' => $items, 'results' => $results, 'listPagerUrl' => $this->getListPageUrl(), 'listPageSizeChangeUrl' => $this->getListPageSizeUrl(), 'numberOfPages' => $results->getNumberOfPages(), 'state' => $enrichedState->getStateArrayWithoutQueryParameter(), 'stateObject' => $enrichedState, 'sortList' => $this->getSortList(), 'sortFieldName' => $this->getSortFieldName(), 'sortFormAction' => $this->getSortFormAction(), 'sortFormStateInputFields' => $this->getSortFormStateInputFields(), 'activeSortId' => $this->getActiveSortId(), 'listConfiguration' => $this->getConfiguration(), 'sModuleSpotName' => $this->sModuleSpotName, 'local' => $this->getActiveLocal(), 'currency' => $this->getActiveCurrency(), 'shop' => $this->getActiveShop(), ); $inputData = array_merge($inputData, $this->getListInformationFromConfiguration()); $resultHTML = $this->render($viewName, $inputData); if ($this->_AllowCache()) { $cacheTrigger = new \MapperCacheTrigger(); $cacheTriggerRestricted = new \MapperCacheTriggerRestrictedProxy($cacheTrigger); $this->configureCacheTrigger($cacheTriggerRestricted); $trigger = $cacheTrigger->getTrigger(); $this->cache->set($cacheKey, $resultHTML, $trigger); } return $resultHTML; }
[ "protected", "function", "renderProducts", "(", "$", "viewName", ",", "ResultDataInterface", "$", "results", "=", "null", ",", "StateInterface", "$", "enrichedState", "=", "null", ")", "{", "// need to cache this", "$", "cacheKey", "=", "null", ";", "if", "(", ...
renders product list using the view provided. this should really be in another controller, unfortunately Chameleon currently does not support calling other controllers the way symfony does. @param string $viewName @param ResultDataInterface $results @param StateInterface $enrichedState @return string
[ "renders", "product", "list", "using", "the", "view", "provided", ".", "this", "should", "really", "be", "in", "another", "controller", "unfortunately", "Chameleon", "currently", "does", "not", "support", "calling", "other", "controllers", "the", "way", "symfony",...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/ArticleList/Module.php#L560-L618
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php
CancellationExample.setupOrderReference
public function setupOrderReference() { $orderTotal = new OffAmazonPaymentsService_Model_OrderTotal(); $orderTotal->setCurrencyCode($this->_currencyCode); $orderTotal->setAmount($this->_orderTotalAmount); $setOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest(); $setOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $setOrderReferenceDetailsRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); $setOrderReferenceDetailsRequest ->setOrderReferenceAttributes( new OffAmazonPaymentsService_Model_OrderReferenceAttributes() ); $setOrderReferenceDetailsRequest ->getOrderReferenceAttributes()->setOrderTotal($orderTotal); return $this->_service->setOrderReferenceDetails( $setOrderReferenceDetailsRequest ); }
php
public function setupOrderReference() { $orderTotal = new OffAmazonPaymentsService_Model_OrderTotal(); $orderTotal->setCurrencyCode($this->_currencyCode); $orderTotal->setAmount($this->_orderTotalAmount); $setOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest(); $setOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $setOrderReferenceDetailsRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); $setOrderReferenceDetailsRequest ->setOrderReferenceAttributes( new OffAmazonPaymentsService_Model_OrderReferenceAttributes() ); $setOrderReferenceDetailsRequest ->getOrderReferenceAttributes()->setOrderTotal($orderTotal); return $this->_service->setOrderReferenceDetails( $setOrderReferenceDetailsRequest ); }
[ "public", "function", "setupOrderReference", "(", ")", "{", "$", "orderTotal", "=", "new", "OffAmazonPaymentsService_Model_OrderTotal", "(", ")", ";", "$", "orderTotal", "->", "setCurrencyCode", "(", "$", "this", "->", "_currencyCode", ")", ";", "$", "orderTotal",...
Add information to the payment contract so that it can be confirmed in a later step Simulates a merchant adding the order details to the payment contract @return OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse response
[ "Add", "information", "to", "the", "payment", "contract", "so", "that", "it", "can", "be", "confirmed", "in", "a", "later", "step", "Simulates", "a", "merchant", "adding", "the", "order", "details", "to", "the", "payment", "contract" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php#L95-L116
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php
CancellationExample.cancelOrderReference
public function cancelOrderReference() { $cancelOrderReferenceRequest = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest(); $cancelOrderReferenceRequest->setSellerId($this->_sellerId); $cancelOrderReferenceRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); return $this->_service->cancelOrderReference($cancelOrderReferenceRequest); }
php
public function cancelOrderReference() { $cancelOrderReferenceRequest = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest(); $cancelOrderReferenceRequest->setSellerId($this->_sellerId); $cancelOrderReferenceRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); return $this->_service->cancelOrderReference($cancelOrderReferenceRequest); }
[ "public", "function", "cancelOrderReference", "(", ")", "{", "$", "cancelOrderReferenceRequest", "=", "new", "OffAmazonPaymentsService_Model_CancelOrderReferenceRequest", "(", ")", ";", "$", "cancelOrderReferenceRequest", "->", "setSellerId", "(", "$", "this", "->", "_sel...
Cancel the payment contract - this can be performed on any order reference that does not have a completed transaction @return OffAmazonPaymentsService_Model_CancelOrderReferenceResponse response
[ "Cancel", "the", "payment", "contract", "-", "this", "can", "be", "performed", "on", "any", "order", "reference", "that", "does", "not", "have", "a", "completed", "transaction" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php#L230-L239
train
edmondscommerce/doctrine-static-meta
src/Entity/Embeddable/Objects/Identity/FullNameEmbeddable.php
FullNameEmbeddable.getFormatted
public function getFormatted(): string { return $this->format( [ $this->getTitle(), $this->getFirstName(), $this->format($this->middleNames), $this->getLastName(), $this->getSuffix(), ] ); }
php
public function getFormatted(): string { return $this->format( [ $this->getTitle(), $this->getFirstName(), $this->format($this->middleNames), $this->getLastName(), $this->getSuffix(), ] ); }
[ "public", "function", "getFormatted", "(", ")", ":", "string", "{", "return", "$", "this", "->", "format", "(", "[", "$", "this", "->", "getTitle", "(", ")", ",", "$", "this", "->", "getFirstName", "(", ")", ",", "$", "this", "->", "format", "(", "...
Get the full name as a single string @return string
[ "Get", "the", "full", "name", "as", "a", "single", "string" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Embeddable/Objects/Identity/FullNameEmbeddable.php#L186-L197
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetRemoveFromBasketLink
public function GetRemoveFromBasketLink($sMessageHandler = null) { if (is_null($sMessageHandler)) { $sMessageHandler = MTShopBasketCore::MSG_CONSUMER_NAME; } $oShopConfig = $this->getShopService()->getActiveShop(); return $this->getActivePageService()->getLinkToActivePageRelative(array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'RemoveVoucher', ), MTShopBasketCore::URL_REQUEST_PARAMETER => array( MTShopBasketCore::URL_MESSAGE_CONSUMER_NAME => $sMessageHandler, MTShopBasketCore::URL_VOUCHER_BASKET_KEY => $this->sBasketVoucherKey, ), )); }
php
public function GetRemoveFromBasketLink($sMessageHandler = null) { if (is_null($sMessageHandler)) { $sMessageHandler = MTShopBasketCore::MSG_CONSUMER_NAME; } $oShopConfig = $this->getShopService()->getActiveShop(); return $this->getActivePageService()->getLinkToActivePageRelative(array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'RemoveVoucher', ), MTShopBasketCore::URL_REQUEST_PARAMETER => array( MTShopBasketCore::URL_MESSAGE_CONSUMER_NAME => $sMessageHandler, MTShopBasketCore::URL_VOUCHER_BASKET_KEY => $this->sBasketVoucherKey, ), )); }
[ "public", "function", "GetRemoveFromBasketLink", "(", "$", "sMessageHandler", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "sMessageHandler", ")", ")", "{", "$", "sMessageHandler", "=", "MTShopBasketCore", "::", "MSG_CONSUMER_NAME", ";", "}", "$", "o...
return a link to remove the voucher from the basket. @param string $sMessageHandler - the message handler which should be used to display the result - if nothing is specified, MTShopBasketCore::MSG_CONSUMER_NAME will be used @return string
[ "return", "a", "link", "to", "remove", "the", "voucher", "from", "the", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L149-L165
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetValue
public function GetValue($bCalculateVoucher = false, $dMaxValueAllowed = null, $bSponsoredVouchers = false) { if ($bCalculateVoucher) { $oSeries = &$this->GetFieldShopVoucherSeries(); $dValue = $oSeries->fieldValue; $oBasket = TShopBasket::GetInstance(); $dBasketValueApplicableForVoucher = $oBasket->GetBasketSumForVoucher($this); if ('prozent' == $oSeries->fieldValueType) { $dValue = round($dBasketValueApplicableForVoucher * ($dValue / 100), 2); } else { // now we need to subtract the amount already used... $dValue = $dValue - $this->GetValuePreviouslyUsed_GetValueHook(); } // now if the voucher is worth more than the current basket, we need to use only the part that we can if ($dBasketValueApplicableForVoucher < $dValue) { $dValue = $dBasketValueApplicableForVoucher; } if ($dValue > $dMaxValueAllowed) { $dValue = $dMaxValueAllowed; } // if this is a NOT sponsored voucher, we need to reduce the article value if (false == $bSponsoredVouchers) { $oBasket->ApplyNoneSponsoredVoucherValueToItems($this, $dValue); } $this->voucherValueInBasket = $dValue; } return $this->voucherValueInBasket; }
php
public function GetValue($bCalculateVoucher = false, $dMaxValueAllowed = null, $bSponsoredVouchers = false) { if ($bCalculateVoucher) { $oSeries = &$this->GetFieldShopVoucherSeries(); $dValue = $oSeries->fieldValue; $oBasket = TShopBasket::GetInstance(); $dBasketValueApplicableForVoucher = $oBasket->GetBasketSumForVoucher($this); if ('prozent' == $oSeries->fieldValueType) { $dValue = round($dBasketValueApplicableForVoucher * ($dValue / 100), 2); } else { // now we need to subtract the amount already used... $dValue = $dValue - $this->GetValuePreviouslyUsed_GetValueHook(); } // now if the voucher is worth more than the current basket, we need to use only the part that we can if ($dBasketValueApplicableForVoucher < $dValue) { $dValue = $dBasketValueApplicableForVoucher; } if ($dValue > $dMaxValueAllowed) { $dValue = $dMaxValueAllowed; } // if this is a NOT sponsored voucher, we need to reduce the article value if (false == $bSponsoredVouchers) { $oBasket->ApplyNoneSponsoredVoucherValueToItems($this, $dValue); } $this->voucherValueInBasket = $dValue; } return $this->voucherValueInBasket; }
[ "public", "function", "GetValue", "(", "$", "bCalculateVoucher", "=", "false", ",", "$", "dMaxValueAllowed", "=", "null", ",", "$", "bSponsoredVouchers", "=", "false", ")", "{", "if", "(", "$", "bCalculateVoucher", ")", "{", "$", "oSeries", "=", "&", "$", ...
Returns the value of the voucher - takes the current basket and user into consideration. @param bool $bCalculateVoucher - set to true when we calculate the voucher value for the basket this should only be set to true when calling the method through the TShopBasketVoucherList::GetVoucherValue @param float $dMaxValueAllowed - if a value is passed, then the voucher will never exceed the value passed @return float
[ "Returns", "the", "value", "of", "the", "voucher", "-", "takes", "the", "current", "basket", "and", "user", "into", "consideration", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L315-L345
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetValuePreviouslyUsed
public function GetValuePreviouslyUsed() { // we have to make sure that is value is accurate... so we will fetch it from database every time // performance should not be a big issue, since it only affects users that include a voucher in their basket $dValueUsed = 0; $query = "SELECT SUM(`value_used`) AS totalused FROM `shop_voucher_use` INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id` WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `shop_order`.`canceled` = '0' "; if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { if (null !== $aValue['totalused']) { $dValueUsed = $aValue['totalused']; } } return $dValueUsed; }
php
public function GetValuePreviouslyUsed() { // we have to make sure that is value is accurate... so we will fetch it from database every time // performance should not be a big issue, since it only affects users that include a voucher in their basket $dValueUsed = 0; $query = "SELECT SUM(`value_used`) AS totalused FROM `shop_voucher_use` INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id` WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `shop_order`.`canceled` = '0' "; if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { if (null !== $aValue['totalused']) { $dValueUsed = $aValue['totalused']; } } return $dValueUsed; }
[ "public", "function", "GetValuePreviouslyUsed", "(", ")", "{", "// we have to make sure that is value is accurate... so we will fetch it from database every time", "// performance should not be a big issue, since it only affects users that include a voucher in their basket", "$", "dValueUsed", "...
return the amount of the voucher used up in previous orders. @return float
[ "return", "the", "amount", "of", "the", "voucher", "used", "up", "in", "previous", "orders", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L362-L380
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.CommitVoucherUseForCurrentUser
public function CommitVoucherUseForCurrentUser($iShopOrderId) { $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance(); /** @var $oShopvoucherUse TdbShopVoucherUse */ $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId); // hook to post-convert value (as may be required when dealing with currency) $this->CommitVoucherUseForCurrentUserPreSaveHook($aData); $oShopVoucherUse->LoadFromRow($aData); $oShopVoucherUse->AllowEditByAll(true); $oShopVoucherUse->Save(); if ($this->checkMarkVoucherAsCompletelyUsed()) { $this->MarkVoucherAsCompletelyUsed(); } }
php
public function CommitVoucherUseForCurrentUser($iShopOrderId) { $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance(); /** @var $oShopvoucherUse TdbShopVoucherUse */ $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId); // hook to post-convert value (as may be required when dealing with currency) $this->CommitVoucherUseForCurrentUserPreSaveHook($aData); $oShopVoucherUse->LoadFromRow($aData); $oShopVoucherUse->AllowEditByAll(true); $oShopVoucherUse->Save(); if ($this->checkMarkVoucherAsCompletelyUsed()) { $this->MarkVoucherAsCompletelyUsed(); } }
[ "public", "function", "CommitVoucherUseForCurrentUser", "(", "$", "iShopOrderId", ")", "{", "$", "oShopVoucherUse", "=", "TdbShopVoucherUse", "::", "GetNewInstance", "(", ")", ";", "/** @var $oShopvoucherUse TdbShopVoucherUse */", "$", "aData", "=", "array", "(", "'shop...
marks the voucher as used in the database, and logs the voucher data for the current user in the shop_voucher_use table. @param int $iShopOrderId - the order for which the voucher is being used
[ "marks", "the", "voucher", "as", "used", "in", "the", "database", "and", "logs", "the", "voucher", "data", "for", "the", "current", "user", "in", "the", "shop_voucher_use", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L388-L402
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.checkMarkVoucherAsCompletelyUsed
public function checkMarkVoucherAsCompletelyUsed() { $bMarkVoucherAsCompletelyUsed = false; $oVoucherSeries = &$this->GetFieldShopVoucherSeries(); if ('absolut' == $oVoucherSeries->fieldValueType && !is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $dValueUsed = $this->GetValuePreviouslyUsed(); if ($dValueUsed >= $this->GetVoucherSeriesOriginalValue()) { $bMarkVoucherAsCompletelyUsed = true; } } elseif ('absolut' == $oVoucherSeries->fieldValueType && is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $bMarkVoucherAsCompletelyUsed = true; } else { $bMarkVoucherAsCompletelyUsed = true; } return $bMarkVoucherAsCompletelyUsed; }
php
public function checkMarkVoucherAsCompletelyUsed() { $bMarkVoucherAsCompletelyUsed = false; $oVoucherSeries = &$this->GetFieldShopVoucherSeries(); if ('absolut' == $oVoucherSeries->fieldValueType && !is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $dValueUsed = $this->GetValuePreviouslyUsed(); if ($dValueUsed >= $this->GetVoucherSeriesOriginalValue()) { $bMarkVoucherAsCompletelyUsed = true; } } elseif ('absolut' == $oVoucherSeries->fieldValueType && is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $bMarkVoucherAsCompletelyUsed = true; } else { $bMarkVoucherAsCompletelyUsed = true; } return $bMarkVoucherAsCompletelyUsed; }
[ "public", "function", "checkMarkVoucherAsCompletelyUsed", "(", ")", "{", "$", "bMarkVoucherAsCompletelyUsed", "=", "false", ";", "$", "oVoucherSeries", "=", "&", "$", "this", "->", "GetFieldShopVoucherSeries", "(", ")", ";", "if", "(", "'absolut'", "==", "$", "o...
if the voucher 1.) has an absolute value, a sponsor, and if the value has been used up 2.) has an absolute value, no sponsor 3.) has an relative value we need to mark the voucher as used. @return bool
[ "if", "the", "voucher", "1", ".", ")", "has", "an", "absolute", "value", "a", "sponsor", "and", "if", "the", "value", "has", "been", "used", "up", "2", ".", ")", "has", "an", "absolute", "value", "no", "sponsor", "3", ".", ")", "has", "an", "relati...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L413-L429
train