repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopCategoryList.class.php
TShopCategoryList.&
public static function &GetDefaultCategory() { static $oCategory; if (!$oCategory) { $oRootCategories = &TdbShopCategoryList::GetChildCategories(); if ($oRootCategories->Length() > 0) { $oCategory = &$oRootCategories->Current(); } } return $oCategory; }
php
public static function &GetDefaultCategory() { static $oCategory; if (!$oCategory) { $oRootCategories = &TdbShopCategoryList::GetChildCategories(); if ($oRootCategories->Length() > 0) { $oCategory = &$oRootCategories->Current(); } } return $oCategory; }
[ "public", "static", "function", "&", "GetDefaultCategory", "(", ")", "{", "static", "$", "oCategory", ";", "if", "(", "!", "$", "oCategory", ")", "{", "$", "oRootCategories", "=", "&", "TdbShopCategoryList", "::", "GetChildCategories", "(", ")", ";", "if", ...
returns the shops default article category. @return TdbShopCategory
[ "returns", "the", "shops", "default", "article", "category", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L111-L122
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopCategoryList.class.php
TShopCategoryList.&
public static function &GetChildCategories($iParentId = null, $aFilter = null, $sLanguageID = null) { $sActiveSnippetRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction(); if (is_null($iParentId)) { $iParentId = ''; } $parameters = array( 'parentId' => $iParentId, ); $parameterType = array(); $query = 'SELECT `shop_category`.* FROM `shop_category` WHERE `shop_category`.`shop_category_id` = :parentId '; if (!is_null($aFilter) && count($aFilter) > 0) { $parameters['filter'] = $aFilter; $parameterType['filter'] = Connection::PARAM_STR_ARRAY; $query .= ' AND `shop_category`.`id` IN (:filter) '; } if (!empty($sActiveSnippetRestriction)) { $query .= ' AND '.$sActiveSnippetRestriction; } $query .= ' ORDER BY `shop_category`.`position` ASC, `shop_category`.`name` ASC'; $oCategories = new TdbShopCategoryList(); $oCategories->SetLanguage($sLanguageID); $oCategories->Load($query, $parameters, $parameterType); return $oCategories; }
php
public static function &GetChildCategories($iParentId = null, $aFilter = null, $sLanguageID = null) { $sActiveSnippetRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction(); if (is_null($iParentId)) { $iParentId = ''; } $parameters = array( 'parentId' => $iParentId, ); $parameterType = array(); $query = 'SELECT `shop_category`.* FROM `shop_category` WHERE `shop_category`.`shop_category_id` = :parentId '; if (!is_null($aFilter) && count($aFilter) > 0) { $parameters['filter'] = $aFilter; $parameterType['filter'] = Connection::PARAM_STR_ARRAY; $query .= ' AND `shop_category`.`id` IN (:filter) '; } if (!empty($sActiveSnippetRestriction)) { $query .= ' AND '.$sActiveSnippetRestriction; } $query .= ' ORDER BY `shop_category`.`position` ASC, `shop_category`.`name` ASC'; $oCategories = new TdbShopCategoryList(); $oCategories->SetLanguage($sLanguageID); $oCategories->Load($query, $parameters, $parameterType); return $oCategories; }
[ "public", "static", "function", "&", "GetChildCategories", "(", "$", "iParentId", "=", "null", ",", "$", "aFilter", "=", "null", ",", "$", "sLanguageID", "=", "null", ")", "{", "$", "sActiveSnippetRestriction", "=", "TdbShopCategoryList", "::", "GetActiveCategor...
returns the child categories of the category identified by iParentId if no parent id is given, then the root categories will be returned. @param string|null $iParentId @param array $aFilter - an optional filter list for the category @param string|null $sLanguageID @return TdbShopCategoryList
[ "returns", "the", "child", "categories", "of", "the", "category", "identified", "by", "iParentId", "if", "no", "parent", "id", "is", "given", "then", "the", "root", "categories", "will", "be", "returned", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L167-L198
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopCategoryList.class.php
TShopCategoryList.&
public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null) { if (null === $sLanguageID) { $sLanguageID = self::getLanguageService()->getActiveLanguageId(); } $bDone = false; $iCurrentCatId = $iEndNodeId; $aTmpList = array(); // we store the list in a tmp array so we can reverse the order do { $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sLanguageID); if (!$oCategory->Load($iCurrentCatId)) { $oCategory = null; $bDone = true; } else { $aTmpList[] = $oCategory; if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) { $bDone = true; } else { $oCategory = $oCategory->GetParent(); if (null === $oCategory) { $bDone = true; } else { $iCurrentCatId = $oCategory->id; } } } } while (!$bDone); $aTmpList = array_reverse($aTmpList); $oCategoryPath = new TIterator(); foreach (array_keys($aTmpList) as $iTmpIndex) { $oCategoryPath->AddItem($aTmpList[$iTmpIndex]); } return $oCategoryPath; }
php
public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null) { if (null === $sLanguageID) { $sLanguageID = self::getLanguageService()->getActiveLanguageId(); } $bDone = false; $iCurrentCatId = $iEndNodeId; $aTmpList = array(); // we store the list in a tmp array so we can reverse the order do { $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sLanguageID); if (!$oCategory->Load($iCurrentCatId)) { $oCategory = null; $bDone = true; } else { $aTmpList[] = $oCategory; if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) { $bDone = true; } else { $oCategory = $oCategory->GetParent(); if (null === $oCategory) { $bDone = true; } else { $iCurrentCatId = $oCategory->id; } } } } while (!$bDone); $aTmpList = array_reverse($aTmpList); $oCategoryPath = new TIterator(); foreach (array_keys($aTmpList) as $iTmpIndex) { $oCategoryPath->AddItem($aTmpList[$iTmpIndex]); } return $oCategoryPath; }
[ "public", "static", "function", "&", "GetCategoryPath", "(", "$", "iEndNodeId", ",", "$", "iStartNodeId", "=", "null", ",", "$", "sLanguageID", "=", "null", ")", "{", "if", "(", "null", "===", "$", "sLanguageID", ")", "{", "$", "sLanguageID", "=", "self"...
return category path from iEndNodeId to iStartNodeId. if not start node is given, the path will start at the root category. @param int $iStartNodeId @param int $iEndNodeId @param string $sLanguageID @return TIterator
[ "return", "category", "path", "from", "iEndNodeId", "to", "iStartNodeId", ".", "if", "not", "start", "node", "is", "given", "the", "path", "will", "start", "at", "the", "root", "category", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L233-L270
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopCategoryList.class.php
TShopCategoryList.getParentCategoryList
public static function getParentCategoryList($categoryId) { $categoryList = new TIterator(); $aTmpList = array(); // we store the list in a tmp array so we can reverse the order $currentCategoryId = $categoryId; $bDone = false; $requestInfoService = self::getRequestInfoService(); $languageService = self::getLanguageService(); if ($requestInfoService->isBackendMode()) { $languageId = $languageService->getActiveEditLanguage()->id; } else { $languageId = $languageService->getActiveLanguageId(); } do { $category = TdbShopCategory::GetNewInstance(); $category->SetLanguage($languageId); if (!$category->Load($currentCategoryId)) { $category = null; $bDone = true; } else { $category = $category->GetParent(); if (!is_null($category)) { $aTmpList[] = $category; $currentCategoryId = $category->id; } else { $bDone = true; } } } while (!$bDone); $aTmpList = array_reverse($aTmpList); foreach ($aTmpList as $tempCategory) { $categoryList->AddItem($tempCategory); } return $categoryList; }
php
public static function getParentCategoryList($categoryId) { $categoryList = new TIterator(); $aTmpList = array(); // we store the list in a tmp array so we can reverse the order $currentCategoryId = $categoryId; $bDone = false; $requestInfoService = self::getRequestInfoService(); $languageService = self::getLanguageService(); if ($requestInfoService->isBackendMode()) { $languageId = $languageService->getActiveEditLanguage()->id; } else { $languageId = $languageService->getActiveLanguageId(); } do { $category = TdbShopCategory::GetNewInstance(); $category->SetLanguage($languageId); if (!$category->Load($currentCategoryId)) { $category = null; $bDone = true; } else { $category = $category->GetParent(); if (!is_null($category)) { $aTmpList[] = $category; $currentCategoryId = $category->id; } else { $bDone = true; } } } while (!$bDone); $aTmpList = array_reverse($aTmpList); foreach ($aTmpList as $tempCategory) { $categoryList->AddItem($tempCategory); } return $categoryList; }
[ "public", "static", "function", "getParentCategoryList", "(", "$", "categoryId", ")", "{", "$", "categoryList", "=", "new", "TIterator", "(", ")", ";", "$", "aTmpList", "=", "array", "(", ")", ";", "// we store the list in a tmp array so we can reverse the order", "...
return all parent categories from the tree. @param string $categoryId @return TIterator
[ "return", "all", "parent", "categories", "from", "the", "tree", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L313-L349
train
comporu/compo-core
src/Compo/Sonata/AdminBundle/Form/FormMapper.php
FormMapper.tab
public function tab($name, array $options = []) { if (!isset($options['label'])) { $options['label'] = 'form.tab_' . $name; } return parent::tab($name, $options); }
php
public function tab($name, array $options = []) { if (!isset($options['label'])) { $options['label'] = 'form.tab_' . $name; } return parent::tab($name, $options); }
[ "public", "function", "tab", "(", "$", "name", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'label'", "]", ")", ")", "{", "$", "options", "[", "'label'", "]", "=", "'form.tab_'", ".", ...
Add new tab. @param string $name @param array $options @return BaseGroupedMapper
[ "Add", "new", "tab", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/AdminBundle/Form/FormMapper.php#L27-L34
train
PGB-LIV/php-ms
src/Core/ModifiableSequenceTrait.php
ModifiableSequenceTrait.removeModification
public function removeModification(Modification $searchModification) { foreach ($this->modifications as $key => $modification) { if ($modification !== $searchModification) { continue; } unset($this->modifications[$key]); } }
php
public function removeModification(Modification $searchModification) { foreach ($this->modifications as $key => $modification) { if ($modification !== $searchModification) { continue; } unset($this->modifications[$key]); } }
[ "public", "function", "removeModification", "(", "Modification", "$", "searchModification", ")", "{", "foreach", "(", "$", "this", "->", "modifications", "as", "$", "key", "=>", "$", "modification", ")", "{", "if", "(", "$", "modification", "!==", "$", "sear...
Remove a modification
[ "Remove", "a", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ModifiableSequenceTrait.php#L121-L130
train
PGB-LIV/php-ms
src/Core/ModifiableSequenceTrait.php
ModifiableSequenceTrait.getMonoisotopicMass
public function getMonoisotopicMass() { $acids = str_split($this->getSequence(), 1); $mass = ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::OXYGEN_MASS; foreach ($acids as $acid) { switch ($acid) { case 'X': case 'B': case 'Z': continue; default: $mass += AminoAcidMono::getMonoisotopicMass($acid); break; } } // Add modification mass // Catch modification on position, residue or terminus foreach ($this->getModifications() as $modification) { if (! is_null($modification->getLocation())) { $mass += $modification->getMonoisotopicMass(); continue; } switch ($modification->getPosition()) { case Modification::POSITION_NTERM: case Modification::POSITION_PROTEIN_NTERM: // TODO: Handle protein level safely // A peptide can be both at protein n-term and not since multiple proteins supported $nTerm = $this->sequence[0]; if (in_array($nTerm, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } break; case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_CTERM: // TODO: Handle protein level safely // A peptide can be both at protein n-term and not since multiple proteins supported $cTerm = $this->sequence[strlen($this->sequence) - 1]; if (in_array($cTerm, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } break; default: foreach ($acids as $acid) { if (in_array($acid, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } } break; } } return $mass; }
php
public function getMonoisotopicMass() { $acids = str_split($this->getSequence(), 1); $mass = ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::OXYGEN_MASS; foreach ($acids as $acid) { switch ($acid) { case 'X': case 'B': case 'Z': continue; default: $mass += AminoAcidMono::getMonoisotopicMass($acid); break; } } // Add modification mass // Catch modification on position, residue or terminus foreach ($this->getModifications() as $modification) { if (! is_null($modification->getLocation())) { $mass += $modification->getMonoisotopicMass(); continue; } switch ($modification->getPosition()) { case Modification::POSITION_NTERM: case Modification::POSITION_PROTEIN_NTERM: // TODO: Handle protein level safely // A peptide can be both at protein n-term and not since multiple proteins supported $nTerm = $this->sequence[0]; if (in_array($nTerm, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } break; case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_CTERM: // TODO: Handle protein level safely // A peptide can be both at protein n-term and not since multiple proteins supported $cTerm = $this->sequence[strlen($this->sequence) - 1]; if (in_array($cTerm, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } break; default: foreach ($acids as $acid) { if (in_array($acid, $modification->getResidues())) { $mass += $modification->getMonoisotopicMass(); } } break; } } return $mass; }
[ "public", "function", "getMonoisotopicMass", "(", ")", "{", "$", "acids", "=", "str_split", "(", "$", "this", "->", "getSequence", "(", ")", ",", "1", ")", ";", "$", "mass", "=", "ChemicalConstants", "::", "HYDROGEN_MASS", "+", "ChemicalConstants", "::", "...
Gets the theoretical monoisotopic neutral mass for this sequence and it's modifications @return float The neutral mass of the sequence
[ "Gets", "the", "theoretical", "monoisotopic", "neutral", "mass", "for", "this", "sequence", "and", "it", "s", "modifications" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ModifiableSequenceTrait.php#L193-L253
train
edmondscommerce/doctrine-static-meta
codeTemplates/src/Entity/Relations/TemplateEntity/Traits/HasRequiredTemplateEntitiesAbstract.php
HasRequiredTemplateEntitiesAbstract.initTemplateEntities
private function initTemplateEntities(): self { if (null !== $this->templateEntities) { return $this; } $this->templateEntities = new ArrayCollection(); return $this; }
php
private function initTemplateEntities(): self { if (null !== $this->templateEntities) { return $this; } $this->templateEntities = new ArrayCollection(); return $this; }
[ "private", "function", "initTemplateEntities", "(", ")", ":", "self", "{", "if", "(", "null", "!==", "$", "this", "->", "templateEntities", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "templateEntities", "=", "new", "ArrayCollection", "("...
Initialise the templateEntities property as a Doctrine ArrayCollection @return $this @SuppressWarnings(PHPMD.UnusedPrivateMethod)
[ "Initialise", "the", "templateEntities", "property", "as", "a", "Doctrine", "ArrayCollection" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/codeTemplates/src/Entity/Relations/TemplateEntity/Traits/HasRequiredTemplateEntitiesAbstract.php#L138-L146
train
edmondscommerce/doctrine-static-meta
src/Entity/Traits/AlwaysValidTrait.php
AlwaysValidTrait.injectEntityDataValidator
public function injectEntityDataValidator(EntityDataValidatorInterface $entityDataValidator) { $this->entityDataValidator = $entityDataValidator; $this->entityDataValidator->setEntity($this); }
php
public function injectEntityDataValidator(EntityDataValidatorInterface $entityDataValidator) { $this->entityDataValidator = $entityDataValidator; $this->entityDataValidator->setEntity($this); }
[ "public", "function", "injectEntityDataValidator", "(", "EntityDataValidatorInterface", "$", "entityDataValidator", ")", "{", "$", "this", "->", "entityDataValidator", "=", "$", "entityDataValidator", ";", "$", "this", "->", "entityDataValidator", "->", "setEntity", "("...
This method is called automatically by the EntityFactory when initialisig the Entity, by way of the EntityDependencyInjector @param EntityDataValidatorInterface $entityDataValidator
[ "This", "method", "is", "called", "automatically", "by", "the", "EntityFactory", "when", "initialisig", "the", "Entity", "by", "way", "of", "the", "EntityDependencyInjector" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/AlwaysValidTrait.php#L129-L133
train
edmondscommerce/doctrine-static-meta
src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php
ImplementNotifyChangeTrackingPolicy.ensureMetaDataIsSet
public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void { self::getDoctrineStaticMeta()->setMetaData($entityManager->getClassMetadata(self::class)); }
php
public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void { self::getDoctrineStaticMeta()->setMetaData($entityManager->getClassMetadata(self::class)); }
[ "public", "function", "ensureMetaDataIsSet", "(", "EntityManagerInterface", "$", "entityManager", ")", ":", "void", "{", "self", "::", "getDoctrineStaticMeta", "(", ")", "->", "setMetaData", "(", "$", "entityManager", "->", "getClassMetadata", "(", "self", "::", "...
The meta data is set to the entity when the meta data is loaded, however if metadata is cached that wont happen This call ensures that the meta data is set @param EntityManagerInterface $entityManager
[ "The", "meta", "data", "is", "set", "to", "the", "entity", "when", "the", "meta", "data", "is", "loaded", "however", "if", "metadata", "is", "cached", "that", "wont", "happen", "This", "call", "ensures", "that", "the", "meta", "data", "is", "set" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L52-L55
train
edmondscommerce/doctrine-static-meta
src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php
ImplementNotifyChangeTrackingPolicy.notifyEmbeddablePrefixedProperties
public function notifyEmbeddablePrefixedProperties( string $embeddablePropertyName, ?string $propName = null, $oldValue = null, $newValue = null ): void { if ($oldValue !== null && $oldValue === $newValue) { return; } /** * @var ClassMetadata $metaData */ $metaData = self::getDoctrineStaticMeta()->getMetaData(); foreach ($metaData->getFieldNames() as $fieldName) { if (true === \ts\stringStartsWith($fieldName, $embeddablePropertyName) && false !== \ts\stringContains($fieldName, '.') ) { if ($fieldName !== null && $fieldName !== "$embeddablePropertyName.$propName") { continue; } foreach ($this->notifyChangeTrackingListeners as $listener) { //wondering if we can get away with not passing in the values? $listener->propertyChanged($this, $fieldName, $oldValue, $newValue); } } } }
php
public function notifyEmbeddablePrefixedProperties( string $embeddablePropertyName, ?string $propName = null, $oldValue = null, $newValue = null ): void { if ($oldValue !== null && $oldValue === $newValue) { return; } /** * @var ClassMetadata $metaData */ $metaData = self::getDoctrineStaticMeta()->getMetaData(); foreach ($metaData->getFieldNames() as $fieldName) { if (true === \ts\stringStartsWith($fieldName, $embeddablePropertyName) && false !== \ts\stringContains($fieldName, '.') ) { if ($fieldName !== null && $fieldName !== "$embeddablePropertyName.$propName") { continue; } foreach ($this->notifyChangeTrackingListeners as $listener) { //wondering if we can get away with not passing in the values? $listener->propertyChanged($this, $fieldName, $oldValue, $newValue); } } } }
[ "public", "function", "notifyEmbeddablePrefixedProperties", "(", "string", "$", "embeddablePropertyName", ",", "?", "string", "$", "propName", "=", "null", ",", "$", "oldValue", "=", "null", ",", "$", "newValue", "=", "null", ")", ":", "void", "{", "if", "("...
This notifies the embeddable properties on the owning Entity @param string $embeddablePropertyName @param null|string $propName @param null $oldValue @param null $newValue
[ "This", "notifies", "the", "embeddable", "properties", "on", "the", "owning", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L65-L91
train
edmondscommerce/doctrine-static-meta
src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php
ImplementNotifyChangeTrackingPolicy.updatePropertyValue
private function updatePropertyValue(string $propName, $newValue): void { if ($this->$propName === $newValue) { return; } $oldValue = $this->$propName; $this->$propName = $newValue; foreach ($this->notifyChangeTrackingListeners as $listener) { $listener->propertyChanged($this, $propName, $oldValue, $newValue); } }
php
private function updatePropertyValue(string $propName, $newValue): void { if ($this->$propName === $newValue) { return; } $oldValue = $this->$propName; $this->$propName = $newValue; foreach ($this->notifyChangeTrackingListeners as $listener) { $listener->propertyChanged($this, $propName, $oldValue, $newValue); } }
[ "private", "function", "updatePropertyValue", "(", "string", "$", "propName", ",", "$", "newValue", ")", ":", "void", "{", "if", "(", "$", "this", "->", "$", "propName", "===", "$", "newValue", ")", "{", "return", ";", "}", "$", "oldValue", "=", "$", ...
To be called from all set methods This method updates the property value, then it runs this through validation If validation fails, it sets the old value back and throws the caught exception If validation passes, it then performs the Doctrine notification for property change @param string $propName @param mixed $newValue @throws ValidationException
[ "To", "be", "called", "from", "all", "set", "methods" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L106-L116
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/pkgShop/objects/db/TPkgShopListfilter_TShopCategory.class.php
TPkgShopListfilter_TShopCategory.GetFieldPkgShopListfilterIdRecursive
public function GetFieldPkgShopListfilterIdRecursive() { $sFilterId = $this->GetFromInternalCache('sActingFilterForCategory'); if (null !== $sFilterId) { return $sFilterId; } if (isset($this->sqlData['lft']) && isset($this->sqlData['rgt'])) { $sFilterId = $this->findFilterFromNestedSet(); } else { $sFilterId = ''; if (empty($this->fieldPkgShopListfilterId) && !empty($this->fieldShopCategoryId)) { $oParent = $this->GetParent(); if ($oParent) { $sFilterId = $oParent->GetFieldPkgShopListfilterIdRecursive(); } } else { $sFilterId = $this->fieldPkgShopListfilterId; } } $this->SetInternalCache('sActingFilterForCategory', $sFilterId); return $sFilterId; }
php
public function GetFieldPkgShopListfilterIdRecursive() { $sFilterId = $this->GetFromInternalCache('sActingFilterForCategory'); if (null !== $sFilterId) { return $sFilterId; } if (isset($this->sqlData['lft']) && isset($this->sqlData['rgt'])) { $sFilterId = $this->findFilterFromNestedSet(); } else { $sFilterId = ''; if (empty($this->fieldPkgShopListfilterId) && !empty($this->fieldShopCategoryId)) { $oParent = $this->GetParent(); if ($oParent) { $sFilterId = $oParent->GetFieldPkgShopListfilterIdRecursive(); } } else { $sFilterId = $this->fieldPkgShopListfilterId; } } $this->SetInternalCache('sActingFilterForCategory', $sFilterId); return $sFilterId; }
[ "public", "function", "GetFieldPkgShopListfilterIdRecursive", "(", ")", "{", "$", "sFilterId", "=", "$", "this", "->", "GetFromInternalCache", "(", "'sActingFilterForCategory'", ")", ";", "if", "(", "null", "!==", "$", "sFilterId", ")", "{", "return", "$", "sFil...
returns the ID of the Listfilter for that is set for this category or one of its ancestors.
[ "returns", "the", "ID", "of", "the", "Listfilter", "for", "that", "is", "set", "for", "this", "category", "or", "one", "of", "its", "ancestors", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/pkgShop/objects/db/TPkgShopListfilter_TShopCategory.class.php#L17-L41
train
PGB-LIV/php-ms
src/Core/Spectra/PrecursorIon.php
PrecursorIon.setScan
public function setScan($scan) { if (! (is_int($scan) || is_float($scan))) { throw new \InvalidArgumentException( 'Argument 1 must be of type int or float. Value is of type ' . gettype($scan)); } $this->scan = $scan; }
php
public function setScan($scan) { if (! (is_int($scan) || is_float($scan))) { throw new \InvalidArgumentException( 'Argument 1 must be of type int or float. Value is of type ' . gettype($scan)); } $this->scan = $scan; }
[ "public", "function", "setScan", "(", "$", "scan", ")", "{", "if", "(", "!", "(", "is_int", "(", "$", "scan", ")", "||", "is_float", "(", "$", "scan", ")", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be of type...
Sets the scan number for this precursor @param int|float $scan Scan number to set @throws \InvalidArgumentException
[ "Sets", "the", "scan", "number", "for", "this", "precursor" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/PrecursorIon.php#L112-L120
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticlelistOrderbyList.class.php
TShopModuleArticlelistOrderbyList.&
public static function &GetListForIds($aIdList, $iLanguageId = null) { $aIdList = TTools::MysqlRealEscapeArray($aIdList); $sQuery = self::GetDefaultQuery($iLanguageId, "`id` IN ('".implode("', '", $aIdList)."') "); return TdbShopModuleArticlelistOrderbyList::GetList($sQuery, $iLanguageId); }
php
public static function &GetListForIds($aIdList, $iLanguageId = null) { $aIdList = TTools::MysqlRealEscapeArray($aIdList); $sQuery = self::GetDefaultQuery($iLanguageId, "`id` IN ('".implode("', '", $aIdList)."') "); return TdbShopModuleArticlelistOrderbyList::GetList($sQuery, $iLanguageId); }
[ "public", "static", "function", "&", "GetListForIds", "(", "$", "aIdList", ",", "$", "iLanguageId", "=", "null", ")", "{", "$", "aIdList", "=", "TTools", "::", "MysqlRealEscapeArray", "(", "$", "aIdList", ")", ";", "$", "sQuery", "=", "self", "::", "GetD...
return list for a set of ids. @param array $aIdList @param int $iLanguageId @return TdbShopModuleArticlelistOrderbyList
[ "return", "list", "for", "a", "set", "of", "ids", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticlelistOrderbyList.class.php#L26-L32
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/CodeHelper.php
CodeHelper.replaceTypeHintsInFile
public function replaceTypeHintsInFile( string $filePath, string $type, string $dbalType, bool $isNullable ): void { $contents = \ts\file_get_contents($filePath); $search = [ ': string;', '(string $', ': string {', '@var string', '@return string', '@param string', ]; $replaceNormal = [ ": $type;", "($type $", ": $type {", "@var $type", "@return $type", "@param $type", ]; $replaceNullable = [ ": ?$type;", "(?$type $", ": ?$type {", "@var $type|null", "@return $type|null", "@param $type|null", ]; $replaceRemove = [ ';', '($', ' {', '', '', '', ]; $replace = $replaceNormal; if (\in_array($dbalType, MappingHelper::MIXED_TYPES, true)) { $replace = $replaceRemove; } elseif ($isNullable) { $replace = $replaceNullable; } $contents = \str_replace( $search, $replace, $contents ); \file_put_contents($filePath, $contents); }
php
public function replaceTypeHintsInFile( string $filePath, string $type, string $dbalType, bool $isNullable ): void { $contents = \ts\file_get_contents($filePath); $search = [ ': string;', '(string $', ': string {', '@var string', '@return string', '@param string', ]; $replaceNormal = [ ": $type;", "($type $", ": $type {", "@var $type", "@return $type", "@param $type", ]; $replaceNullable = [ ": ?$type;", "(?$type $", ": ?$type {", "@var $type|null", "@return $type|null", "@param $type|null", ]; $replaceRemove = [ ';', '($', ' {', '', '', '', ]; $replace = $replaceNormal; if (\in_array($dbalType, MappingHelper::MIXED_TYPES, true)) { $replace = $replaceRemove; } elseif ($isNullable) { $replace = $replaceNullable; } $contents = \str_replace( $search, $replace, $contents ); \file_put_contents($filePath, $contents); }
[ "public", "function", "replaceTypeHintsInFile", "(", "string", "$", "filePath", ",", "string", "$", "type", ",", "string", "$", "dbalType", ",", "bool", "$", "isNullable", ")", ":", "void", "{", "$", "contents", "=", "\\", "ts", "\\", "file_get_contents", ...
We use the string type hint as our default in templates This method will then replace those with the updated type @param string $filePath @param string $type @param string $dbalType @param bool $isNullable
[ "We", "use", "the", "string", "type", "hint", "as", "our", "default", "in", "templates" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/CodeHelper.php#L82-L140
train
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/TPkgShopListfilterItemList.class.php
TPkgShopListfilterItemList.GetQueryRestriction
public function GetQueryRestriction($oExcludeItem = null, $bReturnAsArray = false) { $sQuery = ''; $aQueryItems = array(); $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = $this->Next()) { if (is_null($oExcludeItem) || !$oExcludeItem->IsSameAs($oItem)) { $sTmpQuery = trim($oItem->GetQueryRestrictionForActiveFilter()); if (!empty($sTmpQuery)) { $aQueryItems[] = $sTmpQuery; } } } $this->setItemPointer($iPointer); if (!$bReturnAsArray) { if (count($aQueryItems)) { $sQuery = '('.implode(') AND (', $aQueryItems).')'; } return $sQuery; } else { return $aQueryItems; } }
php
public function GetQueryRestriction($oExcludeItem = null, $bReturnAsArray = false) { $sQuery = ''; $aQueryItems = array(); $iPointer = $this->getItemPointer(); $this->GoToStart(); while ($oItem = $this->Next()) { if (is_null($oExcludeItem) || !$oExcludeItem->IsSameAs($oItem)) { $sTmpQuery = trim($oItem->GetQueryRestrictionForActiveFilter()); if (!empty($sTmpQuery)) { $aQueryItems[] = $sTmpQuery; } } } $this->setItemPointer($iPointer); if (!$bReturnAsArray) { if (count($aQueryItems)) { $sQuery = '('.implode(') AND (', $aQueryItems).')'; } return $sQuery; } else { return $aQueryItems; } }
[ "public", "function", "GetQueryRestriction", "(", "$", "oExcludeItem", "=", "null", ",", "$", "bReturnAsArray", "=", "false", ")", "{", "$", "sQuery", "=", "''", ";", "$", "aQueryItems", "=", "array", "(", ")", ";", "$", "iPointer", "=", "$", "this", "...
return sql condition for the current filter list. optionaly excluding the element passed. @param TdbPkgShopListfilterItem $oExcludeItem @param bool $bReturnAsArray - set to true if you want an array with the query parts instead of a string @return string
[ "return", "sql", "condition", "for", "the", "current", "filter", "list", ".", "optionaly", "excluding", "the", "element", "passed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/TPkgShopListfilterItemList.class.php#L34-L58
train
PGB-LIV/php-ms
src/Reader/MzIdentMlReaderFactory.php
MzIdentMlReaderFactory.getReader
public static function getReader($filePath) { $xmlReader = new \SimpleXMLElement($filePath, null, true); switch ($xmlReader->attributes()->version) { case '1.1.0': return new MzIdentMlReader1r1($filePath); case '1.2.0': return new MzIdentMlReader1r2($filePath); default: throw new \UnexpectedValueException('Version ' . $xmlReader->attributes()->version . ' is not supported'); } }
php
public static function getReader($filePath) { $xmlReader = new \SimpleXMLElement($filePath, null, true); switch ($xmlReader->attributes()->version) { case '1.1.0': return new MzIdentMlReader1r1($filePath); case '1.2.0': return new MzIdentMlReader1r2($filePath); default: throw new \UnexpectedValueException('Version ' . $xmlReader->attributes()->version . ' is not supported'); } }
[ "public", "static", "function", "getReader", "(", "$", "filePath", ")", "{", "$", "xmlReader", "=", "new", "\\", "SimpleXMLElement", "(", "$", "filePath", ",", "null", ",", "true", ")", ";", "switch", "(", "$", "xmlReader", "->", "attributes", "(", ")", ...
Parses the XML file to identify the specification version and then returns the appropriate reader @param string $filePath Path to the location of the mzIdentML file @return MzIdentMlReader1Interface
[ "Parses", "the", "XML", "file", "to", "identify", "the", "specification", "version", "and", "then", "returns", "the", "appropriate", "reader" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReaderFactory.php#L33-L45
train
sylingd/Yesf
src/Http/Request.php
Request.file
public function file() { static $res = null; if ($res === null) { $res = []; foreach ($this->files as $v) { $res[] = new File($v); } } return $res; }
php
public function file() { static $res = null; if ($res === null) { $res = []; foreach ($this->files as $v) { $res[] = new File($v); } } return $res; }
[ "public", "function", "file", "(", ")", "{", "static", "$", "res", "=", "null", ";", "if", "(", "$", "res", "===", "null", ")", "{", "$", "res", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "files", "as", "$", "v", ")", "{", "$", ...
Get uploaded files @access public @return array
[ "Get", "uploaded", "files" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Request.php#L88-L97
train
sylingd/Yesf
src/Http/Request.php
Request.end
public function end() { $this->get = null; $this->post = null; $this->server = null; $this->header = null; $this->cookie = null; $this->files = null; $this->sw_request = null; if ($this->session !== null) { $handler = Container::getInstance()->get(Dispatcher::class)->getSessionHandler(); $handler->write($this->session->id(), $this->session->encode()); $this->session = null; } }
php
public function end() { $this->get = null; $this->post = null; $this->server = null; $this->header = null; $this->cookie = null; $this->files = null; $this->sw_request = null; if ($this->session !== null) { $handler = Container::getInstance()->get(Dispatcher::class)->getSessionHandler(); $handler->write($this->session->id(), $this->session->encode()); $this->session = null; } }
[ "public", "function", "end", "(", ")", "{", "$", "this", "->", "get", "=", "null", ";", "$", "this", "->", "post", "=", "null", ";", "$", "this", "->", "server", "=", "null", ";", "$", "this", "->", "header", "=", "null", ";", "$", "this", "->"...
Finish request, release resources @access public
[ "Finish", "request", "release", "resources" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Request.php#L182-L195
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php
TPkgShopProductExportCSVEndPoint.getLine
private function getLine(array $fields): string { $fields = $this->quoteFields($fields); return $this->sEnclosure.implode($this->sEnclosure.$this->sDelimiter.$this->sEnclosure, $fields).$this->sEnclosure; }
php
private function getLine(array $fields): string { $fields = $this->quoteFields($fields); return $this->sEnclosure.implode($this->sEnclosure.$this->sDelimiter.$this->sEnclosure, $fields).$this->sEnclosure; }
[ "private", "function", "getLine", "(", "array", "$", "fields", ")", ":", "string", "{", "$", "fields", "=", "$", "this", "->", "quoteFields", "(", "$", "fields", ")", ";", "return", "$", "this", "->", "sEnclosure", ".", "implode", "(", "$", "this", "...
Returns a CSV line from the given field data. This line does not end with line break characters. @param string[] $fields @return string
[ "Returns", "a", "CSV", "line", "from", "the", "given", "field", "data", ".", "This", "line", "does", "not", "end", "with", "line", "break", "characters", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L63-L68
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php
TPkgShopProductExportCSVEndPoint.quoteFields
protected function quoteFields(array $fields): array { if ('"' !== $this->sEnclosure) { return $fields; } return array_map(function ($element) { return \str_replace('"', '""', $element); }, $fields); }
php
protected function quoteFields(array $fields): array { if ('"' !== $this->sEnclosure) { return $fields; } return array_map(function ($element) { return \str_replace('"', '""', $element); }, $fields); }
[ "protected", "function", "quoteFields", "(", "array", "$", "fields", ")", ":", "array", "{", "if", "(", "'\"'", "!==", "$", "this", "->", "sEnclosure", ")", "{", "return", "$", "fields", ";", "}", "return", "array_map", "(", "function", "(", "$", "elem...
Quotes occurrences of the enclosure character within the passed fields. @param string[] $fields @return string[]
[ "Quotes", "occurrences", "of", "the", "enclosure", "character", "within", "the", "passed", "fields", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L77-L86
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php
TPkgShopProductExportCSVEndPoint.HandleArticleList
protected function HandleArticleList() { $aFields = $this->GetFields(); $oArticleList = $this->GetArticleList(); $iCount = 0; if (!is_null($oArticleList)) { /** @var $oArticle TdbShopArticle */ while ($oArticle = &$oArticleList->Next() && !$this->BreakUp($iCount)) { $oArticle = $this->PreProcessArticle($oArticle); $this->HandleArticle($oArticle, $aFields); ++$iCount; } } return; }
php
protected function HandleArticleList() { $aFields = $this->GetFields(); $oArticleList = $this->GetArticleList(); $iCount = 0; if (!is_null($oArticleList)) { /** @var $oArticle TdbShopArticle */ while ($oArticle = &$oArticleList->Next() && !$this->BreakUp($iCount)) { $oArticle = $this->PreProcessArticle($oArticle); $this->HandleArticle($oArticle, $aFields); ++$iCount; } } return; }
[ "protected", "function", "HandleArticleList", "(", ")", "{", "$", "aFields", "=", "$", "this", "->", "GetFields", "(", ")", ";", "$", "oArticleList", "=", "$", "this", "->", "GetArticleList", "(", ")", ";", "$", "iCount", "=", "0", ";", "if", "(", "!...
loop through the article list and handle each article.
[ "loop", "through", "the", "article", "list", "and", "handle", "each", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L91-L106
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php
TPkgShopProductExportCSVEndPoint.HandleArticle
protected function HandleArticle(&$oArticle, &$aFields) { /** * @var $logger LoggerInterface */ $logger = ServiceLocator::get('logger'); $iStart = microtime(true); static $iCount = 0; static $sMemUsageBeforeArticleProcessed = null; static $sMemUsageTmp = null; ++$iCount; if (null === $sMemUsageBeforeArticleProcessed) { $sMemUsageBeforeArticleProcessed = memory_get_usage(); $sMemUsageTmp = $sMemUsageBeforeArticleProcessed; } $aFieldValues = array(); reset($aFields); foreach ($aFields as $sFieldName) { $aFieldValues[] = $this->GetFieldValue($sFieldName, $oArticle); } $sLine = $this->getLine($aFieldValues); $this->Write($sLine.$this->lineBreak); $iLogCount = 1000; if (0 === $iCount % $iLogCount) { $sMemUsageAfterArticleProcessed = memory_get_usage(); $sMemDifference = $sMemUsageAfterArticleProcessed - $sMemUsageBeforeArticleProcessed; $sMemDifference = $sMemDifference / 1024; $sMemDifference = $sMemDifference / 1024; $sMemDifferenceTmp = $sMemUsageAfterArticleProcessed - $sMemUsageTmp; $sMemDifferenceTmp = $sMemDifferenceTmp / 1024; $sMemDifferenceTmp = $sMemDifferenceTmp / 1024; if ($this->GetDebug()) { $logger->debug('memory difference after processing '.$iLogCount.' articles: '.$sMemDifference.'MB ('.$sMemDifferenceTmp.'MB for '.$iLogCount.' articles) - total article count: '.$iCount); } $sMemUsageTmp = $sMemUsageAfterArticleProcessed; } $iEnd = microtime(true); $iTime = $iEnd - $iStart; if ($this->GetDebug()) { $logger->debug("\n start ".$iStart."\n end ".$iEnd."\n time for one article: ".$iTime); } return $sLine; }
php
protected function HandleArticle(&$oArticle, &$aFields) { /** * @var $logger LoggerInterface */ $logger = ServiceLocator::get('logger'); $iStart = microtime(true); static $iCount = 0; static $sMemUsageBeforeArticleProcessed = null; static $sMemUsageTmp = null; ++$iCount; if (null === $sMemUsageBeforeArticleProcessed) { $sMemUsageBeforeArticleProcessed = memory_get_usage(); $sMemUsageTmp = $sMemUsageBeforeArticleProcessed; } $aFieldValues = array(); reset($aFields); foreach ($aFields as $sFieldName) { $aFieldValues[] = $this->GetFieldValue($sFieldName, $oArticle); } $sLine = $this->getLine($aFieldValues); $this->Write($sLine.$this->lineBreak); $iLogCount = 1000; if (0 === $iCount % $iLogCount) { $sMemUsageAfterArticleProcessed = memory_get_usage(); $sMemDifference = $sMemUsageAfterArticleProcessed - $sMemUsageBeforeArticleProcessed; $sMemDifference = $sMemDifference / 1024; $sMemDifference = $sMemDifference / 1024; $sMemDifferenceTmp = $sMemUsageAfterArticleProcessed - $sMemUsageTmp; $sMemDifferenceTmp = $sMemDifferenceTmp / 1024; $sMemDifferenceTmp = $sMemDifferenceTmp / 1024; if ($this->GetDebug()) { $logger->debug('memory difference after processing '.$iLogCount.' articles: '.$sMemDifference.'MB ('.$sMemDifferenceTmp.'MB for '.$iLogCount.' articles) - total article count: '.$iCount); } $sMemUsageTmp = $sMemUsageAfterArticleProcessed; } $iEnd = microtime(true); $iTime = $iEnd - $iStart; if ($this->GetDebug()) { $logger->debug("\n start ".$iStart."\n end ".$iEnd."\n time for one article: ".$iTime); } return $sLine; }
[ "protected", "function", "HandleArticle", "(", "&", "$", "oArticle", ",", "&", "$", "aFields", ")", "{", "/**\n * @var $logger LoggerInterface\n */", "$", "logger", "=", "ServiceLocator", "::", "get", "(", "'logger'", ")", ";", "$", "iStart", "=", ...
do work for one article loops through the available fields and calls GetFieldValue method for each field. @param TdbShopArticle $oArticle @param array $aFields @return string
[ "do", "work", "for", "one", "article", "loops", "through", "the", "available", "fields", "and", "calls", "GetFieldValue", "method", "for", "each", "field", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L117-L169
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php
TPkgShopProductExportCSVEndPoint.CleanContent
protected function CleanContent($sValue) { $sValue = parent::CleanContent($sValue); $sValue = preg_replace('/\ +/', ' ', $sValue); if ('"' === $this->sEnclosure) { return $sValue; } if (true === \in_array($this->sDelimiter, [',', "\t", "\n"], true)) { $sValue = str_replace($this->sDelimiter, ' ', $sValue); } else { $sValue = str_replace($this->sDelimiter, ',', $sValue); } return $sValue; }
php
protected function CleanContent($sValue) { $sValue = parent::CleanContent($sValue); $sValue = preg_replace('/\ +/', ' ', $sValue); if ('"' === $this->sEnclosure) { return $sValue; } if (true === \in_array($this->sDelimiter, [',', "\t", "\n"], true)) { $sValue = str_replace($this->sDelimiter, ' ', $sValue); } else { $sValue = str_replace($this->sDelimiter, ',', $sValue); } return $sValue; }
[ "protected", "function", "CleanContent", "(", "$", "sValue", ")", "{", "$", "sValue", "=", "parent", "::", "CleanContent", "(", "$", "sValue", ")", ";", "$", "sValue", "=", "preg_replace", "(", "'/\\ +/'", ",", "' '", ",", "$", "sValue", ")", ";", "if"...
Clean double blanks in content and replace delimiter to avoid errors. @param $sValue @return string
[ "Clean", "double", "blanks", "in", "content", "and", "replace", "delimiter", "to", "avoid", "errors", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L192-L208
train
PGB-LIV/php-ms
src/Core/Identification.php
Identification.getScore
public function getScore($key) { if (! array_key_exists($key, $this->scores)) { throw new \OutOfBoundsException('The key "' . $key . ' was not found.'); } return $this->scores[$key]; }
php
public function getScore($key) { if (! array_key_exists($key, $this->scores)) { throw new \OutOfBoundsException('The key "' . $key . ' was not found.'); } return $this->scores[$key]; }
[ "public", "function", "getScore", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "scores", ")", ")", "{", "throw", "new", "\\", "OutOfBoundsException", "(", "'The key \"'", ".", "$", "key", ".", ...
Gets the value for a score identified by the key that was set when setScore was called. @param string $key The key to retrieve the value for @throws \OutOfBoundsException If the key was not found on this identification @return mixed
[ "Gets", "the", "value", "for", "a", "score", "identified", "by", "the", "key", "that", "was", "set", "when", "setScore", "was", "called", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L131-L138
train
PGB-LIV/php-ms
src/Core/Identification.php
Identification.setIonsMatched
public function setIonsMatched($ionsMatched) { if (! is_int($ionsMatched)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($ionsMatched)); } $this->ionsMatched = $ionsMatched; }
php
public function setIonsMatched($ionsMatched) { if (! is_int($ionsMatched)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($ionsMatched)); } $this->ionsMatched = $ionsMatched; }
[ "public", "function", "setIonsMatched", "(", "$", "ionsMatched", ")", "{", "if", "(", "!", "is_int", "(", "$", "ionsMatched", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be an int value. Valued passed is of type '", ".", "...
Sets the the number of fragment ions matched @param int $ionsMatched The number of ions matched @throws \InvalidArgumentException If the arguments do not match the data types
[ "Sets", "the", "the", "number", "of", "fragment", "ions", "matched" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L155-L163
train
PGB-LIV/php-ms
src/Core/Identification.php
Identification.setRank
public function setRank($rank) { if (! is_int($rank)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($rank)); } $this->rank = $rank; }
php
public function setRank($rank) { if (! is_int($rank)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($rank)); } $this->rank = $rank; }
[ "public", "function", "setRank", "(", "$", "rank", ")", "{", "if", "(", "!", "is_int", "(", "$", "rank", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be an int value. Valued passed is of type '", ".", "gettype", "(", "$...
Sets the rank for this instance @param int $rank Rank value to set too
[ "Sets", "the", "rank", "for", "this", "instance" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L181-L189
train
chameleon-system/chameleon-shop
src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionDataEndPoint.class.php
TPkgShopPaymentTransactionDataEndPoint.getTotalValueForItemType
public function getTotalValueForItemType($sType) { $dTotal = 0; reset($this->items); /** @var TPkgShopPaymentTransactionItemData $oItem */ foreach ($this->items as $oItem) { if ($sType !== $oItem->getType()) { continue; } $dTotal = $dTotal + ($oItem->getAmount() * $oItem->getValue()); } return $dTotal; }
php
public function getTotalValueForItemType($sType) { $dTotal = 0; reset($this->items); /** @var TPkgShopPaymentTransactionItemData $oItem */ foreach ($this->items as $oItem) { if ($sType !== $oItem->getType()) { continue; } $dTotal = $dTotal + ($oItem->getAmount() * $oItem->getValue()); } return $dTotal; }
[ "public", "function", "getTotalValueForItemType", "(", "$", "sType", ")", "{", "$", "dTotal", "=", "0", ";", "reset", "(", "$", "this", "->", "items", ")", ";", "/** @var TPkgShopPaymentTransactionItemData $oItem */", "foreach", "(", "$", "this", "->", "items", ...
return the total value of all items with the given item type. @param $sType - must be one of TPkgShopPaymentTransactionItemData::TYPE_* @return int
[ "return", "the", "total", "value", "of", "all", "items", "with", "the", "given", "item", "type", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionDataEndPoint.class.php#L243-L256
train
edmondscommerce/doctrine-static-meta
src/Entity/Fields/Traits/String/EnumFieldTrait.php
EnumFieldTrait.setEnum
private function setEnum(string $enum): self { $this->updatePropertyValue( EnumFieldInterface::PROP_ENUM, $enum ); return $this; }
php
private function setEnum(string $enum): self { $this->updatePropertyValue( EnumFieldInterface::PROP_ENUM, $enum ); return $this; }
[ "private", "function", "setEnum", "(", "string", "$", "enum", ")", ":", "self", "{", "$", "this", "->", "updatePropertyValue", "(", "EnumFieldInterface", "::", "PROP_ENUM", ",", "$", "enum", ")", ";", "return", "$", "this", ";", "}" ]
Uses the Symfony Validator and fails back to basic in_array validation with exception @param string $enum @return self
[ "Uses", "the", "Symfony", "Validator", "and", "fails", "back", "to", "basic", "in_array", "validation", "with", "exception" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/String/EnumFieldTrait.php#L88-L96
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/IdList.php
OffAmazonPaymentsService_Model_IdList.setmember
public function setmember($member) { if (!$this->_isNumericArray($member)) { $member = array ($member); } $this->_fields['member']['FieldValue'] = $member; return $this; }
php
public function setmember($member) { if (!$this->_isNumericArray($member)) { $member = array ($member); } $this->_fields['member']['FieldValue'] = $member; return $this; }
[ "public", "function", "setmember", "(", "$", "member", ")", "{", "if", "(", "!", "$", "this", "->", "_isNumericArray", "(", "$", "member", ")", ")", "{", "$", "member", "=", "array", "(", "$", "member", ")", ";", "}", "$", "this", "->", "_fields", ...
Sets the value of the member. @param string or an array of string member @return this instance
[ "Sets", "the", "value", "of", "the", "member", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/IdList.php#L75-L82
train
CVO-Technologies/cakephp-github
src/Model/Resource/Event.php
Event.describe
public function describe() { var_dump($this); var_dump($this->type); return $this->id . ' - ' . $this->type . ' - ' . $this->actor->login; }
php
public function describe() { var_dump($this); var_dump($this->type); return $this->id . ' - ' . $this->type . ' - ' . $this->actor->login; }
[ "public", "function", "describe", "(", ")", "{", "var_dump", "(", "$", "this", ")", ";", "var_dump", "(", "$", "this", "->", "type", ")", ";", "return", "$", "this", "->", "id", ".", "' - '", ".", "$", "this", "->", "type", ".", "' - '", ".", "$"...
Return a text description of a event. @return string description of a event.
[ "Return", "a", "text", "description", "of", "a", "event", "." ]
43647e53fd87a3ab93fe2f24ce3686b594d36241
https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Model/Resource/Event.php#L17-L23
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php
TShopBasketDiscountCoreList.GetDiscountValue
public function GetDiscountValue() { $dValue = 0; $iTmpPointer = $this->getItemPointer(); $this->GoToStart(); while ($oDiscount = $this->Next()) { $dValue += $oDiscount->GetValue(); } $this->setItemPointer($iTmpPointer); return $dValue; }
php
public function GetDiscountValue() { $dValue = 0; $iTmpPointer = $this->getItemPointer(); $this->GoToStart(); while ($oDiscount = $this->Next()) { $dValue += $oDiscount->GetValue(); } $this->setItemPointer($iTmpPointer); return $dValue; }
[ "public", "function", "GetDiscountValue", "(", ")", "{", "$", "dValue", "=", "0", ";", "$", "iTmpPointer", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oDiscount", "=", "$...
return the total discount value for all active discounts. note that the method will fetch the current basket using the baskets singleton factory. @return float
[ "return", "the", "total", "discount", "value", "for", "all", "active", "discounts", ".", "note", "that", "the", "method", "will", "fetch", "the", "current", "basket", "using", "the", "baskets", "singleton", "factory", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php#L28-L40
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php
TShopBasketDiscountCoreList.RemoveInvalidDiscounts
public function RemoveInvalidDiscounts($sMessangerName = null) { // since the min value of the basket for which a discount may work is affected by other discounts, // we need to remove the discounts first, and then add them one by one back to the basket // we suppress the add messages, but keep the negative messages $oMessageManager = TCMSMessageManager::GetInstance(); // get copy of discounts $aDiscountList = $this->_items; $this->Destroy(); foreach ($aDiscountList as $iDiscountKey => $oDiscount) { /** @var $oDiscount TdbShopDiscount */ $cDiscountAllowUseCode = $oDiscount->AllowUseOfDiscount(); if (TdbShopDiscount::ALLOW_USE == $cDiscountAllowUseCode) { $this->AddItem($oDiscount); } else { if (!is_null($sMessangerName)) { // send message that the discount was removed $aMessageData = $oDiscount->GetObjectPropertiesAsArray(); $aMessageData['iRemoveReasoneCode'] = $cDiscountAllowUseCode; $oMessageManager->AddMessage($sMessangerName, 'DISCOUNT-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData); } } } }
php
public function RemoveInvalidDiscounts($sMessangerName = null) { // since the min value of the basket for which a discount may work is affected by other discounts, // we need to remove the discounts first, and then add them one by one back to the basket // we suppress the add messages, but keep the negative messages $oMessageManager = TCMSMessageManager::GetInstance(); // get copy of discounts $aDiscountList = $this->_items; $this->Destroy(); foreach ($aDiscountList as $iDiscountKey => $oDiscount) { /** @var $oDiscount TdbShopDiscount */ $cDiscountAllowUseCode = $oDiscount->AllowUseOfDiscount(); if (TdbShopDiscount::ALLOW_USE == $cDiscountAllowUseCode) { $this->AddItem($oDiscount); } else { if (!is_null($sMessangerName)) { // send message that the discount was removed $aMessageData = $oDiscount->GetObjectPropertiesAsArray(); $aMessageData['iRemoveReasoneCode'] = $cDiscountAllowUseCode; $oMessageManager->AddMessage($sMessangerName, 'DISCOUNT-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData); } } } }
[ "public", "function", "RemoveInvalidDiscounts", "(", "$", "sMessangerName", "=", "null", ")", "{", "// since the min value of the basket for which a discount may work is affected by other discounts,", "// we need to remove the discounts first, and then add them one by one back to the basket", ...
Removes all discounts from the basket, that are not valid based on the contents of the basket and the current user Returns the number of discounts removed. @param string $sMessangerName - optional message manager to which we output why a discount was removed @return int
[ "Removes", "all", "discounts", "from", "the", "basket", "that", "are", "not", "valid", "based", "on", "the", "contents", "of", "the", "basket", "and", "the", "current", "user", "Returns", "the", "number", "of", "discounts", "removed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php#L50-L75
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php
ArchetypeEmbeddableGenerator.getNewEmbeddableFqnFromClassName
private function getNewEmbeddableFqnFromClassName(string $className): string { return $this->namespaceHelper->tidy( $this->projectRootNamespace . '\\' . implode('\\', \array_slice($this->archetypeObjectSubDirectories, 1)) . '\\' . $className ); }
php
private function getNewEmbeddableFqnFromClassName(string $className): string { return $this->namespaceHelper->tidy( $this->projectRootNamespace . '\\' . implode('\\', \array_slice($this->archetypeObjectSubDirectories, 1)) . '\\' . $className ); }
[ "private", "function", "getNewEmbeddableFqnFromClassName", "(", "string", "$", "className", ")", ":", "string", "{", "return", "$", "this", "->", "namespaceHelper", "->", "tidy", "(", "$", "this", "->", "projectRootNamespace", ".", "'\\\\'", ".", "implode", "(",...
Get the Fully Qualified name for the new embeddable object based upon the project root names @param string $className @return string
[ "Get", "the", "Fully", "Qualified", "name", "for", "the", "new", "embeddable", "object", "based", "upon", "the", "project", "root", "names" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php#L348-L355
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php
ArchetypeEmbeddableGenerator.getNewPathFromArchetypePath
private function getNewPathFromArchetypePath(string $archetypePath): string { $rootArchetypePath = substr($archetypePath, 0, \ts\strpos($archetypePath, '/src/Entity/Embeddable')); $path = \str_replace($rootArchetypePath, $this->pathToProjectRoot, $archetypePath); $pattern = '%^(.*?)/([^/]*?)' . $this->archetypeObjectClassName . '([^/]*?)php$%m'; $replacement = '$1/$2' . $this->newObjectClassName . '$3php'; $path = \preg_replace($pattern, $replacement, $path, -1, $replacements); if (0 === $replacements) { throw new \RuntimeException('Failed updating the path with regex in ' . __METHOD__); } return $path; }
php
private function getNewPathFromArchetypePath(string $archetypePath): string { $rootArchetypePath = substr($archetypePath, 0, \ts\strpos($archetypePath, '/src/Entity/Embeddable')); $path = \str_replace($rootArchetypePath, $this->pathToProjectRoot, $archetypePath); $pattern = '%^(.*?)/([^/]*?)' . $this->archetypeObjectClassName . '([^/]*?)php$%m'; $replacement = '$1/$2' . $this->newObjectClassName . '$3php'; $path = \preg_replace($pattern, $replacement, $path, -1, $replacements); if (0 === $replacements) { throw new \RuntimeException('Failed updating the path with regex in ' . __METHOD__); } return $path; }
[ "private", "function", "getNewPathFromArchetypePath", "(", "string", "$", "archetypePath", ")", ":", "string", "{", "$", "rootArchetypePath", "=", "substr", "(", "$", "archetypePath", ",", "0", ",", "\\", "ts", "\\", "strpos", "(", "$", "archetypePath", ",", ...
Calculate the new path by doing a preg replace on the corresponding archetype path @param string $archetypePath @return null|string|string[]
[ "Calculate", "the", "new", "path", "by", "doing", "a", "preg", "replace", "on", "the", "corresponding", "archetype", "path" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php#L364-L379
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.SetActiveShippingGroup
public function SetActiveShippingGroup($oShippingGroup) { $bGroupAssigned = false; if (!is_null($oShippingGroup)) { $oAvailableShippingGroups = $this->GetAvailableShippingGroups(); if (!is_null($oAvailableShippingGroups) && $oAvailableShippingGroups->IsInList($oShippingGroup->id)) { $bGroupAssigned = true; $this->oActiveShippingGroup = $oShippingGroup; // if a payment method is selected, then we need to make sure it is available for the selected shipping group. // since the SetActivePaymentmethod performs the check we call it. if (!is_null($this->GetActivePaymentMethod())) { $this->SetActivePaymentMethod($this->GetActivePaymentMethod()); } } } else { $this->oActiveShippingGroup = null; $this->SetActivePaymentMethod(null); } return $bGroupAssigned; }
php
public function SetActiveShippingGroup($oShippingGroup) { $bGroupAssigned = false; if (!is_null($oShippingGroup)) { $oAvailableShippingGroups = $this->GetAvailableShippingGroups(); if (!is_null($oAvailableShippingGroups) && $oAvailableShippingGroups->IsInList($oShippingGroup->id)) { $bGroupAssigned = true; $this->oActiveShippingGroup = $oShippingGroup; // if a payment method is selected, then we need to make sure it is available for the selected shipping group. // since the SetActivePaymentmethod performs the check we call it. if (!is_null($this->GetActivePaymentMethod())) { $this->SetActivePaymentMethod($this->GetActivePaymentMethod()); } } } else { $this->oActiveShippingGroup = null; $this->SetActivePaymentMethod(null); } return $bGroupAssigned; }
[ "public", "function", "SetActiveShippingGroup", "(", "$", "oShippingGroup", ")", "{", "$", "bGroupAssigned", "=", "false", ";", "if", "(", "!", "is_null", "(", "$", "oShippingGroup", ")", ")", "{", "$", "oAvailableShippingGroups", "=", "$", "this", "->", "Ge...
set the active shipping group - return false, if an invalid group is selected. @param TdbShopShippingGroup $oShippingGroup @return bool
[ "set", "the", "active", "shipping", "group", "-", "return", "false", "if", "an", "invalid", "group", "is", "selected", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L304-L325
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.&
public function &GetActiveShippingGroup() { if (is_null($this->oActiveShippingGroup)) { // fetch the one from the shop $oShopConfig = TdbShop::GetInstance(); $oActiveShippingGroup = $oShopConfig->GetFieldShopShippingGroup(); if (false == $this->SetActiveShippingGroup($oActiveShippingGroup)) { // unable to set - group not in allowed list $oList = $this->GetAvailableShippingGroups(); $oList->GoToStart(); if ($oList->Length() > 0) { $oActiveShippingGroup = $oList->Current(); $this->SetActiveShippingGroup($oActiveShippingGroup); } } } return $this->oActiveShippingGroup; }
php
public function &GetActiveShippingGroup() { if (is_null($this->oActiveShippingGroup)) { // fetch the one from the shop $oShopConfig = TdbShop::GetInstance(); $oActiveShippingGroup = $oShopConfig->GetFieldShopShippingGroup(); if (false == $this->SetActiveShippingGroup($oActiveShippingGroup)) { // unable to set - group not in allowed list $oList = $this->GetAvailableShippingGroups(); $oList->GoToStart(); if ($oList->Length() > 0) { $oActiveShippingGroup = $oList->Current(); $this->SetActiveShippingGroup($oActiveShippingGroup); } } } return $this->oActiveShippingGroup; }
[ "public", "function", "&", "GetActiveShippingGroup", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oActiveShippingGroup", ")", ")", "{", "// fetch the one from the shop", "$", "oShopConfig", "=", "TdbShop", "::", "GetInstance", "(", ")", ";", "...
return the active shipping group - will set the shipping group to the default group, if none is set. @return TdbShopShippingGroup
[ "return", "the", "active", "shipping", "group", "-", "will", "set", "the", "shipping", "group", "to", "the", "default", "group", "if", "none", "is", "set", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L332-L350
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.GetAvailablePaymentMethods
public function GetAvailablePaymentMethods() { $oList = null; if ($this->GetActiveShippingGroup()) { $oList = $this->GetActiveShippingGroup()->GetValidPaymentMethods(); } return $oList; }
php
public function GetAvailablePaymentMethods() { $oList = null; if ($this->GetActiveShippingGroup()) { $oList = $this->GetActiveShippingGroup()->GetValidPaymentMethods(); } return $oList; }
[ "public", "function", "GetAvailablePaymentMethods", "(", ")", "{", "$", "oList", "=", "null", ";", "if", "(", "$", "this", "->", "GetActiveShippingGroup", "(", ")", ")", "{", "$", "oList", "=", "$", "this", "->", "GetActiveShippingGroup", "(", ")", "->", ...
return all payment methods for the active shipping group. @return TdbShopPaymentMethodList
[ "return", "all", "payment", "methods", "for", "the", "active", "shipping", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L375-L383
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.GetValidPaymentMethodsSelectableByTheUser
public function GetValidPaymentMethodsSelectableByTheUser() { $oList = null; if ($this->GetActiveShippingGroup()) { $oList = $this->GetActiveShippingGroup()->GetValidPaymentMethodsSelectableByTheUser(); } return $oList; }
php
public function GetValidPaymentMethodsSelectableByTheUser() { $oList = null; if ($this->GetActiveShippingGroup()) { $oList = $this->GetActiveShippingGroup()->GetValidPaymentMethodsSelectableByTheUser(); } return $oList; }
[ "public", "function", "GetValidPaymentMethodsSelectableByTheUser", "(", ")", "{", "$", "oList", "=", "null", ";", "if", "(", "$", "this", "->", "GetActiveShippingGroup", "(", ")", ")", "{", "$", "oList", "=", "$", "this", "->", "GetActiveShippingGroup", "(", ...
return all payment methods for the active shipping group that are selectable by the user. @return TdbShopPaymentMethodList
[ "return", "all", "payment", "methods", "for", "the", "active", "shipping", "group", "that", "are", "selectable", "by", "the", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L390-L398
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.ClearBasket
public function ClearBasket() { $this->UnlockBasket(); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $request->getSession()->remove(self::SESSION_KEY_NAME); $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_CLEAR, $event); }
php
public function ClearBasket() { $this->UnlockBasket(); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $request->getSession()->remove(self::SESSION_KEY_NAME); $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_CLEAR, $event); }
[ "public", "function", "ClearBasket", "(", ")", "{", "$", "this", "->", "UnlockBasket", "(", ")", ";", "/** @var Request $request */", "$", "request", "=", "\\", "ChameleonSystem", "\\", "CoreBundle", "\\", "ServiceLocator", "::", "get", "(", "'request_stack'", "...
deletes contents of basket.
[ "deletes", "contents", "of", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L443-L455
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.BasketInSession
public static function BasketInSession() { /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); return $request->getSession()->has(self::SESSION_KEY_NAME); }
php
public static function BasketInSession() { /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); return $request->getSession()->has(self::SESSION_KEY_NAME); }
[ "public", "static", "function", "BasketInSession", "(", ")", "{", "/** @var Request $request */", "$", "request", "=", "\\", "ChameleonSystem", "\\", "CoreBundle", "\\", "ServiceLocator", "::", "get", "(", "'request_stack'", ")", "->", "getCurrentRequest", "(", ")",...
return true if the basket item is stored in session. @return bool
[ "return", "true", "if", "the", "basket", "item", "is", "stored", "in", "session", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L482-L488
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.CommitToSession
public function CommitToSession($bForce = false) { // save copy to session if (TShopBasket::BasketInSession()) { $oTmp = TShopBasket::GetInstance(); if (true === $bForce || $oTmp == $this) { $oUser = TdbDataExtranetUser::GetInstance(); $oUser->ObserverUnregister('oUserBasket'); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); /** @var TPKgCmsSession $session */ $session = $request->getSession(); $session->set(self::SESSION_KEY_NAME, $this); } } }
php
public function CommitToSession($bForce = false) { // save copy to session if (TShopBasket::BasketInSession()) { $oTmp = TShopBasket::GetInstance(); if (true === $bForce || $oTmp == $this) { $oUser = TdbDataExtranetUser::GetInstance(); $oUser->ObserverUnregister('oUserBasket'); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); /** @var TPKgCmsSession $session */ $session = $request->getSession(); $session->set(self::SESSION_KEY_NAME, $this); } } }
[ "public", "function", "CommitToSession", "(", "$", "bForce", "=", "false", ")", "{", "// save copy to session", "if", "(", "TShopBasket", "::", "BasketInSession", "(", ")", ")", "{", "$", "oTmp", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "if", ...
commits the basket to session, AND unregisters itself als an observer from oUser - this method is called through the register_shutdown_function and should not be called directly. @param bool $bForce - overwrite session with basket data even if this is not the correct basket instance if you use this to replace the basket object, make sure to call TShopBasket::GetInstance(false,true) after to set the instance based on this new session
[ "commits", "the", "basket", "to", "session", "AND", "unregisters", "itself", "als", "an", "observer", "from", "oUser", "-", "this", "method", "is", "called", "through", "the", "register_shutdown_function", "and", "should", "not", "be", "called", "directly", "." ...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L528-L544
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.GetBasketSumForVoucher
public function GetBasketSumForVoucher(TShopVoucher &$oVoucher) { $value = $this->GetBasketArticles()->GetBasketSumForVoucher($oVoucher); if (true === $oVoucher->IsSponsored()) { $value += $this->dCostShipping; } return $value; }
php
public function GetBasketSumForVoucher(TShopVoucher &$oVoucher) { $value = $this->GetBasketArticles()->GetBasketSumForVoucher($oVoucher); if (true === $oVoucher->IsSponsored()) { $value += $this->dCostShipping; } return $value; }
[ "public", "function", "GetBasketSumForVoucher", "(", "TShopVoucher", "&", "$", "oVoucher", ")", "{", "$", "value", "=", "$", "this", "->", "GetBasketArticles", "(", ")", "->", "GetBasketSumForVoucher", "(", "$", "oVoucher", ")", ";", "if", "(", "true", "==="...
exposes the GetBasketSumForVoucher method in TShopBasketArticleList. @param TShopVoucher $oVoucher @return float
[ "exposes", "the", "GetBasketSumForVoucher", "method", "in", "TShopBasketArticleList", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L553-L561
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.RecalculateShipping
protected function RecalculateShipping() { $this->dCostShipping = 0; // validate shipping group - reset if not valid if (null !== $this->GetActiveShippingGroup()) { if (false === $this->SetActiveShippingGroup($this->GetActiveShippingGroup())) { $this->SetActiveShippingGroup(null); } } // if the basket contains a voucher that is set to free_shipping, then we keep costs to zero if (is_null($this->GetActiveVouchers()) || !$this->GetActiveVouchers()->HasFreeShippingVoucher()) { if (!is_null($this->GetActiveShippingGroup())) { $this->dCostShipping = $this->GetActiveShippingGroup()->GetShippingCostsForBasket(); } } }
php
protected function RecalculateShipping() { $this->dCostShipping = 0; // validate shipping group - reset if not valid if (null !== $this->GetActiveShippingGroup()) { if (false === $this->SetActiveShippingGroup($this->GetActiveShippingGroup())) { $this->SetActiveShippingGroup(null); } } // if the basket contains a voucher that is set to free_shipping, then we keep costs to zero if (is_null($this->GetActiveVouchers()) || !$this->GetActiveVouchers()->HasFreeShippingVoucher()) { if (!is_null($this->GetActiveShippingGroup())) { $this->dCostShipping = $this->GetActiveShippingGroup()->GetShippingCostsForBasket(); } } }
[ "protected", "function", "RecalculateShipping", "(", ")", "{", "$", "this", "->", "dCostShipping", "=", "0", ";", "// validate shipping group - reset if not valid", "if", "(", "null", "!==", "$", "this", "->", "GetActiveShippingGroup", "(", ")", ")", "{", "if", ...
fetches the shipping costs from the active shipping group.
[ "fetches", "the", "shipping", "costs", "from", "the", "active", "shipping", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L804-L821
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.&
public function &GetActiveVATList() { if (is_null($this->oActiveVatList)) { $this->oActiveVatList = TdbShopVatList::GetList(); $this->oActiveVatList->bAllowItemCache = true; $this->oActiveVatList->GoToStart(); } return $this->oActiveVatList; }
php
public function &GetActiveVATList() { if (is_null($this->oActiveVatList)) { $this->oActiveVatList = TdbShopVatList::GetList(); $this->oActiveVatList->bAllowItemCache = true; $this->oActiveVatList->GoToStart(); } return $this->oActiveVatList; }
[ "public", "function", "&", "GetActiveVATList", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oActiveVatList", ")", ")", "{", "$", "this", "->", "oActiveVatList", "=", "TdbShopVatList", "::", "GetList", "(", ")", ";", "$", "this", "->", ...
return copy of active vat group list. @return TdbShopVatList
[ "return", "copy", "of", "active", "vat", "group", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L895-L904
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.GetLargestVATObject
public function GetLargestVATObject() { $oActiveVatList = $this->GetActiveVATList(); /** @var $oMaxItem TdbShopVat */ $oMaxItem = null; if (is_object($oActiveVatList)) { $oMaxItem = $oActiveVatList->GetMaxItem(); } return $oMaxItem; }
php
public function GetLargestVATObject() { $oActiveVatList = $this->GetActiveVATList(); /** @var $oMaxItem TdbShopVat */ $oMaxItem = null; if (is_object($oActiveVatList)) { $oMaxItem = $oActiveVatList->GetMaxItem(); } return $oMaxItem; }
[ "public", "function", "GetLargestVATObject", "(", ")", "{", "$", "oActiveVatList", "=", "$", "this", "->", "GetActiveVATList", "(", ")", ";", "/** @var $oMaxItem TdbShopVat */", "$", "oMaxItem", "=", "null", ";", "if", "(", "is_object", "(", "$", "oActiveVatList...
return the largest vat object from the active vat group. @return TdbShopVat
[ "return", "the", "largest", "vat", "object", "from", "the", "active", "vat", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L911-L921
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.RecalculateNoneSponsoredVouchers
protected function RecalculateNoneSponsoredVouchers() { if (!is_null($this->GetActiveVouchers())) { $this->dCostNoneSponsoredVouchers = 0; $this->GetActiveVouchers()->RemoveInvalidVouchers(MTShopBasketCore::MSG_CONSUMER_NAME, $this); $this->dCostNoneSponsoredVouchers = $this->GetActiveVouchers()->GetVoucherValue(false); if ($this->dCostNoneSponsoredVouchers > $this->dCostArticlesTotalAfterDiscounts) { $this->dCostNoneSponsoredVouchers = $this->dCostArticlesTotalAfterDiscounts; } } else { $this->dCostNoneSponsoredVouchers = 0; } }
php
protected function RecalculateNoneSponsoredVouchers() { if (!is_null($this->GetActiveVouchers())) { $this->dCostNoneSponsoredVouchers = 0; $this->GetActiveVouchers()->RemoveInvalidVouchers(MTShopBasketCore::MSG_CONSUMER_NAME, $this); $this->dCostNoneSponsoredVouchers = $this->GetActiveVouchers()->GetVoucherValue(false); if ($this->dCostNoneSponsoredVouchers > $this->dCostArticlesTotalAfterDiscounts) { $this->dCostNoneSponsoredVouchers = $this->dCostArticlesTotalAfterDiscounts; } } else { $this->dCostNoneSponsoredVouchers = 0; } }
[ "protected", "function", "RecalculateNoneSponsoredVouchers", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "GetActiveVouchers", "(", ")", ")", ")", "{", "$", "this", "->", "dCostNoneSponsoredVouchers", "=", "0", ";", "$", "this", "->", ...
calculates the value of NONE sponsored vouchers. The article prices for each item in the basket affected by a voucher is reduced by the value calculated for the item.
[ "calculates", "the", "value", "of", "NONE", "sponsored", "vouchers", ".", "The", "article", "prices", "for", "each", "item", "in", "the", "basket", "affected", "by", "a", "voucher", "is", "reduced", "by", "the", "value", "calculated", "for", "the", "item", ...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L962-L975
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.redirectToPaymentStep
protected function redirectToPaymentStep() { if (defined('CMS_PAYMENT_REDIRECT_ON_FAILURE') && CMS_PAYMENT_REDIRECT_ON_FAILURE != '') { $oOrderStep = TdbShopOrderStep::GetStep(CMS_PAYMENT_REDIRECT_ON_FAILURE); if ($oOrderStep) { $oOrderStep->JumpToStep($oOrderStep); } } }
php
protected function redirectToPaymentStep() { if (defined('CMS_PAYMENT_REDIRECT_ON_FAILURE') && CMS_PAYMENT_REDIRECT_ON_FAILURE != '') { $oOrderStep = TdbShopOrderStep::GetStep(CMS_PAYMENT_REDIRECT_ON_FAILURE); if ($oOrderStep) { $oOrderStep->JumpToStep($oOrderStep); } } }
[ "protected", "function", "redirectToPaymentStep", "(", ")", "{", "if", "(", "defined", "(", "'CMS_PAYMENT_REDIRECT_ON_FAILURE'", ")", "&&", "CMS_PAYMENT_REDIRECT_ON_FAILURE", "!=", "''", ")", "{", "$", "oOrderStep", "=", "TdbShopOrderStep", "::", "GetStep", "(", "CM...
if CMS_PAYMENT_REDIRECT_ON_FAILURE is defined with correct order step system name do redirect to defined step. This step should contain payment selection.
[ "if", "CMS_PAYMENT_REDIRECT_ON_FAILURE", "is", "defined", "with", "correct", "order", "step", "system", "name", "do", "redirect", "to", "defined", "step", ".", "This", "step", "should", "contain", "payment", "selection", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1131-L1139
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.&
public static function &GetLastCreatedOrder($bResetValue = false) { $oOrder = null; if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) { $oOrder = TdbShopOrder::GetNewInstance(); /** @var $oOrder TdbShopOrder */ if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) { // now we want to make sure that the current user is the owner of that order. this is // the case if: the user is logged in and the user id in the order matches, or the user is // not logged in and the order has no user id $oUser = TdbDataExtranetUser::GetInstance(); $isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id); $isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1)); if (!$isOwner) { $oOrder = null; } } else { $oOrder = null; } if ($bResetValue) { unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]); } } return $oOrder; }
php
public static function &GetLastCreatedOrder($bResetValue = false) { $oOrder = null; if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) { $oOrder = TdbShopOrder::GetNewInstance(); /** @var $oOrder TdbShopOrder */ if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) { // now we want to make sure that the current user is the owner of that order. this is // the case if: the user is logged in and the user id in the order matches, or the user is // not logged in and the order has no user id $oUser = TdbDataExtranetUser::GetInstance(); $isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id); $isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1)); if (!$isOwner) { $oOrder = null; } } else { $oOrder = null; } if ($bResetValue) { unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]); } } return $oOrder; }
[ "public", "static", "function", "&", "GetLastCreatedOrder", "(", "$", "bResetValue", "=", "false", ")", "{", "$", "oOrder", "=", "null", ";", "if", "(", "array_key_exists", "(", "self", "::", "SESSION_KEY_LAST_CREATED_ORDER_ID", ",", "$", "_SESSION", ")", ")",...
returns the order object created last within the current session of the user. @param bool $bResetValue - set to true if you want to reset the session item @return TdbShopOrder
[ "returns", "the", "order", "object", "created", "last", "within", "the", "current", "session", "of", "the", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1259-L1284
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.CreateOrderAllowCreation
protected function CreateOrderAllowCreation($sMessageConsumer, $bSkipPaymentValidation = false) { $oMsgManager = TCMSMessageManager::GetInstance(); $bAllowCreation = true; if ($bAllowCreation) { if ($this->LockIsActive()) { // the order has already been created... $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'); $bAllowCreation = false; // kill basket, and reset key $oBasket = TShopBasket::GetInstance(); $this->UnlockBasket(); $oBasket->ClearBasket(); unset($oBasket); } } if ($bAllowCreation) { // prevent order creation if the last order is less then 10 seconds ago - the system will prevent this anyway, but we need to // show the user a sensible error message in this case if (true === $this->isReorderDueToDoubleClick()) { $bAllowCreation = false; $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'); } } if ($bAllowCreation) { // now check if there are article in the basket if ($this->dCostTotal < 0) { // negativ orders are not permitted $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-NEGATIV-ORDER'); $bAllowCreation = false; } } if ($bAllowCreation) { if ($this->iTotalNumberOfUniqueArticles < 1 || $this->dTotalNumberOfArticles <= 0) { // no articles in order $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-EMPTY-ORDER'); $bAllowCreation = false; } } if ($bAllowCreation) { // check to make sure we have a billing addres for the user $oUser = TdbDataExtranetUser::GetInstance(); $oBillingAdr = $oUser->GetBillingAddress(); if (is_null($oBillingAdr) || !$oBillingAdr->ContainsData()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-USER-HAS-NO-BILLING-ADDRESS'); $bAllowCreation = false; } } if ($bAllowCreation) { // check if shipping and payment have been selected if (false == $this->HasValidShippingGroup()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-SHIPPING-GROUP-NOT-VALID'); $bAllowCreation = false; } } if ($bAllowCreation) { if (!$bSkipPaymentValidation) { if (false == $this->HasValidPaymentMethod()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-METHOD-NOT-VALID'); $bAllowCreation = false; } } } return $bAllowCreation; }
php
protected function CreateOrderAllowCreation($sMessageConsumer, $bSkipPaymentValidation = false) { $oMsgManager = TCMSMessageManager::GetInstance(); $bAllowCreation = true; if ($bAllowCreation) { if ($this->LockIsActive()) { // the order has already been created... $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'); $bAllowCreation = false; // kill basket, and reset key $oBasket = TShopBasket::GetInstance(); $this->UnlockBasket(); $oBasket->ClearBasket(); unset($oBasket); } } if ($bAllowCreation) { // prevent order creation if the last order is less then 10 seconds ago - the system will prevent this anyway, but we need to // show the user a sensible error message in this case if (true === $this->isReorderDueToDoubleClick()) { $bAllowCreation = false; $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'); } } if ($bAllowCreation) { // now check if there are article in the basket if ($this->dCostTotal < 0) { // negativ orders are not permitted $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-NEGATIV-ORDER'); $bAllowCreation = false; } } if ($bAllowCreation) { if ($this->iTotalNumberOfUniqueArticles < 1 || $this->dTotalNumberOfArticles <= 0) { // no articles in order $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-EMPTY-ORDER'); $bAllowCreation = false; } } if ($bAllowCreation) { // check to make sure we have a billing addres for the user $oUser = TdbDataExtranetUser::GetInstance(); $oBillingAdr = $oUser->GetBillingAddress(); if (is_null($oBillingAdr) || !$oBillingAdr->ContainsData()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-USER-HAS-NO-BILLING-ADDRESS'); $bAllowCreation = false; } } if ($bAllowCreation) { // check if shipping and payment have been selected if (false == $this->HasValidShippingGroup()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-SHIPPING-GROUP-NOT-VALID'); $bAllowCreation = false; } } if ($bAllowCreation) { if (!$bSkipPaymentValidation) { if (false == $this->HasValidPaymentMethod()) { $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-METHOD-NOT-VALID'); $bAllowCreation = false; } } } return $bAllowCreation; }
[ "protected", "function", "CreateOrderAllowCreation", "(", "$", "sMessageConsumer", ",", "$", "bSkipPaymentValidation", "=", "false", ")", "{", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "bAllowCreation", "=", "true", ";...
return true if the basket may be saved as an order, false if we want to prevent saving the order. @param string $sMessageConsumer - message manager who we want to send errors to @param bool $bSkipPaymentValidation - set to true if you want to skip the validation of the selected payment method @return bool
[ "return", "true", "if", "the", "basket", "may", "be", "saved", "as", "an", "order", "false", "if", "we", "want", "to", "prevent", "saving", "the", "order", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1308-L1380
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.HasValidShippingGroup
protected function HasValidShippingGroup() { $bHasValidShippingGroup = false; $oShipping = $this->GetActiveShippingGroup(); if (!is_null($oShipping) && $oShipping->IsAvailable()) { $bHasValidShippingGroup = true; } return $bHasValidShippingGroup; }
php
protected function HasValidShippingGroup() { $bHasValidShippingGroup = false; $oShipping = $this->GetActiveShippingGroup(); if (!is_null($oShipping) && $oShipping->IsAvailable()) { $bHasValidShippingGroup = true; } return $bHasValidShippingGroup; }
[ "protected", "function", "HasValidShippingGroup", "(", ")", "{", "$", "bHasValidShippingGroup", "=", "false", ";", "$", "oShipping", "=", "$", "this", "->", "GetActiveShippingGroup", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oShipping", ")", "&&",...
return true if the basket as a valid shipping group selected. @return bool
[ "return", "true", "if", "the", "basket", "as", "a", "valid", "shipping", "group", "selected", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1387-L1396
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.HasValidPaymentMethod
protected function HasValidPaymentMethod() { $bHasValidPaymentMethod = false; $oPayment = $this->GetActivePaymentMethod(); if (!is_null($oPayment) && $oPayment->IsAvailable()) { $bHasValidPaymentMethod = true; } return $bHasValidPaymentMethod; }
php
protected function HasValidPaymentMethod() { $bHasValidPaymentMethod = false; $oPayment = $this->GetActivePaymentMethod(); if (!is_null($oPayment) && $oPayment->IsAvailable()) { $bHasValidPaymentMethod = true; } return $bHasValidPaymentMethod; }
[ "protected", "function", "HasValidPaymentMethod", "(", ")", "{", "$", "bHasValidPaymentMethod", "=", "false", ";", "$", "oPayment", "=", "$", "this", "->", "GetActivePaymentMethod", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oPayment", ")", "&&", ...
return true if the basket as a valid payment method selected. @return bool
[ "return", "true", "if", "the", "basket", "as", "a", "valid", "payment", "method", "selected", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1403-L1412
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.RemoveVoucher
public function RemoveVoucher($sBasketVoucherKey, $sMessageHandler) { $bRemoved = $this->GetActiveVouchers()->RemoveItem('sBasketVoucherKey', $sBasketVoucherKey); $oMessageManager = TCMSMessageManager::GetInstance(); if ($bRemoved) { $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-REMOVED'); $this->SetBasketRecalculationFlag(); } else { $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-NOT-FOUND'); } return $bRemoved; }
php
public function RemoveVoucher($sBasketVoucherKey, $sMessageHandler) { $bRemoved = $this->GetActiveVouchers()->RemoveItem('sBasketVoucherKey', $sBasketVoucherKey); $oMessageManager = TCMSMessageManager::GetInstance(); if ($bRemoved) { $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-REMOVED'); $this->SetBasketRecalculationFlag(); } else { $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-NOT-FOUND'); } return $bRemoved; }
[ "public", "function", "RemoveVoucher", "(", "$", "sBasketVoucherKey", ",", "$", "sMessageHandler", ")", "{", "$", "bRemoved", "=", "$", "this", "->", "GetActiveVouchers", "(", ")", "->", "RemoveItem", "(", "'sBasketVoucherKey'", ",", "$", "sBasketVoucherKey", ")...
remove the voucher with the given basket key from the voucher list. Results will be sent to sMessageHandler. @param string $sBasketVoucherKey - The basket key of the voucher @param string $sMessageHandler @return bool
[ "remove", "the", "voucher", "with", "the", "given", "basket", "key", "from", "the", "voucher", "list", ".", "Results", "will", "be", "sent", "to", "sMessageHandler", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1543-L1555
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.CheckBasketVoucherAvailable
protected function CheckBasketVoucherAvailable($sMessageConsumer) { $bBasketVoucherAvailable = true; $oVoucherList = $this->GetVoucherList(); $oMessageManager = TCMSMessageManager::GetInstance(); if ($oVoucherList) { if ($oVoucherList->Length() > 0) { $oVoucherList->GoToStart(); while ($oBasketVoucher = $oVoucherList->Next()) { $sVoucherCode = $oBasketVoucher->fieldCode; $sBasketVoucherKey = $oBasketVoucher->sBasketVoucherKey; $sBasketVoucherSeriesId = $oBasketVoucher->fieldShopVoucherSeriesId; $oVoucher = TdbShopVoucher::GetNewInstance(); $bVoucherLoaded = $oVoucher->Load($oBasketVoucher->id); if (($bVoucherLoaded && $oVoucher->fieldIsUsedUp) || !$bVoucherLoaded) { $oNextAvailableVoucher = $this->GetNextAvailableVoucher($sVoucherCode, $sBasketVoucherSeriesId, $sMessageConsumer); /** * next voucher with same code is available, so auto add that one. * as we do not want to inform the customer that this happened, * we create a temporary message consumer for RemoveVoucher and AddVoucher messages and clear them afterwards. */ if (!is_null($oNextAvailableVoucher)) { $this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer.'-TO-BE-REMOVED'); $this->AddVoucher($oNextAvailableVoucher, $sMessageConsumer.'-TO-BE-REMOVED'); $oMessageManager->ClearMessages($sMessageConsumer.'-TO-BE-REMOVED'); } else { $this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer); $bBasketVoucherAvailable = false; $this->bMarkAsRecalculationNeeded = true; $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-VOUCHER-NOT-LONGER-AVAILABLE', array('sVoucherCode' => $sVoucherCode)); } } } } } return $bBasketVoucherAvailable; }
php
protected function CheckBasketVoucherAvailable($sMessageConsumer) { $bBasketVoucherAvailable = true; $oVoucherList = $this->GetVoucherList(); $oMessageManager = TCMSMessageManager::GetInstance(); if ($oVoucherList) { if ($oVoucherList->Length() > 0) { $oVoucherList->GoToStart(); while ($oBasketVoucher = $oVoucherList->Next()) { $sVoucherCode = $oBasketVoucher->fieldCode; $sBasketVoucherKey = $oBasketVoucher->sBasketVoucherKey; $sBasketVoucherSeriesId = $oBasketVoucher->fieldShopVoucherSeriesId; $oVoucher = TdbShopVoucher::GetNewInstance(); $bVoucherLoaded = $oVoucher->Load($oBasketVoucher->id); if (($bVoucherLoaded && $oVoucher->fieldIsUsedUp) || !$bVoucherLoaded) { $oNextAvailableVoucher = $this->GetNextAvailableVoucher($sVoucherCode, $sBasketVoucherSeriesId, $sMessageConsumer); /** * next voucher with same code is available, so auto add that one. * as we do not want to inform the customer that this happened, * we create a temporary message consumer for RemoveVoucher and AddVoucher messages and clear them afterwards. */ if (!is_null($oNextAvailableVoucher)) { $this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer.'-TO-BE-REMOVED'); $this->AddVoucher($oNextAvailableVoucher, $sMessageConsumer.'-TO-BE-REMOVED'); $oMessageManager->ClearMessages($sMessageConsumer.'-TO-BE-REMOVED'); } else { $this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer); $bBasketVoucherAvailable = false; $this->bMarkAsRecalculationNeeded = true; $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-VOUCHER-NOT-LONGER-AVAILABLE', array('sVoucherCode' => $sVoucherCode)); } } } } } return $bBasketVoucherAvailable; }
[ "protected", "function", "CheckBasketVoucherAvailable", "(", "$", "sMessageConsumer", ")", "{", "$", "bBasketVoucherAvailable", "=", "true", ";", "$", "oVoucherList", "=", "$", "this", "->", "GetVoucherList", "(", ")", ";", "$", "oMessageManager", "=", "TCMSMessag...
Check all vouchers in basket and check if voucher was not in use by other order. If one voucher was used in other order try to get another one with in the same series and voucher code. @param string $sMessageConsumer @return bool
[ "Check", "all", "vouchers", "in", "basket", "and", "check", "if", "voucher", "was", "not", "in", "use", "by", "other", "order", ".", "If", "one", "voucher", "was", "used", "in", "other", "order", "try", "to", "get", "another", "one", "with", "in", "the...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1839-L1878
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.GetNextAvailableVoucher
protected function GetNextAvailableVoucher($sVoucherCode, $sSeriesId, $sMessageConsumer) { $oNextAvailableVoucher = null; $oVoucher = TdbShopVoucher::GetNewInstance(); if ($oVoucher->LoadFromFields(array('code' => $sVoucherCode, 'is_used_up' => '0', 'shop_voucher_series_id' => $sSeriesId))) { $oNextAvailableVoucher = $oVoucher; } return $oNextAvailableVoucher; }
php
protected function GetNextAvailableVoucher($sVoucherCode, $sSeriesId, $sMessageConsumer) { $oNextAvailableVoucher = null; $oVoucher = TdbShopVoucher::GetNewInstance(); if ($oVoucher->LoadFromFields(array('code' => $sVoucherCode, 'is_used_up' => '0', 'shop_voucher_series_id' => $sSeriesId))) { $oNextAvailableVoucher = $oVoucher; } return $oNextAvailableVoucher; }
[ "protected", "function", "GetNextAvailableVoucher", "(", "$", "sVoucherCode", ",", "$", "sSeriesId", ",", "$", "sMessageConsumer", ")", "{", "$", "oNextAvailableVoucher", "=", "null", ";", "$", "oVoucher", "=", "TdbShopVoucher", "::", "GetNewInstance", "(", ")", ...
Get next available voucher for whith given vocuehr code and series id. Was used after deleting vouchers used in other order. @param string $sVoucherCode @param string $sSeriesId @param string $sMessageConsumer @return TdbShopVoucher
[ "Get", "next", "available", "voucher", "for", "whith", "given", "vocuehr", "code", "and", "series", "id", ".", "Was", "used", "after", "deleting", "vouchers", "used", "in", "other", "order", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1890-L1899
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.OnBasketItemUpdateEvent
public function OnBasketItemUpdateEvent($oBasketItemChanged) { $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this, $oBasketItemChanged ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_UPDATE_ITEM, $event); }
php
public function OnBasketItemUpdateEvent($oBasketItemChanged) { $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this, $oBasketItemChanged ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_UPDATE_ITEM, $event); }
[ "public", "function", "OnBasketItemUpdateEvent", "(", "$", "oBasketItemChanged", ")", "{", "$", "event", "=", "new", "\\", "ChameleonSystem", "\\", "ShopBundle", "\\", "objects", "\\", "TShopBasket", "\\", "BasketItemEvent", "(", "TdbDataExtranetUser", "::", "GetIns...
the hook is triggered when the basket item list contained in the basket changed an article. @param TShopBasketArticle $oBasketItemChanged
[ "the", "hook", "is", "triggered", "when", "the", "basket", "item", "list", "contained", "in", "the", "basket", "changed", "an", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1939-L1947
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
TShopBasketCore.OnBasketItemDeleteEvent
public function OnBasketItemDeleteEvent($oBasketItemRemoved) { $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this, $oBasketItemRemoved ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_DELETE_ITEM, $event); }
php
public function OnBasketItemDeleteEvent($oBasketItemRemoved) { $event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent( TdbDataExtranetUser::GetInstance(), $this, $oBasketItemRemoved ); $this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_DELETE_ITEM, $event); }
[ "public", "function", "OnBasketItemDeleteEvent", "(", "$", "oBasketItemRemoved", ")", "{", "$", "event", "=", "new", "\\", "ChameleonSystem", "\\", "ShopBundle", "\\", "objects", "\\", "TShopBasket", "\\", "BasketItemEvent", "(", "TdbDataExtranetUser", "::", "GetIns...
the hook is triggered when the basket item list contained in the basket deletes an article. @param TShopBasketArticle $oBasketItemRemoved
[ "the", "hook", "is", "triggered", "when", "the", "basket", "item", "list", "contained", "in", "the", "basket", "deletes", "an", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1954-L1962
train
chameleon-system/chameleon-shop
src/ShopBundle/mappers/order/TPkgShopMapper_OrderUserData.class.php
TPkgShopMapper_OrderUserData.getAddress
protected function getAddress(TdbShopOrder $oOrder, $iAddressType, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled) { $aAddress = array(); if (self::ADDRESS_TYPE_BILLING === $iAddressType) { $oSalutation = $oOrder->GetFieldAdrBillingSalutation(); if ($oSalutation && $bCachingEnabled) { $oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id); } $aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : (''); $aAddress['sFirstName'] = $oOrder->fieldAdrBillingFirstname; $aAddress['sLastName'] = $oOrder->fieldAdrBillingLastname; $aAddress['sAdditionalInfo'] = $oOrder->fieldAdrBillingAdditionalInfo; $aAddress['sAddressStreet'] = $oOrder->fieldAdrBillingStreet; $aAddress['sAddressStreetNr'] = $oOrder->fieldAdrBillingStreetnr; $aAddress['sAddressZip'] = $oOrder->fieldAdrBillingPostalcode; $aAddress['sAddressCity'] = $oOrder->fieldAdrBillingCity; $aAddress['sAddressTelephone'] = $oOrder->fieldAdrBillingTelefon; $aAddress['sAddressFax'] = $oOrder->fieldAdrBillingFax; $oCountry = $oOrder->GetFieldAdrBillingCountry(); if (null !== $oCountry) { if ($bCachingEnabled) { $oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id); } $aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : (''); } } elseif (self::ADDRESS_TYPE_SHIPPING === $iAddressType) { $oSalutation = $oOrder->GetFieldAdrShippingSalutation(); if ($oSalutation && $bCachingEnabled) { $oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id); } $aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : (''); $aAddress['sFirstName'] = $oOrder->fieldAdrShippingFirstname; $aAddress['sLastName'] = $oOrder->fieldAdrShippingLastname; $aAddress['sAdditionalInfo'] = $oOrder->fieldAdrShippingAdditionalInfo; $aAddress['sAddressStreet'] = $oOrder->fieldAdrShippingStreet; $aAddress['sAddressStreetNr'] = $oOrder->fieldAdrShippingStreetnr; $aAddress['sAddressZip'] = $oOrder->fieldAdrShippingPostalcode; $aAddress['sAddressCity'] = $oOrder->fieldAdrShippingCity; $aAddress['sAddressTelephone'] = $oOrder->fieldAdrShippingTelefon; $aAddress['sAddressFax'] = $oOrder->fieldAdrShippingFax; $oCountry = $oOrder->GetFieldAdrShippingCountry(); if (null !== $oCountry) { if ($bCachingEnabled) { $oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id); } $aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : (''); } } return $aAddress; }
php
protected function getAddress(TdbShopOrder $oOrder, $iAddressType, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled) { $aAddress = array(); if (self::ADDRESS_TYPE_BILLING === $iAddressType) { $oSalutation = $oOrder->GetFieldAdrBillingSalutation(); if ($oSalutation && $bCachingEnabled) { $oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id); } $aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : (''); $aAddress['sFirstName'] = $oOrder->fieldAdrBillingFirstname; $aAddress['sLastName'] = $oOrder->fieldAdrBillingLastname; $aAddress['sAdditionalInfo'] = $oOrder->fieldAdrBillingAdditionalInfo; $aAddress['sAddressStreet'] = $oOrder->fieldAdrBillingStreet; $aAddress['sAddressStreetNr'] = $oOrder->fieldAdrBillingStreetnr; $aAddress['sAddressZip'] = $oOrder->fieldAdrBillingPostalcode; $aAddress['sAddressCity'] = $oOrder->fieldAdrBillingCity; $aAddress['sAddressTelephone'] = $oOrder->fieldAdrBillingTelefon; $aAddress['sAddressFax'] = $oOrder->fieldAdrBillingFax; $oCountry = $oOrder->GetFieldAdrBillingCountry(); if (null !== $oCountry) { if ($bCachingEnabled) { $oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id); } $aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : (''); } } elseif (self::ADDRESS_TYPE_SHIPPING === $iAddressType) { $oSalutation = $oOrder->GetFieldAdrShippingSalutation(); if ($oSalutation && $bCachingEnabled) { $oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id); } $aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : (''); $aAddress['sFirstName'] = $oOrder->fieldAdrShippingFirstname; $aAddress['sLastName'] = $oOrder->fieldAdrShippingLastname; $aAddress['sAdditionalInfo'] = $oOrder->fieldAdrShippingAdditionalInfo; $aAddress['sAddressStreet'] = $oOrder->fieldAdrShippingStreet; $aAddress['sAddressStreetNr'] = $oOrder->fieldAdrShippingStreetnr; $aAddress['sAddressZip'] = $oOrder->fieldAdrShippingPostalcode; $aAddress['sAddressCity'] = $oOrder->fieldAdrShippingCity; $aAddress['sAddressTelephone'] = $oOrder->fieldAdrShippingTelefon; $aAddress['sAddressFax'] = $oOrder->fieldAdrShippingFax; $oCountry = $oOrder->GetFieldAdrShippingCountry(); if (null !== $oCountry) { if ($bCachingEnabled) { $oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id); } $aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : (''); } } return $aAddress; }
[ "protected", "function", "getAddress", "(", "TdbShopOrder", "$", "oOrder", ",", "$", "iAddressType", ",", "IMapperCacheTriggerRestricted", "$", "oCacheTriggerManager", ",", "$", "bCachingEnabled", ")", "{", "$", "aAddress", "=", "array", "(", ")", ";", "if", "("...
get the value map for one address type can be defined by using the class constants. @param TdbShopOrder $oOrder @param int $iAddressType use constants of the class to define the type to be fetched from @return array
[ "get", "the", "value", "map", "for", "one", "address", "type", "can", "be", "defined", "by", "using", "the", "class", "constants", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/order/TPkgShopMapper_OrderUserData.class.php#L52-L107
train
PGB-LIV/php-ms
src/Search/MsgfPlusSearch.php
MsgfPlusSearch.search
public function search(SearchParametersInterface $parameters) { if (! is_a($parameters, 'pgb_liv\php_ms\Search\Parameters\MsgfPlusSearchParameters')) { throw new \InvalidArgumentException('Argument 1 expected to be of type MsgfPlusSearchParameters'); } if (is_null($parameters->getSpectraPath()) || ! file_exists($parameters->getSpectraPath())) { throw new \InvalidArgumentException('Valid Spectra file must be specified in paramaters.'); } if (is_null($parameters->getDatabases()) || ! file_exists($parameters->getDatabases())) { throw new \InvalidArgumentException('Valid database file must be specified in paramaters.'); } $command = $this->getCommand($parameters); $this->executeCommand($command); if (! is_null($parameters->getOutputFile())) { return $parameters->getOutputFile(); } else { $extensionPos = strrpos($parameters->getSpectraPath(), '.'); return substr($parameters->getSpectraPath(), 0, $extensionPos) . '.mzid'; } }
php
public function search(SearchParametersInterface $parameters) { if (! is_a($parameters, 'pgb_liv\php_ms\Search\Parameters\MsgfPlusSearchParameters')) { throw new \InvalidArgumentException('Argument 1 expected to be of type MsgfPlusSearchParameters'); } if (is_null($parameters->getSpectraPath()) || ! file_exists($parameters->getSpectraPath())) { throw new \InvalidArgumentException('Valid Spectra file must be specified in paramaters.'); } if (is_null($parameters->getDatabases()) || ! file_exists($parameters->getDatabases())) { throw new \InvalidArgumentException('Valid database file must be specified in paramaters.'); } $command = $this->getCommand($parameters); $this->executeCommand($command); if (! is_null($parameters->getOutputFile())) { return $parameters->getOutputFile(); } else { $extensionPos = strrpos($parameters->getSpectraPath(), '.'); return substr($parameters->getSpectraPath(), 0, $extensionPos) . '.mzid'; } }
[ "public", "function", "search", "(", "SearchParametersInterface", "$", "parameters", ")", "{", "if", "(", "!", "is_a", "(", "$", "parameters", ",", "'pgb_liv\\php_ms\\Search\\Parameters\\MsgfPlusSearchParameters'", ")", ")", "{", "throw", "new", "\\", "InvalidArgument...
Perform the MS-GF+ search using the specified parameters. Any paramaters not specified will use the MS-GF+ defaults. @param SearchParametersInterface $parameters Paramaters object for any arguments to send to MS-GF+ @throws \InvalidArgumentException Thrown if any of the required properties are missing @return string Path to the results file
[ "Perform", "the", "MS", "-", "GF", "+", "search", "using", "the", "specified", "parameters", ".", "Any", "paramaters", "not", "specified", "will", "use", "the", "MS", "-", "GF", "+", "defaults", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/MsgfPlusSearch.php#L58-L82
train
PGB-LIV/php-ms
src/Search/MsgfPlusSearch.php
MsgfPlusSearch.executeCommand
private function executeCommand($command) { $stdoutPath = tempnam(sys_get_temp_dir(), 'php-msMsgfOut'); $stderrPath = tempnam(sys_get_temp_dir(), 'php-msMsGfErr'); $descriptors = array( 0 => array( 'pipe', 'r' ), 1 => array( 'file', $stdoutPath, 'a' ), 2 => array( 'file', $stderrPath, 'a' ) ); $process = proc_open($command, $descriptors, $pipes); proc_close($process); if (filesize($stderrPath) > 0) { throw new \InvalidArgumentException(file_get_contents($stderrPath)); } return $stdoutPath; }
php
private function executeCommand($command) { $stdoutPath = tempnam(sys_get_temp_dir(), 'php-msMsgfOut'); $stderrPath = tempnam(sys_get_temp_dir(), 'php-msMsGfErr'); $descriptors = array( 0 => array( 'pipe', 'r' ), 1 => array( 'file', $stdoutPath, 'a' ), 2 => array( 'file', $stderrPath, 'a' ) ); $process = proc_open($command, $descriptors, $pipes); proc_close($process); if (filesize($stderrPath) > 0) { throw new \InvalidArgumentException(file_get_contents($stderrPath)); } return $stdoutPath; }
[ "private", "function", "executeCommand", "(", "$", "command", ")", "{", "$", "stdoutPath", "=", "tempnam", "(", "sys_get_temp_dir", "(", ")", ",", "'php-msMsgfOut'", ")", ";", "$", "stderrPath", "=", "tempnam", "(", "sys_get_temp_dir", "(", ")", ",", "'php-m...
Executes the MSGF+ Command. @param string $command Complete command line argument to execute @throws \InvalidArgumentException Thrown if MS-GF+ writes anything to stderr @return string Path to MS-GF+ stdout log file
[ "Executes", "the", "MSGF", "+", "Command", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/MsgfPlusSearch.php#L145-L175
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php
SimpleCheckoutExampleCLI._waitUntilAuthorizationProcessingIsCompleted
private function _waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId) { $response = $this->callStepAndCheckForException( 'waitUntilAuthorizationProcessingIsCompleted', array($amazonAuthorizationId) ); printGetAuthorizationDetailsResponse($response); validateThatAuthorizationIsOpen($response); }
php
private function _waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId) { $response = $this->callStepAndCheckForException( 'waitUntilAuthorizationProcessingIsCompleted', array($amazonAuthorizationId) ); printGetAuthorizationDetailsResponse($response); validateThatAuthorizationIsOpen($response); }
[ "private", "function", "_waitUntilAuthorizationProcessingIsCompleted", "(", "$", "amazonAuthorizationId", ")", "{", "$", "response", "=", "$", "this", "->", "callStepAndCheckForException", "(", "'waitUntilAuthorizationProcessingIsCompleted'", ",", "array", "(", "$", "amazon...
Poll the API for the status of the Authorization Request, and continue once the status has been updated Throw an error if the status is not equal to Open @param string $amazonAuthorizationId authorization transaction to query
[ "Poll", "the", "API", "for", "the", "status", "of", "the", "Authorization", "Request", "and", "continue", "once", "the", "status", "has", "been", "updated", "Throw", "an", "error", "if", "the", "status", "is", "not", "equal", "to", "Open" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L164-L173
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php
SimpleCheckoutExampleCLI._getPreTaxAndShippingOrderAmountFromStdIn
private function _getPreTaxAndShippingOrderAmountFromStdIn() { print PHP_EOL . "-------------------------------------------" . PHP_EOL; print "Enter the pre tax amount to charge for the order" . "as a number (to 2 decimal places): "; do { $orderAmount = trim(fgets(STDIN)); } while (!is_numeric($orderAmount)); return $orderAmount; }
php
private function _getPreTaxAndShippingOrderAmountFromStdIn() { print PHP_EOL . "-------------------------------------------" . PHP_EOL; print "Enter the pre tax amount to charge for the order" . "as a number (to 2 decimal places): "; do { $orderAmount = trim(fgets(STDIN)); } while (!is_numeric($orderAmount)); return $orderAmount; }
[ "private", "function", "_getPreTaxAndShippingOrderAmountFromStdIn", "(", ")", "{", "print", "PHP_EOL", ".", "\"-------------------------------------------\"", ".", "PHP_EOL", ";", "print", "\"Enter the pre tax amount to charge for the order\"", ".", "\"as a number (to 2 decimal place...
Capture the pre tax order amount from standard input, making sure that it is a numeric string @return string total amount of the order before tax and shipping charges
[ "Capture", "the", "pre", "tax", "order", "amount", "from", "standard", "input", "making", "sure", "that", "it", "is", "a", "numeric", "string" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L213-L223
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php
SimpleCheckoutExampleCLI._getShippingTypeFromStdIn
private function _getShippingTypeFromStdIn() { print PHP_EOL . "Select a shipping option for the order:" . PHP_EOL; print "\t 1 - Overnight shipping" . PHP_EOL; print "\t 2 - 2-day shipping" . PHP_EOL; print "\t 3 - 5-day shipping" . PHP_EOL; print ">>"; do { $shippingType = trim(fgets(STDIN)); } while (!is_numeric($shippingType) and ($shippingType < 1 or $shippingType > 3)); return $shippingType - 1; }
php
private function _getShippingTypeFromStdIn() { print PHP_EOL . "Select a shipping option for the order:" . PHP_EOL; print "\t 1 - Overnight shipping" . PHP_EOL; print "\t 2 - 2-day shipping" . PHP_EOL; print "\t 3 - 5-day shipping" . PHP_EOL; print ">>"; do { $shippingType = trim(fgets(STDIN)); } while (!is_numeric($shippingType) and ($shippingType < 1 or $shippingType > 3)); return $shippingType - 1; }
[ "private", "function", "_getShippingTypeFromStdIn", "(", ")", "{", "print", "PHP_EOL", ".", "\"Select a shipping option for the order:\"", ".", "PHP_EOL", ";", "print", "\"\\t 1 - Overnight shipping\"", ".", "PHP_EOL", ";", "print", "\"\\t 2 - 2-day shipping\"", ".", "PHP_E...
Capture the shipping type for this order, which determines the shipping charge @return number selected shipping type index
[ "Capture", "the", "shipping", "type", "for", "this", "order", "which", "determines", "the", "shipping", "charge" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L231-L245
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExampleCLI.php
SplitShipmentsCheckoutExampleCLI._performAuthAndCaptureForOrderShipment
private function _performAuthAndCaptureForOrderShipment($shipmentNumber) { $response = $amazonAuthorizationId = $this->_performAuthorizationForShipment($shipmentNumber); $this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId); $this->_performCaptureForShipment($shipmentNumber, $amazonAuthorizationId); }
php
private function _performAuthAndCaptureForOrderShipment($shipmentNumber) { $response = $amazonAuthorizationId = $this->_performAuthorizationForShipment($shipmentNumber); $this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId); $this->_performCaptureForShipment($shipmentNumber, $amazonAuthorizationId); }
[ "private", "function", "_performAuthAndCaptureForOrderShipment", "(", "$", "shipmentNumber", ")", "{", "$", "response", "=", "$", "amazonAuthorizationId", "=", "$", "this", "->", "_performAuthorizationForShipment", "(", "$", "shipmentNumber", ")", ";", "$", "this", ...
Perform the authorize and capture for a single shipment in the order @param int $shipmentNumber the shipment to perform transactions on
[ "Perform", "the", "authorize", "and", "capture", "for", "a", "single", "shipment", "in", "the", "order" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExampleCLI.php#L180-L185
train
chameleon-system/chameleon-shop
src/ShopCurrencyBundle/Bridge/Chameleon/Objects/CurrencyBasket.php
CurrencyBasket.SetActivePaymentMethod
public function SetActivePaymentMethod($oShopPayment) { $oldActivePaymentMethod = $this->GetActivePaymentMethod(); $isPaymentSet = parent::SetActivePaymentMethod($oShopPayment); $newActivePaymentMethod = $this->GetActivePaymentMethod(); if (null === $oldActivePaymentMethod || null === $newActivePaymentMethod) { return $isPaymentSet; } if (false === $oldActivePaymentMethod->IsSameAs($newActivePaymentMethod)) { return $isPaymentSet; } $activeCurrency = $this->getCurrencyService()->getObject(); if (null === $newActivePaymentMethod->fieldValueOriginal && true == $activeCurrency->fieldIsBaseCurrency) { return $isPaymentSet; } if (null !== $newActivePaymentMethod->fieldValueOriginal) { $convertedValue = \TdbPkgShopCurrency::ConvertToActiveCurrency($newActivePaymentMethod->fieldValueOriginal); if ($convertedValue === $newActivePaymentMethod->GetPrice()) { return $isPaymentSet; } } $reloadedPayment = \TdbShopPaymentMethod::GetNewInstance($newActivePaymentMethod->id); parent::SetActivePaymentMethod($reloadedPayment); return $isPaymentSet; }
php
public function SetActivePaymentMethod($oShopPayment) { $oldActivePaymentMethod = $this->GetActivePaymentMethod(); $isPaymentSet = parent::SetActivePaymentMethod($oShopPayment); $newActivePaymentMethod = $this->GetActivePaymentMethod(); if (null === $oldActivePaymentMethod || null === $newActivePaymentMethod) { return $isPaymentSet; } if (false === $oldActivePaymentMethod->IsSameAs($newActivePaymentMethod)) { return $isPaymentSet; } $activeCurrency = $this->getCurrencyService()->getObject(); if (null === $newActivePaymentMethod->fieldValueOriginal && true == $activeCurrency->fieldIsBaseCurrency) { return $isPaymentSet; } if (null !== $newActivePaymentMethod->fieldValueOriginal) { $convertedValue = \TdbPkgShopCurrency::ConvertToActiveCurrency($newActivePaymentMethod->fieldValueOriginal); if ($convertedValue === $newActivePaymentMethod->GetPrice()) { return $isPaymentSet; } } $reloadedPayment = \TdbShopPaymentMethod::GetNewInstance($newActivePaymentMethod->id); parent::SetActivePaymentMethod($reloadedPayment); return $isPaymentSet; }
[ "public", "function", "SetActivePaymentMethod", "(", "$", "oShopPayment", ")", "{", "$", "oldActivePaymentMethod", "=", "$", "this", "->", "GetActivePaymentMethod", "(", ")", ";", "$", "isPaymentSet", "=", "parent", "::", "SetActivePaymentMethod", "(", "$", "oShop...
Reloads the active payment method on currency change, so that the payment method holds the payment charges in the correct currency. {@inheritdoc}
[ "Reloads", "the", "active", "payment", "method", "on", "currency", "change", "so", "that", "the", "payment", "method", "holds", "the", "payment", "charges", "in", "the", "correct", "currency", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/Bridge/Chameleon/Objects/CurrencyBasket.php#L25-L53
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStepList.class.php
TShopOrderStepList.GetNavigationStepList
public static function GetNavigationStepList(TdbShopOrderStep $oActiveStep) { $query = "SELECT * FROM `shop_order_step` WHERE `show_in_navigation` = '1' ORDER BY `position` ASC "; $oSteps = &TdbShopOrderStepList::GetList($query); $oSteps->bAllowItemCache = true; $stepIdList = array(); while ($oStep = &$oSteps->Next()) { if (false === $oStep->IsActive()) { continue; } $stepIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oStep->id); if ($oActiveStep->id == $oStep->id) { $oStep->bIsTheActiveStep = true; } else { $oStep->bIsTheActiveStep = false; } } $query = "SELECT * FROM `shop_order_step` WHERE `show_in_navigation` = '1' AND `id` IN ('".implode("','", $stepIdList)."') ORDER BY `position` ASC "; $oSteps = &TdbShopOrderStepList::GetList($query); $oSteps->bAllowItemCache = true; while ($oStep = &$oSteps->Next()) { $stepIdList[] = $oStep->id; if ($oActiveStep->id == $oStep->id) { $oStep->bIsTheActiveStep = true; } else { $oStep->bIsTheActiveStep = false; } } $oSteps->GoToStart(); return $oSteps; }
php
public static function GetNavigationStepList(TdbShopOrderStep $oActiveStep) { $query = "SELECT * FROM `shop_order_step` WHERE `show_in_navigation` = '1' ORDER BY `position` ASC "; $oSteps = &TdbShopOrderStepList::GetList($query); $oSteps->bAllowItemCache = true; $stepIdList = array(); while ($oStep = &$oSteps->Next()) { if (false === $oStep->IsActive()) { continue; } $stepIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oStep->id); if ($oActiveStep->id == $oStep->id) { $oStep->bIsTheActiveStep = true; } else { $oStep->bIsTheActiveStep = false; } } $query = "SELECT * FROM `shop_order_step` WHERE `show_in_navigation` = '1' AND `id` IN ('".implode("','", $stepIdList)."') ORDER BY `position` ASC "; $oSteps = &TdbShopOrderStepList::GetList($query); $oSteps->bAllowItemCache = true; while ($oStep = &$oSteps->Next()) { $stepIdList[] = $oStep->id; if ($oActiveStep->id == $oStep->id) { $oStep->bIsTheActiveStep = true; } else { $oStep->bIsTheActiveStep = false; } } $oSteps->GoToStart(); return $oSteps; }
[ "public", "static", "function", "GetNavigationStepList", "(", "TdbShopOrderStep", "$", "oActiveStep", ")", "{", "$", "query", "=", "\"SELECT *\n FROM `shop_order_step`\n WHERE `show_in_navigation` = '1'\n ORDER BY `position` ASC\n \""...
returns all navi steps marked as navi steps. the active step will be marked as "is active". @param TdbShopOrderStep $oActiveStep @return TdbShopOrderStepList
[ "returns", "all", "navi", "steps", "marked", "as", "navi", "steps", ".", "the", "active", "step", "will", "be", "marked", "as", "is", "active", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStepList.class.php#L73-L114
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Action/CreateEntityAction.php
CreateEntityAction.run
public function run(): void { $this->entityCreator->createTargetFileObject($this->entityFqn)->write(); $this->abstractEntityFactoryCreator->createTargetFileObject()->writeIfNotExists(); $this->entityFactoryCreator->createTargetFileObject()->write(); $this->entityInterfaceCreator->createTargetFileObject()->write(); $this->abstractEntityRepositoryCreator->createTargetFileObject()->writeIfNotExists(); $this->entityRepositoryCreator->createTargetFileObject()->write(); if (true === $this->generateSaver) { $this->entitySaverCreator->createTargetFileObject()->write(); } $this->entityFixtureCreator->createTargetFileObject()->write(); $this->abstractEntityTestCreator->createTargetFileObject()->writeIfNotExists(); $this->bootstrapCreator->createTargetFileObject()->writeIfNotExists(); $this->entityTestCreator->createTargetFileObject()->write(); $this->dataTransferObjectCreator->createTargetFileObject()->write(); $this->entityDtoFactoryCreator->createTargetFileObject()->write(); $this->entityUpserterCreator->createTargetFileObject()->write(); $this->entityUnitOfWorkHelperCreator->createTargetFileObject()->write(); }
php
public function run(): void { $this->entityCreator->createTargetFileObject($this->entityFqn)->write(); $this->abstractEntityFactoryCreator->createTargetFileObject()->writeIfNotExists(); $this->entityFactoryCreator->createTargetFileObject()->write(); $this->entityInterfaceCreator->createTargetFileObject()->write(); $this->abstractEntityRepositoryCreator->createTargetFileObject()->writeIfNotExists(); $this->entityRepositoryCreator->createTargetFileObject()->write(); if (true === $this->generateSaver) { $this->entitySaverCreator->createTargetFileObject()->write(); } $this->entityFixtureCreator->createTargetFileObject()->write(); $this->abstractEntityTestCreator->createTargetFileObject()->writeIfNotExists(); $this->bootstrapCreator->createTargetFileObject()->writeIfNotExists(); $this->entityTestCreator->createTargetFileObject()->write(); $this->dataTransferObjectCreator->createTargetFileObject()->write(); $this->entityDtoFactoryCreator->createTargetFileObject()->write(); $this->entityUpserterCreator->createTargetFileObject()->write(); $this->entityUnitOfWorkHelperCreator->createTargetFileObject()->write(); }
[ "public", "function", "run", "(", ")", ":", "void", "{", "$", "this", "->", "entityCreator", "->", "createTargetFileObject", "(", "$", "this", "->", "entityFqn", ")", "->", "write", "(", ")", ";", "$", "this", "->", "abstractEntityFactoryCreator", "->", "c...
Create all the Entity related code @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
[ "Create", "all", "the", "Entity", "related", "code" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Action/CreateEntityAction.php#L182-L215
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/RefundResult.php
RefundResult._waitUntilRefundProcessingIsCompleted
private function _waitUntilRefundProcessingIsCompleted($amazonRefundId) { // Check for the presence of the ipn notification $this->waitForNotificationToBeProcessedBeforeContinuing( $amazonRefundId, "RefundNotification" ); // Notification is present, go and get the full // information for this notification $response = $this->callStepAndCheckForException( 'getRefundDetails', array($amazonRefundId) ); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); echo $this->printResponseToWebpage( "printGetRefundDetailsResponse", array($response) ); }
php
private function _waitUntilRefundProcessingIsCompleted($amazonRefundId) { // Check for the presence of the ipn notification $this->waitForNotificationToBeProcessedBeforeContinuing( $amazonRefundId, "RefundNotification" ); // Notification is present, go and get the full // information for this notification $response = $this->callStepAndCheckForException( 'getRefundDetails', array($amazonRefundId) ); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); echo $this->printResponseToWebpage( "printGetRefundDetailsResponse", array($response) ); }
[ "private", "function", "_waitUntilRefundProcessingIsCompleted", "(", "$", "amazonRefundId", ")", "{", "// Check for the presence of the ipn notification", "$", "this", "->", "waitForNotificationToBeProcessedBeforeContinuing", "(", "$", "amazonRefundId", ",", "\"RefundNotification\"...
Check that we have received an IPN notification for the refund For PHP, there is an IPN handler that will write the contents of the IPN to a file in the format of <amazonReferenceId>_RefundNotification.txt This method will check for the presence of this file and will loop/timeout until the notification has been handled. Merchants can use alternative approaches such as memory caches, shared memory or database storage so that scripts serving user pages are able to check on the status of a notification @param string $amazonRefundId refund transaction to query @return void
[ "Check", "that", "we", "have", "received", "an", "IPN", "notification", "for", "the", "refund" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/RefundResult.php#L138-L156
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/AutomaticPaymentsSimpleCheckoutResult.php
AutomaticPaymentsSimpleCheckoutResult._getAdditionalInformationForProcessedAuthorization
private function _getAdditionalInformationForProcessedAuthorization ($amazonAuthorizationId) { // Notification is present, go and get the full // information for this notification $response = $this->callStepAndCheckForException('getAuthorizationDetails', array( $amazonAuthorizationId )); $this->printResponseToWebpage("printGetAuthorizationDetailsResponse", array( $response )); validateThatAuthorizationIsOpen($response); }
php
private function _getAdditionalInformationForProcessedAuthorization ($amazonAuthorizationId) { // Notification is present, go and get the full // information for this notification $response = $this->callStepAndCheckForException('getAuthorizationDetails', array( $amazonAuthorizationId )); $this->printResponseToWebpage("printGetAuthorizationDetailsResponse", array( $response )); validateThatAuthorizationIsOpen($response); }
[ "private", "function", "_getAdditionalInformationForProcessedAuthorization", "(", "$", "amazonAuthorizationId", ")", "{", "// Notification is present, go and get the full", "// information for this notification", "$", "response", "=", "$", "this", "->", "callStepAndCheckForException"...
Display additional information about a completed authorization Once an IPN has been received to notify the transition of an IPN to one of the terminal states, the merchant may optionally call GetAuthorizationDetails to obtain additional information about the authorization. In countries which require VAT invoicing, this approach will allow you to obtain the buyers billing address so that the invocing requirements can be met.
[ "Display", "additional", "information", "about", "a", "completed", "authorization" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/AutomaticPaymentsSimpleCheckoutResult.php#L230-L244
train
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/pkgShop/objects/db/TPkgShopPaymentIPN_TShopOrder.class.php
TPkgShopPaymentIPN_TShopOrder.hasIPNStatusCode
final public function hasIPNStatusCode($sStatusCode) { $oStatusCode = TdbPkgShopPaymentIpnMessage::getMessageForOrder($this, $sStatusCode); $bHasStatusCode = (null !== $oStatusCode); return $bHasStatusCode; }
php
final public function hasIPNStatusCode($sStatusCode) { $oStatusCode = TdbPkgShopPaymentIpnMessage::getMessageForOrder($this, $sStatusCode); $bHasStatusCode = (null !== $oStatusCode); return $bHasStatusCode; }
[ "final", "public", "function", "hasIPNStatusCode", "(", "$", "sStatusCode", ")", "{", "$", "oStatusCode", "=", "TdbPkgShopPaymentIpnMessage", "::", "getMessageForOrder", "(", "$", "this", ",", "$", "sStatusCode", ")", ";", "$", "bHasStatusCode", "=", "(", "null"...
returns true if the status code has been sent as an IPN for the order. @param $sStatusCode @return bool
[ "returns", "true", "if", "the", "status", "code", "has", "been", "sent", "as", "an", "IPN", "for", "the", "order", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/pkgShop/objects/db/TPkgShopPaymentIPN_TShopOrder.class.php#L21-L27
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php
TShopPaymentHandlerPayOne.PayOne3dSecure_3dScheck
protected function PayOne3dSecure_3dScheck() { $aResponse = array(); $aResponse['success'] = false; $oGlobal = TGlobal::instance(); $oBasket = TShopBasket::GetInstance(); // load data from POST $aUserPaymentData = $this->GetUserPaymentData(); // Save to session $_SESSION['PayOneResponse']['pseudocardpan'] = $aUserPaymentData['pseudocardpan']; $_SESSION['PayOneResponse']['truncatedcardpan'] = $aUserPaymentData['truncatedcardpan']; // create success URL $aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook')); $aExcludes = array_keys($aSuccessCall); $aExcludes[] = 'aShipping'; $aExcludes[] = 'orderstepmethod'; $aExcludes[] = 'aPayment'; $aExcludes[] = 'module_fnc'; $sSuccessURL = urldecode(str_replace('&amp;', '&', $this->getActivePageService()->getLinkToActivePageAbsolute($aSuccessCall, $aExcludes))); $sSuccessURL .= '&payrequest=3dsredirect'; // Init 3D-Secure params $frequest = new financegateRequest(); $fconnect = new financegateConnect(); $frequest->setRequest('3dscheck'); $frequest->setClearingType('cc'); $frequest->setPortalId($this->GetConfigParameter('portalid')); $frequest->setKey($this->GetConfigParameter('key')); $frequest->setMId($this->GetConfigParameter('mid')); $frequest->setAId($this->GetConfigParameter('aid')); $frequest->setMode($this->GetConfigParameter('mode')); $request = $this->getCurrentRequest(); $frequest->setIp(null === $request ? '' : $request->getClientIp()); $frequest->setExitUrl($sSuccessURL); $frequest->setAmount($oBasket->dCostTotal * 100); $frequest->setCurrency($this->GetCurrency()); $frequest->setLanguage($this->GetCurrentLanguageCode()); $frequest->setPseudocardpan($aUserPaymentData['pseudocardpan']); $fconnect->setApiUrl($this->GetConfigParameter('serverApiUrlPayOne')); $fresponse = $fconnect->processByRequest($frequest); //if(_ES_DEBUG) var_dump($fresponse); $sStatus = $fresponse->getStatus(); $aResponse['success'] = true; $aResponse['status'] = $sStatus; if ('ENROLLED' == $sStatus) { $this->ExecuteExternalPayOneCall($fresponse); // REDIRECT TO EXTERNAL SECURE-PIN-URL! } else { if ('VALID' == $sStatus) { // do nothing } else { $aResponse['success'] = false; $aResponse['status'] = $sStatus; $aResponse['errormessage'] = $fresponse->getErrorMessage(); $aResponse['errortext'] = $fresponse->getCustomerMessage(); //if(_ES_DEBUG) print_form($_REQUEST,$info); } } return $aResponse; }
php
protected function PayOne3dSecure_3dScheck() { $aResponse = array(); $aResponse['success'] = false; $oGlobal = TGlobal::instance(); $oBasket = TShopBasket::GetInstance(); // load data from POST $aUserPaymentData = $this->GetUserPaymentData(); // Save to session $_SESSION['PayOneResponse']['pseudocardpan'] = $aUserPaymentData['pseudocardpan']; $_SESSION['PayOneResponse']['truncatedcardpan'] = $aUserPaymentData['truncatedcardpan']; // create success URL $aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook')); $aExcludes = array_keys($aSuccessCall); $aExcludes[] = 'aShipping'; $aExcludes[] = 'orderstepmethod'; $aExcludes[] = 'aPayment'; $aExcludes[] = 'module_fnc'; $sSuccessURL = urldecode(str_replace('&amp;', '&', $this->getActivePageService()->getLinkToActivePageAbsolute($aSuccessCall, $aExcludes))); $sSuccessURL .= '&payrequest=3dsredirect'; // Init 3D-Secure params $frequest = new financegateRequest(); $fconnect = new financegateConnect(); $frequest->setRequest('3dscheck'); $frequest->setClearingType('cc'); $frequest->setPortalId($this->GetConfigParameter('portalid')); $frequest->setKey($this->GetConfigParameter('key')); $frequest->setMId($this->GetConfigParameter('mid')); $frequest->setAId($this->GetConfigParameter('aid')); $frequest->setMode($this->GetConfigParameter('mode')); $request = $this->getCurrentRequest(); $frequest->setIp(null === $request ? '' : $request->getClientIp()); $frequest->setExitUrl($sSuccessURL); $frequest->setAmount($oBasket->dCostTotal * 100); $frequest->setCurrency($this->GetCurrency()); $frequest->setLanguage($this->GetCurrentLanguageCode()); $frequest->setPseudocardpan($aUserPaymentData['pseudocardpan']); $fconnect->setApiUrl($this->GetConfigParameter('serverApiUrlPayOne')); $fresponse = $fconnect->processByRequest($frequest); //if(_ES_DEBUG) var_dump($fresponse); $sStatus = $fresponse->getStatus(); $aResponse['success'] = true; $aResponse['status'] = $sStatus; if ('ENROLLED' == $sStatus) { $this->ExecuteExternalPayOneCall($fresponse); // REDIRECT TO EXTERNAL SECURE-PIN-URL! } else { if ('VALID' == $sStatus) { // do nothing } else { $aResponse['success'] = false; $aResponse['status'] = $sStatus; $aResponse['errormessage'] = $fresponse->getErrorMessage(); $aResponse['errortext'] = $fresponse->getCustomerMessage(); //if(_ES_DEBUG) print_form($_REQUEST,$info); } } return $aResponse; }
[ "protected", "function", "PayOne3dSecure_3dScheck", "(", ")", "{", "$", "aResponse", "=", "array", "(", ")", ";", "$", "aResponse", "[", "'success'", "]", "=", "false", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oBasket",...
3D-Secure - 3dScheck. @return $response array
[ "3D", "-", "Secure", "-", "3dScheck", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php#L554-L626
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php
TShopPaymentHandlerPayOne.ExecuteExternalPayOneCall
protected function ExecuteExternalPayOneCall($fresponse) { $oShop = TShop::GetInstance(); $sRedirectURL = $oShop->GetLinkToSystemPage('PayOne3DSecureHelper'); // save 3D Secure Parameter in session to load it in the helper redirect page $_SESSION['PayOneRedirectParams']['AcsUrl'] = $fresponse->getAcsUrl(); $_SESSION['PayOneRedirectParams']['PaReq'] = $fresponse->getPaReq(); $_SESSION['PayOneRedirectParams']['TermUrl'] = $fresponse->getTermUrl(); $_SESSION['PayOneRedirectParams']['MD'] = $fresponse->getMd(); $this->getRedirect()->redirect($sRedirectURL); }
php
protected function ExecuteExternalPayOneCall($fresponse) { $oShop = TShop::GetInstance(); $sRedirectURL = $oShop->GetLinkToSystemPage('PayOne3DSecureHelper'); // save 3D Secure Parameter in session to load it in the helper redirect page $_SESSION['PayOneRedirectParams']['AcsUrl'] = $fresponse->getAcsUrl(); $_SESSION['PayOneRedirectParams']['PaReq'] = $fresponse->getPaReq(); $_SESSION['PayOneRedirectParams']['TermUrl'] = $fresponse->getTermUrl(); $_SESSION['PayOneRedirectParams']['MD'] = $fresponse->getMd(); $this->getRedirect()->redirect($sRedirectURL); }
[ "protected", "function", "ExecuteExternalPayOneCall", "(", "$", "fresponse", ")", "{", "$", "oShop", "=", "TShop", "::", "GetInstance", "(", ")", ";", "$", "sRedirectURL", "=", "$", "oShop", "->", "GetLinkToSystemPage", "(", "'PayOne3DSecureHelper'", ")", ";", ...
perform the API redirect to PayOne using Server-API. @return array $fresponse - params to handle request/redirect
[ "perform", "the", "API", "redirect", "to", "PayOne", "using", "Server", "-", "API", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php#L743-L755
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopStockMessage.class.php
TShopStockMessage.RenderShippingMessageFromTriggerForQuantity
protected function RenderShippingMessageFromTriggerForQuantity($aMessage = array()) { $sTriggerMessage = $aMessage['oTrigger']->fieldMessage; $sString = '<span class="'.$this->getCssClassForMessageForQuantity($aMessage).'">'. TGlobal::Translate( 'chameleon_system_shop.stock_message.different_shipping_time_applies', array( '%amount%' => $aMessage['amount'], '%shippingMessage%' => $sTriggerMessage, ) ).'</span>'; return $sString; }
php
protected function RenderShippingMessageFromTriggerForQuantity($aMessage = array()) { $sTriggerMessage = $aMessage['oTrigger']->fieldMessage; $sString = '<span class="'.$this->getCssClassForMessageForQuantity($aMessage).'">'. TGlobal::Translate( 'chameleon_system_shop.stock_message.different_shipping_time_applies', array( '%amount%' => $aMessage['amount'], '%shippingMessage%' => $sTriggerMessage, ) ).'</span>'; return $sString; }
[ "protected", "function", "RenderShippingMessageFromTriggerForQuantity", "(", "$", "aMessage", "=", "array", "(", ")", ")", "{", "$", "sTriggerMessage", "=", "$", "aMessage", "[", "'oTrigger'", "]", "->", "fieldMessage", ";", "$", "sString", "=", "'<span class=\"'"...
renders the trigger message. @param array $aMessage @return string
[ "renders", "the", "trigger", "message", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopStockMessage.class.php#L106-L119
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopStockMessage.class.php
TShopStockMessage.&
public function &GetFieldShopStockMessageTrigger() { $oShopStockMessageTrigger = $this->GetFromInternalCache('oActive_shop_stock_message_trigger_id'); if (is_null($oShopStockMessageTrigger)) { $sQuery = "SELECT * FROM `shop_stock_message_trigger` WHERE `shop_stock_message_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `amount` >= '".MySqlLegacySupport::getInstance()->real_escape_string($this->GetArticle()->getAvailableStock())."' ORDER BY `amount` ASC LIMIT 1 "; $oShopStockMessageTrigger = TdbShopStockMessageTrigger::GetNewInstance(); /** @var $oShopStockMessageTrigger TdbShopStockMessageTrigger */ $oTmp = MySqlLegacySupport::getInstance()->fetch_object(MySqlLegacySupport::getInstance()->query($sQuery)); //if (!$oShopStockMessageTrigger->LoadFromRow(MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery)))) $oShopStockMessageTrigger = null; if (is_object($oTmp)) { if (!$oShopStockMessageTrigger->LoadFromField('id', $oTmp->id)) { $oShopStockMessageTrigger = null; } } else { $oShopStockMessageTrigger = null; } $this->SetInternalCache('oActive_shop_stock_message_trigger_id', $oShopStockMessageTrigger); } return $oShopStockMessageTrigger; }
php
public function &GetFieldShopStockMessageTrigger() { $oShopStockMessageTrigger = $this->GetFromInternalCache('oActive_shop_stock_message_trigger_id'); if (is_null($oShopStockMessageTrigger)) { $sQuery = "SELECT * FROM `shop_stock_message_trigger` WHERE `shop_stock_message_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `amount` >= '".MySqlLegacySupport::getInstance()->real_escape_string($this->GetArticle()->getAvailableStock())."' ORDER BY `amount` ASC LIMIT 1 "; $oShopStockMessageTrigger = TdbShopStockMessageTrigger::GetNewInstance(); /** @var $oShopStockMessageTrigger TdbShopStockMessageTrigger */ $oTmp = MySqlLegacySupport::getInstance()->fetch_object(MySqlLegacySupport::getInstance()->query($sQuery)); //if (!$oShopStockMessageTrigger->LoadFromRow(MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery)))) $oShopStockMessageTrigger = null; if (is_object($oTmp)) { if (!$oShopStockMessageTrigger->LoadFromField('id', $oTmp->id)) { $oShopStockMessageTrigger = null; } } else { $oShopStockMessageTrigger = null; } $this->SetInternalCache('oActive_shop_stock_message_trigger_id', $oShopStockMessageTrigger); } return $oShopStockMessageTrigger; }
[ "public", "function", "&", "GetFieldShopStockMessageTrigger", "(", ")", "{", "$", "oShopStockMessageTrigger", "=", "$", "this", "->", "GetFromInternalCache", "(", "'oActive_shop_stock_message_trigger_id'", ")", ";", "if", "(", "is_null", "(", "$", "oShopStockMessageTrig...
The method checks the ShopStockMessageTrigger for the current ShopStockMessage if there is a Match it will return this matching one in the other case it will return a null object. @return TdbShopStockMessageTrigger
[ "The", "method", "checks", "the", "ShopStockMessageTrigger", "for", "the", "current", "ShopStockMessage", "if", "there", "is", "a", "Match", "it", "will", "return", "this", "matching", "one", "in", "the", "other", "case", "it", "will", "return", "a", "null", ...
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopStockMessage.class.php#L180-L206
train
chameleon-system/chameleon-shop
src/ShopWishlistBundle/objects/db/TShopWishlistArticle.class.php
TShopWishlistArticle.GetToWishlistLink
public function GetToWishlistLink($bIncludePortalLink = false, $bRedirectToLoginPage = true) { $oShopConfig = TdbShop::GetInstance(); $aParameters = array('module_fnc['.$oShopConfig->GetBasketModuleSpotName().']' => 'AddToWishlist', MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $this->GetMessageConsumerName()); $aIncludeParams = TdbShop::GetURLPageStateParameters(); $oGlobal = TGlobal::instance(); foreach ($aIncludeParams as $sKeyName) { if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) { $aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName); } } $oActivePage = $this->getActivePageService()->getActivePage(); $sLink = $oActivePage->GetRealURLPlain($aParameters, $bIncludePortalLink); $oUser = TdbDataExtranetUser::GetInstance(); if ($bRedirectToLoginPage && !$oUser->IsLoggedIn()) { $sSuccessLink = $sLink; $oExtranet = TdbDataExtranet::GetInstance(); $sLoginPageURL = $oExtranet->GetLinkLoginPage(true); $sLink = $sLoginPageURL.'?sSuccessURL='.urlencode($sSuccessLink); } return $sLink; }
php
public function GetToWishlistLink($bIncludePortalLink = false, $bRedirectToLoginPage = true) { $oShopConfig = TdbShop::GetInstance(); $aParameters = array('module_fnc['.$oShopConfig->GetBasketModuleSpotName().']' => 'AddToWishlist', MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $this->GetMessageConsumerName()); $aIncludeParams = TdbShop::GetURLPageStateParameters(); $oGlobal = TGlobal::instance(); foreach ($aIncludeParams as $sKeyName) { if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) { $aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName); } } $oActivePage = $this->getActivePageService()->getActivePage(); $sLink = $oActivePage->GetRealURLPlain($aParameters, $bIncludePortalLink); $oUser = TdbDataExtranetUser::GetInstance(); if ($bRedirectToLoginPage && !$oUser->IsLoggedIn()) { $sSuccessLink = $sLink; $oExtranet = TdbDataExtranet::GetInstance(); $sLoginPageURL = $oExtranet->GetLinkLoginPage(true); $sLink = $sLoginPageURL.'?sSuccessURL='.urlencode($sSuccessLink); } return $sLink; }
[ "public", "function", "GetToWishlistLink", "(", "$", "bIncludePortalLink", "=", "false", ",", "$", "bRedirectToLoginPage", "=", "true", ")", "{", "$", "oShopConfig", "=", "TdbShop", "::", "GetInstance", "(", ")", ";", "$", "aParameters", "=", "array", "(", "...
return the link that can be used to add the article to the users wishlist. @param bool $bIncludePortalLink @return string
[ "return", "the", "link", "that", "can", "be", "used", "to", "add", "the", "article", "to", "the", "users", "wishlist", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TShopWishlistArticle.class.php#L23-L48
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/AmazonDataConverter.php
AmazonDataConverter.convertAddressLineData
protected function convertAddressLineData($localAddressData, array $address) { if ('AT' == $address['CountryCode'] || 'DE' == $address['CountryCode']) { $addressLine1 = $address['AddressLine1']; $addressLine2 = $address['AddressLine2']; $addressLine3 = $address['AddressLine3']; $postBox = ''; $company = ''; $street = ''; if ('' != $addressLine3) { $street = $addressLine3; if (true === is_numeric($addressLine1) || true === strstr($addressLine1.' '.$addressLine2, 'Packstation') ) { $postBox = $addressLine1.' '.$addressLine2; } else { $company = $addressLine1.' '.$addressLine2; } } else { if ('' != $addressLine2) { $street = $addressLine2; if (true === is_numeric($addressLine1) || true === strstr($addressLine1, 'Packstation')) { $postBox = $addressLine1; } else { $company = $addressLine1; } } else { if ('' != $addressLine1) { $street = $addressLine1; } } } $localAddressData['company'] = $company; $localAddressData['address_additional_info'] = $postBox; $localAddressData['street'] = $street; } return $localAddressData; }
php
protected function convertAddressLineData($localAddressData, array $address) { if ('AT' == $address['CountryCode'] || 'DE' == $address['CountryCode']) { $addressLine1 = $address['AddressLine1']; $addressLine2 = $address['AddressLine2']; $addressLine3 = $address['AddressLine3']; $postBox = ''; $company = ''; $street = ''; if ('' != $addressLine3) { $street = $addressLine3; if (true === is_numeric($addressLine1) || true === strstr($addressLine1.' '.$addressLine2, 'Packstation') ) { $postBox = $addressLine1.' '.$addressLine2; } else { $company = $addressLine1.' '.$addressLine2; } } else { if ('' != $addressLine2) { $street = $addressLine2; if (true === is_numeric($addressLine1) || true === strstr($addressLine1, 'Packstation')) { $postBox = $addressLine1; } else { $company = $addressLine1; } } else { if ('' != $addressLine1) { $street = $addressLine1; } } } $localAddressData['company'] = $company; $localAddressData['address_additional_info'] = $postBox; $localAddressData['street'] = $street; } return $localAddressData; }
[ "protected", "function", "convertAddressLineData", "(", "$", "localAddressData", ",", "array", "$", "address", ")", "{", "if", "(", "'AT'", "==", "$", "address", "[", "'CountryCode'", "]", "||", "'DE'", "==", "$", "address", "[", "'CountryCode'", "]", ")", ...
code from amazon to convert address lines to company postbox and street for countries AT nad DE only. @param array $localAddressData @param array $address @return array
[ "code", "from", "amazon", "to", "convert", "address", "lines", "to", "company", "postbox", "and", "street", "for", "countries", "AT", "nad", "DE", "only", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonDataConverter.php#L123-L161
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/AmazonDataConverter.php
AmazonDataConverter.isCountryForAddressTypeActive
private function isCountryForAddressTypeActive(TdbDataCountry $country, $targetAddressType) { if (self::ORDER_ADDRESS_TYPE_BILLING === $targetAddressType) { return true; } return $country->isActive(); }
php
private function isCountryForAddressTypeActive(TdbDataCountry $country, $targetAddressType) { if (self::ORDER_ADDRESS_TYPE_BILLING === $targetAddressType) { return true; } return $country->isActive(); }
[ "private", "function", "isCountryForAddressTypeActive", "(", "TdbDataCountry", "$", "country", ",", "$", "targetAddressType", ")", "{", "if", "(", "self", "::", "ORDER_ADDRESS_TYPE_BILLING", "===", "$", "targetAddressType", ")", "{", "return", "true", ";", "}", "r...
Check if country is active if address is not a billing address. @param TdbDataCountry $country @param int $targetAddressType @return bool
[ "Check", "if", "country", "is", "active", "if", "address", "is", "not", "a", "billing", "address", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonDataConverter.php#L217-L224
train
avto-dev/dev-tools
src/Laravel/VarDumper/VarDumperMiddleware.php
VarDumperMiddleware.handle
public function handle(Request $request, Closure $next) { /** @var Response $response */ $response = $next($request); if ($this->stack->count() > 0) { $dumped = \implode(\PHP_EOL, $this->stack->all()); $this->stack->clear(); $response->setContent($dumped . $response->getContent()); } return $response; }
php
public function handle(Request $request, Closure $next) { /** @var Response $response */ $response = $next($request); if ($this->stack->count() > 0) { $dumped = \implode(\PHP_EOL, $this->stack->all()); $this->stack->clear(); $response->setContent($dumped . $response->getContent()); } return $response; }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "Closure", "$", "next", ")", "{", "/** @var Response $response */", "$", "response", "=", "$", "next", "(", "$", "request", ")", ";", "if", "(", "$", "this", "->", "stack", "->", "count...
Modify response after the request is handled by the application. @param Request $request @param Closure $next @return mixed
[ "Modify", "response", "after", "the", "request", "is", "handled", "by", "the", "application", "." ]
0a9b13f0322878cbfa55f5f73cfb0dc521457373
https://github.com/avto-dev/dev-tools/blob/0a9b13f0322878cbfa55f5f73cfb0dc521457373/src/Laravel/VarDumper/VarDumperMiddleware.php#L39-L53
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrderStep/TShopStepLoginEndPoint.class.php
TShopStepLoginEndPoint.AllowAccessToStep
protected function AllowAccessToStep($bRedirectToPreviousPermittedStep = false) { $bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep); if ($bAllowAccess && $bRedirectToPreviousPermittedStep) { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $this->JumpToStep($this->GetNextStep()); } } return $bAllowAccess; }
php
protected function AllowAccessToStep($bRedirectToPreviousPermittedStep = false) { $bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep); if ($bAllowAccess && $bRedirectToPreviousPermittedStep) { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $this->JumpToStep($this->GetNextStep()); } } return $bAllowAccess; }
[ "protected", "function", "AllowAccessToStep", "(", "$", "bRedirectToPreviousPermittedStep", "=", "false", ")", "{", "$", "bAllowAccess", "=", "parent", "::", "AllowAccessToStep", "(", "$", "bRedirectToPreviousPermittedStep", ")", ";", "if", "(", "$", "bAllowAccess", ...
we allow access only if a) the user is not yet registered. @param bool $bRedirectToPreviousPermittedStep @return bool
[ "we", "allow", "access", "only", "if", "a", ")", "the", "user", "is", "not", "yet", "registered", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepLoginEndPoint.class.php#L28-L39
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Command/CliConfigCommandFactory.php
CliConfigCommandFactory.getCommands
public function getCommands(): array { $commands = [ $this->container->get(GenerateRelationsCommand::class), $this->container->get(GenerateEntityCommand::class), $this->container->get(SetRelationCommand::class), $this->container->get(GenerateFieldCommand::class), $this->container->get(SetFieldCommand::class), $this->container->get(SetEmbeddableCommand::class), $this->container->get(GenerateEmbeddableFromArchetypeCommand::class), $this->container->get(GenerateEmbeddableSkeletonCommand::class), $this->container->get(RemoveUnusedRelationsCommand::class), $this->container->get(OverrideCreateCommand::class), $this->container->get(OverridesUpdateCommand::class), $this->container->get(CreateConstraintCommand::class), $this->container->get(FinaliseBuildCommand::class), $this->container->get(CreateConstraintCommand::class), ]; $migrationsCommands = [ $this->container->get(ExecuteCommand::class), $this->container->get(GenerateCommand::class), $this->container->get(LatestCommand::class), $this->container->get(MigrateCommand::class), $this->container->get(DiffCommand::class), $this->container->get(UpToDateCommand::class), $this->container->get(StatusCommand::class), $this->container->get(VersionCommand::class), ]; foreach ($migrationsCommands as $command) { $commands[] = $this->addMigrationsConfig($command); } return $commands; }
php
public function getCommands(): array { $commands = [ $this->container->get(GenerateRelationsCommand::class), $this->container->get(GenerateEntityCommand::class), $this->container->get(SetRelationCommand::class), $this->container->get(GenerateFieldCommand::class), $this->container->get(SetFieldCommand::class), $this->container->get(SetEmbeddableCommand::class), $this->container->get(GenerateEmbeddableFromArchetypeCommand::class), $this->container->get(GenerateEmbeddableSkeletonCommand::class), $this->container->get(RemoveUnusedRelationsCommand::class), $this->container->get(OverrideCreateCommand::class), $this->container->get(OverridesUpdateCommand::class), $this->container->get(CreateConstraintCommand::class), $this->container->get(FinaliseBuildCommand::class), $this->container->get(CreateConstraintCommand::class), ]; $migrationsCommands = [ $this->container->get(ExecuteCommand::class), $this->container->get(GenerateCommand::class), $this->container->get(LatestCommand::class), $this->container->get(MigrateCommand::class), $this->container->get(DiffCommand::class), $this->container->get(UpToDateCommand::class), $this->container->get(StatusCommand::class), $this->container->get(VersionCommand::class), ]; foreach ($migrationsCommands as $command) { $commands[] = $this->addMigrationsConfig($command); } return $commands; }
[ "public", "function", "getCommands", "(", ")", ":", "array", "{", "$", "commands", "=", "[", "$", "this", "->", "container", "->", "get", "(", "GenerateRelationsCommand", "::", "class", ")", ",", "$", "this", "->", "container", "->", "get", "(", "Generat...
For use in your project's cli-config.php file @see /cli-config.php @return array
[ "For", "use", "in", "your", "project", "s", "cli", "-", "config", ".", "php", "file" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Command/CliConfigCommandFactory.php#L58-L91
train
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIpnMessage.class.php
TPkgShopPaymentIpnMessage.getMessageForOrder
public static function getMessageForOrder(TdbShopOrder $oOrder, $sStatusCode) { $oStatus = null; $oPaymentHandler = $oOrder->GetPaymentHandler(); $query = "SELECT `pkg_shop_payment_ipn_message`.* FROM `pkg_shop_payment_ipn_message` INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id` WHERE ( `pkg_shop_payment_ipn_message`.`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string( $oPaymentHandler->fieldShopPaymentHandlerGroupId )."' AND `pkg_shop_payment_ipn_message`.`success` = '1' AND `pkg_shop_payment_ipn_message`.`completed` = '1' ) AND `pkg_shop_payment_ipn_status`.`code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sStatusCode)."' "; if ($aMessage = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $oStatus = TdbPkgShopPaymentIpnMessage::GetNewInstance($aMessage); } return $oStatus; }
php
public static function getMessageForOrder(TdbShopOrder $oOrder, $sStatusCode) { $oStatus = null; $oPaymentHandler = $oOrder->GetPaymentHandler(); $query = "SELECT `pkg_shop_payment_ipn_message`.* FROM `pkg_shop_payment_ipn_message` INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id` WHERE ( `pkg_shop_payment_ipn_message`.`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string( $oPaymentHandler->fieldShopPaymentHandlerGroupId )."' AND `pkg_shop_payment_ipn_message`.`success` = '1' AND `pkg_shop_payment_ipn_message`.`completed` = '1' ) AND `pkg_shop_payment_ipn_status`.`code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sStatusCode)."' "; if ($aMessage = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $oStatus = TdbPkgShopPaymentIpnMessage::GetNewInstance($aMessage); } return $oStatus; }
[ "public", "static", "function", "getMessageForOrder", "(", "TdbShopOrder", "$", "oOrder", ",", "$", "sStatusCode", ")", "{", "$", "oStatus", "=", "null", ";", "$", "oPaymentHandler", "=", "$", "oOrder", "->", "GetPaymentHandler", "(", ")", ";", "$", "query",...
returns the status object with a specific code for an order. @param TdbShopOrder $oOrder @param string $sStatusCode @return TdbPkgShopPaymentIpnMessage|null
[ "returns", "the", "status", "object", "with", "a", "specific", "code", "for", "an", "order", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIpnMessage.class.php#L72-L94
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php
AmazonPaymentGroupConfig.getPayWithAmazonButton
public function getPayWithAmazonButton() { $buttonURL = $this->getValue('payWithAmazonButtonURL', null); if (null !== $buttonURL) { $buttonURL .= '?sellerId='.urlencode($this->getMerchantId()); } return $buttonURL; }
php
public function getPayWithAmazonButton() { $buttonURL = $this->getValue('payWithAmazonButtonURL', null); if (null !== $buttonURL) { $buttonURL .= '?sellerId='.urlencode($this->getMerchantId()); } return $buttonURL; }
[ "public", "function", "getPayWithAmazonButton", "(", ")", "{", "$", "buttonURL", "=", "$", "this", "->", "getValue", "(", "'payWithAmazonButtonURL'", ",", "null", ")", ";", "if", "(", "null", "!==", "$", "buttonURL", ")", "{", "$", "buttonURL", ".=", "'?se...
return buy button url inc. merchant id parameter. @return string
[ "return", "buy", "button", "url", "inc", ".", "merchant", "id", "parameter", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L131-L139
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php
AmazonPaymentGroupConfig.getSellerAuthorizationNote
public function getSellerAuthorizationNote(\TdbShopOrder $order, $amount, $captureNow, array $itemList = array()) { $text = $this->getValue('sellerAuthorizationNote'); $data = $this->getTemplateDataFromOrder($order); $data['captureNow'] = $captureNow; $data['transaction__totalValue'] = $amount; $data['transaction__items'] = $itemList; return $this->render($text, $data); }
php
public function getSellerAuthorizationNote(\TdbShopOrder $order, $amount, $captureNow, array $itemList = array()) { $text = $this->getValue('sellerAuthorizationNote'); $data = $this->getTemplateDataFromOrder($order); $data['captureNow'] = $captureNow; $data['transaction__totalValue'] = $amount; $data['transaction__items'] = $itemList; return $this->render($text, $data); }
[ "public", "function", "getSellerAuthorizationNote", "(", "\\", "TdbShopOrder", "$", "order", ",", "$", "amount", ",", "$", "captureNow", ",", "array", "$", "itemList", "=", "array", "(", ")", ")", "{", "$", "text", "=", "$", "this", "->", "getValue", "("...
returns a text displayed on the auth email sent by amazon to the buyer. @param \TdbShopOrder $order @param float $amount @param bool $captureNow @param array $itemList @return string
[ "returns", "a", "text", "displayed", "on", "the", "auth", "email", "sent", "by", "amazon", "to", "the", "buyer", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L204-L213
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php
AmazonPaymentGroupConfig.getTemplateDataFromOrder
protected function getTemplateDataFromOrder(\TdbShopOrder $order) { $data = $order->GetSQLWithTablePrefix($order->table); $shop = $order->GetFieldShop(); $shopData = $shop->GetSQLWithTablePrefix($shop->table); $data = array_merge($data, $shopData); return $data; }
php
protected function getTemplateDataFromOrder(\TdbShopOrder $order) { $data = $order->GetSQLWithTablePrefix($order->table); $shop = $order->GetFieldShop(); $shopData = $shop->GetSQLWithTablePrefix($shop->table); $data = array_merge($data, $shopData); return $data; }
[ "protected", "function", "getTemplateDataFromOrder", "(", "\\", "TdbShopOrder", "$", "order", ")", "{", "$", "data", "=", "$", "order", "->", "GetSQLWithTablePrefix", "(", "$", "order", "->", "table", ")", ";", "$", "shop", "=", "$", "order", "->", "GetFie...
extract data from oder to be used by text generated via template. @param \TdbShopOrder $order @return array
[ "extract", "data", "from", "oder", "to", "be", "used", "by", "text", "generated", "via", "template", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L254-L262
train
symbiote/silverstripe-cdncontent
code/controllers/CDNSecureFileController.php
CDNSecureFileController.handleRequest
public function handleRequest(SS_HTTPRequest $request, DataModel $model) { $response = new SS_HTTPResponse(); $filename = $request->getURL(); if (strpos($filename, 'cdnassets') === 0) { $filename = 'assets/' . substr($filename, strlen('cdnassets/')); } $file = null; if (strpos($filename, '_resampled') !== false) { $file = ContentServiceAsset::get()->filter('Filename', $filename)->first(); } else if (strpos($filename, '/_versions/') !== false) { $file = FileVersion::get()->filter('Filename', "/" . $filename)->first(); } else { $file = File::get()->filter('filename', $filename)->first(); } if ($file && $file->canView()) { if (!$file->CDNFile && !$file->FilePointer) { return $this->httpError(404); } // Permission passed redirect to file $redirectLink = ''; if ($file->getViewType() != CDNFile::ANYONE_PERM) { if ($file->hasMethod('getSecureURL')) { $redirectLink = $file->getSecureURL(180); } if (!strlen($redirectLink)) { // can we stream it? return $this->sendFile($file); } } else { $redirectLink = $file->getURL(); } if ($redirectLink && trim($redirectLink, '/') != $request->getURL()) { $response->redirect($redirectLink); } else { return $this->httpError(404); } } else { if (class_exists('SecureFileController')) { $handoff = SecureFileController::create(); return $handoff->handleRequest($request, $model); } elseif ($file instanceof File) { // Permission failure Security::permissionFailure($this, 'You are not authorised to access this resource. Please log in.'); } else { // File doesn't exist $response = new SS_HTTPResponse('File Not Found', 404); } } return $response; }
php
public function handleRequest(SS_HTTPRequest $request, DataModel $model) { $response = new SS_HTTPResponse(); $filename = $request->getURL(); if (strpos($filename, 'cdnassets') === 0) { $filename = 'assets/' . substr($filename, strlen('cdnassets/')); } $file = null; if (strpos($filename, '_resampled') !== false) { $file = ContentServiceAsset::get()->filter('Filename', $filename)->first(); } else if (strpos($filename, '/_versions/') !== false) { $file = FileVersion::get()->filter('Filename', "/" . $filename)->first(); } else { $file = File::get()->filter('filename', $filename)->first(); } if ($file && $file->canView()) { if (!$file->CDNFile && !$file->FilePointer) { return $this->httpError(404); } // Permission passed redirect to file $redirectLink = ''; if ($file->getViewType() != CDNFile::ANYONE_PERM) { if ($file->hasMethod('getSecureURL')) { $redirectLink = $file->getSecureURL(180); } if (!strlen($redirectLink)) { // can we stream it? return $this->sendFile($file); } } else { $redirectLink = $file->getURL(); } if ($redirectLink && trim($redirectLink, '/') != $request->getURL()) { $response->redirect($redirectLink); } else { return $this->httpError(404); } } else { if (class_exists('SecureFileController')) { $handoff = SecureFileController::create(); return $handoff->handleRequest($request, $model); } elseif ($file instanceof File) { // Permission failure Security::permissionFailure($this, 'You are not authorised to access this resource. Please log in.'); } else { // File doesn't exist $response = new SS_HTTPResponse('File Not Found', 404); } } return $response; }
[ "public", "function", "handleRequest", "(", "SS_HTTPRequest", "$", "request", ",", "DataModel", "$", "model", ")", "{", "$", "response", "=", "new", "SS_HTTPResponse", "(", ")", ";", "$", "filename", "=", "$", "request", "->", "getURL", "(", ")", ";", "i...
Process all incoming requests passed to this controller, checking that the file exists and passing the file through if possible.
[ "Process", "all", "incoming", "requests", "passed", "to", "this", "controller", "checking", "that", "the", "file", "exists", "and", "passing", "the", "file", "through", "if", "possible", "." ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/controllers/CDNSecureFileController.php#L17-L73
train
symbiote/silverstripe-cdncontent
code/controllers/CDNSecureFileController.php
CDNSecureFileController.sendFile
public function sendFile($file) { $reader = $file->reader(); if (!$reader || !$reader->isReadable()) { return; } if(class_exists('SapphireTest', false) && SapphireTest::is_running_test()) { return $reader->read(); } $type = HTTP::get_mime_type($file->Filename); $disposition = strpos($type, 'image') !== false ? 'inline' : 'attachment'; header('Content-Description: File Transfer'); // Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download) header(sprintf('Content-Disposition: %s; filename="%s"', $disposition, basename($file->Filename))); header('Content-Length: ' . $file->FileSize); header('Content-Type: ' . $type); header('Content-Transfer-Encoding: binary'); // Ensure we enforce no-cache headers consistently, so that files accesses aren't cached by CDN/edge networks header('Pragma: no-cache'); header('Cache-Control: private, no-cache, no-store'); increase_time_limit_to(0); // Clear PHP buffer, otherwise the script will try to allocate memory for entire file. while (ob_get_level() > 0) { ob_end_flush(); } // Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same // website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/) session_write_close(); echo $reader->read(); die(); }
php
public function sendFile($file) { $reader = $file->reader(); if (!$reader || !$reader->isReadable()) { return; } if(class_exists('SapphireTest', false) && SapphireTest::is_running_test()) { return $reader->read(); } $type = HTTP::get_mime_type($file->Filename); $disposition = strpos($type, 'image') !== false ? 'inline' : 'attachment'; header('Content-Description: File Transfer'); // Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download) header(sprintf('Content-Disposition: %s; filename="%s"', $disposition, basename($file->Filename))); header('Content-Length: ' . $file->FileSize); header('Content-Type: ' . $type); header('Content-Transfer-Encoding: binary'); // Ensure we enforce no-cache headers consistently, so that files accesses aren't cached by CDN/edge networks header('Pragma: no-cache'); header('Cache-Control: private, no-cache, no-store'); increase_time_limit_to(0); // Clear PHP buffer, otherwise the script will try to allocate memory for entire file. while (ob_get_level() > 0) { ob_end_flush(); } // Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same // website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/) session_write_close(); echo $reader->read(); die(); }
[ "public", "function", "sendFile", "(", "$", "file", ")", "{", "$", "reader", "=", "$", "file", "->", "reader", "(", ")", ";", "if", "(", "!", "$", "reader", "||", "!", "$", "reader", "->", "isReadable", "(", ")", ")", "{", "return", ";", "}", "...
Output file to the browser. For performance reasons, we avoid SS_HTTPResponse and just output the contents instead.
[ "Output", "file", "to", "the", "browser", ".", "For", "performance", "reasons", "we", "avoid", "SS_HTTPResponse", "and", "just", "output", "the", "contents", "instead", "." ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/controllers/CDNSecureFileController.php#L79-L116
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/pkgShop/db/AmazonShopOrder.php
AmazonShopOrder.getAmazonOrderReferenceId
public function getAmazonOrderReferenceId() { $paymentHandler = $this->GetPaymentHandler(); if (false === ($paymentHandler instanceof AmazonPaymentHandler)) { throw new \InvalidArgumentException('order was not paid with amazon payment'); } /** @var $paymentHandler AmazonPaymentHandler */ return $paymentHandler->getAmazonOrderReferenceId(); }
php
public function getAmazonOrderReferenceId() { $paymentHandler = $this->GetPaymentHandler(); if (false === ($paymentHandler instanceof AmazonPaymentHandler)) { throw new \InvalidArgumentException('order was not paid with amazon payment'); } /** @var $paymentHandler AmazonPaymentHandler */ return $paymentHandler->getAmazonOrderReferenceId(); }
[ "public", "function", "getAmazonOrderReferenceId", "(", ")", "{", "$", "paymentHandler", "=", "$", "this", "->", "GetPaymentHandler", "(", ")", ";", "if", "(", "false", "===", "(", "$", "paymentHandler", "instanceof", "AmazonPaymentHandler", ")", ")", "{", "th...
returns amazon order reference id if the order was paid with amazon. throws an InvalidArgumentException if the order was not paid with amazon. @throws \InvalidArgumentException @return string
[ "returns", "amazon", "order", "reference", "id", "if", "the", "order", "was", "paid", "with", "amazon", ".", "throws", "an", "InvalidArgumentException", "if", "the", "order", "was", "not", "paid", "with", "amazon", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/pkgShop/db/AmazonShopOrder.php#L27-L37
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php
MTShopOrderWizardCoreEndPoint.GetCallingURL
public static function GetCallingURL() { $sURL = '/'; if (array_key_exists(self::SESSION_PARAM_NAME, $_SESSION)) { $sURL = $_SESSION[self::SESSION_PARAM_NAME]; } else { $sURL = self::getPageService()->getLinkToPortalHomePageAbsolute(); } return $sURL; }
php
public static function GetCallingURL() { $sURL = '/'; if (array_key_exists(self::SESSION_PARAM_NAME, $_SESSION)) { $sURL = $_SESSION[self::SESSION_PARAM_NAME]; } else { $sURL = self::getPageService()->getLinkToPortalHomePageAbsolute(); } return $sURL; }
[ "public", "static", "function", "GetCallingURL", "(", ")", "{", "$", "sURL", "=", "'/'", ";", "if", "(", "array_key_exists", "(", "self", "::", "SESSION_PARAM_NAME", ",", "$", "_SESSION", ")", ")", "{", "$", "sURL", "=", "$", "_SESSION", "[", "self", "...
return the url to the page that requested the order step. @return string
[ "return", "the", "url", "to", "the", "page", "that", "requested", "the", "order", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L130-L140
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php
MTShopOrderWizardCoreEndPoint.GetStepAsAjax
protected function GetStepAsAjax($sStepName = null) { $sHTML = ''; if (is_null($sStepName)) { $sStepName = $this->global->GetUserData('sStepName'); } $oStep = TdbShopOrderStep::GetStep($sStepName); if ($oStep) { $sModuleSpotName = $this->sModuleSpotName; $sHTML = $oStep->Render($sModuleSpotName); } return $sHTML; }
php
protected function GetStepAsAjax($sStepName = null) { $sHTML = ''; if (is_null($sStepName)) { $sStepName = $this->global->GetUserData('sStepName'); } $oStep = TdbShopOrderStep::GetStep($sStepName); if ($oStep) { $sModuleSpotName = $this->sModuleSpotName; $sHTML = $oStep->Render($sModuleSpotName); } return $sHTML; }
[ "protected", "function", "GetStepAsAjax", "(", "$", "sStepName", "=", "null", ")", "{", "$", "sHTML", "=", "''", ";", "if", "(", "is_null", "(", "$", "sStepName", ")", ")", "{", "$", "sStepName", "=", "$", "this", "->", "global", "->", "GetUserData", ...
return the step passed as ajax. @param string $sStepName @return string
[ "return", "the", "step", "passed", "as", "ajax", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L254-L267
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php
MTShopOrderWizardCoreEndPoint.JumpSelectPaymentMethod
protected function JumpSelectPaymentMethod($sPaymentMethodId = null, $sPaymentMethodNameInternal = null) { $oPaymentMethod = null; if (is_null($sPaymentMethodId)) { $sPaymentMethodId = $this->global->GetUserData('sPaymentMethodId'); } if (empty($sPaymentMethodId)) { $oPaymentMethod = TdbShopPaymentMethod::GetNewInstance(); if (is_null($sPaymentMethodNameInternal)) { $sPaymentMethodNameInternal = $this->global->GetUserData('sPaymentMethodNameInternal'); } $oPaymentMethod->LoadFromField('name_internal', $sPaymentMethodNameInternal); } if (is_null($oPaymentMethod)) { $oPaymentMethod = TdbShopPaymentMethod::GetNewInstance(); $oPaymentMethod->Load($sPaymentMethodId); } if ($oPaymentMethod->IsAvailable()) { $oBasket = TShopBasket::GetInstance(); $oBasket->SetActivePaymentMethod($oPaymentMethod); // check if payment method was set $oCheckPayment = $oBasket->GetActivePaymentMethod(); if (!$oCheckPayment) { TTools::WriteLogEntry('JumpSelectPaymentMethod: unable to select payment method', 1, __FILE__, __LINE__); } // also set shipping type if not already set $oActiveShippingGroup = $oBasket->GetActiveShippingGroup(); if (is_null($oActiveShippingGroup) || !$oPaymentMethod->isConnected('shop_shipping_group', $oActiveShippingGroup->id)) { $oMatchingShippingGroup = TdbShopShippingGroupList::GetShippingGroupsThatAllowPaymentWith($oPaymentMethod->fieldNameInternal); $oBasket->SetActiveShippingGroup($oMatchingShippingGroup); $oBasket->RecalculateBasket(); } $oPaymentMethod->GetFieldShopPaymentHandler()->PostSelectPaymentHook(TCMSMessageManager::GLOBAL_CONSUMER_NAME); return true; } else { trigger_error('trying to access an unavailable payment method through JumpSelect', E_USER_WARNING); return false; } }
php
protected function JumpSelectPaymentMethod($sPaymentMethodId = null, $sPaymentMethodNameInternal = null) { $oPaymentMethod = null; if (is_null($sPaymentMethodId)) { $sPaymentMethodId = $this->global->GetUserData('sPaymentMethodId'); } if (empty($sPaymentMethodId)) { $oPaymentMethod = TdbShopPaymentMethod::GetNewInstance(); if (is_null($sPaymentMethodNameInternal)) { $sPaymentMethodNameInternal = $this->global->GetUserData('sPaymentMethodNameInternal'); } $oPaymentMethod->LoadFromField('name_internal', $sPaymentMethodNameInternal); } if (is_null($oPaymentMethod)) { $oPaymentMethod = TdbShopPaymentMethod::GetNewInstance(); $oPaymentMethod->Load($sPaymentMethodId); } if ($oPaymentMethod->IsAvailable()) { $oBasket = TShopBasket::GetInstance(); $oBasket->SetActivePaymentMethod($oPaymentMethod); // check if payment method was set $oCheckPayment = $oBasket->GetActivePaymentMethod(); if (!$oCheckPayment) { TTools::WriteLogEntry('JumpSelectPaymentMethod: unable to select payment method', 1, __FILE__, __LINE__); } // also set shipping type if not already set $oActiveShippingGroup = $oBasket->GetActiveShippingGroup(); if (is_null($oActiveShippingGroup) || !$oPaymentMethod->isConnected('shop_shipping_group', $oActiveShippingGroup->id)) { $oMatchingShippingGroup = TdbShopShippingGroupList::GetShippingGroupsThatAllowPaymentWith($oPaymentMethod->fieldNameInternal); $oBasket->SetActiveShippingGroup($oMatchingShippingGroup); $oBasket->RecalculateBasket(); } $oPaymentMethod->GetFieldShopPaymentHandler()->PostSelectPaymentHook(TCMSMessageManager::GLOBAL_CONSUMER_NAME); return true; } else { trigger_error('trying to access an unavailable payment method through JumpSelect', E_USER_WARNING); return false; } }
[ "protected", "function", "JumpSelectPaymentMethod", "(", "$", "sPaymentMethodId", "=", "null", ",", "$", "sPaymentMethodNameInternal", "=", "null", ")", "{", "$", "oPaymentMethod", "=", "null", ";", "if", "(", "is_null", "(", "$", "sPaymentMethodId", ")", ")", ...
executes the post select payment hook for the given payment method. you can pass either the id or the internal name of the payment method. @param string $sPaymentMethodId @param string $sPaymentMethodNameInternal
[ "executes", "the", "post", "select", "payment", "hook", "for", "the", "given", "payment", "method", ".", "you", "can", "pass", "either", "the", "id", "or", "the", "internal", "name", "of", "the", "payment", "method", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L297-L342
train
CVO-Technologies/cakephp-github
src/Webservice/GitHubWebservice.php
GitHubWebservice._parseLinks
protected function _parseLinks($links) { $links = array_map(function ($value) { $matches = []; preg_match('/\<(?P<link>.*)\>\; rel\=\"(?P<rel>.*)\"/', $value, $matches); return $matches; }, explode(', ', $links)); return Hash::combine($links, '{n}.rel', '{n}.link'); }
php
protected function _parseLinks($links) { $links = array_map(function ($value) { $matches = []; preg_match('/\<(?P<link>.*)\>\; rel\=\"(?P<rel>.*)\"/', $value, $matches); return $matches; }, explode(', ', $links)); return Hash::combine($links, '{n}.rel', '{n}.link'); }
[ "protected", "function", "_parseLinks", "(", "$", "links", ")", "{", "$", "links", "=", "array_map", "(", "function", "(", "$", "value", ")", "{", "$", "matches", "=", "[", "]", ";", "preg_match", "(", "'/\\<(?P<link>.*)\\>\\; rel\\=\\\"(?P<rel>.*)\\\"/'", ","...
Parse Link headers from response. @param array|null $links List of Link headers @return array
[ "Parse", "Link", "headers", "from", "response", "." ]
43647e53fd87a3ab93fe2f24ce3686b594d36241
https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Webservice/GitHubWebservice.php#L147-L157
train
edmondscommerce/doctrine-static-meta
src/Entity/Factory/EntityDependencyInjector.php
EntityDependencyInjector.injectEntityDependencies
public function injectEntityDependencies(EntityInterface $entity): void { $this->buildEntityInjectMethodsForEntity($entity); $entityFqn = $this->leadingSlash($entity::getDoctrineStaticMeta()->getReflectionClass()->getName()); $this->injectStatic($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_STATIC]); $this->inject($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_INSTANCE]); }
php
public function injectEntityDependencies(EntityInterface $entity): void { $this->buildEntityInjectMethodsForEntity($entity); $entityFqn = $this->leadingSlash($entity::getDoctrineStaticMeta()->getReflectionClass()->getName()); $this->injectStatic($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_STATIC]); $this->inject($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_INSTANCE]); }
[ "public", "function", "injectEntityDependencies", "(", "EntityInterface", "$", "entity", ")", ":", "void", "{", "$", "this", "->", "buildEntityInjectMethodsForEntity", "(", "$", "entity", ")", ";", "$", "entityFqn", "=", "$", "this", "->", "leadingSlash", "(", ...
This method loops over the inject methods for an Entity and then injects the relevant dependencies We match the method argument type with the dependency to be injected. @param EntityInterface $entity
[ "This", "method", "loops", "over", "the", "inject", "methods", "for", "an", "Entity", "and", "then", "injects", "the", "relevant", "dependencies" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityDependencyInjector.php#L41-L47
train
edmondscommerce/doctrine-static-meta
src/Entity/Factory/EntityDependencyInjector.php
EntityDependencyInjector.buildEntityInjectMethodsForEntity
private function buildEntityInjectMethodsForEntity(EntityInterface $entity): void { $reflection = $entity::getDoctrineStaticMeta()->getReflectionClass(); $entityFqn = $this->leadingSlash($reflection->getName()); if (array_key_exists($entityFqn, $this->entityInjectMethods)) { return; } $this->entityInjectMethods[$entityFqn] = [ self::TYPE_KEY_INSTANCE => [], self::TYPE_KEY_STATIC => [], ]; $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { if (!\ts\stringStartsWith($method->getName(), self::INJECT_DEPENDENCY_METHOD_PREFIX)) { continue; } $typeKey = $method->isStatic() ? self::TYPE_KEY_STATIC : self::TYPE_KEY_INSTANCE; $this->entityInjectMethods[$entityFqn][$typeKey][$method->getName()] = $this->getDependencyForInjectMethod($method); } }
php
private function buildEntityInjectMethodsForEntity(EntityInterface $entity): void { $reflection = $entity::getDoctrineStaticMeta()->getReflectionClass(); $entityFqn = $this->leadingSlash($reflection->getName()); if (array_key_exists($entityFqn, $this->entityInjectMethods)) { return; } $this->entityInjectMethods[$entityFqn] = [ self::TYPE_KEY_INSTANCE => [], self::TYPE_KEY_STATIC => [], ]; $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { if (!\ts\stringStartsWith($method->getName(), self::INJECT_DEPENDENCY_METHOD_PREFIX)) { continue; } $typeKey = $method->isStatic() ? self::TYPE_KEY_STATIC : self::TYPE_KEY_INSTANCE; $this->entityInjectMethods[$entityFqn][$typeKey][$method->getName()] = $this->getDependencyForInjectMethod($method); } }
[ "private", "function", "buildEntityInjectMethodsForEntity", "(", "EntityInterface", "$", "entity", ")", ":", "void", "{", "$", "reflection", "=", "$", "entity", "::", "getDoctrineStaticMeta", "(", ")", "->", "getReflectionClass", "(", ")", ";", "$", "entityFqn", ...
Build the array of entity methods to dependencies ready to be used for injection @param EntityInterface $entity @throws \ReflectionException
[ "Build", "the", "array", "of", "entity", "methods", "to", "dependencies", "ready", "to", "be", "used", "for", "injection" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityDependencyInjector.php#L56-L78
train
edmondscommerce/doctrine-static-meta
src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php
PingingAndReconnectingConnection.ping
public function ping(): bool { parent::connect(); if ($this->_conn instanceof Driver\PingableConnection) { return $this->_conn->ping(); } try { parent::query($this->getDatabasePlatform()->getDummySelectSQL()); return true; } catch (DBALException $e) { return false; } }
php
public function ping(): bool { parent::connect(); if ($this->_conn instanceof Driver\PingableConnection) { return $this->_conn->ping(); } try { parent::query($this->getDatabasePlatform()->getDummySelectSQL()); return true; } catch (DBALException $e) { return false; } }
[ "public", "function", "ping", "(", ")", ":", "bool", "{", "parent", "::", "connect", "(", ")", ";", "if", "(", "$", "this", "->", "_conn", "instanceof", "Driver", "\\", "PingableConnection", ")", "{", "return", "$", "this", "->", "_conn", "->", "ping",...
Overriding the ping method so we explicitly call the raw unwrapped methods as required, otherwise we go into infinite loop @return bool
[ "Overriding", "the", "ping", "method", "so", "we", "explicitly", "call", "the", "raw", "unwrapped", "methods", "as", "required", "otherwise", "we", "go", "into", "infinite", "loop" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php#L87-L102
train
edmondscommerce/doctrine-static-meta
src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php
PingingAndReconnectingConnection.resetTransactionNestingLevel
private function resetTransactionNestingLevel(): void { if (!$this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) { $reflection = new \ts\Reflection\ReflectionClass(Connection::class); $this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel'); $this->selfReflectionNestingLevelProperty->setAccessible(true); } $this->selfReflectionNestingLevelProperty->setValue($this, 0); }
php
private function resetTransactionNestingLevel(): void { if (!$this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) { $reflection = new \ts\Reflection\ReflectionClass(Connection::class); $this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel'); $this->selfReflectionNestingLevelProperty->setAccessible(true); } $this->selfReflectionNestingLevelProperty->setValue($this, 0); }
[ "private", "function", "resetTransactionNestingLevel", "(", ")", ":", "void", "{", "if", "(", "!", "$", "this", "->", "selfReflectionNestingLevelProperty", "instanceof", "\\", "ReflectionProperty", ")", "{", "$", "reflection", "=", "new", "\\", "ts", "\\", "Refl...
This is required because beginTransaction increment _transactionNestingLevel before the real query is executed, and results incremented also on gone away error. This should be safe for a new established connection.
[ "This", "is", "required", "because", "beginTransaction", "increment", "_transactionNestingLevel", "before", "the", "real", "query", "is", "executed", "and", "results", "incremented", "also", "on", "gone", "away", "error", ".", "This", "should", "be", "safe", "for"...
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php#L110-L119
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingTypeList.class.php
TShopShippingTypeList.&
public static function &GetAvailableTypes($iGroupId) { $shippingTypeDataAccess = self::getShippingTypeDataAccess(); $shopService = self::getShopService(); $oUser = self::getExtranetUserProvider()->getActiveUser(); $oShippingAddress = $oUser->GetShippingAddress(); $sActiveShippingCountryId = ''; if ($oShippingAddress) { $sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId; } if (true === empty($sActiveShippingCountryId)) { // use default country $oShop = $shopService->getActiveShop(); if ($oShop) { $sActiveShippingCountryId = $oShop->fieldDataCountryId; } } $rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket()); $idList = array(); $oBasket = TShopBasket::GetInstance(); $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again foreach ($rows as $row) { $item = TdbShopShippingType::GetNewInstance($row); if ($item->IsAvailable()) { $idList[] = $item->id; } } $query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`'; $oList = new TdbShopShippingTypeList(); $oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY)); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
php
public static function &GetAvailableTypes($iGroupId) { $shippingTypeDataAccess = self::getShippingTypeDataAccess(); $shopService = self::getShopService(); $oUser = self::getExtranetUserProvider()->getActiveUser(); $oShippingAddress = $oUser->GetShippingAddress(); $sActiveShippingCountryId = ''; if ($oShippingAddress) { $sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId; } if (true === empty($sActiveShippingCountryId)) { // use default country $oShop = $shopService->getActiveShop(); if ($oShop) { $sActiveShippingCountryId = $oShop->fieldDataCountryId; } } $rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket()); $idList = array(); $oBasket = TShopBasket::GetInstance(); $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again foreach ($rows as $row) { $item = TdbShopShippingType::GetNewInstance($row); if ($item->IsAvailable()) { $idList[] = $item->id; } } $query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`'; $oList = new TdbShopShippingTypeList(); $oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY)); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
[ "public", "static", "function", "&", "GetAvailableTypes", "(", "$", "iGroupId", ")", "{", "$", "shippingTypeDataAccess", "=", "self", "::", "getShippingTypeDataAccess", "(", ")", ";", "$", "shopService", "=", "self", "::", "getShopService", "(", ")", ";", "$",...
return list of shipping types that match the given group, the current basket, and the current user. @param int $iGroupId @return TdbShopShippingTypeList
[ "return", "list", "of", "shipping", "types", "that", "match", "the", "given", "group", "the", "current", "basket", "and", "the", "current", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L53-L91
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingTypeList.class.php
TShopShippingTypeList.&
public static function &GetPublicShippingTypes($iGroupId) { $query = "SELECT `shop_shipping_type`.* FROM `shop_shipping_type` INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` = `shop_shipping_group_shop_shipping_type_mlt`.`target_id` WHERE `shop_shipping_group_shop_shipping_type_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iGroupId)."' "; $oList = &TdbShopShippingTypeList::GetList($query); $oList->RemoveRestrictedItems(); return $oList; }
php
public static function &GetPublicShippingTypes($iGroupId) { $query = "SELECT `shop_shipping_type`.* FROM `shop_shipping_type` INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` = `shop_shipping_group_shop_shipping_type_mlt`.`target_id` WHERE `shop_shipping_group_shop_shipping_type_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iGroupId)."' "; $oList = &TdbShopShippingTypeList::GetList($query); $oList->RemoveRestrictedItems(); return $oList; }
[ "public", "static", "function", "&", "GetPublicShippingTypes", "(", "$", "iGroupId", ")", "{", "$", "query", "=", "\"SELECT `shop_shipping_type`.*\n FROM `shop_shipping_type`\n INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` ...
return all public shipping types for a given shipping group. @param int $iGroupId @return TdbShopShippingTypeList
[ "return", "all", "public", "shipping", "types", "for", "a", "given", "shipping", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L100-L112
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingTypeList.class.php
TShopShippingTypeList.RemoveRestrictedItems
public function RemoveRestrictedItems() { // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them $aValidIds = array(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->IsPublic()) { $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id); } } $query = 'SELECT `shop_shipping_type`.* FROM `shop_shipping_type` WHERE '; if (count($aValidIds) > 0) { $query .= " `shop_shipping_type`.`id` IN ('".implode("','", $aValidIds)."') "; } else { $query .= ' 1 = 0 '; } $query .= ' ORDER BY `shop_shipping_type`.`position`'; $this->Load($query); }
php
public function RemoveRestrictedItems() { // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them $aValidIds = array(); $this->GoToStart(); while ($oItem = &$this->Next()) { if ($oItem->IsPublic()) { $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id); } } $query = 'SELECT `shop_shipping_type`.* FROM `shop_shipping_type` WHERE '; if (count($aValidIds) > 0) { $query .= " `shop_shipping_type`.`id` IN ('".implode("','", $aValidIds)."') "; } else { $query .= ' 1 = 0 '; } $query .= ' ORDER BY `shop_shipping_type`.`position`'; $this->Load($query); }
[ "public", "function", "RemoveRestrictedItems", "(", ")", "{", "// since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them", "$", "aValidIds", "=", "array", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", ...
remove list items that are restricted to some user or user group.
[ "remove", "list", "items", "that", "are", "restricted", "to", "some", "user", "or", "user", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L150-L171
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/NotificationSample.php
OffAmazonPaymentsNotifications_Samples_NotificationSample.logNotification
public function logNotification() { try { $this->logNotificationContents(); $this->ipnLogFile->writeLine("============================================================================="); $this->ipnLogFile->closeFile(); } catch (Exception $ex){ error_log($ex->getMessage()); } }
php
public function logNotification() { try { $this->logNotificationContents(); $this->ipnLogFile->writeLine("============================================================================="); $this->ipnLogFile->closeFile(); } catch (Exception $ex){ error_log($ex->getMessage()); } }
[ "public", "function", "logNotification", "(", ")", "{", "try", "{", "$", "this", "->", "logNotificationContents", "(", ")", ";", "$", "this", "->", "ipnLogFile", "->", "writeLine", "(", "\"=============================================================================\"", ...
Log the notification to the file @return void
[ "Log", "the", "notification", "to", "the", "file" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/NotificationSample.php#L79-L88
train