id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
27,600
OXID-eSales/paymorrow-module
core/oxpspaymorrowlogger.php
OxpsPaymorrowLogger.getErrorLogPath
public function getErrorLogPath() { $sLogPath = $this->_sErrorLogPath; if ( !is_dir( $sLogPath ) ) { mkdir( $sLogPath, 0777, true ); } return $sLogPath; }
php
public function getErrorLogPath() { $sLogPath = $this->_sErrorLogPath; if ( !is_dir( $sLogPath ) ) { mkdir( $sLogPath, 0777, true ); } return $sLogPath; }
[ "public", "function", "getErrorLogPath", "(", ")", "{", "$", "sLogPath", "=", "$", "this", "->", "_sErrorLogPath", ";", "if", "(", "!", "is_dir", "(", "$", "sLogPath", ")", ")", "{", "mkdir", "(", "$", "sLogPath", ",", "0777", ",", "true", ")", ";", "}", "return", "$", "sLogPath", ";", "}" ]
Get error log directory full path. Also creates missing log folders is needed. @return bool|string
[ "Get", "error", "log", "directory", "full", "path", ".", "Also", "creates", "missing", "log", "folders", "is", "needed", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L166-L175
27,601
OXID-eSales/paymorrow-module
core/oxpspaymorrowlogger.php
OxpsPaymorrowLogger._toConvertToString
protected function _toConvertToString( $aArray ) { $sResult = date( "Y-m-d H:i:s", oxRegistry::get( "oxUtilsDate" )->getTime() ) . PHP_EOL; $sResult .= str_repeat( '=', 60 ) . PHP_EOL; foreach ( $aArray as $sKey => $sValue ) { $sResult .= " $sKey: $sValue" . PHP_EOL; } $sResult .= str_repeat( '=', 60 ) . PHP_EOL . PHP_EOL; return $sResult; }
php
protected function _toConvertToString( $aArray ) { $sResult = date( "Y-m-d H:i:s", oxRegistry::get( "oxUtilsDate" )->getTime() ) . PHP_EOL; $sResult .= str_repeat( '=', 60 ) . PHP_EOL; foreach ( $aArray as $sKey => $sValue ) { $sResult .= " $sKey: $sValue" . PHP_EOL; } $sResult .= str_repeat( '=', 60 ) . PHP_EOL . PHP_EOL; return $sResult; }
[ "protected", "function", "_toConvertToString", "(", "$", "aArray", ")", "{", "$", "sResult", "=", "date", "(", "\"Y-m-d H:i:s\"", ",", "oxRegistry", "::", "get", "(", "\"oxUtilsDate\"", ")", "->", "getTime", "(", ")", ")", ".", "PHP_EOL", ";", "$", "sResult", ".=", "str_repeat", "(", "'='", ",", "60", ")", ".", "PHP_EOL", ";", "foreach", "(", "$", "aArray", "as", "$", "sKey", "=>", "$", "sValue", ")", "{", "$", "sResult", ".=", "\" $sKey: $sValue\"", ".", "PHP_EOL", ";", "}", "$", "sResult", ".=", "str_repeat", "(", "'='", ",", "60", ")", ".", "PHP_EOL", ".", "PHP_EOL", ";", "return", "$", "sResult", ";", "}" ]
Converts the data array to string and returns it. @param $aArray array that needs to be converted @return string
[ "Converts", "the", "data", "array", "to", "string", "and", "returns", "it", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L232-L244
27,602
OXID-eSales/paymorrow-module
core/oxpspaymorrowlogger.php
OxpsPaymorrowLogger._getFormattedContents
protected function _getFormattedContents( $sLogDirectoryPath, $sFileName, $sFormat ) { $sFilePath = $sLogDirectoryPath . '/' . $sFileName; if ( in_array( $sFileName, array('.', '..', '.htaccess') ) or !is_file( $sFilePath ) ) { return ''; } $this->setFileName( $sFileName ); return sprintf( $sFormat, $sFileName, $this->getContents() ); }
php
protected function _getFormattedContents( $sLogDirectoryPath, $sFileName, $sFormat ) { $sFilePath = $sLogDirectoryPath . '/' . $sFileName; if ( in_array( $sFileName, array('.', '..', '.htaccess') ) or !is_file( $sFilePath ) ) { return ''; } $this->setFileName( $sFileName ); return sprintf( $sFormat, $sFileName, $this->getContents() ); }
[ "protected", "function", "_getFormattedContents", "(", "$", "sLogDirectoryPath", ",", "$", "sFileName", ",", "$", "sFormat", ")", "{", "$", "sFilePath", "=", "$", "sLogDirectoryPath", ".", "'/'", ".", "$", "sFileName", ";", "if", "(", "in_array", "(", "$", "sFileName", ",", "array", "(", "'.'", ",", "'..'", ",", "'.htaccess'", ")", ")", "or", "!", "is_file", "(", "$", "sFilePath", ")", ")", "{", "return", "''", ";", "}", "$", "this", "->", "setFileName", "(", "$", "sFileName", ")", ";", "return", "sprintf", "(", "$", "sFormat", ",", "$", "sFileName", ",", "$", "this", "->", "getContents", "(", ")", ")", ";", "}" ]
Get formatted log file content. @param string $sLogDirectoryPath Log folder path. @param string $sFileName Log file name. @param string $sFormat Output format string. @return string
[ "Get", "formatted", "log", "file", "content", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowlogger.php#L255-L266
27,603
moodev/php-weasel
lib/Weasel/Annotation/AnnotationReader.php
AnnotationReader.setLogger
public function setLogger(LoggerInterface $logger) { $this->logger = $logger; if (isset($logger)) { $this->parser->setLogger($logger); $this->nsParser->setLogger($logger); } }
php
public function setLogger(LoggerInterface $logger) { $this->logger = $logger; if (isset($logger)) { $this->parser->setLogger($logger); $this->nsParser->setLogger($logger); } }
[ "public", "function", "setLogger", "(", "LoggerInterface", "$", "logger", ")", "{", "$", "this", "->", "logger", "=", "$", "logger", ";", "if", "(", "isset", "(", "$", "logger", ")", ")", "{", "$", "this", "->", "parser", "->", "setLogger", "(", "$", "logger", ")", ";", "$", "this", "->", "nsParser", "->", "setLogger", "(", "$", "logger", ")", ";", "}", "}" ]
Sets a logger instance on the mixed @param LoggerInterface $logger @return null
[ "Sets", "a", "logger", "instance", "on", "the", "mixed" ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/Annotation/AnnotationReader.php#L243-L250
27,604
techdivision/import-product
src/Services/ProductBunchProcessor.php
ProductBunchProcessor.loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue
public function loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value) { return $this->getEavAttributeOptionValueRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); }
php
public function loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value) { return $this->getEavAttributeOptionValueRepository()->findOneByAttributeCodeAndStoreIdAndValue($attributeCode, $storeId, $value); }
[ "public", "function", "loadEavAttributeOptionValueByAttributeCodeAndStoreIdAndValue", "(", "$", "attributeCode", ",", "$", "storeId", ",", "$", "value", ")", "{", "return", "$", "this", "->", "getEavAttributeOptionValueRepository", "(", ")", "->", "findOneByAttributeCodeAndStoreIdAndValue", "(", "$", "attributeCode", ",", "$", "storeId", ",", "$", "value", ")", ";", "}" ]
Load's and return's the EAV attribute option value with the passed code, store ID and value. @param string $attributeCode The code of the EAV attribute option to load @param integer $storeId The store ID of the attribute option to load @param string $value The value of the attribute option to load @return array The EAV attribute option value @deprecated Since 5.0.0 @see \TechDivision\Import\Services\EavAwareProcessorInterface::loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue()
[ "Load", "s", "and", "return", "s", "the", "EAV", "attribute", "option", "value", "with", "the", "passed", "code", "store", "ID", "and", "value", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Services/ProductBunchProcessor.php#L913-L916
27,605
techdivision/import-product
src/Services/ProductBunchProcessor.php
ProductBunchProcessor.persistProduct
public function persistProduct($product, $name = null) { // persist the new entity and return the ID $id = $this->getProductAction()->persist($product, $name); // add the product to the cache, register the SKU reference as well $this->getProductRepository()->toCache($product[MemberNames::SKU], $product, array($product[MemberNames::SKU] => $id)); // return the ID of the persisted product return $id; }
php
public function persistProduct($product, $name = null) { // persist the new entity and return the ID $id = $this->getProductAction()->persist($product, $name); // add the product to the cache, register the SKU reference as well $this->getProductRepository()->toCache($product[MemberNames::SKU], $product, array($product[MemberNames::SKU] => $id)); // return the ID of the persisted product return $id; }
[ "public", "function", "persistProduct", "(", "$", "product", ",", "$", "name", "=", "null", ")", "{", "// persist the new entity and return the ID", "$", "id", "=", "$", "this", "->", "getProductAction", "(", ")", "->", "persist", "(", "$", "product", ",", "$", "name", ")", ";", "// add the product to the cache, register the SKU reference as well", "$", "this", "->", "getProductRepository", "(", ")", "->", "toCache", "(", "$", "product", "[", "MemberNames", "::", "SKU", "]", ",", "$", "product", ",", "array", "(", "$", "product", "[", "MemberNames", "::", "SKU", "]", "=>", "$", "id", ")", ")", ";", "// return the ID of the persisted product", "return", "$", "id", ";", "}" ]
Persist's the passed product data and return's the ID. @param array $product The product data to persist @param string|null $name The name of the prepared statement that has to be executed @return string The ID of the persisted entity
[ "Persist", "s", "the", "passed", "product", "data", "and", "return", "s", "the", "ID", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Services/ProductBunchProcessor.php#L1020-L1031
27,606
OXID-eSales/paymorrow-module
core/oxpspaymorrowerrorhandler.php
OxpsPaymorrowErrorHandler.getErrorByCode
public function getErrorByCode( $iErrorCode ) { return array_key_exists( $iErrorCode, $this->_aPublicErrors ) ? $this->translateError( $this->_aPublicErrors[$iErrorCode] ) : $this->translateError( $this->_aPublicErrors[3000] ); // If exact error not exist throw general }
php
public function getErrorByCode( $iErrorCode ) { return array_key_exists( $iErrorCode, $this->_aPublicErrors ) ? $this->translateError( $this->_aPublicErrors[$iErrorCode] ) : $this->translateError( $this->_aPublicErrors[3000] ); // If exact error not exist throw general }
[ "public", "function", "getErrorByCode", "(", "$", "iErrorCode", ")", "{", "return", "array_key_exists", "(", "$", "iErrorCode", ",", "$", "this", "->", "_aPublicErrors", ")", "?", "$", "this", "->", "translateError", "(", "$", "this", "->", "_aPublicErrors", "[", "$", "iErrorCode", "]", ")", ":", "$", "this", "->", "translateError", "(", "$", "this", "->", "_aPublicErrors", "[", "3000", "]", ")", ";", "// If exact error not exist throw general", "}" ]
Get human readable error message by error code. @param integer $iErrorCode @return string
[ "Get", "human", "readable", "error", "message", "by", "error", "code", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowerrorhandler.php#L58-L63
27,607
OXID-eSales/paymorrow-module
core/oxpspaymorrowerrorhandler.php
OxpsPaymorrowErrorHandler.redirectWithError
public function redirectWithError( $iErrorCode, $sController = 'order' ) { $sErrorMessage = $this->getErrorByCode( $iErrorCode ); // Set error $oEx = oxNew( 'oxExceptionToDisplay' ); $oEx->setMessage( $sErrorMessage ); oxRegistry::get( "oxUtilsView" )->addErrorToDisplay( $oEx, false ); // Redirect (refresh page) $sUrl = $this->getConfig()->getShopCurrentUrl() . "cl=" . $sController; $sUrl = oxRegistry::get( "oxUtilsUrl" )->processUrl( $sUrl ); oxRegistry::getUtils()->redirect( $sUrl ); return; }
php
public function redirectWithError( $iErrorCode, $sController = 'order' ) { $sErrorMessage = $this->getErrorByCode( $iErrorCode ); // Set error $oEx = oxNew( 'oxExceptionToDisplay' ); $oEx->setMessage( $sErrorMessage ); oxRegistry::get( "oxUtilsView" )->addErrorToDisplay( $oEx, false ); // Redirect (refresh page) $sUrl = $this->getConfig()->getShopCurrentUrl() . "cl=" . $sController; $sUrl = oxRegistry::get( "oxUtilsUrl" )->processUrl( $sUrl ); oxRegistry::getUtils()->redirect( $sUrl ); return; }
[ "public", "function", "redirectWithError", "(", "$", "iErrorCode", ",", "$", "sController", "=", "'order'", ")", "{", "$", "sErrorMessage", "=", "$", "this", "->", "getErrorByCode", "(", "$", "iErrorCode", ")", ";", "// Set error", "$", "oEx", "=", "oxNew", "(", "'oxExceptionToDisplay'", ")", ";", "$", "oEx", "->", "setMessage", "(", "$", "sErrorMessage", ")", ";", "oxRegistry", "::", "get", "(", "\"oxUtilsView\"", ")", "->", "addErrorToDisplay", "(", "$", "oEx", ",", "false", ")", ";", "// Redirect (refresh page)", "$", "sUrl", "=", "$", "this", "->", "getConfig", "(", ")", "->", "getShopCurrentUrl", "(", ")", ".", "\"cl=\"", ".", "$", "sController", ";", "$", "sUrl", "=", "oxRegistry", "::", "get", "(", "\"oxUtilsUrl\"", ")", "->", "processUrl", "(", "$", "sUrl", ")", ";", "oxRegistry", "::", "getUtils", "(", ")", "->", "redirect", "(", "$", "sUrl", ")", ";", "return", ";", "}" ]
Redirect user to given controller and shows an error. In case of 'RELOAD_CONFIGURATION_REQUIRED' error, update module settings and redirect. @codeCoverageIgnore @param $iErrorCode @param string $sController
[ "Redirect", "user", "to", "given", "controller", "and", "shows", "an", "error", ".", "In", "case", "of", "RELOAD_CONFIGURATION_REQUIRED", "error", "update", "module", "settings", "and", "redirect", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowerrorhandler.php#L74-L89
27,608
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.cleanTmp
public static function cleanTmp( $sClearFolderPath = '' ) { $sTempFolderPath = realpath(oxRegistry::getConfig()->getConfigParam( 'sCompileDir' )); if ( !empty( $sClearFolderPath ) and ( strpos( $sClearFolderPath, $sTempFolderPath ) !== false ) and is_dir( $sClearFolderPath ) ) { // User argument folder path to delete from $sFolderPath = $sClearFolderPath; } elseif ( empty( $sClearFolderPath ) ) { // Use temp folder path from settings $sFolderPath = $sTempFolderPath; } else { return false; } $hDir = opendir( $sFolderPath ); if ( !empty( $hDir ) ) { while ( false !== ( $sFileName = readdir( $hDir ) ) ) { $sFilePath = $sFolderPath . '/' . $sFileName; if ( !in_array( $sFileName, array('.', '..', '.htaccess') ) and is_file( $sFilePath ) ) { // Delete a file if it is allowed to delete @unlink( $sFilePath ); } elseif ( $sFileName == 'smarty' and is_dir( $sFilePath ) ) { // Recursive call to clean Smarty temp self::cleanTmp( $sFilePath ); } } } return true; }
php
public static function cleanTmp( $sClearFolderPath = '' ) { $sTempFolderPath = realpath(oxRegistry::getConfig()->getConfigParam( 'sCompileDir' )); if ( !empty( $sClearFolderPath ) and ( strpos( $sClearFolderPath, $sTempFolderPath ) !== false ) and is_dir( $sClearFolderPath ) ) { // User argument folder path to delete from $sFolderPath = $sClearFolderPath; } elseif ( empty( $sClearFolderPath ) ) { // Use temp folder path from settings $sFolderPath = $sTempFolderPath; } else { return false; } $hDir = opendir( $sFolderPath ); if ( !empty( $hDir ) ) { while ( false !== ( $sFileName = readdir( $hDir ) ) ) { $sFilePath = $sFolderPath . '/' . $sFileName; if ( !in_array( $sFileName, array('.', '..', '.htaccess') ) and is_file( $sFilePath ) ) { // Delete a file if it is allowed to delete @unlink( $sFilePath ); } elseif ( $sFileName == 'smarty' and is_dir( $sFilePath ) ) { // Recursive call to clean Smarty temp self::cleanTmp( $sFilePath ); } } } return true; }
[ "public", "static", "function", "cleanTmp", "(", "$", "sClearFolderPath", "=", "''", ")", "{", "$", "sTempFolderPath", "=", "realpath", "(", "oxRegistry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(", "'sCompileDir'", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "sClearFolderPath", ")", "and", "(", "strpos", "(", "$", "sClearFolderPath", ",", "$", "sTempFolderPath", ")", "!==", "false", ")", "and", "is_dir", "(", "$", "sClearFolderPath", ")", ")", "{", "// User argument folder path to delete from", "$", "sFolderPath", "=", "$", "sClearFolderPath", ";", "}", "elseif", "(", "empty", "(", "$", "sClearFolderPath", ")", ")", "{", "// Use temp folder path from settings", "$", "sFolderPath", "=", "$", "sTempFolderPath", ";", "}", "else", "{", "return", "false", ";", "}", "$", "hDir", "=", "opendir", "(", "$", "sFolderPath", ")", ";", "if", "(", "!", "empty", "(", "$", "hDir", ")", ")", "{", "while", "(", "false", "!==", "(", "$", "sFileName", "=", "readdir", "(", "$", "hDir", ")", ")", ")", "{", "$", "sFilePath", "=", "$", "sFolderPath", ".", "'/'", ".", "$", "sFileName", ";", "if", "(", "!", "in_array", "(", "$", "sFileName", ",", "array", "(", "'.'", ",", "'..'", ",", "'.htaccess'", ")", ")", "and", "is_file", "(", "$", "sFilePath", ")", ")", "{", "// Delete a file if it is allowed to delete", "@", "unlink", "(", "$", "sFilePath", ")", ";", "}", "elseif", "(", "$", "sFileName", "==", "'smarty'", "and", "is_dir", "(", "$", "sFilePath", ")", ")", "{", "// Recursive call to clean Smarty temp", "self", "::", "cleanTmp", "(", "$", "sFilePath", ")", ";", "}", "}", "}", "return", "true", ";", "}" ]
Clean temp folder content. @param string $sClearFolderPath Sub-folder path to delete from. Should be a full, valid path inside temp folder. @return boolean
[ "Clean", "temp", "folder", "content", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L121-L159
27,609
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.translate
public function translate( $sCode, $blUseModulePrefix = true ) { if ( $blUseModulePrefix ) { $sCode = 'PAYMORROW_' . $sCode; } return oxRegistry::getLang()->translateString( $sCode, oxRegistry::getLang()->getBaseLanguage(), false ); }
php
public function translate( $sCode, $blUseModulePrefix = true ) { if ( $blUseModulePrefix ) { $sCode = 'PAYMORROW_' . $sCode; } return oxRegistry::getLang()->translateString( $sCode, oxRegistry::getLang()->getBaseLanguage(), false ); }
[ "public", "function", "translate", "(", "$", "sCode", ",", "$", "blUseModulePrefix", "=", "true", ")", "{", "if", "(", "$", "blUseModulePrefix", ")", "{", "$", "sCode", "=", "'PAYMORROW_'", ".", "$", "sCode", ";", "}", "return", "oxRegistry", "::", "getLang", "(", ")", "->", "translateString", "(", "$", "sCode", ",", "oxRegistry", "::", "getLang", "(", ")", "->", "getBaseLanguage", "(", ")", ",", "false", ")", ";", "}" ]
Get translated string bt the translation code. @param string $sCode @param boolean $blUseModulePrefix User module translations prefix or not. @return string
[ "Get", "translated", "string", "bt", "the", "translation", "code", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L182-L189
27,610
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.getCmsContent
public function getCmsContent( $sIdentifier, $blNoHtml = true ) { /** @var oxContent|oxI18n $oContent */ $oContent = oxNew( 'oxContent' ); $oContent->loadByIdent( trim( (string) $sIdentifier ) ); $sValue = (string) $oContent->oxcontents__oxcontent->getRawValue(); return ( empty( $blNoHtml ) ? $sValue : nl2br( strip_tags( $sValue ) ) ); }
php
public function getCmsContent( $sIdentifier, $blNoHtml = true ) { /** @var oxContent|oxI18n $oContent */ $oContent = oxNew( 'oxContent' ); $oContent->loadByIdent( trim( (string) $sIdentifier ) ); $sValue = (string) $oContent->oxcontents__oxcontent->getRawValue(); return ( empty( $blNoHtml ) ? $sValue : nl2br( strip_tags( $sValue ) ) ); }
[ "public", "function", "getCmsContent", "(", "$", "sIdentifier", ",", "$", "blNoHtml", "=", "true", ")", "{", "/** @var oxContent|oxI18n $oContent */", "$", "oContent", "=", "oxNew", "(", "'oxContent'", ")", ";", "$", "oContent", "->", "loadByIdent", "(", "trim", "(", "(", "string", ")", "$", "sIdentifier", ")", ")", ";", "$", "sValue", "=", "(", "string", ")", "$", "oContent", "->", "oxcontents__oxcontent", "->", "getRawValue", "(", ")", ";", "return", "(", "empty", "(", "$", "blNoHtml", ")", "?", "$", "sValue", ":", "nl2br", "(", "strip_tags", "(", "$", "sValue", ")", ")", ")", ";", "}" ]
Get CMS snippet content by identified ID. @param string $sIdentifier @param bool $blNoHtml @return string
[ "Get", "CMS", "snippet", "content", "by", "identified", "ID", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L199-L208
27,611
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.getSetting
public function getSetting( $sModuleSettingName, $blUseModulePrefix = true ) { if ( $blUseModulePrefix ) { $sModuleSettingName = 'paymorrow' . (string) $sModuleSettingName; } return oxRegistry::getConfig()->getConfigParam( (string) $sModuleSettingName ); }
php
public function getSetting( $sModuleSettingName, $blUseModulePrefix = true ) { if ( $blUseModulePrefix ) { $sModuleSettingName = 'paymorrow' . (string) $sModuleSettingName; } return oxRegistry::getConfig()->getConfigParam( (string) $sModuleSettingName ); }
[ "public", "function", "getSetting", "(", "$", "sModuleSettingName", ",", "$", "blUseModulePrefix", "=", "true", ")", "{", "if", "(", "$", "blUseModulePrefix", ")", "{", "$", "sModuleSettingName", "=", "'paymorrow'", ".", "(", "string", ")", "$", "sModuleSettingName", ";", "}", "return", "oxRegistry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(", "(", "string", ")", "$", "sModuleSettingName", ")", ";", "}" ]
Get module setting value. @param string $sModuleSettingName Module setting parameter name without module prefix. @param boolean $blUseModulePrefix User module settings prefix or not. @return mixed
[ "Get", "module", "setting", "value", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L218-L225
27,612
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.updateSettings
public function updateSettings() { // Load the configuration from Paymorrow /** @var OxpsPaymorrowRequestControllerProxy $oRequestControllerProxy */ $oRequestControllerProxy = oxNew( 'OxpsPaymorrowRequestControllerProxy' ); $aConfigurationResponse = $oRequestControllerProxy->getConfiguration(); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxNew( 'OxpsPaymorrowResponseHandler' ); $aConfigurationData = $oResponseHandler->parseGetConfigurationResponse( $aConfigurationResponse ); $oConfig = oxRegistry::getConfig(); if ( oxRegistry::get( 'OxpsPaymorrowSettings' )->isSandboxMode() ) { $aSettingsMap = array( 'api_endpoint' => 'paymorrowEndpointUrlTest', 'api_resource_handler' => 'paymorrowResourcePathTest', 'api_operation_mode' => 'paymorrowOperationModeTest', ); } else { $aSettingsMap = array( 'api_endpoint' => 'paymorrowEndpointUrlProd', 'api_resource_handler' => 'paymorrowResourcePath', 'api_operation_mode' => 'paymorrowOperationMode', ); } // Apply the configuration for module settings foreach ( $aSettingsMap as $sPaymorrowKey => $sSettingsKey ) { if ( !empty( $aConfigurationData[$sPaymorrowKey] ) ) { $sValue = trim( (string) $aConfigurationData[$sPaymorrowKey] ); $oConfig->setConfigParam( $sSettingsKey, $sValue ); $oConfig->saveShopConfVar( 'str', $sSettingsKey, $sValue, null, sprintf( 'module:%s', $this->getId() ) ); } } // Reset resource cache /** @var OxpsPaymorrowResourceCache $oResourceCache */ $oResourceCache = oxNew( 'OxpsPaymorrowResourceCache' ); $oResourceCache->cleanCache(); }
php
public function updateSettings() { // Load the configuration from Paymorrow /** @var OxpsPaymorrowRequestControllerProxy $oRequestControllerProxy */ $oRequestControllerProxy = oxNew( 'OxpsPaymorrowRequestControllerProxy' ); $aConfigurationResponse = $oRequestControllerProxy->getConfiguration(); /** @var OxpsPaymorrowResponseHandler $oResponseHandler */ $oResponseHandler = oxNew( 'OxpsPaymorrowResponseHandler' ); $aConfigurationData = $oResponseHandler->parseGetConfigurationResponse( $aConfigurationResponse ); $oConfig = oxRegistry::getConfig(); if ( oxRegistry::get( 'OxpsPaymorrowSettings' )->isSandboxMode() ) { $aSettingsMap = array( 'api_endpoint' => 'paymorrowEndpointUrlTest', 'api_resource_handler' => 'paymorrowResourcePathTest', 'api_operation_mode' => 'paymorrowOperationModeTest', ); } else { $aSettingsMap = array( 'api_endpoint' => 'paymorrowEndpointUrlProd', 'api_resource_handler' => 'paymorrowResourcePath', 'api_operation_mode' => 'paymorrowOperationMode', ); } // Apply the configuration for module settings foreach ( $aSettingsMap as $sPaymorrowKey => $sSettingsKey ) { if ( !empty( $aConfigurationData[$sPaymorrowKey] ) ) { $sValue = trim( (string) $aConfigurationData[$sPaymorrowKey] ); $oConfig->setConfigParam( $sSettingsKey, $sValue ); $oConfig->saveShopConfVar( 'str', $sSettingsKey, $sValue, null, sprintf( 'module:%s', $this->getId() ) ); } } // Reset resource cache /** @var OxpsPaymorrowResourceCache $oResourceCache */ $oResourceCache = oxNew( 'OxpsPaymorrowResourceCache' ); $oResourceCache->cleanCache(); }
[ "public", "function", "updateSettings", "(", ")", "{", "// Load the configuration from Paymorrow", "/** @var OxpsPaymorrowRequestControllerProxy $oRequestControllerProxy */", "$", "oRequestControllerProxy", "=", "oxNew", "(", "'OxpsPaymorrowRequestControllerProxy'", ")", ";", "$", "aConfigurationResponse", "=", "$", "oRequestControllerProxy", "->", "getConfiguration", "(", ")", ";", "/** @var OxpsPaymorrowResponseHandler $oResponseHandler */", "$", "oResponseHandler", "=", "oxNew", "(", "'OxpsPaymorrowResponseHandler'", ")", ";", "$", "aConfigurationData", "=", "$", "oResponseHandler", "->", "parseGetConfigurationResponse", "(", "$", "aConfigurationResponse", ")", ";", "$", "oConfig", "=", "oxRegistry", "::", "getConfig", "(", ")", ";", "if", "(", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowSettings'", ")", "->", "isSandboxMode", "(", ")", ")", "{", "$", "aSettingsMap", "=", "array", "(", "'api_endpoint'", "=>", "'paymorrowEndpointUrlTest'", ",", "'api_resource_handler'", "=>", "'paymorrowResourcePathTest'", ",", "'api_operation_mode'", "=>", "'paymorrowOperationModeTest'", ",", ")", ";", "}", "else", "{", "$", "aSettingsMap", "=", "array", "(", "'api_endpoint'", "=>", "'paymorrowEndpointUrlProd'", ",", "'api_resource_handler'", "=>", "'paymorrowResourcePath'", ",", "'api_operation_mode'", "=>", "'paymorrowOperationMode'", ",", ")", ";", "}", "// Apply the configuration for module settings", "foreach", "(", "$", "aSettingsMap", "as", "$", "sPaymorrowKey", "=>", "$", "sSettingsKey", ")", "{", "if", "(", "!", "empty", "(", "$", "aConfigurationData", "[", "$", "sPaymorrowKey", "]", ")", ")", "{", "$", "sValue", "=", "trim", "(", "(", "string", ")", "$", "aConfigurationData", "[", "$", "sPaymorrowKey", "]", ")", ";", "$", "oConfig", "->", "setConfigParam", "(", "$", "sSettingsKey", ",", "$", "sValue", ")", ";", "$", "oConfig", "->", "saveShopConfVar", "(", "'str'", ",", "$", "sSettingsKey", ",", "$", "sValue", ",", "null", ",", "sprintf", "(", "'module:%s'", ",", "$", "this", "->", "getId", "(", ")", ")", ")", ";", "}", "}", "// Reset resource cache", "/** @var OxpsPaymorrowResourceCache $oResourceCache */", "$", "oResourceCache", "=", "oxNew", "(", "'OxpsPaymorrowResourceCache'", ")", ";", "$", "oResourceCache", "->", "cleanCache", "(", ")", ";", "}" ]
Settings update event. Fetches latest configuration data from Paymorrow and update relevant module settings with it.
[ "Settings", "update", "event", ".", "Fetches", "latest", "configuration", "data", "from", "Paymorrow", "and", "update", "relevant", "module", "settings", "with", "it", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L241-L285
27,613
OXID-eSales/paymorrow-module
core/oxpspaymorrowmodule.php
OxpsPaymorrowModule.getPaymentTransactionId
public function getPaymentTransactionId($blOnlySessionKey = false) { $sTransactionIdKey = sprintf('pm_order_transaction_id%s', $this->getPaymentMethodName()); $sTransactionId = (string) oxRegistry::getSession()->getVariable($sTransactionIdKey); return empty($blOnlySessionKey) ? $sTransactionId : $sTransactionIdKey; }
php
public function getPaymentTransactionId($blOnlySessionKey = false) { $sTransactionIdKey = sprintf('pm_order_transaction_id%s', $this->getPaymentMethodName()); $sTransactionId = (string) oxRegistry::getSession()->getVariable($sTransactionIdKey); return empty($blOnlySessionKey) ? $sTransactionId : $sTransactionIdKey; }
[ "public", "function", "getPaymentTransactionId", "(", "$", "blOnlySessionKey", "=", "false", ")", "{", "$", "sTransactionIdKey", "=", "sprintf", "(", "'pm_order_transaction_id%s'", ",", "$", "this", "->", "getPaymentMethodName", "(", ")", ")", ";", "$", "sTransactionId", "=", "(", "string", ")", "oxRegistry", "::", "getSession", "(", ")", "->", "getVariable", "(", "$", "sTransactionIdKey", ")", ";", "return", "empty", "(", "$", "blOnlySessionKey", ")", "?", "$", "sTransactionId", ":", "$", "sTransactionIdKey", ";", "}" ]
Check session for verified Paymorrow payment method ID and get order transaction ID for the method. @param bool $blOnlySessionKey If true, only return a session ket of the transaction ID, otherwise - the ID @return string
[ "Check", "session", "for", "verified", "Paymorrow", "payment", "method", "ID", "and", "get", "order", "transaction", "ID", "for", "the", "method", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowmodule.php#L375-L381
27,614
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowresource.php
OxpsPaymorrowResource._getResource
protected function _getResource( $sResourcePath, $blNoCache = false ) { $aResponse = null; if ( !$blNoCache ) { /** @var OxpsPaymorrowResourceCache $oResourceCache */ $oResourceCache = oxNew( 'OxpsPaymorrowResourceCache' ); $aResponse = $oResourceCache->pop( $sResourcePath ); } if ( empty( $aResponse ) ) { /** @var OxpsOxid2Paymorrow $oOxidToPm */ $oOxidToPm = oxNew( 'OxpsOxid2Paymorrow' ); $aResponse = $oOxidToPm->getBuiltPaymorrowResourceProxy()->getResource( $sResourcePath ); if ( !$blNoCache ) { $oResourceCache->push( $sResourcePath, $aResponse ); } } $this->_resourceResponse( $aResponse ); }
php
protected function _getResource( $sResourcePath, $blNoCache = false ) { $aResponse = null; if ( !$blNoCache ) { /** @var OxpsPaymorrowResourceCache $oResourceCache */ $oResourceCache = oxNew( 'OxpsPaymorrowResourceCache' ); $aResponse = $oResourceCache->pop( $sResourcePath ); } if ( empty( $aResponse ) ) { /** @var OxpsOxid2Paymorrow $oOxidToPm */ $oOxidToPm = oxNew( 'OxpsOxid2Paymorrow' ); $aResponse = $oOxidToPm->getBuiltPaymorrowResourceProxy()->getResource( $sResourcePath ); if ( !$blNoCache ) { $oResourceCache->push( $sResourcePath, $aResponse ); } } $this->_resourceResponse( $aResponse ); }
[ "protected", "function", "_getResource", "(", "$", "sResourcePath", ",", "$", "blNoCache", "=", "false", ")", "{", "$", "aResponse", "=", "null", ";", "if", "(", "!", "$", "blNoCache", ")", "{", "/** @var OxpsPaymorrowResourceCache $oResourceCache */", "$", "oResourceCache", "=", "oxNew", "(", "'OxpsPaymorrowResourceCache'", ")", ";", "$", "aResponse", "=", "$", "oResourceCache", "->", "pop", "(", "$", "sResourcePath", ")", ";", "}", "if", "(", "empty", "(", "$", "aResponse", ")", ")", "{", "/** @var OxpsOxid2Paymorrow $oOxidToPm */", "$", "oOxidToPm", "=", "oxNew", "(", "'OxpsOxid2Paymorrow'", ")", ";", "$", "aResponse", "=", "$", "oOxidToPm", "->", "getBuiltPaymorrowResourceProxy", "(", ")", "->", "getResource", "(", "$", "sResourcePath", ")", ";", "if", "(", "!", "$", "blNoCache", ")", "{", "$", "oResourceCache", "->", "push", "(", "$", "sResourcePath", ",", "$", "aResponse", ")", ";", "}", "}", "$", "this", "->", "_resourceResponse", "(", "$", "aResponse", ")", ";", "}" ]
Get a resource by path and output the resource content. @param string $sResourcePath @param bool $blNoCache forces not to cache resource
[ "Get", "a", "resource", "by", "path", "and", "output", "the", "resource", "content", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowresource.php#L96-L118
27,615
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowresource.php
OxpsPaymorrowResource._resourceResponse
protected function _resourceResponse( array $aResponse ) { if ( isset( $aResponse['contentType'] ) ) { oxRegistry::getUtils()->setHeader( 'Content-Type: ' . $aResponse['contentType'] ); } if ( isset( $aResponse['body'] ) ) { print( $aResponse['body'] ); } exit(); }
php
protected function _resourceResponse( array $aResponse ) { if ( isset( $aResponse['contentType'] ) ) { oxRegistry::getUtils()->setHeader( 'Content-Type: ' . $aResponse['contentType'] ); } if ( isset( $aResponse['body'] ) ) { print( $aResponse['body'] ); } exit(); }
[ "protected", "function", "_resourceResponse", "(", "array", "$", "aResponse", ")", "{", "if", "(", "isset", "(", "$", "aResponse", "[", "'contentType'", "]", ")", ")", "{", "oxRegistry", "::", "getUtils", "(", ")", "->", "setHeader", "(", "'Content-Type: '", ".", "$", "aResponse", "[", "'contentType'", "]", ")", ";", "}", "if", "(", "isset", "(", "$", "aResponse", "[", "'body'", "]", ")", ")", "{", "print", "(", "$", "aResponse", "[", "'body'", "]", ")", ";", "}", "exit", "(", ")", ";", "}" ]
Sent response headers, content and stop execution to prevent defaults. @codeCoverageIgnore @param array $aResponse
[ "Sent", "response", "headers", "content", "and", "stop", "execution", "to", "prevent", "defaults", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowresource.php#L127-L138
27,616
moodev/php-weasel
lib/Weasel/JsonMarshaller/JsonMapper.php
JsonMapper._registerBuiltInTypes
protected function _registerBuiltInTypes() { $this->registerJsonType("boolean", new Types\BoolType(), array("bool")); $this->registerJsonType("float", new Types\FloatType()); $this->registerJsonType("integer", new Types\IntType(), array("int")); $this->registerJsonType("string", new Types\StringType()); $this->registerJsonType("datetime", new Types\DateTimeType()); }
php
protected function _registerBuiltInTypes() { $this->registerJsonType("boolean", new Types\BoolType(), array("bool")); $this->registerJsonType("float", new Types\FloatType()); $this->registerJsonType("integer", new Types\IntType(), array("int")); $this->registerJsonType("string", new Types\StringType()); $this->registerJsonType("datetime", new Types\DateTimeType()); }
[ "protected", "function", "_registerBuiltInTypes", "(", ")", "{", "$", "this", "->", "registerJsonType", "(", "\"boolean\"", ",", "new", "Types", "\\", "BoolType", "(", ")", ",", "array", "(", "\"bool\"", ")", ")", ";", "$", "this", "->", "registerJsonType", "(", "\"float\"", ",", "new", "Types", "\\", "FloatType", "(", ")", ")", ";", "$", "this", "->", "registerJsonType", "(", "\"integer\"", ",", "new", "Types", "\\", "IntType", "(", ")", ",", "array", "(", "\"int\"", ")", ")", ";", "$", "this", "->", "registerJsonType", "(", "\"string\"", ",", "new", "Types", "\\", "StringType", "(", ")", ")", ";", "$", "this", "->", "registerJsonType", "(", "\"datetime\"", ",", "new", "Types", "\\", "DateTimeType", "(", ")", ")", ";", "}" ]
Setup the types we consider "built-in".
[ "Setup", "the", "types", "we", "consider", "built", "-", "in", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/JsonMapper.php#L80-L87
27,617
moodev/php-weasel
lib/Weasel/JsonMarshaller/JsonMapper.php
JsonMapper.writeString
public function writeString($data, $type = null) { if (!isset($type)) { $type = $this->_guessType($data); } return $this->_encodeValue($data, $this->_parseTypeString($type)); }
php
public function writeString($data, $type = null) { if (!isset($type)) { $type = $this->_guessType($data); } return $this->_encodeValue($data, $this->_parseTypeString($type)); }
[ "public", "function", "writeString", "(", "$", "data", ",", "$", "type", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "type", ")", ")", "{", "$", "type", "=", "$", "this", "->", "_guessType", "(", "$", "data", ")", ";", "}", "return", "$", "this", "->", "_encodeValue", "(", "$", "data", ",", "$", "this", "->", "_parseTypeString", "(", "$", "type", ")", ")", ";", "}" ]
Serialize an data to a string of JSON. @param mixed $data Data to serialize @param string $type Type of the data being encoded. If not provided then this will be guessed. Guessing only works with primitives and simple objects. @return string The JSON
[ "Serialize", "an", "data", "to", "a", "string", "of", "JSON", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/JsonMapper.php#L156-L162
27,618
moodev/php-weasel
lib/Weasel/JsonMarshaller/JsonMapper.php
JsonMapper.registerJsonType
public function registerJsonType($name, $handler, $aliases = array()) { $this->typeHandlers[$name] = $handler; foreach ($aliases as $alias) { $this->typeHandlers[$alias] = $handler; } }
php
public function registerJsonType($name, $handler, $aliases = array()) { $this->typeHandlers[$name] = $handler; foreach ($aliases as $alias) { $this->typeHandlers[$alias] = $handler; } }
[ "public", "function", "registerJsonType", "(", "$", "name", ",", "$", "handler", ",", "$", "aliases", "=", "array", "(", ")", ")", "{", "$", "this", "->", "typeHandlers", "[", "$", "name", "]", "=", "$", "handler", ";", "foreach", "(", "$", "aliases", "as", "$", "alias", ")", "{", "$", "this", "->", "typeHandlers", "[", "$", "alias", "]", "=", "$", "handler", ";", "}", "}" ]
Register a custom type. @param string $name @param Types\JsonType $handler @param string[] $aliases
[ "Register", "a", "custom", "type", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/JsonMapper.php#L673-L679
27,619
moodev/php-weasel
lib/Weasel/JsonMarshaller/JsonMapper.php
JsonMapper.registerType
public function registerType($name, $handler, $aliases = array()) { trigger_error("Types are deprecated, use JsonTypes through registerJsonType.", E_USER_DEPRECATED); $this->registerJsonType($name, new OldTypeWrapper($handler), $aliases); }
php
public function registerType($name, $handler, $aliases = array()) { trigger_error("Types are deprecated, use JsonTypes through registerJsonType.", E_USER_DEPRECATED); $this->registerJsonType($name, new OldTypeWrapper($handler), $aliases); }
[ "public", "function", "registerType", "(", "$", "name", ",", "$", "handler", ",", "$", "aliases", "=", "array", "(", ")", ")", "{", "trigger_error", "(", "\"Types are deprecated, use JsonTypes through registerJsonType.\"", ",", "E_USER_DEPRECATED", ")", ";", "$", "this", "->", "registerJsonType", "(", "$", "name", ",", "new", "OldTypeWrapper", "(", "$", "handler", ")", ",", "$", "aliases", ")", ";", "}" ]
Register an old style custom type. This is a compatibility handler and will be removed. Please use registerJsonType! @Deprecated @param string $name @param Types\Type $handler @param string[] $aliases
[ "Register", "an", "old", "style", "custom", "type", ".", "This", "is", "a", "compatibility", "handler", "and", "will", "be", "removed", ".", "Please", "use", "registerJsonType!" ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/JsonMapper.php#L689-L693
27,620
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getTaxClassIdByTaxClassName
public function getTaxClassIdByTaxClassName($taxClassName) { // query whether or not, the requested tax class is available if (isset($this->taxClasses[$taxClassName])) { return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID]; } // throw an exception, if not throw new \Exception( $this->appendExceptionSuffix( sprintf('Found invalid tax class name %s', $taxClassName) ) ); }
php
public function getTaxClassIdByTaxClassName($taxClassName) { // query whether or not, the requested tax class is available if (isset($this->taxClasses[$taxClassName])) { return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID]; } // throw an exception, if not throw new \Exception( $this->appendExceptionSuffix( sprintf('Found invalid tax class name %s', $taxClassName) ) ); }
[ "public", "function", "getTaxClassIdByTaxClassName", "(", "$", "taxClassName", ")", "{", "// query whether or not, the requested tax class is available", "if", "(", "isset", "(", "$", "this", "->", "taxClasses", "[", "$", "taxClassName", "]", ")", ")", "{", "return", "(", "integer", ")", "$", "this", "->", "taxClasses", "[", "$", "taxClassName", "]", "[", "MemberNames", "::", "CLASS_ID", "]", ";", "}", "// throw an exception, if not", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Found invalid tax class name %s'", ",", "$", "taxClassName", ")", ")", ")", ";", "}" ]
Return's the tax class ID for the passed tax class name. @param string $taxClassName The tax class name to return the ID for @return integer The tax class ID @throws \Exception Is thrown, if the tax class with the requested name is not available
[ "Return", "s", "the", "tax", "class", "ID", "for", "the", "passed", "tax", "class", "name", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L436-L450
27,621
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getRootCategory
public function getRootCategory() { // load the default store $defaultStore = $this->getDefaultStore(); // load the actual store view code $storeViewCode = $this->getStoreViewCode($defaultStore[MemberNames::CODE]); // query weather or not we've a root category or not if (isset($this->rootCategories[$storeViewCode])) { return $this->rootCategories[$storeViewCode]; } // throw an exception if the root category is NOT available throw new \Exception( $this->appendExceptionSuffix( sprintf('Root category for %s is not available', $storeViewCode) ) ); }
php
public function getRootCategory() { // load the default store $defaultStore = $this->getDefaultStore(); // load the actual store view code $storeViewCode = $this->getStoreViewCode($defaultStore[MemberNames::CODE]); // query weather or not we've a root category or not if (isset($this->rootCategories[$storeViewCode])) { return $this->rootCategories[$storeViewCode]; } // throw an exception if the root category is NOT available throw new \Exception( $this->appendExceptionSuffix( sprintf('Root category for %s is not available', $storeViewCode) ) ); }
[ "public", "function", "getRootCategory", "(", ")", "{", "// load the default store", "$", "defaultStore", "=", "$", "this", "->", "getDefaultStore", "(", ")", ";", "// load the actual store view code", "$", "storeViewCode", "=", "$", "this", "->", "getStoreViewCode", "(", "$", "defaultStore", "[", "MemberNames", "::", "CODE", "]", ")", ";", "// query weather or not we've a root category or not", "if", "(", "isset", "(", "$", "this", "->", "rootCategories", "[", "$", "storeViewCode", "]", ")", ")", "{", "return", "$", "this", "->", "rootCategories", "[", "$", "storeViewCode", "]", ";", "}", "// throw an exception if the root category is NOT available", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Root category for %s is not available'", ",", "$", "storeViewCode", ")", ")", ")", ";", "}" ]
Return's the root category for the actual view store. @return array The store's root category @throws \Exception Is thrown if the root category for the passed store code is NOT available
[ "Return", "s", "the", "root", "category", "for", "the", "actual", "view", "store", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L552-L572
27,622
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getStoreViewCodesByWebsiteCode
public function getStoreViewCodesByWebsiteCode($websiteCode) { // query whether or not the website with the passed code exists if (!isset($this->storeWebsites[$websiteCode])) { // throw an exception if the website is NOT available throw new \Exception( $this->appendExceptionSuffix( sprintf('Website with code "%s" is not available', $websiteCode) ) ); } // initialize the array for the store view codes $storeViewCodes = array(); // load the website ID $websiteId = (integer) $this->storeWebsites[$websiteCode][MemberNames::WEBSITE_ID]; // iterate over the available stores to find the one of the website foreach ($this->stores as $storeCode => $store) { if ((integer) $store[MemberNames::WEBSITE_ID] === $websiteId) { $storeViewCodes[] = $storeCode; } } // return the array with the matching store view codes return $storeViewCodes; }
php
public function getStoreViewCodesByWebsiteCode($websiteCode) { // query whether or not the website with the passed code exists if (!isset($this->storeWebsites[$websiteCode])) { // throw an exception if the website is NOT available throw new \Exception( $this->appendExceptionSuffix( sprintf('Website with code "%s" is not available', $websiteCode) ) ); } // initialize the array for the store view codes $storeViewCodes = array(); // load the website ID $websiteId = (integer) $this->storeWebsites[$websiteCode][MemberNames::WEBSITE_ID]; // iterate over the available stores to find the one of the website foreach ($this->stores as $storeCode => $store) { if ((integer) $store[MemberNames::WEBSITE_ID] === $websiteId) { $storeViewCodes[] = $storeCode; } } // return the array with the matching store view codes return $storeViewCodes; }
[ "public", "function", "getStoreViewCodesByWebsiteCode", "(", "$", "websiteCode", ")", "{", "// query whether or not the website with the passed code exists", "if", "(", "!", "isset", "(", "$", "this", "->", "storeWebsites", "[", "$", "websiteCode", "]", ")", ")", "{", "// throw an exception if the website is NOT available", "throw", "new", "\\", "Exception", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Website with code \"%s\" is not available'", ",", "$", "websiteCode", ")", ")", ")", ";", "}", "// initialize the array for the store view codes", "$", "storeViewCodes", "=", "array", "(", ")", ";", "// load the website ID", "$", "websiteId", "=", "(", "integer", ")", "$", "this", "->", "storeWebsites", "[", "$", "websiteCode", "]", "[", "MemberNames", "::", "WEBSITE_ID", "]", ";", "// iterate over the available stores to find the one of the website", "foreach", "(", "$", "this", "->", "stores", "as", "$", "storeCode", "=>", "$", "store", ")", "{", "if", "(", "(", "integer", ")", "$", "store", "[", "MemberNames", "::", "WEBSITE_ID", "]", "===", "$", "websiteId", ")", "{", "$", "storeViewCodes", "[", "]", "=", "$", "storeCode", ";", "}", "}", "// return the array with the matching store view codes", "return", "$", "storeViewCodes", ";", "}" ]
Returns an array with the codes of the store views related with the passed website code. @param string $websiteCode The code of the website to return the store view codes for @return array The array with the matching store view codes
[ "Returns", "an", "array", "with", "the", "codes", "of", "the", "store", "views", "related", "with", "the", "passed", "website", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L581-L609
27,623
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getCleanUpColumns
public function getCleanUpColumns() { // load the colums that has to be cleaned-up $cleanUpColumns = $this->getConfiguration()->getParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS); // query whether or not the image columns has to be cleaned-up also if ($this->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_IMAGE_COLUMNS) && $this->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_IMAGE_COLUMNS, false) ) { // if yes load the image column names $imageTypes = array_keys($this->getImageTypes()); // and append them to the column names from the configuration foreach ($imageTypes as $imageAttribute) { $cleanUpColumns[] = $imageAttribute; } } // return the array with the column names that has to be cleaned-up return $cleanUpColumns; }
php
public function getCleanUpColumns() { // load the colums that has to be cleaned-up $cleanUpColumns = $this->getConfiguration()->getParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS); // query whether or not the image columns has to be cleaned-up also if ($this->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_IMAGE_COLUMNS) && $this->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_IMAGE_COLUMNS, false) ) { // if yes load the image column names $imageTypes = array_keys($this->getImageTypes()); // and append them to the column names from the configuration foreach ($imageTypes as $imageAttribute) { $cleanUpColumns[] = $imageAttribute; } } // return the array with the column names that has to be cleaned-up return $cleanUpColumns; }
[ "public", "function", "getCleanUpColumns", "(", ")", "{", "// load the colums that has to be cleaned-up", "$", "cleanUpColumns", "=", "$", "this", "->", "getConfiguration", "(", ")", "->", "getParam", "(", "ConfigurationKeys", "::", "CLEAN_UP_EMPTY_COLUMNS", ")", ";", "// query whether or not the image columns has to be cleaned-up also", "if", "(", "$", "this", "->", "getConfiguration", "(", ")", "->", "hasParam", "(", "ConfigurationKeys", "::", "CLEAN_UP_EMPTY_IMAGE_COLUMNS", ")", "&&", "$", "this", "->", "getConfiguration", "(", ")", "->", "hasParam", "(", "ConfigurationKeys", "::", "CLEAN_UP_EMPTY_IMAGE_COLUMNS", ",", "false", ")", ")", "{", "// if yes load the image column names", "$", "imageTypes", "=", "array_keys", "(", "$", "this", "->", "getImageTypes", "(", ")", ")", ";", "// and append them to the column names from the configuration", "foreach", "(", "$", "imageTypes", "as", "$", "imageAttribute", ")", "{", "$", "cleanUpColumns", "[", "]", "=", "$", "imageAttribute", ";", "}", "}", "// return the array with the column names that has to be cleaned-up", "return", "$", "cleanUpColumns", ";", "}" ]
Merge the columns from the configuration with all image type columns to define which columns should be cleaned-up. @return array The columns that has to be cleaned-up
[ "Merge", "the", "columns", "from", "the", "configuration", "with", "all", "image", "type", "columns", "to", "define", "which", "columns", "should", "be", "cleaned", "-", "up", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L617-L638
27,624
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.mapLinkTypeCodeToLinkTypeId
public function mapLinkTypeCodeToLinkTypeId($linkTypeCode) { // query weather or not the link type code has been mapped if (isset($this->linkTypes[$linkTypeCode])) { return $this->linkTypes[$linkTypeCode][MemberNames::LINK_TYPE_ID]; } // throw an exception if the link type code has not been mapped yet throw new MapLinkTypeCodeToIdException( $this->appendExceptionSuffix( sprintf('Found not mapped link type code %s', $linkTypeCode) ) ); }
php
public function mapLinkTypeCodeToLinkTypeId($linkTypeCode) { // query weather or not the link type code has been mapped if (isset($this->linkTypes[$linkTypeCode])) { return $this->linkTypes[$linkTypeCode][MemberNames::LINK_TYPE_ID]; } // throw an exception if the link type code has not been mapped yet throw new MapLinkTypeCodeToIdException( $this->appendExceptionSuffix( sprintf('Found not mapped link type code %s', $linkTypeCode) ) ); }
[ "public", "function", "mapLinkTypeCodeToLinkTypeId", "(", "$", "linkTypeCode", ")", "{", "// query weather or not the link type code has been mapped", "if", "(", "isset", "(", "$", "this", "->", "linkTypes", "[", "$", "linkTypeCode", "]", ")", ")", "{", "return", "$", "this", "->", "linkTypes", "[", "$", "linkTypeCode", "]", "[", "MemberNames", "::", "LINK_TYPE_ID", "]", ";", "}", "// throw an exception if the link type code has not been mapped yet", "throw", "new", "MapLinkTypeCodeToIdException", "(", "$", "this", "->", "appendExceptionSuffix", "(", "sprintf", "(", "'Found not mapped link type code %s'", ",", "$", "linkTypeCode", ")", ")", ")", ";", "}" ]
Return's the link type ID for the passed link type code. @param string $linkTypeCode The link type code to return the link type ID for @return integer The mapped link type ID @throws \TechDivision\Import\Product\Exceptions\MapLinkTypeCodeToIdException Is thrown if the link type code is not mapped yet
[ "Return", "s", "the", "link", "type", "ID", "for", "the", "passed", "link", "type", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L690-L704
27,625
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getProductLinkAttribute
public function getProductLinkAttribute($linkTypeId, $attributeCode) { // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId && $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode ) { // return the matching link attribute return $linkAttribute; } } }
php
public function getProductLinkAttribute($linkTypeId, $attributeCode) { // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId && $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode ) { // return the matching link attribute return $linkAttribute; } } }
[ "public", "function", "getProductLinkAttribute", "(", "$", "linkTypeId", ",", "$", "attributeCode", ")", "{", "// try to load the link attribute with the passed link type ID and attribute code", "foreach", "(", "$", "this", "->", "linkAttributes", "as", "$", "linkAttribute", ")", "{", "if", "(", "$", "linkAttribute", "[", "MemberNames", "::", "LINK_TYPE_ID", "]", "===", "$", "linkTypeId", "&&", "$", "linkAttribute", "[", "MemberNames", "::", "PRODUCT_LINK_ATTRIBUTE_CODE", "]", "===", "$", "attributeCode", ")", "{", "// return the matching link attribute", "return", "$", "linkAttribute", ";", "}", "}", "}" ]
Return's the link attribute for the passed link type ID and attribute code. @param integer $linkTypeId The link type @param string $attributeCode The attribute code @return array The link attribute
[ "Return", "s", "the", "link", "attribute", "for", "the", "passed", "link", "type", "ID", "and", "attribute", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L714-L726
27,626
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getProductLinkAttributeByLinkTypeCodeAndAttributeCode
public function getProductLinkAttributeByLinkTypeCodeAndAttributeCode($linkTypeCode, $attributeCode) { // map the link type code => ID $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode); // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId && $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode ) { // return the matching link attribute return $linkAttribute; } } }
php
public function getProductLinkAttributeByLinkTypeCodeAndAttributeCode($linkTypeCode, $attributeCode) { // map the link type code => ID $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode); // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId && $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode ) { // return the matching link attribute return $linkAttribute; } } }
[ "public", "function", "getProductLinkAttributeByLinkTypeCodeAndAttributeCode", "(", "$", "linkTypeCode", ",", "$", "attributeCode", ")", "{", "// map the link type code => ID", "$", "linkTypeId", "=", "$", "this", "->", "mapLinkTypeCodeToLinkTypeId", "(", "$", "linkTypeCode", ")", ";", "// try to load the link attribute with the passed link type ID and attribute code", "foreach", "(", "$", "this", "->", "linkAttributes", "as", "$", "linkAttribute", ")", "{", "if", "(", "$", "linkAttribute", "[", "MemberNames", "::", "LINK_TYPE_ID", "]", "===", "$", "linkTypeId", "&&", "$", "linkAttribute", "[", "MemberNames", "::", "PRODUCT_LINK_ATTRIBUTE_CODE", "]", "===", "$", "attributeCode", ")", "{", "// return the matching link attribute", "return", "$", "linkAttribute", ";", "}", "}", "}" ]
Return's the link attribute for the passed link type and attribute code. @param string $linkTypeCode The link type code @param string $attributeCode The attribute code @return array The link attribute
[ "Return", "s", "the", "link", "attribute", "for", "the", "passed", "link", "type", "and", "attribute", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L736-L751
27,627
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getProductLinkAttributes
public function getProductLinkAttributes($linkTypeCode) { // map the link type code => ID $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode); // initialize the array for the link attributes $linkAttributes = array(); // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId) { // return the matching link attribute $linkAttributes[] = $linkAttribute; } } // return the link attributes return $linkAttributes; }
php
public function getProductLinkAttributes($linkTypeCode) { // map the link type code => ID $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode); // initialize the array for the link attributes $linkAttributes = array(); // try to load the link attribute with the passed link type ID and attribute code foreach ($this->linkAttributes as $linkAttribute) { if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId) { // return the matching link attribute $linkAttributes[] = $linkAttribute; } } // return the link attributes return $linkAttributes; }
[ "public", "function", "getProductLinkAttributes", "(", "$", "linkTypeCode", ")", "{", "// map the link type code => ID", "$", "linkTypeId", "=", "$", "this", "->", "mapLinkTypeCodeToLinkTypeId", "(", "$", "linkTypeCode", ")", ";", "// initialize the array for the link attributes", "$", "linkAttributes", "=", "array", "(", ")", ";", "// try to load the link attribute with the passed link type ID and attribute code", "foreach", "(", "$", "this", "->", "linkAttributes", "as", "$", "linkAttribute", ")", "{", "if", "(", "$", "linkAttribute", "[", "MemberNames", "::", "LINK_TYPE_ID", "]", "===", "$", "linkTypeId", ")", "{", "// return the matching link attribute", "$", "linkAttributes", "[", "]", "=", "$", "linkAttribute", ";", "}", "}", "// return the link attributes", "return", "$", "linkAttributes", ";", "}" ]
Returns the product link attributes for the passed link type code. @param string $linkTypeCode The link type code @return array The product link types
[ "Returns", "the", "product", "link", "attributes", "for", "the", "passed", "link", "type", "code", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L760-L779
27,628
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.mapLinkTypeCodeToColumnName
public function mapLinkTypeCodeToColumnName($linkTypeCode) { // query whether or not the link type code has a mapping if (isset($this->linkTypeCodeToColumnNameMapping[$linkTypeCode])) { return $this->linkTypeCodeToColumnNameMapping[$linkTypeCode]; } // return the passed link type code return $linkTypeCode; }
php
public function mapLinkTypeCodeToColumnName($linkTypeCode) { // query whether or not the link type code has a mapping if (isset($this->linkTypeCodeToColumnNameMapping[$linkTypeCode])) { return $this->linkTypeCodeToColumnNameMapping[$linkTypeCode]; } // return the passed link type code return $linkTypeCode; }
[ "public", "function", "mapLinkTypeCodeToColumnName", "(", "$", "linkTypeCode", ")", "{", "// query whether or not the link type code has a mapping", "if", "(", "isset", "(", "$", "this", "->", "linkTypeCodeToColumnNameMapping", "[", "$", "linkTypeCode", "]", ")", ")", "{", "return", "$", "this", "->", "linkTypeCodeToColumnNameMapping", "[", "$", "linkTypeCode", "]", ";", "}", "// return the passed link type code", "return", "$", "linkTypeCode", ";", "}" ]
Maps the link type code to the apropriate column name. @param string $linkTypeCode The link type code to map @return string The mapped column name
[ "Maps", "the", "link", "type", "code", "to", "the", "apropriate", "column", "name", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L788-L798
27,629
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.prepareLinkTypeMappings
public function prepareLinkTypeMappings() { // initialize the array with link type mappings $linkTypeMappings = array(); // prepare the link type mappings foreach ($this->getLinkTypes() as $linkType) { // map the link type code to the column name, if necessary $columnName = $this->mapLinkTypeCodeToColumnName($linkType[MemberNames::CODE]); // create the header for the link type mapping $linkTypeMappings[$linkType[MemberNames::CODE]][] = array ( $fullColumnName = sprintf('%s_skus', $columnName), $this->getLinkTypeColumnCallback($fullColumnName) ); // add the mappings for the columns that contains the values for the configured link type attributes foreach ($this->getProductLinkAttributes($linkType[MemberNames::CODE]) as $linkAttribute) { // initialize the full column name that uses the column name as prefix and the attribute code as suffix $fullColumnName = sprintf('%s_%s', $columnName, $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE]); // load the callback that extracts the values from the columns $callback = $this->getLinkTypeColumnCallback($fullColumnName); // map the column name to the real column name if (isset($this->linkTypeAttributeColumnToCallbackMapping[$fullColumnName])) { list ($fullColumnName, ) = $this->linkTypeAttributeColumnToCallbackMapping[$fullColumnName]; } // add the link type mapping for the column with the link type value $linkTypeMappings[$linkType[MemberNames::CODE]][] = array( $fullColumnName, $callback, $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] ); } } // return the link type mappings return $linkTypeMappings; }
php
public function prepareLinkTypeMappings() { // initialize the array with link type mappings $linkTypeMappings = array(); // prepare the link type mappings foreach ($this->getLinkTypes() as $linkType) { // map the link type code to the column name, if necessary $columnName = $this->mapLinkTypeCodeToColumnName($linkType[MemberNames::CODE]); // create the header for the link type mapping $linkTypeMappings[$linkType[MemberNames::CODE]][] = array ( $fullColumnName = sprintf('%s_skus', $columnName), $this->getLinkTypeColumnCallback($fullColumnName) ); // add the mappings for the columns that contains the values for the configured link type attributes foreach ($this->getProductLinkAttributes($linkType[MemberNames::CODE]) as $linkAttribute) { // initialize the full column name that uses the column name as prefix and the attribute code as suffix $fullColumnName = sprintf('%s_%s', $columnName, $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE]); // load the callback that extracts the values from the columns $callback = $this->getLinkTypeColumnCallback($fullColumnName); // map the column name to the real column name if (isset($this->linkTypeAttributeColumnToCallbackMapping[$fullColumnName])) { list ($fullColumnName, ) = $this->linkTypeAttributeColumnToCallbackMapping[$fullColumnName]; } // add the link type mapping for the column with the link type value $linkTypeMappings[$linkType[MemberNames::CODE]][] = array( $fullColumnName, $callback, $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] ); } } // return the link type mappings return $linkTypeMappings; }
[ "public", "function", "prepareLinkTypeMappings", "(", ")", "{", "// initialize the array with link type mappings", "$", "linkTypeMappings", "=", "array", "(", ")", ";", "// prepare the link type mappings", "foreach", "(", "$", "this", "->", "getLinkTypes", "(", ")", "as", "$", "linkType", ")", "{", "// map the link type code to the column name, if necessary", "$", "columnName", "=", "$", "this", "->", "mapLinkTypeCodeToColumnName", "(", "$", "linkType", "[", "MemberNames", "::", "CODE", "]", ")", ";", "// create the header for the link type mapping", "$", "linkTypeMappings", "[", "$", "linkType", "[", "MemberNames", "::", "CODE", "]", "]", "[", "]", "=", "array", "(", "$", "fullColumnName", "=", "sprintf", "(", "'%s_skus'", ",", "$", "columnName", ")", ",", "$", "this", "->", "getLinkTypeColumnCallback", "(", "$", "fullColumnName", ")", ")", ";", "// add the mappings for the columns that contains the values for the configured link type attributes", "foreach", "(", "$", "this", "->", "getProductLinkAttributes", "(", "$", "linkType", "[", "MemberNames", "::", "CODE", "]", ")", "as", "$", "linkAttribute", ")", "{", "// initialize the full column name that uses the column name as prefix and the attribute code as suffix", "$", "fullColumnName", "=", "sprintf", "(", "'%s_%s'", ",", "$", "columnName", ",", "$", "linkAttribute", "[", "MemberNames", "::", "PRODUCT_LINK_ATTRIBUTE_CODE", "]", ")", ";", "// load the callback that extracts the values from the columns", "$", "callback", "=", "$", "this", "->", "getLinkTypeColumnCallback", "(", "$", "fullColumnName", ")", ";", "// map the column name to the real column name", "if", "(", "isset", "(", "$", "this", "->", "linkTypeAttributeColumnToCallbackMapping", "[", "$", "fullColumnName", "]", ")", ")", "{", "list", "(", "$", "fullColumnName", ",", ")", "=", "$", "this", "->", "linkTypeAttributeColumnToCallbackMapping", "[", "$", "fullColumnName", "]", ";", "}", "// add the link type mapping for the column with the link type value", "$", "linkTypeMappings", "[", "$", "linkType", "[", "MemberNames", "::", "CODE", "]", "]", "[", "]", "=", "array", "(", "$", "fullColumnName", ",", "$", "callback", ",", "$", "linkAttribute", "[", "MemberNames", "::", "PRODUCT_LINK_ATTRIBUTE_CODE", "]", ")", ";", "}", "}", "// return the link type mappings", "return", "$", "linkTypeMappings", ";", "}" ]
Return's the link type code => colums mapping. @return array The mapping with the link type codes => colums
[ "Return", "s", "the", "link", "type", "code", "=", ">", "colums", "mapping", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L805-L845
27,630
techdivision/import-product
src/Subjects/AbstractProductSubject.php
AbstractProductSubject.getLinkTypeColumnCallback
public function getLinkTypeColumnCallback($columnName) { // query whether or not a callback mapping is available if (isset($this->linkTypeAttributeColumnToCallbackMapping[$columnName])) { // load it from the array with the mappings list (, $callbackName) = $this->linkTypeAttributeColumnToCallbackMapping[$columnName]; // prepare and return the callback return array($this, $callbackName); } // return the default callback return array($this, 'explode'); }
php
public function getLinkTypeColumnCallback($columnName) { // query whether or not a callback mapping is available if (isset($this->linkTypeAttributeColumnToCallbackMapping[$columnName])) { // load it from the array with the mappings list (, $callbackName) = $this->linkTypeAttributeColumnToCallbackMapping[$columnName]; // prepare and return the callback return array($this, $callbackName); } // return the default callback return array($this, 'explode'); }
[ "public", "function", "getLinkTypeColumnCallback", "(", "$", "columnName", ")", "{", "// query whether or not a callback mapping is available", "if", "(", "isset", "(", "$", "this", "->", "linkTypeAttributeColumnToCallbackMapping", "[", "$", "columnName", "]", ")", ")", "{", "// load it from the array with the mappings", "list", "(", ",", "$", "callbackName", ")", "=", "$", "this", "->", "linkTypeAttributeColumnToCallbackMapping", "[", "$", "columnName", "]", ";", "// prepare and return the callback", "return", "array", "(", "$", "this", ",", "$", "callbackName", ")", ";", "}", "// return the default callback", "return", "array", "(", "$", "this", ",", "'explode'", ")", ";", "}" ]
Returns the callback method used to extract the value of the passed column to create the link type attribute value with. @param string $columnName The column name to create the callback for @return callable The callback
[ "Returns", "the", "callback", "method", "used", "to", "extract", "the", "value", "of", "the", "passed", "column", "to", "create", "the", "link", "type", "attribute", "value", "with", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Subjects/AbstractProductSubject.php#L855-L868
27,631
OXID-eSales/paymorrow-module
core/oxpspaymorrowsettings.php
OxpsPaymorrowSettings.getSettings
public function getSettings() { $aValidSettings = $this->getValidSettings(); $aSettings = array(); foreach ( $aValidSettings as $sSettingName ) { $aSettings[$sSettingName] = $this->getSetting( $sSettingName ); } return $aSettings; }
php
public function getSettings() { $aValidSettings = $this->getValidSettings(); $aSettings = array(); foreach ( $aValidSettings as $sSettingName ) { $aSettings[$sSettingName] = $this->getSetting( $sSettingName ); } return $aSettings; }
[ "public", "function", "getSettings", "(", ")", "{", "$", "aValidSettings", "=", "$", "this", "->", "getValidSettings", "(", ")", ";", "$", "aSettings", "=", "array", "(", ")", ";", "foreach", "(", "$", "aValidSettings", "as", "$", "sSettingName", ")", "{", "$", "aSettings", "[", "$", "sSettingName", "]", "=", "$", "this", "->", "getSetting", "(", "$", "sSettingName", ")", ";", "}", "return", "$", "aSettings", ";", "}" ]
Get Paymorrow settings from OXID DB oxConfig table. @return array
[ "Get", "Paymorrow", "settings", "from", "OXID", "DB", "oxConfig", "table", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowsettings.php#L241-L251
27,632
OXID-eSales/paymorrow-module
core/oxpspaymorrowsettings.php
OxpsPaymorrowSettings.getSetting
public function getSetting( $sSettingName, $blUseModulePrefix = true ) { return in_array( $sSettingName, $this->_aValidPaymorrowSettings ) ? $this->_OxpsPaymorrowSettings_getSetting_parent( $sSettingName, true ) : null; }
php
public function getSetting( $sSettingName, $blUseModulePrefix = true ) { return in_array( $sSettingName, $this->_aValidPaymorrowSettings ) ? $this->_OxpsPaymorrowSettings_getSetting_parent( $sSettingName, true ) : null; }
[ "public", "function", "getSetting", "(", "$", "sSettingName", ",", "$", "blUseModulePrefix", "=", "true", ")", "{", "return", "in_array", "(", "$", "sSettingName", ",", "$", "this", "->", "_aValidPaymorrowSettings", ")", "?", "$", "this", "->", "_OxpsPaymorrowSettings_getSetting_parent", "(", "$", "sSettingName", ",", "true", ")", ":", "null", ";", "}" ]
Get specific Paymorrow setting. @param string $sSettingName @param bool $sSettingName @return mixed|null
[ "Get", "specific", "Paymorrow", "setting", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowsettings.php#L261-L266
27,633
OXID-eSales/paymorrow-module
core/oxpspaymorrowsettings.php
OxpsPaymorrowSettings._getKey
protected function _getKey( $sKeyType ) { $sSettingName = (string) $sKeyType; $sSettingName .= 'Key'; if ( $this->isSandboxMode() ) { $sSettingName .= 'Test'; } $sEncodedKey = (string) $this->getSetting( $sSettingName ); return !empty( $sEncodedKey ) ? base64_decode( $sEncodedKey ) : ''; }
php
protected function _getKey( $sKeyType ) { $sSettingName = (string) $sKeyType; $sSettingName .= 'Key'; if ( $this->isSandboxMode() ) { $sSettingName .= 'Test'; } $sEncodedKey = (string) $this->getSetting( $sSettingName ); return !empty( $sEncodedKey ) ? base64_decode( $sEncodedKey ) : ''; }
[ "protected", "function", "_getKey", "(", "$", "sKeyType", ")", "{", "$", "sSettingName", "=", "(", "string", ")", "$", "sKeyType", ";", "$", "sSettingName", ".=", "'Key'", ";", "if", "(", "$", "this", "->", "isSandboxMode", "(", ")", ")", "{", "$", "sSettingName", ".=", "'Test'", ";", "}", "$", "sEncodedKey", "=", "(", "string", ")", "$", "this", "->", "getSetting", "(", "$", "sSettingName", ")", ";", "return", "!", "empty", "(", "$", "sEncodedKey", ")", "?", "base64_decode", "(", "$", "sEncodedKey", ")", ":", "''", ";", "}" ]
Get public or private merchant key or public Paymorrow key setting value. It verifies if it is Test or Live mode to return corresponding value. Additionally a base64 decoding is performed. @param string $sKeyType True for public key, false for private key. @return mixed
[ "Get", "public", "or", "private", "merchant", "key", "or", "public", "Paymorrow", "key", "setting", "value", ".", "It", "verifies", "if", "it", "is", "Test", "or", "Live", "mode", "to", "return", "corresponding", "value", ".", "Additionally", "a", "base64", "decoding", "is", "performed", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowsettings.php#L278-L290
27,634
techdivision/import-product
src/Repositories/CategoryProductRepository.php
CategoryProductRepository.findAllBySku
public function findAllBySku($sku) { // prepare the params $params = array(MemberNames::SKU => $sku); // initialize the array for the category product relations $categoryProducts = array(); // load and return the product category relation for the passed product SKU $this->categoryProductsBySkuStmt->execute($params); // prepare the result by using the category ID as key foreach ($this->categoryProductsBySkuStmt->fetchAll(\PDO::FETCH_ASSOC) as $categoryProduct) { $categoryProducts[$categoryProduct[MemberNames::CATEGORY_ID]] = $categoryProduct; } // return the category product relations return $categoryProducts; }
php
public function findAllBySku($sku) { // prepare the params $params = array(MemberNames::SKU => $sku); // initialize the array for the category product relations $categoryProducts = array(); // load and return the product category relation for the passed product SKU $this->categoryProductsBySkuStmt->execute($params); // prepare the result by using the category ID as key foreach ($this->categoryProductsBySkuStmt->fetchAll(\PDO::FETCH_ASSOC) as $categoryProduct) { $categoryProducts[$categoryProduct[MemberNames::CATEGORY_ID]] = $categoryProduct; } // return the category product relations return $categoryProducts; }
[ "public", "function", "findAllBySku", "(", "$", "sku", ")", "{", "// prepare the params", "$", "params", "=", "array", "(", "MemberNames", "::", "SKU", "=>", "$", "sku", ")", ";", "// initialize the array for the category product relations", "$", "categoryProducts", "=", "array", "(", ")", ";", "// load and return the product category relation for the passed product SKU", "$", "this", "->", "categoryProductsBySkuStmt", "->", "execute", "(", "$", "params", ")", ";", "// prepare the result by using the category ID as key", "foreach", "(", "$", "this", "->", "categoryProductsBySkuStmt", "->", "fetchAll", "(", "\\", "PDO", "::", "FETCH_ASSOC", ")", "as", "$", "categoryProduct", ")", "{", "$", "categoryProducts", "[", "$", "categoryProduct", "[", "MemberNames", "::", "CATEGORY_ID", "]", "]", "=", "$", "categoryProduct", ";", "}", "// return the category product relations", "return", "$", "categoryProducts", ";", "}" ]
Return's the category product relations for the product with the passed SKU. @param string $sku The product SKU to load the category relations for @return array The category product relations for the product with the passed SKU
[ "Return", "s", "the", "category", "product", "relations", "for", "the", "product", "with", "the", "passed", "SKU", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Repositories/CategoryProductRepository.php#L97-L116
27,635
OXID-eSales/paymorrow-module
controllers/admin/oxpspaymorrowpaymentmap.php
OxpsPaymorrowPaymentMap.getPaymorrowEditValue
public function getPaymorrowEditValue() { $sOXID = $this->getPaymentObjectId(); if ( $sOXID != "-1" && isset( $sOXID ) ) { /** @var oxPayment $oPayment */ $oPayment = oxNew( "oxPayment" ); $oPayment->loadInLang( $this->_iEditLang, $sOXID ); $oOtherLang = $oPayment->getAvailableInLangs(); if ( !isset( $oOtherLang[$this->_iEditLang] ) ) { $oPayment->loadInLang( key( $oOtherLang ), $sOXID ); } return $oPayment; } return null; }
php
public function getPaymorrowEditValue() { $sOXID = $this->getPaymentObjectId(); if ( $sOXID != "-1" && isset( $sOXID ) ) { /** @var oxPayment $oPayment */ $oPayment = oxNew( "oxPayment" ); $oPayment->loadInLang( $this->_iEditLang, $sOXID ); $oOtherLang = $oPayment->getAvailableInLangs(); if ( !isset( $oOtherLang[$this->_iEditLang] ) ) { $oPayment->loadInLang( key( $oOtherLang ), $sOXID ); } return $oPayment; } return null; }
[ "public", "function", "getPaymorrowEditValue", "(", ")", "{", "$", "sOXID", "=", "$", "this", "->", "getPaymentObjectId", "(", ")", ";", "if", "(", "$", "sOXID", "!=", "\"-1\"", "&&", "isset", "(", "$", "sOXID", ")", ")", "{", "/** @var oxPayment $oPayment */", "$", "oPayment", "=", "oxNew", "(", "\"oxPayment\"", ")", ";", "$", "oPayment", "->", "loadInLang", "(", "$", "this", "->", "_iEditLang", ",", "$", "sOXID", ")", ";", "$", "oOtherLang", "=", "$", "oPayment", "->", "getAvailableInLangs", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "oOtherLang", "[", "$", "this", "->", "_iEditLang", "]", ")", ")", "{", "$", "oPayment", "->", "loadInLang", "(", "key", "(", "$", "oOtherLang", ")", ",", "$", "sOXID", ")", ";", "}", "return", "$", "oPayment", ";", "}", "return", "null", ";", "}" ]
Get current edited payment object. @return null|oxPayment
[ "Get", "current", "edited", "payment", "object", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/admin/oxpspaymorrowpaymentmap.php#L77-L97
27,636
OXID-eSales/paymorrow-module
controllers/admin/oxpspaymorrowpaymentmap.php
OxpsPaymorrowPaymentMap.save
public function save() { $aParams = oxRegistry::getConfig()->getRequestParameter( "editval" ); $sOXID = $aParams['oxpayments__oxid']; /** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */ $oxPayment = oxNew( 'oxpayment' ); $oxPayment->load( $sOXID ); $blPaymorrowActive = (int) $aParams['oxpayments__oxpspaymorrowactive']; // Set duplicated payment fields values $oxPayment = $this->_setDuplicatedFields( $oxPayment, $aParams ); $oxPayment->setPaymorrowActive( $blPaymorrowActive ); $iPaymorrowPaymentMapTo = (int) $aParams['oxpayments__oxpspaymorrowmap']; if ( $oxPayment->setPaymorrowPaymentMap( $iPaymorrowPaymentMapTo ) ) { $oxPayment->save(); } }
php
public function save() { $aParams = oxRegistry::getConfig()->getRequestParameter( "editval" ); $sOXID = $aParams['oxpayments__oxid']; /** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */ $oxPayment = oxNew( 'oxpayment' ); $oxPayment->load( $sOXID ); $blPaymorrowActive = (int) $aParams['oxpayments__oxpspaymorrowactive']; // Set duplicated payment fields values $oxPayment = $this->_setDuplicatedFields( $oxPayment, $aParams ); $oxPayment->setPaymorrowActive( $blPaymorrowActive ); $iPaymorrowPaymentMapTo = (int) $aParams['oxpayments__oxpspaymorrowmap']; if ( $oxPayment->setPaymorrowPaymentMap( $iPaymorrowPaymentMapTo ) ) { $oxPayment->save(); } }
[ "public", "function", "save", "(", ")", "{", "$", "aParams", "=", "oxRegistry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "\"editval\"", ")", ";", "$", "sOXID", "=", "$", "aParams", "[", "'oxpayments__oxid'", "]", ";", "/** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */", "$", "oxPayment", "=", "oxNew", "(", "'oxpayment'", ")", ";", "$", "oxPayment", "->", "load", "(", "$", "sOXID", ")", ";", "$", "blPaymorrowActive", "=", "(", "int", ")", "$", "aParams", "[", "'oxpayments__oxpspaymorrowactive'", "]", ";", "// Set duplicated payment fields values", "$", "oxPayment", "=", "$", "this", "->", "_setDuplicatedFields", "(", "$", "oxPayment", ",", "$", "aParams", ")", ";", "$", "oxPayment", "->", "setPaymorrowActive", "(", "$", "blPaymorrowActive", ")", ";", "$", "iPaymorrowPaymentMapTo", "=", "(", "int", ")", "$", "aParams", "[", "'oxpayments__oxpspaymorrowmap'", "]", ";", "if", "(", "$", "oxPayment", "->", "setPaymorrowPaymentMap", "(", "$", "iPaymorrowPaymentMapTo", ")", ")", "{", "$", "oxPayment", "->", "save", "(", ")", ";", "}", "}" ]
Save Payment methods mapping to database @return string|void
[ "Save", "Payment", "methods", "mapping", "to", "database" ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/admin/oxpspaymorrowpaymentmap.php#L105-L127
27,637
OXID-eSales/paymorrow-module
controllers/admin/oxpspaymorrowpaymentmap.php
OxpsPaymorrowPaymentMap._setDuplicatedFields
protected function _setDuplicatedFields( $oPayment, $aParams ) { $aDuplicatedFields = (array) $this->_aDuplicatedPaymentFields; foreach ( $aDuplicatedFields as $sFieldName => $sType ) { $sField = sprintf( '%s__%s', $oPayment->getCoreTableName(), $sFieldName ); if ( !isset( $aParams[$sField] ) and ( $sFieldName != 'oxchecked' ) ) { continue; } $this->_setDuplicatedField( $oPayment, $sFieldName, $sType, $aParams, $sField ); } return $oPayment; }
php
protected function _setDuplicatedFields( $oPayment, $aParams ) { $aDuplicatedFields = (array) $this->_aDuplicatedPaymentFields; foreach ( $aDuplicatedFields as $sFieldName => $sType ) { $sField = sprintf( '%s__%s', $oPayment->getCoreTableName(), $sFieldName ); if ( !isset( $aParams[$sField] ) and ( $sFieldName != 'oxchecked' ) ) { continue; } $this->_setDuplicatedField( $oPayment, $sFieldName, $sType, $aParams, $sField ); } return $oPayment; }
[ "protected", "function", "_setDuplicatedFields", "(", "$", "oPayment", ",", "$", "aParams", ")", "{", "$", "aDuplicatedFields", "=", "(", "array", ")", "$", "this", "->", "_aDuplicatedPaymentFields", ";", "foreach", "(", "$", "aDuplicatedFields", "as", "$", "sFieldName", "=>", "$", "sType", ")", "{", "$", "sField", "=", "sprintf", "(", "'%s__%s'", ",", "$", "oPayment", "->", "getCoreTableName", "(", ")", ",", "$", "sFieldName", ")", ";", "if", "(", "!", "isset", "(", "$", "aParams", "[", "$", "sField", "]", ")", "and", "(", "$", "sFieldName", "!=", "'oxchecked'", ")", ")", "{", "continue", ";", "}", "$", "this", "->", "_setDuplicatedField", "(", "$", "oPayment", ",", "$", "sFieldName", ",", "$", "sType", ",", "$", "aParams", ",", "$", "sField", ")", ";", "}", "return", "$", "oPayment", ";", "}" ]
Set payment model duplicated fields values from array. Makes sure, that field is in the array. For amount type field validates if value is correct. @param OxpsPaymorrowOxPayment|oxPayment $oPayment @param array $aParams @return OxpsPaymorrowOxPayment|oxPayment
[ "Set", "payment", "model", "duplicated", "fields", "values", "from", "array", ".", "Makes", "sure", "that", "field", "is", "in", "the", "array", ".", "For", "amount", "type", "field", "validates", "if", "value", "is", "correct", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/admin/oxpspaymorrowpaymentmap.php#L140-L155
27,638
OXID-eSales/paymorrow-module
controllers/admin/oxpspaymorrowpaymentmap.php
OxpsPaymorrowPaymentMap._setDuplicatedField
protected function _setDuplicatedField( $oPayment, $sFieldName, $sType, $aParams, $sField ) { $mValue = $aParams[$sField]; settype( $mValue, $sType ); if ( ( $sFieldName == 'oxaddsumtype' ) and !in_array( $mValue, array('abs', '%') ) ) { return false; } $oPayment->$sField = new oxField( $mValue ); return true; }
php
protected function _setDuplicatedField( $oPayment, $sFieldName, $sType, $aParams, $sField ) { $mValue = $aParams[$sField]; settype( $mValue, $sType ); if ( ( $sFieldName == 'oxaddsumtype' ) and !in_array( $mValue, array('abs', '%') ) ) { return false; } $oPayment->$sField = new oxField( $mValue ); return true; }
[ "protected", "function", "_setDuplicatedField", "(", "$", "oPayment", ",", "$", "sFieldName", ",", "$", "sType", ",", "$", "aParams", ",", "$", "sField", ")", "{", "$", "mValue", "=", "$", "aParams", "[", "$", "sField", "]", ";", "settype", "(", "$", "mValue", ",", "$", "sType", ")", ";", "if", "(", "(", "$", "sFieldName", "==", "'oxaddsumtype'", ")", "and", "!", "in_array", "(", "$", "mValue", ",", "array", "(", "'abs'", ",", "'%'", ")", ")", ")", "{", "return", "false", ";", "}", "$", "oPayment", "->", "$", "sField", "=", "new", "oxField", "(", "$", "mValue", ")", ";", "return", "true", ";", "}" ]
Check if field if valid and ok to set a value. @param OxpsPaymorrowOxPayment|oxPayment $oPayment @param string $sFieldName @param string $sType @param array $aParams @param string $sField @return bool
[ "Check", "if", "field", "if", "valid", "and", "ok", "to", "set", "a", "value", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/admin/oxpspaymorrowpaymentmap.php#L168-L180
27,639
hostnet/accessor-generator-plugin-lib
src/Reflection/ReflectionProperty.php
ReflectionProperty.setModifiers
private function setModifiers(?int $modifiers): void { // Default to private. if ($modifiers === null) { $this->modifiers = \ReflectionProperty::IS_PRIVATE; return; } // Get the number of active visibility modifiers amount all modifies. $active_visibility_modifiers = ((bool) ($modifiers & \ReflectionProperty::IS_PRIVATE)) + ((bool) ($modifiers & \ReflectionProperty::IS_PROTECTED)) + ((bool) ($modifiers & \ReflectionProperty::IS_PUBLIC)); // Not one and only one of private, protected and public is selected, throw exception. if ($active_visibility_modifiers !== 1) { throw new \DomainException(sprintf( '$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.', $modifiers, $active_visibility_modifiers )); } $this->modifiers = $modifiers; }
php
private function setModifiers(?int $modifiers): void { // Default to private. if ($modifiers === null) { $this->modifiers = \ReflectionProperty::IS_PRIVATE; return; } // Get the number of active visibility modifiers amount all modifies. $active_visibility_modifiers = ((bool) ($modifiers & \ReflectionProperty::IS_PRIVATE)) + ((bool) ($modifiers & \ReflectionProperty::IS_PROTECTED)) + ((bool) ($modifiers & \ReflectionProperty::IS_PUBLIC)); // Not one and only one of private, protected and public is selected, throw exception. if ($active_visibility_modifiers !== 1) { throw new \DomainException(sprintf( '$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.', $modifiers, $active_visibility_modifiers )); } $this->modifiers = $modifiers; }
[ "private", "function", "setModifiers", "(", "?", "int", "$", "modifiers", ")", ":", "void", "{", "// Default to private.", "if", "(", "$", "modifiers", "===", "null", ")", "{", "$", "this", "->", "modifiers", "=", "\\", "ReflectionProperty", "::", "IS_PRIVATE", ";", "return", ";", "}", "// Get the number of active visibility modifiers amount all modifies.", "$", "active_visibility_modifiers", "=", "(", "(", "bool", ")", "(", "$", "modifiers", "&", "\\", "ReflectionProperty", "::", "IS_PRIVATE", ")", ")", "+", "(", "(", "bool", ")", "(", "$", "modifiers", "&", "\\", "ReflectionProperty", "::", "IS_PROTECTED", ")", ")", "+", "(", "(", "bool", ")", "(", "$", "modifiers", "&", "\\", "ReflectionProperty", "::", "IS_PUBLIC", ")", ")", ";", "// Not one and only one of private, protected and public is selected, throw exception.", "if", "(", "$", "active_visibility_modifiers", "!==", "1", ")", "{", "throw", "new", "\\", "DomainException", "(", "sprintf", "(", "'$modifiers (%s) has not ONE of IS_PRIVATE, IS_PROTECTED or IS_PUBLIC set, but found %s.'", ",", "$", "modifiers", ",", "$", "active_visibility_modifiers", ")", ")", ";", "}", "$", "this", "->", "modifiers", "=", "$", "modifiers", ";", "}" ]
Check modifiers for right type and to have at least a visibility bit enabled. Also turns null into private visibility. @throws \InvalidArgumentException @throws \DomainException @param int|null $modifiers
[ "Check", "modifiers", "for", "right", "type", "and", "to", "have", "at", "least", "a", "visibility", "bit", "enabled", ".", "Also", "turns", "null", "into", "private", "visibility", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Reflection/ReflectionProperty.php#L63-L88
27,640
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxorder.php
OxpsPaymorrowOxOrder.finalizeOrder
public function finalizeOrder( \OxidEsales\Eshop\Application\Model\Basket $oBasket, $oUser, $blRecalculatingOrder = false ) { $mReturn = $this->_OxpsPaymorrowOxOrder_finalizeOrder_parent( $oBasket, $oUser, $blRecalculatingOrder ); if ( ( $this->oxorder__oxtransstatus->value == 'OK' ) and $this->_wasPaymorrowPaymentUsed( $oBasket ) ) { $aData = array( 'pm_order_transaction_id' => oxRegistry::get( 'OxpsPaymorrowModule' )->getPaymentTransactionId(), 'order_id' => $this->getId(), 'new_order_id' => $this->getPaymorrowOrderNumber(), ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aData, 'finalizeOrder' ); /** @var OxpsPaymorrowRequestControllerProxy $oPmRequestControllerProxy */ $oPmRequestControllerProxy = oxNew( 'OxpsPaymorrowRequestControllerProxy' ); $oPmRequestControllerProxy->updateOrderId( $aData ); } return $mReturn; }
php
public function finalizeOrder( \OxidEsales\Eshop\Application\Model\Basket $oBasket, $oUser, $blRecalculatingOrder = false ) { $mReturn = $this->_OxpsPaymorrowOxOrder_finalizeOrder_parent( $oBasket, $oUser, $blRecalculatingOrder ); if ( ( $this->oxorder__oxtransstatus->value == 'OK' ) and $this->_wasPaymorrowPaymentUsed( $oBasket ) ) { $aData = array( 'pm_order_transaction_id' => oxRegistry::get( 'OxpsPaymorrowModule' )->getPaymentTransactionId(), 'order_id' => $this->getId(), 'new_order_id' => $this->getPaymorrowOrderNumber(), ); oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $aData, 'finalizeOrder' ); /** @var OxpsPaymorrowRequestControllerProxy $oPmRequestControllerProxy */ $oPmRequestControllerProxy = oxNew( 'OxpsPaymorrowRequestControllerProxy' ); $oPmRequestControllerProxy->updateOrderId( $aData ); } return $mReturn; }
[ "public", "function", "finalizeOrder", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Basket", "$", "oBasket", ",", "$", "oUser", ",", "$", "blRecalculatingOrder", "=", "false", ")", "{", "$", "mReturn", "=", "$", "this", "->", "_OxpsPaymorrowOxOrder_finalizeOrder_parent", "(", "$", "oBasket", ",", "$", "oUser", ",", "$", "blRecalculatingOrder", ")", ";", "if", "(", "(", "$", "this", "->", "oxorder__oxtransstatus", "->", "value", "==", "'OK'", ")", "and", "$", "this", "->", "_wasPaymorrowPaymentUsed", "(", "$", "oBasket", ")", ")", "{", "$", "aData", "=", "array", "(", "'pm_order_transaction_id'", "=>", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowModule'", ")", "->", "getPaymentTransactionId", "(", ")", ",", "'order_id'", "=>", "$", "this", "->", "getId", "(", ")", ",", "'new_order_id'", "=>", "$", "this", "->", "getPaymorrowOrderNumber", "(", ")", ",", ")", ";", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowLogger'", ")", "->", "logWithType", "(", "$", "aData", ",", "'finalizeOrder'", ")", ";", "/** @var OxpsPaymorrowRequestControllerProxy $oPmRequestControllerProxy */", "$", "oPmRequestControllerProxy", "=", "oxNew", "(", "'OxpsPaymorrowRequestControllerProxy'", ")", ";", "$", "oPmRequestControllerProxy", "->", "updateOrderId", "(", "$", "aData", ")", ";", "}", "return", "$", "mReturn", ";", "}" ]
Overridden parent method. Sends an update order Id call to set order number instead of order OXID. Triggers for complete order payed with a Paymorrow payment method. @param \OxidEsales\Eshop\Application\Model\Basket $oBasket @param oxUser $oUser @param bool $blRecalculatingOrder @return mixed
[ "Overridden", "parent", "method", ".", "Sends", "an", "update", "order", "Id", "call", "to", "set", "order", "number", "instead", "of", "order", "OXID", ".", "Triggers", "for", "complete", "order", "payed", "with", "a", "Paymorrow", "payment", "method", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxorder.php#L115-L134
27,641
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxorder.php
OxpsPaymorrowOxOrder.getPaymorrowOxUserPaymentReloaded
public function getPaymorrowOxUserPaymentReloaded() { $sUserPaymentId = $this->oxorder__oxpaymentid->value; /** @var oxUserPayment $oUserPayment */ $oUserPayment = oxNew( 'oxUserPayment' ); $oUserPayment->load( $sUserPaymentId ); return $oUserPayment; }
php
public function getPaymorrowOxUserPaymentReloaded() { $sUserPaymentId = $this->oxorder__oxpaymentid->value; /** @var oxUserPayment $oUserPayment */ $oUserPayment = oxNew( 'oxUserPayment' ); $oUserPayment->load( $sUserPaymentId ); return $oUserPayment; }
[ "public", "function", "getPaymorrowOxUserPaymentReloaded", "(", ")", "{", "$", "sUserPaymentId", "=", "$", "this", "->", "oxorder__oxpaymentid", "->", "value", ";", "/** @var oxUserPayment $oUserPayment */", "$", "oUserPayment", "=", "oxNew", "(", "'oxUserPayment'", ")", ";", "$", "oUserPayment", "->", "load", "(", "$", "sUserPaymentId", ")", ";", "return", "$", "oUserPayment", ";", "}" ]
Get user payment instance related to the order. @return oxUserPayment
[ "Get", "user", "payment", "instance", "related", "to", "the", "order", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxorder.php#L141-L150
27,642
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxorder.php
OxpsPaymorrowOxOrder.getOrderDate
public function getOrderDate() { if ( empty( $this->oxorder__oxorderdate->value ) ) { return ''; } return date( 'Y-m-d', strtotime( $this->oxorder__oxorderdate->value ) ); }
php
public function getOrderDate() { if ( empty( $this->oxorder__oxorderdate->value ) ) { return ''; } return date( 'Y-m-d', strtotime( $this->oxorder__oxorderdate->value ) ); }
[ "public", "function", "getOrderDate", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "oxorder__oxorderdate", "->", "value", ")", ")", "{", "return", "''", ";", "}", "return", "date", "(", "'Y-m-d'", ",", "strtotime", "(", "$", "this", "->", "oxorder__oxorderdate", "->", "value", ")", ")", ";", "}" ]
Get order creation date. @return string
[ "Get", "order", "creation", "date", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxorder.php#L167-L174
27,643
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxorder.php
OxpsPaymorrowOxOrder._wasPaymorrowPaymentUsed
protected function _wasPaymorrowPaymentUsed( oxBasket $oBasket ) { /** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */ $oPayment = oxNew( 'OxpsPaymorrowOxPayment' ); if ( $oPayment->load( $oBasket->getPaymentId() ) and $oPayment->isPaymorrowActiveAndMapped() ) { return true; } return false; }
php
protected function _wasPaymorrowPaymentUsed( oxBasket $oBasket ) { /** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */ $oPayment = oxNew( 'OxpsPaymorrowOxPayment' ); if ( $oPayment->load( $oBasket->getPaymentId() ) and $oPayment->isPaymorrowActiveAndMapped() ) { return true; } return false; }
[ "protected", "function", "_wasPaymorrowPaymentUsed", "(", "oxBasket", "$", "oBasket", ")", "{", "/** @var OxpsPaymorrowOxPayment|oxPayment $oPayment */", "$", "oPayment", "=", "oxNew", "(", "'OxpsPaymorrowOxPayment'", ")", ";", "if", "(", "$", "oPayment", "->", "load", "(", "$", "oBasket", "->", "getPaymentId", "(", ")", ")", "and", "$", "oPayment", "->", "isPaymorrowActiveAndMapped", "(", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check is valid Paymorrow payment method was used in the checkout ir not. @param oxBasket $oBasket @return bool
[ "Check", "is", "valid", "Paymorrow", "payment", "method", "was", "used", "in", "the", "checkout", "ir", "not", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxorder.php#L221-L231
27,644
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxorder.php
OxpsPaymorrowOxOrder._OxpsPaymorrowOxOrder_finalizeOrder_parent
protected function _OxpsPaymorrowOxOrder_finalizeOrder_parent( oxBasket $oBasket, $oUser, $blRecalculatingOrder = false ) { return parent::finalizeOrder( $oBasket, $oUser, $blRecalculatingOrder ); }
php
protected function _OxpsPaymorrowOxOrder_finalizeOrder_parent( oxBasket $oBasket, $oUser, $blRecalculatingOrder = false ) { return parent::finalizeOrder( $oBasket, $oUser, $blRecalculatingOrder ); }
[ "protected", "function", "_OxpsPaymorrowOxOrder_finalizeOrder_parent", "(", "oxBasket", "$", "oBasket", ",", "$", "oUser", ",", "$", "blRecalculatingOrder", "=", "false", ")", "{", "return", "parent", "::", "finalizeOrder", "(", "$", "oBasket", ",", "$", "oUser", ",", "$", "blRecalculatingOrder", ")", ";", "}" ]
Parent `finalizeOrder` function call. @codeCoverageIgnore @param oxBasket $oBasket @param oxUser|null $oUser @param bool $blRecalculatingOrder @return mixed
[ "Parent", "finalizeOrder", "function", "call", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxorder.php#L259-L263
27,645
hostnet/accessor-generator-plugin-lib
src/Twig/PerLineTokenParser.php
PerLineTokenParser.parse
public function parse(Token $token): PerLineNode { $stream = $this->parser->getStream(); // perline is a very simple tag, not having anything more than its name // between the braces, so we expect the closing brace immediately. $stream->expect(Token::BLOCK_END_TYPE); // sub-parse everything until we reach the endperline tag. $body = $this->parser->subparse(function (Token $token) { return $token->test('endperline'); }, true); // make sure our closing tag is also closed neatly and advance the // stream to allow continuation of parsing. $stream->expect(Token::BLOCK_END_TYPE); // turn out body in a nicely formatted PerLineNode return $this->parseBody($body); }
php
public function parse(Token $token): PerLineNode { $stream = $this->parser->getStream(); // perline is a very simple tag, not having anything more than its name // between the braces, so we expect the closing brace immediately. $stream->expect(Token::BLOCK_END_TYPE); // sub-parse everything until we reach the endperline tag. $body = $this->parser->subparse(function (Token $token) { return $token->test('endperline'); }, true); // make sure our closing tag is also closed neatly and advance the // stream to allow continuation of parsing. $stream->expect(Token::BLOCK_END_TYPE); // turn out body in a nicely formatted PerLineNode return $this->parseBody($body); }
[ "public", "function", "parse", "(", "Token", "$", "token", ")", ":", "PerLineNode", "{", "$", "stream", "=", "$", "this", "->", "parser", "->", "getStream", "(", ")", ";", "// perline is a very simple tag, not having anything more than its name", "// between the braces, so we expect the closing brace immediately.", "$", "stream", "->", "expect", "(", "Token", "::", "BLOCK_END_TYPE", ")", ";", "// sub-parse everything until we reach the endperline tag.", "$", "body", "=", "$", "this", "->", "parser", "->", "subparse", "(", "function", "(", "Token", "$", "token", ")", "{", "return", "$", "token", "->", "test", "(", "'endperline'", ")", ";", "}", ",", "true", ")", ";", "// make sure our closing tag is also closed neatly and advance the", "// stream to allow continuation of parsing.", "$", "stream", "->", "expect", "(", "Token", "::", "BLOCK_END_TYPE", ")", ";", "// turn out body in a nicely formatted PerLineNode", "return", "$", "this", "->", "parseBody", "(", "$", "body", ")", ";", "}" ]
Parses perline token and returns PerLineNode. Parse everything within the perline block and then restructure the contents into some thing nice to build a PerLineNode out of. @param Token $token @throws SyntaxError @return PerLineNode
[ "Parses", "perline", "token", "and", "returns", "PerLineNode", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Twig/PerLineTokenParser.php#L48-L67
27,646
hostnet/accessor-generator-plugin-lib
src/Twig/PerLineTokenParser.php
PerLineTokenParser.parseBody
private function parseBody(Node $body): PerLineNode { $prefix = ''; // Text before the (possibly) multi line expression $postfix = ''; // Text before the (possibly) multi line expression $lineno = $body->getTemplateLine(); // The line number where we found the {% perline %} tag // If the body does not contain a list of tags, the body itself is the // only useful content of the perline tags, so we return only the body // tag. This is the case when the perline tags could be removed without // an effect in the generated code. if (count($body) === 0) { return new PerLineNode($body, '', '', $lineno, $this->getTag()); } // Get all the nodes as array, because it will be modified. $nodes = $body->getIterator()->getArrayCopy(); // Check for prefix, the first node should be a text node to have a // prefix. $first = reset($nodes); if ($first instanceof TextNode) { $prefix = $first->getAttribute('data'); array_shift($nodes); } // Check for postfix, the last node should be a text node to have a // postfix. $last = end($nodes); if ($last instanceof TextNode) { $postfix = rtrim($last->getAttribute('data')); array_pop($nodes); } // After we ditched the prefix and postfix there could only be one node // left, ready to be returned and used directly. If there are multiple // we wrap those in a Twig Node. if (count($nodes) === 1) { $nodes = current($nodes); } else { $nodes = new Node($nodes); } // Return the new structured node. return new PerLineNode($nodes, $prefix, $postfix, $lineno, $this->getTag()); }
php
private function parseBody(Node $body): PerLineNode { $prefix = ''; // Text before the (possibly) multi line expression $postfix = ''; // Text before the (possibly) multi line expression $lineno = $body->getTemplateLine(); // The line number where we found the {% perline %} tag // If the body does not contain a list of tags, the body itself is the // only useful content of the perline tags, so we return only the body // tag. This is the case when the perline tags could be removed without // an effect in the generated code. if (count($body) === 0) { return new PerLineNode($body, '', '', $lineno, $this->getTag()); } // Get all the nodes as array, because it will be modified. $nodes = $body->getIterator()->getArrayCopy(); // Check for prefix, the first node should be a text node to have a // prefix. $first = reset($nodes); if ($first instanceof TextNode) { $prefix = $first->getAttribute('data'); array_shift($nodes); } // Check for postfix, the last node should be a text node to have a // postfix. $last = end($nodes); if ($last instanceof TextNode) { $postfix = rtrim($last->getAttribute('data')); array_pop($nodes); } // After we ditched the prefix and postfix there could only be one node // left, ready to be returned and used directly. If there are multiple // we wrap those in a Twig Node. if (count($nodes) === 1) { $nodes = current($nodes); } else { $nodes = new Node($nodes); } // Return the new structured node. return new PerLineNode($nodes, $prefix, $postfix, $lineno, $this->getTag()); }
[ "private", "function", "parseBody", "(", "Node", "$", "body", ")", ":", "PerLineNode", "{", "$", "prefix", "=", "''", ";", "// Text before the (possibly) multi line expression", "$", "postfix", "=", "''", ";", "// Text before the (possibly) multi line expression", "$", "lineno", "=", "$", "body", "->", "getTemplateLine", "(", ")", ";", "// The line number where we found the {% perline %} tag", "// If the body does not contain a list of tags, the body itself is the", "// only useful content of the perline tags, so we return only the body", "// tag. This is the case when the perline tags could be removed without", "// an effect in the generated code.", "if", "(", "count", "(", "$", "body", ")", "===", "0", ")", "{", "return", "new", "PerLineNode", "(", "$", "body", ",", "''", ",", "''", ",", "$", "lineno", ",", "$", "this", "->", "getTag", "(", ")", ")", ";", "}", "// Get all the nodes as array, because it will be modified.", "$", "nodes", "=", "$", "body", "->", "getIterator", "(", ")", "->", "getArrayCopy", "(", ")", ";", "// Check for prefix, the first node should be a text node to have a", "// prefix.", "$", "first", "=", "reset", "(", "$", "nodes", ")", ";", "if", "(", "$", "first", "instanceof", "TextNode", ")", "{", "$", "prefix", "=", "$", "first", "->", "getAttribute", "(", "'data'", ")", ";", "array_shift", "(", "$", "nodes", ")", ";", "}", "// Check for postfix, the last node should be a text node to have a", "// postfix.", "$", "last", "=", "end", "(", "$", "nodes", ")", ";", "if", "(", "$", "last", "instanceof", "TextNode", ")", "{", "$", "postfix", "=", "rtrim", "(", "$", "last", "->", "getAttribute", "(", "'data'", ")", ")", ";", "array_pop", "(", "$", "nodes", ")", ";", "}", "// After we ditched the prefix and postfix there could only be one node", "// left, ready to be returned and used directly. If there are multiple", "// we wrap those in a Twig Node.", "if", "(", "count", "(", "$", "nodes", ")", "===", "1", ")", "{", "$", "nodes", "=", "current", "(", "$", "nodes", ")", ";", "}", "else", "{", "$", "nodes", "=", "new", "Node", "(", "$", "nodes", ")", ";", "}", "// Return the new structured node.", "return", "new", "PerLineNode", "(", "$", "nodes", ",", "$", "prefix", ",", "$", "postfix", ",", "$", "lineno", ",", "$", "this", "->", "getTag", "(", ")", ")", ";", "}" ]
Parse the body into a prefix, postfix and all the other twig nodes that will compile into multiple lines. @param Node $body @return PerLineNode
[ "Parse", "the", "body", "into", "a", "prefix", "postfix", "and", "all", "the", "other", "twig", "nodes", "that", "will", "compile", "into", "multiple", "lines", "." ]
0ff78bed5dddb4bec9fd64500f822a28ce987f62
https://github.com/hostnet/accessor-generator-plugin-lib/blob/0ff78bed5dddb4bec9fd64500f822a28ce987f62/src/Twig/PerLineTokenParser.php#L78-L122
27,647
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.getDomains
protected function getDomains( \Aimeos\MW\View\Iface $view ) { if( ( $domains = $view->param( 'resource' ) ) == '' ) { /** admin/jsonadm/domains * A list of domain names whose clients are available for the JSON API * * The HTTP OPTIONS method returns a list of resources known by the * JSON API including their URLs. The list of available resources * can be exteded dynamically be implementing a new Jsonadm client * class handling request for this new domain. * * To add the new domain client to the list of resources returned * by the HTTP OPTIONS method, you have to add its name in lower case * to the existing configuration. * * @param array List of domain names * @since 2016.01 * @category Developer * @see admin/jsonadm/resources */ $default = array( 'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order', 'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text' ); $domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default ); } return (array) $domains; }
php
protected function getDomains( \Aimeos\MW\View\Iface $view ) { if( ( $domains = $view->param( 'resource' ) ) == '' ) { /** admin/jsonadm/domains * A list of domain names whose clients are available for the JSON API * * The HTTP OPTIONS method returns a list of resources known by the * JSON API including their URLs. The list of available resources * can be exteded dynamically be implementing a new Jsonadm client * class handling request for this new domain. * * To add the new domain client to the list of resources returned * by the HTTP OPTIONS method, you have to add its name in lower case * to the existing configuration. * * @param array List of domain names * @since 2016.01 * @category Developer * @see admin/jsonadm/resources */ $default = array( 'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order', 'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text' ); $domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default ); } return (array) $domains; }
[ "protected", "function", "getDomains", "(", "\\", "Aimeos", "\\", "MW", "\\", "View", "\\", "Iface", "$", "view", ")", "{", "if", "(", "(", "$", "domains", "=", "$", "view", "->", "param", "(", "'resource'", ")", ")", "==", "''", ")", "{", "/** admin/jsonadm/domains\n\t\t\t * A list of domain names whose clients are available for the JSON API\n\t\t\t *\n\t\t\t * The HTTP OPTIONS method returns a list of resources known by the\n\t\t\t * JSON API including their URLs. The list of available resources\n\t\t\t * can be exteded dynamically be implementing a new Jsonadm client\n\t\t\t * class handling request for this new domain.\n\t\t\t *\n\t\t\t * To add the new domain client to the list of resources returned\n\t\t\t * by the HTTP OPTIONS method, you have to add its name in lower case\n\t\t\t * to the existing configuration.\n\t\t\t *\n\t\t\t * @param array List of domain names\n\t\t\t * @since 2016.01\n\t\t\t * @category Developer\n\t\t\t * @see admin/jsonadm/resources\n\t\t\t */", "$", "default", "=", "array", "(", "'attribute'", ",", "'catalog'", ",", "'coupon'", ",", "'customer'", ",", "'locale'", ",", "'media'", ",", "'order'", ",", "'plugin'", ",", "'price'", ",", "'product'", ",", "'service'", ",", "'supplier'", ",", "'stock'", ",", "'tag'", ",", "'text'", ")", ";", "$", "domains", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConfig", "(", ")", "->", "get", "(", "'admin/jsonadm/domains'", ",", "$", "default", ")", ";", "}", "return", "(", "array", ")", "$", "domains", ";", "}" ]
Returns the list of domains that are available as resources @param \Aimeos\MW\View\Iface $view View object with "resource" parameter @return array List of domain names
[ "Returns", "the", "list", "of", "domains", "that", "are", "available", "as", "resources" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L140-L169
27,648
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.getIds
protected function getIds( $request ) { $ids = []; if( isset( $request->data ) ) { foreach( (array) $request->data as $entry ) { if( isset( $entry->id ) ) { $ids[] = $entry->id; } } } return $ids; }
php
protected function getIds( $request ) { $ids = []; if( isset( $request->data ) ) { foreach( (array) $request->data as $entry ) { if( isset( $entry->id ) ) { $ids[] = $entry->id; } } } return $ids; }
[ "protected", "function", "getIds", "(", "$", "request", ")", "{", "$", "ids", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "request", "->", "data", ")", ")", "{", "foreach", "(", "(", "array", ")", "$", "request", "->", "data", "as", "$", "entry", ")", "{", "if", "(", "isset", "(", "$", "entry", "->", "id", ")", ")", "{", "$", "ids", "[", "]", "=", "$", "entry", "->", "id", ";", "}", "}", "}", "return", "$", "ids", ";", "}" ]
Returns the IDs sent in the request body @param \stdClass $request Decoded request body @return array List of item IDs
[ "Returns", "the", "IDs", "sent", "in", "the", "request", "body" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L178-L193
27,649
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.getRefItems
protected function getRefItems( array $listItems ) { $list = $map = []; $context = $this->getContext(); foreach( $listItems as $listItem ) { $map[$listItem->getDomain()][] = $listItem->getRefId(); } foreach( $map as $domain => $ids ) { $manager = \Aimeos\MShop::create( $context, $domain ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', str_replace( '/', '.', $domain ) . '.id', $ids ) ); $list = array_merge( $list, $manager->searchItems( $search ) ); } return $list; }
php
protected function getRefItems( array $listItems ) { $list = $map = []; $context = $this->getContext(); foreach( $listItems as $listItem ) { $map[$listItem->getDomain()][] = $listItem->getRefId(); } foreach( $map as $domain => $ids ) { $manager = \Aimeos\MShop::create( $context, $domain ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', str_replace( '/', '.', $domain ) . '.id', $ids ) ); $list = array_merge( $list, $manager->searchItems( $search ) ); } return $list; }
[ "protected", "function", "getRefItems", "(", "array", "$", "listItems", ")", "{", "$", "list", "=", "$", "map", "=", "[", "]", ";", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "foreach", "(", "$", "listItems", "as", "$", "listItem", ")", "{", "$", "map", "[", "$", "listItem", "->", "getDomain", "(", ")", "]", "[", "]", "=", "$", "listItem", "->", "getRefId", "(", ")", ";", "}", "foreach", "(", "$", "map", "as", "$", "domain", "=>", "$", "ids", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "context", ",", "$", "domain", ")", ";", "$", "search", "=", "$", "manager", "->", "createSearch", "(", ")", ";", "$", "search", "->", "setConditions", "(", "$", "search", "->", "compare", "(", "'=='", ",", "str_replace", "(", "'/'", ",", "'.'", ",", "$", "domain", ")", ".", "'.id'", ",", "$", "ids", ")", ")", ";", "$", "list", "=", "array_merge", "(", "$", "list", ",", "$", "manager", "->", "searchItems", "(", "$", "search", ")", ")", ";", "}", "return", "$", "list", ";", "}" ]
Returns the items associated via a lists table @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
[ "Returns", "the", "items", "associated", "via", "a", "lists", "table" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L226-L246
27,650
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.getAllowedResources
protected function getAllowedResources( \Aimeos\MW\View\Iface $view, array $resources ) { $config = $this->getContext()->getConfig(); $allowed = []; foreach( $resources as $resource ) { if( $view->access( $config->get( 'admin/jsonadm/resource/' . $resource . '/groups', [] ) ) === true ) { $allowed[] = $resource; } } return $allowed; }
php
protected function getAllowedResources( \Aimeos\MW\View\Iface $view, array $resources ) { $config = $this->getContext()->getConfig(); $allowed = []; foreach( $resources as $resource ) { if( $view->access( $config->get( 'admin/jsonadm/resource/' . $resource . '/groups', [] ) ) === true ) { $allowed[] = $resource; } } return $allowed; }
[ "protected", "function", "getAllowedResources", "(", "\\", "Aimeos", "\\", "MW", "\\", "View", "\\", "Iface", "$", "view", ",", "array", "$", "resources", ")", "{", "$", "config", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConfig", "(", ")", ";", "$", "allowed", "=", "[", "]", ";", "foreach", "(", "$", "resources", "as", "$", "resource", ")", "{", "if", "(", "$", "view", "->", "access", "(", "$", "config", "->", "get", "(", "'admin/jsonadm/resource/'", ".", "$", "resource", ".", "'/groups'", ",", "[", "]", ")", ")", "===", "true", ")", "{", "$", "allowed", "[", "]", "=", "$", "resource", ";", "}", "}", "return", "$", "allowed", ";", "}" ]
Returns the list of allowed resources @param \Aimeos\MW\View\Iface $view View object with "access" helper @param array List of all available resources @return array List of allowed resources
[ "Returns", "the", "list", "of", "allowed", "resources" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L256-L269
27,651
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.saveData
protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) { $data = []; if( isset( $request->data ) ) { foreach( (array) $request->data as $entry ) { $data[] = $this->saveEntry( $manager, $entry ); } } return $data; }
php
protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) { $data = []; if( isset( $request->data ) ) { foreach( (array) $request->data as $entry ) { $data[] = $this->saveEntry( $manager, $entry ); } } return $data; }
[ "protected", "function", "saveData", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Common", "\\", "Manager", "\\", "Iface", "$", "manager", ",", "\\", "stdClass", "$", "request", ")", "{", "$", "data", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "request", "->", "data", ")", ")", "{", "foreach", "(", "(", "array", ")", "$", "request", "->", "data", "as", "$", "entry", ")", "{", "$", "data", "[", "]", "=", "$", "this", "->", "saveEntry", "(", "$", "manager", ",", "$", "entry", ")", ";", "}", "}", "return", "$", "data", ";", "}" ]
Creates of updates several items at once @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items @param \stdClass $request Object with request body data @return array List of items
[ "Creates", "of", "updates", "several", "items", "at", "once" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L398-L410
27,652
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Base.php
Base.saveRelationships
protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager, \Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships ) { $id = $item->getId(); $listManager = $manager->getSubManager( 'lists' ); foreach( (array) $relationships as $domain => $list ) { if( isset( $list->data ) ) { foreach( (array) $list->data as $data ) { $listItem = $listManager->createItem(); if( isset( $data->attributes ) && ( $attr = (array) $data->attributes ) ) { $item = $item->fromArray( $attr, true ); } if( isset( $data->id ) ) { $listItem->setRefId( $data->id ); } $listItem->setParentId( $id ); $listItem->setDomain( $domain ); $listManager->saveItem( $listItem, false ); } } } }
php
protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager, \Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships ) { $id = $item->getId(); $listManager = $manager->getSubManager( 'lists' ); foreach( (array) $relationships as $domain => $list ) { if( isset( $list->data ) ) { foreach( (array) $list->data as $data ) { $listItem = $listManager->createItem(); if( isset( $data->attributes ) && ( $attr = (array) $data->attributes ) ) { $item = $item->fromArray( $attr, true ); } if( isset( $data->id ) ) { $listItem->setRefId( $data->id ); } $listItem->setParentId( $id ); $listItem->setDomain( $domain ); $listManager->saveItem( $listItem, false ); } } } }
[ "protected", "function", "saveRelationships", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Common", "\\", "Manager", "\\", "Iface", "$", "manager", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Common", "\\", "Item", "\\", "Iface", "$", "item", ",", "\\", "stdClass", "$", "relationships", ")", "{", "$", "id", "=", "$", "item", "->", "getId", "(", ")", ";", "$", "listManager", "=", "$", "manager", "->", "getSubManager", "(", "'lists'", ")", ";", "foreach", "(", "(", "array", ")", "$", "relationships", "as", "$", "domain", "=>", "$", "list", ")", "{", "if", "(", "isset", "(", "$", "list", "->", "data", ")", ")", "{", "foreach", "(", "(", "array", ")", "$", "list", "->", "data", "as", "$", "data", ")", "{", "$", "listItem", "=", "$", "listManager", "->", "createItem", "(", ")", ";", "if", "(", "isset", "(", "$", "data", "->", "attributes", ")", "&&", "(", "$", "attr", "=", "(", "array", ")", "$", "data", "->", "attributes", ")", ")", "{", "$", "item", "=", "$", "item", "->", "fromArray", "(", "$", "attr", ",", "true", ")", ";", "}", "if", "(", "isset", "(", "$", "data", "->", "id", ")", ")", "{", "$", "listItem", "->", "setRefId", "(", "$", "data", "->", "id", ")", ";", "}", "$", "listItem", "->", "setParentId", "(", "$", "id", ")", ";", "$", "listItem", "->", "setDomain", "(", "$", "domain", ")", ";", "$", "listManager", "->", "saveItem", "(", "$", "listItem", ",", "false", ")", ";", "}", "}", "}", "}" ]
Saves the item references associated via the list @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set @param \stdClass $relationships Object including the <domain>/data/attributes structure
[ "Saves", "the", "item", "references", "associated", "via", "the", "list" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Base.php#L449-L478
27,653
contributte/thepay-api
src/PermanentPayment.php
PermanentPayment.getSignatureLite
public function getSignatureLite(): string { $data = [ 'merchantId' => $this->getMerchantConfig()->merchantId, 'accountId' => $this->getMerchantConfig()->accountId, 'merchantData' => $this->getMerchantData(), 'password' => $this->getMerchantConfig()->password, ]; return md5( http_build_query( array_filter($data) ) ); }
php
public function getSignatureLite(): string { $data = [ 'merchantId' => $this->getMerchantConfig()->merchantId, 'accountId' => $this->getMerchantConfig()->accountId, 'merchantData' => $this->getMerchantData(), 'password' => $this->getMerchantConfig()->password, ]; return md5( http_build_query( array_filter($data) ) ); }
[ "public", "function", "getSignatureLite", "(", ")", ":", "string", "{", "$", "data", "=", "[", "'merchantId'", "=>", "$", "this", "->", "getMerchantConfig", "(", ")", "->", "merchantId", ",", "'accountId'", "=>", "$", "this", "->", "getMerchantConfig", "(", ")", "->", "accountId", ",", "'merchantData'", "=>", "$", "this", "->", "getMerchantData", "(", ")", ",", "'password'", "=>", "$", "this", "->", "getMerchantConfig", "(", ")", "->", "password", ",", "]", ";", "return", "md5", "(", "http_build_query", "(", "array_filter", "(", "$", "data", ")", ")", ")", ";", "}" ]
Version of the getSignature method. Used by getPermanentPayment call.
[ "Version", "of", "the", "getSignature", "method", ".", "Used", "by", "getPermanentPayment", "call", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/PermanentPayment.php#L94-L108
27,654
OXID-eSales/paymorrow-module
core/oxpspaymorrowclient.php
OxpsPaymorrowClient.signRequest
public function signRequest( $sRequestString ) { $hPrivateKey = openssl_get_privatekey( oxRegistry::get( 'OxpsPaymorrowSettings' )->getPrivateKey() ); openssl_sign( $sRequestString, $bSignature, $hPrivateKey ); return bin2hex( $bSignature ); }
php
public function signRequest( $sRequestString ) { $hPrivateKey = openssl_get_privatekey( oxRegistry::get( 'OxpsPaymorrowSettings' )->getPrivateKey() ); openssl_sign( $sRequestString, $bSignature, $hPrivateKey ); return bin2hex( $bSignature ); }
[ "public", "function", "signRequest", "(", "$", "sRequestString", ")", "{", "$", "hPrivateKey", "=", "openssl_get_privatekey", "(", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowSettings'", ")", "->", "getPrivateKey", "(", ")", ")", ";", "openssl_sign", "(", "$", "sRequestString", ",", "$", "bSignature", ",", "$", "hPrivateKey", ")", ";", "return", "bin2hex", "(", "$", "bSignature", ")", ";", "}" ]
Overridden parent method. Loads private key from the module settings to sign request data. @param string $sRequestString @return string
[ "Overridden", "parent", "method", ".", "Loads", "private", "key", "from", "the", "module", "settings", "to", "sign", "request", "data", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowclient.php#L48-L57
27,655
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Common/Factory/Base.php
Base.addClientDecorators
protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client, \Aimeos\MShop\Context\Item\Iface $context, $path ) { $config = $context->getConfig(); /** admin/jsonadm/common/decorators/default * Configures the list of decorators applied to all JSON API clients * * Decorators extend the functionality of a class by adding new aspects * (e.g. log what is currently done), executing the methods of the underlying * class only in certain conditions (e.g. only for logged in users) or * modify what is returned to the caller. * * This option allows you to configure a list of decorator names that should * be wrapped around the original instance of all created clients: * * admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' ) * * This would wrap the decorators named "decorator1" and "decorator2" around * all client instances in that order. The decorator classes would be * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator1" and * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator2". * * @param array List of decorator names * @since 2015.12 * @category Developer */ $decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] ); if( $path !== null && is_string( $path ) ) { $dpath = trim( $path, '/' ); $dpath = ( $dpath !== '' ? $dpath . '/' : $dpath ); $excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] ); $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); foreach( $decorators as $key => $name ) { if( in_array( $name, $excludes ) ) { unset( $decorators[$key] ); } } $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] ); $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); if( !empty( $path ) ) { $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\'; $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] ); $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); } } else { $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); } return $client; }
php
protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client, \Aimeos\MShop\Context\Item\Iface $context, $path ) { $config = $context->getConfig(); /** admin/jsonadm/common/decorators/default * Configures the list of decorators applied to all JSON API clients * * Decorators extend the functionality of a class by adding new aspects * (e.g. log what is currently done), executing the methods of the underlying * class only in certain conditions (e.g. only for logged in users) or * modify what is returned to the caller. * * This option allows you to configure a list of decorator names that should * be wrapped around the original instance of all created clients: * * admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' ) * * This would wrap the decorators named "decorator1" and "decorator2" around * all client instances in that order. The decorator classes would be * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator1" and * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator2". * * @param array List of decorator names * @since 2015.12 * @category Developer */ $decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] ); if( $path !== null && is_string( $path ) ) { $dpath = trim( $path, '/' ); $dpath = ( $dpath !== '' ? $dpath . '/' : $dpath ); $excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] ); $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); foreach( $decorators as $key => $name ) { if( in_array( $name, $excludes ) ) { unset( $decorators[$key] ); } } $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] ); $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); if( !empty( $path ) ) { $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\'; $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] ); $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); } } else { $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; $client = self::addDecorators( $client, $decorators, $classprefix, $context, $path ); } return $client; }
[ "protected", "static", "function", "addClientDecorators", "(", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Iface", "$", "client", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "$", "path", ")", "{", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ";", "/** admin/jsonadm/common/decorators/default\n\t\t * Configures the list of decorators applied to all JSON API clients\n\t\t *\n\t\t * Decorators extend the functionality of a class by adding new aspects\n\t\t * (e.g. log what is currently done), executing the methods of the underlying\n\t\t * class only in certain conditions (e.g. only for logged in users) or\n\t\t * modify what is returned to the caller.\n\t\t *\n\t\t * This option allows you to configure a list of decorator names that should\n\t\t * be wrapped around the original instance of all created clients:\n\t\t *\n\t\t * admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' )\n\t\t *\n\t\t * This would wrap the decorators named \"decorator1\" and \"decorator2\" around\n\t\t * all client instances in that order. The decorator classes would be\n\t\t * \"\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\Decorator1\" and\n\t\t * \"\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\Decorator2\".\n\t\t *\n\t\t * @param array List of decorator names\n\t\t * @since 2015.12\n\t\t * @category Developer\n\t\t */", "$", "decorators", "=", "$", "config", "->", "get", "(", "'admin/jsonadm/common/decorators/default'", ",", "[", "]", ")", ";", "if", "(", "$", "path", "!==", "null", "&&", "is_string", "(", "$", "path", ")", ")", "{", "$", "dpath", "=", "trim", "(", "$", "path", ",", "'/'", ")", ";", "$", "dpath", "=", "(", "$", "dpath", "!==", "''", "?", "$", "dpath", ".", "'/'", ":", "$", "dpath", ")", ";", "$", "excludes", "=", "$", "config", "->", "get", "(", "'admin/jsonadm/'", ".", "$", "dpath", ".", "'decorators/excludes'", ",", "[", "]", ")", ";", "$", "localClass", "=", "str_replace", "(", "' '", ",", "'\\\\'", ",", "ucwords", "(", "str_replace", "(", "'/'", ",", "' '", ",", "$", "path", ")", ")", ")", ";", "foreach", "(", "$", "decorators", "as", "$", "key", "=>", "$", "name", ")", "{", "if", "(", "in_array", "(", "$", "name", ",", "$", "excludes", ")", ")", "{", "unset", "(", "$", "decorators", "[", "$", "key", "]", ")", ";", "}", "}", "$", "classprefix", "=", "'\\\\Aimeos\\\\Admin\\\\JsonAdm\\\\Common\\\\Decorator\\\\'", ";", "$", "decorators", "=", "$", "config", "->", "get", "(", "'admin/jsonadm/'", ".", "$", "dpath", ".", "'decorators/global'", ",", "[", "]", ")", ";", "$", "client", "=", "self", "::", "addDecorators", "(", "$", "client", ",", "$", "decorators", ",", "$", "classprefix", ",", "$", "context", ",", "$", "path", ")", ";", "if", "(", "!", "empty", "(", "$", "path", ")", ")", "{", "$", "classprefix", "=", "'\\\\Aimeos\\\\Admin\\\\JsonAdm\\\\'", ".", "ucfirst", "(", "$", "localClass", ")", ".", "'\\\\Decorator\\\\'", ";", "$", "decorators", "=", "$", "config", "->", "get", "(", "'admin/jsonadm/'", ".", "$", "dpath", ".", "'decorators/local'", ",", "[", "]", ")", ";", "$", "client", "=", "self", "::", "addDecorators", "(", "$", "client", ",", "$", "decorators", ",", "$", "classprefix", ",", "$", "context", ",", "$", "path", ")", ";", "}", "}", "else", "{", "$", "classprefix", "=", "'\\\\Aimeos\\\\Admin\\\\JsonAdm\\\\Common\\\\Decorator\\\\'", ";", "$", "client", "=", "self", "::", "addDecorators", "(", "$", "client", ",", "$", "decorators", ",", "$", "classprefix", ",", "$", "context", ",", "$", "path", ")", ";", "}", "return", "$", "client", ";", "}" ]
Adds the decorators to the JSON API client object @param \Aimeos\Admin\JsonAdm\Common\Iface $client Client object @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects @param string $path Name of the client separated by slashes, e.g "product/property" @return \Aimeos\Admin\JsonAdm\Common\Iface Client object
[ "Adds", "the", "decorators", "to", "the", "JSON", "API", "client", "object" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Common/Factory/Base.php#L48-L110
27,656
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuserpayment.php
OxpsPaymorrowOxUserPayment.load
public function load( $sOxId ) { $sSQL = sprintf( 'SELECT `OXID`, `OXUSERID`, `OXPAYMENTSID`, DECODE( `OXVALUE`, "%s" ) AS `OXVALUE`, `OXPSPAYMORROWBANKNAME`, `OXPSPAYMORROWIBAN`, `OXPSPAYMORROWBIC`, `OXPSPAYMORROWORDERID` FROM `oxuserpayments` WHERE `OXID` = %s', $this->getPaymentKey(), oxDb::getDb()->quote( $sOxId ) ); return $this->assignRecord( $sSQL ); }
php
public function load( $sOxId ) { $sSQL = sprintf( 'SELECT `OXID`, `OXUSERID`, `OXPAYMENTSID`, DECODE( `OXVALUE`, "%s" ) AS `OXVALUE`, `OXPSPAYMORROWBANKNAME`, `OXPSPAYMORROWIBAN`, `OXPSPAYMORROWBIC`, `OXPSPAYMORROWORDERID` FROM `oxuserpayments` WHERE `OXID` = %s', $this->getPaymentKey(), oxDb::getDb()->quote( $sOxId ) ); return $this->assignRecord( $sSQL ); }
[ "public", "function", "load", "(", "$", "sOxId", ")", "{", "$", "sSQL", "=", "sprintf", "(", "'SELECT `OXID`, `OXUSERID`, `OXPAYMENTSID`, DECODE( `OXVALUE`, \"%s\" ) AS `OXVALUE`,\n `OXPSPAYMORROWBANKNAME`, `OXPSPAYMORROWIBAN`, `OXPSPAYMORROWBIC`, `OXPSPAYMORROWORDERID`\n FROM `oxuserpayments` WHERE `OXID` = %s'", ",", "$", "this", "->", "getPaymentKey", "(", ")", ",", "oxDb", "::", "getDb", "(", ")", "->", "quote", "(", "$", "sOxId", ")", ")", ";", "return", "$", "this", "->", "assignRecord", "(", "$", "sSQL", ")", ";", "}" ]
Overridden `load` function - loads additional Paymorrow fields in oxUserPayments table. Loads user payment object. @param string $sOxId @return mixed
[ "Overridden", "load", "function", "-", "loads", "additional", "Paymorrow", "fields", "in", "oxUserPayments", "table", ".", "Loads", "user", "payment", "object", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuserpayment.php#L130-L141
27,657
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuserpayment.php
OxpsPaymorrowOxUserPayment.isUserPaymentPaymorrowMethod
public function isUserPaymentPaymorrowMethod() { $sPaymentId = $this->oxuserpayments__oxpaymentsid->value; /** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */ $oxPayment = oxNew( 'oxPayment' ); $oxPayment->load( $sPaymentId ); return $oxPayment->isPaymorrowActiveAndMapped(); }
php
public function isUserPaymentPaymorrowMethod() { $sPaymentId = $this->oxuserpayments__oxpaymentsid->value; /** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */ $oxPayment = oxNew( 'oxPayment' ); $oxPayment->load( $sPaymentId ); return $oxPayment->isPaymorrowActiveAndMapped(); }
[ "public", "function", "isUserPaymentPaymorrowMethod", "(", ")", "{", "$", "sPaymentId", "=", "$", "this", "->", "oxuserpayments__oxpaymentsid", "->", "value", ";", "/** @var OxpsPaymorrowOxPayment|oxPayment $oxPayment */", "$", "oxPayment", "=", "oxNew", "(", "'oxPayment'", ")", ";", "$", "oxPayment", "->", "load", "(", "$", "sPaymentId", ")", ";", "return", "$", "oxPayment", "->", "isPaymorrowActiveAndMapped", "(", ")", ";", "}" ]
Check if user payment method is mapped to a Paymorrow payment method. @return bool
[ "Check", "if", "user", "payment", "method", "is", "mapped", "to", "a", "Paymorrow", "payment", "method", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuserpayment.php#L148-L157
27,658
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxuserpayment.php
OxpsPaymorrowOxUserPayment.getPaymorrowOxPayment
public function getPaymorrowOxPayment() { $sPaymentId = $this->oxuserpayments__oxpaymentsid->value; $oPayment = oxNew( 'oxPayment' ); $oPayment->load( $sPaymentId ); return $oPayment; }
php
public function getPaymorrowOxPayment() { $sPaymentId = $this->oxuserpayments__oxpaymentsid->value; $oPayment = oxNew( 'oxPayment' ); $oPayment->load( $sPaymentId ); return $oPayment; }
[ "public", "function", "getPaymorrowOxPayment", "(", ")", "{", "$", "sPaymentId", "=", "$", "this", "->", "oxuserpayments__oxpaymentsid", "->", "value", ";", "$", "oPayment", "=", "oxNew", "(", "'oxPayment'", ")", ";", "$", "oPayment", "->", "load", "(", "$", "sPaymentId", ")", ";", "return", "$", "oPayment", ";", "}" ]
Get related payment method. Used in custom paymorrow email templates. @return oxPayment
[ "Get", "related", "payment", "method", ".", "Used", "in", "custom", "paymorrow", "email", "templates", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxuserpayment.php#L165-L173
27,659
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket.getPaymorrowBasketLineItems
public function getPaymorrowBasketLineItems() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $aBasketContents = $this->getContents(); if ( empty( $aBasketContents ) ) { return array(); } $iLineItemCount = 1; // must start from 1 $aLineItems = array(); /** @var oxBasketItem|OxpsPaymorrowOxBasketItem $oBasketItem */ foreach ( $aBasketContents as $oBasketItem ) { $aLineItems = array_merge( $aLineItems, $oBasketItem->getPaymorrowBasketItemSummary( $iLineItemCount ) ); $iLineItemCount++; } /** * Checks for additional Payment, Wrapping, Gift Card, Delivery/Shipping, Vouchers, * TS Protection - costs */ $aLineItems = array_merge( $aLineItems, $this->_getPaymorrowAdditionalCostsSummary( $iLineItemCount ) ); return $aLineItems; }
php
public function getPaymorrowBasketLineItems() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $aBasketContents = $this->getContents(); if ( empty( $aBasketContents ) ) { return array(); } $iLineItemCount = 1; // must start from 1 $aLineItems = array(); /** @var oxBasketItem|OxpsPaymorrowOxBasketItem $oBasketItem */ foreach ( $aBasketContents as $oBasketItem ) { $aLineItems = array_merge( $aLineItems, $oBasketItem->getPaymorrowBasketItemSummary( $iLineItemCount ) ); $iLineItemCount++; } /** * Checks for additional Payment, Wrapping, Gift Card, Delivery/Shipping, Vouchers, * TS Protection - costs */ $aLineItems = array_merge( $aLineItems, $this->_getPaymorrowAdditionalCostsSummary( $iLineItemCount ) ); return $aLineItems; }
[ "public", "function", "getPaymorrowBasketLineItems", "(", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "aBasketContents", "=", "$", "this", "->", "getContents", "(", ")", ";", "if", "(", "empty", "(", "$", "aBasketContents", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "iLineItemCount", "=", "1", ";", "// must start from 1", "$", "aLineItems", "=", "array", "(", ")", ";", "/** @var oxBasketItem|OxpsPaymorrowOxBasketItem $oBasketItem */", "foreach", "(", "$", "aBasketContents", "as", "$", "oBasketItem", ")", "{", "$", "aLineItems", "=", "array_merge", "(", "$", "aLineItems", ",", "$", "oBasketItem", "->", "getPaymorrowBasketItemSummary", "(", "$", "iLineItemCount", ")", ")", ";", "$", "iLineItemCount", "++", ";", "}", "/**\n * Checks for additional Payment, Wrapping, Gift Card, Delivery/Shipping, Vouchers,\n * TS Protection - costs\n */", "$", "aLineItems", "=", "array_merge", "(", "$", "aLineItems", ",", "$", "this", "->", "_getPaymorrowAdditionalCostsSummary", "(", "$", "iLineItemCount", ")", ")", ";", "return", "$", "aLineItems", ";", "}" ]
Get line items array - summary of bought products, costs and vouchers. @for: OxpsPaymorrowEshopDataProvider @return array
[ "Get", "line", "items", "array", "-", "summary", "of", "bought", "products", "costs", "and", "vouchers", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L48-L75
27,660
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket.getPaymorrowTotalAmount
public function getPaymorrowTotalAmount() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $dTotalPrice = (double) $this->getPrice()->getPrice(); // Add surcharge price in case it is not yet included in basket $oSurchargePrice = $this->_getPaymentMethodSurcharge(); if ( !empty( $oSurchargePrice ) and is_object( $oSurchargePrice ) ) { $dTotalPrice += (double) $oSurchargePrice->getPrice(); } return $dTotalPrice; }
php
public function getPaymorrowTotalAmount() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $dTotalPrice = (double) $this->getPrice()->getPrice(); // Add surcharge price in case it is not yet included in basket $oSurchargePrice = $this->_getPaymentMethodSurcharge(); if ( !empty( $oSurchargePrice ) and is_object( $oSurchargePrice ) ) { $dTotalPrice += (double) $oSurchargePrice->getPrice(); } return $dTotalPrice; }
[ "public", "function", "getPaymorrowTotalAmount", "(", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "dTotalPrice", "=", "(", "double", ")", "$", "this", "->", "getPrice", "(", ")", "->", "getPrice", "(", ")", ";", "// Add surcharge price in case it is not yet included in basket", "$", "oSurchargePrice", "=", "$", "this", "->", "_getPaymentMethodSurcharge", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "oSurchargePrice", ")", "and", "is_object", "(", "$", "oSurchargePrice", ")", ")", "{", "$", "dTotalPrice", "+=", "(", "double", ")", "$", "oSurchargePrice", "->", "getPrice", "(", ")", ";", "}", "return", "$", "dTotalPrice", ";", "}" ]
Get basket total amount. Also adds surcharge amount if it is needed. @return float
[ "Get", "basket", "total", "amount", ".", "Also", "adds", "surcharge", "amount", "if", "it", "is", "needed", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L93-L107
27,661
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getPaymorrowAdditionalCostsSummary
protected function _getPaymorrowAdditionalCostsSummary( $iLineItemCount ) { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ // Line Item numbering after all basket items were summarized $iLineItem = (int) $iLineItemCount; // Get cost and add costs VATs list( $aCostItems, $iLineItem ) = $this->_getDefaultCostsSummary( $iLineItem ); // Get payment method surcharge item data in case payment form have just been posted $aItemData = (array) $this->_getPaymentMethodSurcharge( $iLineItem ); if ( !empty( $aItemData ) ) { $aCostItems = array_merge( $aCostItems, $aItemData ); $iLineItem++; } // Add voucher discount line item if ( $this->getVoucherDiscount() and $this->getVoucherDiscount()->getBruttoPrice() != 0 ) { $aCostItems = array_merge( $aCostItems, $this->_getPaymorrowVouchersSummary( $iLineItem ) ); } return $aCostItems; }
php
protected function _getPaymorrowAdditionalCostsSummary( $iLineItemCount ) { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ // Line Item numbering after all basket items were summarized $iLineItem = (int) $iLineItemCount; // Get cost and add costs VATs list( $aCostItems, $iLineItem ) = $this->_getDefaultCostsSummary( $iLineItem ); // Get payment method surcharge item data in case payment form have just been posted $aItemData = (array) $this->_getPaymentMethodSurcharge( $iLineItem ); if ( !empty( $aItemData ) ) { $aCostItems = array_merge( $aCostItems, $aItemData ); $iLineItem++; } // Add voucher discount line item if ( $this->getVoucherDiscount() and $this->getVoucherDiscount()->getBruttoPrice() != 0 ) { $aCostItems = array_merge( $aCostItems, $this->_getPaymorrowVouchersSummary( $iLineItem ) ); } return $aCostItems; }
[ "protected", "function", "_getPaymorrowAdditionalCostsSummary", "(", "$", "iLineItemCount", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "// Line Item numbering after all basket items were summarized", "$", "iLineItem", "=", "(", "int", ")", "$", "iLineItemCount", ";", "// Get cost and add costs VATs", "list", "(", "$", "aCostItems", ",", "$", "iLineItem", ")", "=", "$", "this", "->", "_getDefaultCostsSummary", "(", "$", "iLineItem", ")", ";", "// Get payment method surcharge item data in case payment form have just been posted", "$", "aItemData", "=", "(", "array", ")", "$", "this", "->", "_getPaymentMethodSurcharge", "(", "$", "iLineItem", ")", ";", "if", "(", "!", "empty", "(", "$", "aItemData", ")", ")", "{", "$", "aCostItems", "=", "array_merge", "(", "$", "aCostItems", ",", "$", "aItemData", ")", ";", "$", "iLineItem", "++", ";", "}", "// Add voucher discount line item", "if", "(", "$", "this", "->", "getVoucherDiscount", "(", ")", "and", "$", "this", "->", "getVoucherDiscount", "(", ")", "->", "getBruttoPrice", "(", ")", "!=", "0", ")", "{", "$", "aCostItems", "=", "array_merge", "(", "$", "aCostItems", ",", "$", "this", "->", "_getPaymorrowVouchersSummary", "(", "$", "iLineItem", ")", ")", ";", "}", "return", "$", "aCostItems", ";", "}" ]
Checks if there are any additional costs and returns Line Items array as summary. @param int $iLineItemCount @return array
[ "Checks", "if", "there", "are", "any", "additional", "costs", "and", "returns", "Line", "Items", "array", "as", "summary", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L160-L184
27,662
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getDefaultCostsSummary
protected function _getDefaultCostsSummary( $iLineItem ) { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $aCostItems = array(); $aCosts = (array) $this->getCosts(); foreach ( $aCosts as $sCost => $oPrice ) { $aItemData = (array) $this->_validateCostPriceAndGetItsData( $oPrice, $iLineItem, $sCost ); if ( !empty( $aItemData ) ) { $aCostItems = array_merge( $aCostItems, $aItemData ); $iLineItem++; } } return array($aCostItems, $iLineItem); }
php
protected function _getDefaultCostsSummary( $iLineItem ) { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $aCostItems = array(); $aCosts = (array) $this->getCosts(); foreach ( $aCosts as $sCost => $oPrice ) { $aItemData = (array) $this->_validateCostPriceAndGetItsData( $oPrice, $iLineItem, $sCost ); if ( !empty( $aItemData ) ) { $aCostItems = array_merge( $aCostItems, $aItemData ); $iLineItem++; } } return array($aCostItems, $iLineItem); }
[ "protected", "function", "_getDefaultCostsSummary", "(", "$", "iLineItem", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "aCostItems", "=", "array", "(", ")", ";", "$", "aCosts", "=", "(", "array", ")", "$", "this", "->", "getCosts", "(", ")", ";", "foreach", "(", "$", "aCosts", "as", "$", "sCost", "=>", "$", "oPrice", ")", "{", "$", "aItemData", "=", "(", "array", ")", "$", "this", "->", "_validateCostPriceAndGetItsData", "(", "$", "oPrice", ",", "$", "iLineItem", ",", "$", "sCost", ")", ";", "if", "(", "!", "empty", "(", "$", "aItemData", ")", ")", "{", "$", "aCostItems", "=", "array_merge", "(", "$", "aCostItems", ",", "$", "aItemData", ")", ";", "$", "iLineItem", "++", ";", "}", "}", "return", "array", "(", "$", "aCostItems", ",", "$", "iLineItem", ")", ";", "}" ]
Load default shop costs and extract lite items summary. @param int $iLineItem @return array Mixed array with line items array as first element and new line count as second element.
[ "Load", "default", "shop", "costs", "and", "extract", "lite", "items", "summary", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L193-L211
27,663
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._validateCostPriceAndGetItsData
protected function _validateCostPriceAndGetItsData( $mPrice, $iLineItem, $sCost ) { if ( empty( $mPrice ) or !is_object( $mPrice ) or !$mPrice->getPrice() ) { return array(); } return $aItemData = (array) $this->_getCostSummary( $iLineItem, $sCost, $mPrice ); }
php
protected function _validateCostPriceAndGetItsData( $mPrice, $iLineItem, $sCost ) { if ( empty( $mPrice ) or !is_object( $mPrice ) or !$mPrice->getPrice() ) { return array(); } return $aItemData = (array) $this->_getCostSummary( $iLineItem, $sCost, $mPrice ); }
[ "protected", "function", "_validateCostPriceAndGetItsData", "(", "$", "mPrice", ",", "$", "iLineItem", ",", "$", "sCost", ")", "{", "if", "(", "empty", "(", "$", "mPrice", ")", "or", "!", "is_object", "(", "$", "mPrice", ")", "or", "!", "$", "mPrice", "->", "getPrice", "(", ")", ")", "{", "return", "array", "(", ")", ";", "}", "return", "$", "aItemData", "=", "(", "array", ")", "$", "this", "->", "_getCostSummary", "(", "$", "iLineItem", ",", "$", "sCost", ",", "$", "mPrice", ")", ";", "}" ]
Validate cost price and get cost line item data array for a valid cost. @param null|oxPrice $mPrice @param int $iLineItem @param string $sCost @return array
[ "Validate", "cost", "price", "and", "get", "cost", "line", "item", "data", "array", "for", "a", "valid", "cost", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L222-L229
27,664
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getCostSummary
protected function _getCostSummary( $iLineItem, $sCostName, $oPrice ) { $sPmPrefix = OxpsPaymorrowOxBasketItem::getPaymorrowBasketSummaryLineItemPrefix( $iLineItem ); list( $sId, $sName, $sType ) = $this->_getCostMetadata( $sCostName ); if ( empty( $sId ) ) { return array(); } $this->filterCostPrice($oPrice, $sCostName); return array( $sPmPrefix . 'quantity' => 1, $sPmPrefix . 'articleId' => $sId, $sPmPrefix . 'name' => $sName, $sPmPrefix . 'type' => $sType, $sPmPrefix . 'unitPriceGross' => (double) $oPrice->getBruttoPrice(), $sPmPrefix . 'grossAmount' => (double) $oPrice->getBruttoPrice(), $sPmPrefix . 'vatAmount' => (double) $oPrice->getVatValue(), $sPmPrefix . 'vatRate' => (double) $oPrice->getVat(), ); }
php
protected function _getCostSummary( $iLineItem, $sCostName, $oPrice ) { $sPmPrefix = OxpsPaymorrowOxBasketItem::getPaymorrowBasketSummaryLineItemPrefix( $iLineItem ); list( $sId, $sName, $sType ) = $this->_getCostMetadata( $sCostName ); if ( empty( $sId ) ) { return array(); } $this->filterCostPrice($oPrice, $sCostName); return array( $sPmPrefix . 'quantity' => 1, $sPmPrefix . 'articleId' => $sId, $sPmPrefix . 'name' => $sName, $sPmPrefix . 'type' => $sType, $sPmPrefix . 'unitPriceGross' => (double) $oPrice->getBruttoPrice(), $sPmPrefix . 'grossAmount' => (double) $oPrice->getBruttoPrice(), $sPmPrefix . 'vatAmount' => (double) $oPrice->getVatValue(), $sPmPrefix . 'vatRate' => (double) $oPrice->getVat(), ); }
[ "protected", "function", "_getCostSummary", "(", "$", "iLineItem", ",", "$", "sCostName", ",", "$", "oPrice", ")", "{", "$", "sPmPrefix", "=", "OxpsPaymorrowOxBasketItem", "::", "getPaymorrowBasketSummaryLineItemPrefix", "(", "$", "iLineItem", ")", ";", "list", "(", "$", "sId", ",", "$", "sName", ",", "$", "sType", ")", "=", "$", "this", "->", "_getCostMetadata", "(", "$", "sCostName", ")", ";", "if", "(", "empty", "(", "$", "sId", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "this", "->", "filterCostPrice", "(", "$", "oPrice", ",", "$", "sCostName", ")", ";", "return", "array", "(", "$", "sPmPrefix", ".", "'quantity'", "=>", "1", ",", "$", "sPmPrefix", ".", "'articleId'", "=>", "$", "sId", ",", "$", "sPmPrefix", ".", "'name'", "=>", "$", "sName", ",", "$", "sPmPrefix", ".", "'type'", "=>", "$", "sType", ",", "$", "sPmPrefix", ".", "'unitPriceGross'", "=>", "(", "double", ")", "$", "oPrice", "->", "getBruttoPrice", "(", ")", ",", "$", "sPmPrefix", ".", "'grossAmount'", "=>", "(", "double", ")", "$", "oPrice", "->", "getBruttoPrice", "(", ")", ",", "$", "sPmPrefix", ".", "'vatAmount'", "=>", "(", "double", ")", "$", "oPrice", "->", "getVatValue", "(", ")", ",", "$", "sPmPrefix", ".", "'vatRate'", "=>", "(", "double", ")", "$", "oPrice", "->", "getVat", "(", ")", ",", ")", ";", "}" ]
Get cost line item summary data as array. @param integer $iLineItem @param string $sCostName @param oxPrice $oPrice @return array
[ "Get", "cost", "line", "item", "summary", "data", "as", "array", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L240-L262
27,665
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getCostMetadata
protected function _getCostMetadata( $sCostName ) { $aCostsMap = array( 'oxdelivery' => array( $this->_getShippingId(), 'DeliveryCosts', 'SHIPPING' ), 'oxwrapping' => array( 'Wrapping', 'Wrapping Costs', 'GOODS' ), 'oxgiftcard' => array( 'GiftCard', 'Gift Card Costs', 'GOODS' ), 'oxpayment' => array( $this->_getPaymentId(), 'PaymentCosts', 'PAYMENT_FEE' ), 'oxtsprotection' => array( $this->_getTsProductId(), 'TS Protection Costs', 'GOODS' ), ); return array_key_exists( $sCostName, $aCostsMap ) ? $aCostsMap[$sCostName] : array(); }
php
protected function _getCostMetadata( $sCostName ) { $aCostsMap = array( 'oxdelivery' => array( $this->_getShippingId(), 'DeliveryCosts', 'SHIPPING' ), 'oxwrapping' => array( 'Wrapping', 'Wrapping Costs', 'GOODS' ), 'oxgiftcard' => array( 'GiftCard', 'Gift Card Costs', 'GOODS' ), 'oxpayment' => array( $this->_getPaymentId(), 'PaymentCosts', 'PAYMENT_FEE' ), 'oxtsprotection' => array( $this->_getTsProductId(), 'TS Protection Costs', 'GOODS' ), ); return array_key_exists( $sCostName, $aCostsMap ) ? $aCostsMap[$sCostName] : array(); }
[ "protected", "function", "_getCostMetadata", "(", "$", "sCostName", ")", "{", "$", "aCostsMap", "=", "array", "(", "'oxdelivery'", "=>", "array", "(", "$", "this", "->", "_getShippingId", "(", ")", ",", "'DeliveryCosts'", ",", "'SHIPPING'", ")", ",", "'oxwrapping'", "=>", "array", "(", "'Wrapping'", ",", "'Wrapping Costs'", ",", "'GOODS'", ")", ",", "'oxgiftcard'", "=>", "array", "(", "'GiftCard'", ",", "'Gift Card Costs'", ",", "'GOODS'", ")", ",", "'oxpayment'", "=>", "array", "(", "$", "this", "->", "_getPaymentId", "(", ")", ",", "'PaymentCosts'", ",", "'PAYMENT_FEE'", ")", ",", "'oxtsprotection'", "=>", "array", "(", "$", "this", "->", "_getTsProductId", "(", ")", ",", "'TS Protection Costs'", ",", "'GOODS'", ")", ",", ")", ";", "return", "array_key_exists", "(", "$", "sCostName", ",", "$", "aCostsMap", ")", "?", "$", "aCostsMap", "[", "$", "sCostName", "]", ":", "array", "(", ")", ";", "}" ]
Get costs metadata values. @param string $sCostName @return array Cost metadata array: ID, Name, Type
[ "Get", "costs", "metadata", "values", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L291-L322
27,666
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getShippingId
protected function _getShippingId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = (string) $this->getShippingId(); if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'shippingCosts'; } return $sId; }
php
protected function _getShippingId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = (string) $this->getShippingId(); if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'shippingCosts'; } return $sId; }
[ "protected", "function", "_getShippingId", "(", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "sId", "=", "(", "string", ")", "$", "this", "->", "getShippingId", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "sId", ")", ")", "{", "$", "sId", "=", "$", "this", "->", "_toUtf", "(", "$", "sId", ")", ";", "}", "else", "{", "$", "sId", "=", "'shippingCosts'", ";", "}", "return", "$", "sId", ";", "}" ]
Get shipping method ID. Default value is "shippingCosts". @return string
[ "Get", "shipping", "method", "ID", ".", "Default", "value", "is", "shippingCosts", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L330-L343
27,667
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getPaymentId
protected function _getPaymentId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = (string) $this->getPaymentId(); if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'PaymentId'; } return $sId; }
php
protected function _getPaymentId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = (string) $this->getPaymentId(); if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'PaymentId'; } return $sId; }
[ "protected", "function", "_getPaymentId", "(", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "sId", "=", "(", "string", ")", "$", "this", "->", "getPaymentId", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "sId", ")", ")", "{", "$", "sId", "=", "$", "this", "->", "_toUtf", "(", "$", "sId", ")", ";", "}", "else", "{", "$", "sId", "=", "'PaymentId'", ";", "}", "return", "$", "sId", ";", "}" ]
Get payment method ID. Default value is "PaymentId". @return string
[ "Get", "payment", "method", "ID", ".", "Default", "value", "is", "PaymentId", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L351-L364
27,668
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getTsProductId
protected function _getTsProductId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = method_exists($this, 'getTsProductId') ? (string) $this->getTsProductId() : ''; if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'TsProtection'; } return $sId; }
php
protected function _getTsProductId() { /** @var OxpsPaymorrowOxBasket|oxBasket $this */ $sId = method_exists($this, 'getTsProductId') ? (string) $this->getTsProductId() : ''; if ( !empty( $sId ) ) { $sId = $this->_toUtf( $sId ); } else { $sId = 'TsProtection'; } return $sId; }
[ "protected", "function", "_getTsProductId", "(", ")", "{", "/** @var OxpsPaymorrowOxBasket|oxBasket $this */", "$", "sId", "=", "method_exists", "(", "$", "this", ",", "'getTsProductId'", ")", "?", "(", "string", ")", "$", "this", "->", "getTsProductId", "(", ")", ":", "''", ";", "if", "(", "!", "empty", "(", "$", "sId", ")", ")", "{", "$", "sId", "=", "$", "this", "->", "_toUtf", "(", "$", "sId", ")", ";", "}", "else", "{", "$", "sId", "=", "'TsProtection'", ";", "}", "return", "$", "sId", ";", "}" ]
Get TS protection ID. Default value is "TsProtection". @return string
[ "Get", "TS", "protection", "ID", ".", "Default", "value", "is", "TsProtection", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L372-L387
27,669
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getPaymentMethodSurcharge
protected function _getPaymentMethodSurcharge( $mLineItem = null ) { $oSession = oxRegistry::getSession(); if ( $oSession->getVariable( 'paymentid' ) or ( !$aPaymentPostData = (array) $oSession->getVariable( 'pm_verify' ) ) or !array_key_exists( 'paymentid', $aPaymentPostData ) ) { return array(); } return $this->_formatPriceItemResponse( $this->_loadPaymentMethodSurcharge( (string) $aPaymentPostData['paymentid'] ), $mLineItem ); }
php
protected function _getPaymentMethodSurcharge( $mLineItem = null ) { $oSession = oxRegistry::getSession(); if ( $oSession->getVariable( 'paymentid' ) or ( !$aPaymentPostData = (array) $oSession->getVariable( 'pm_verify' ) ) or !array_key_exists( 'paymentid', $aPaymentPostData ) ) { return array(); } return $this->_formatPriceItemResponse( $this->_loadPaymentMethodSurcharge( (string) $aPaymentPostData['paymentid'] ), $mLineItem ); }
[ "protected", "function", "_getPaymentMethodSurcharge", "(", "$", "mLineItem", "=", "null", ")", "{", "$", "oSession", "=", "oxRegistry", "::", "getSession", "(", ")", ";", "if", "(", "$", "oSession", "->", "getVariable", "(", "'paymentid'", ")", "or", "(", "!", "$", "aPaymentPostData", "=", "(", "array", ")", "$", "oSession", "->", "getVariable", "(", "'pm_verify'", ")", ")", "or", "!", "array_key_exists", "(", "'paymentid'", ",", "$", "aPaymentPostData", ")", ")", "{", "return", "array", "(", ")", ";", "}", "return", "$", "this", "->", "_formatPriceItemResponse", "(", "$", "this", "->", "_loadPaymentMethodSurcharge", "(", "(", "string", ")", "$", "aPaymentPostData", "[", "'paymentid'", "]", ")", ",", "$", "mLineItem", ")", ";", "}" ]
Get payment method surcharge line item by loading it from posted Paymorrow payment form data. @param null|int $mLineItem If null, then surcharge price object is returned, else surcharge line item data array @return oxPrice|array
[ "Get", "payment", "method", "surcharge", "line", "item", "by", "loading", "it", "from", "posted", "Paymorrow", "payment", "form", "data", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L396-L411
27,670
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._formatPriceItemResponse
protected function _formatPriceItemResponse( $mPrice, $mLineItem ) { if ( !is_null( $mLineItem ) and is_object( $mPrice ) ) { return $this->_getCostSummary( (int) $mLineItem, 'oxpayment', $mPrice ); } return $mPrice; }
php
protected function _formatPriceItemResponse( $mPrice, $mLineItem ) { if ( !is_null( $mLineItem ) and is_object( $mPrice ) ) { return $this->_getCostSummary( (int) $mLineItem, 'oxpayment', $mPrice ); } return $mPrice; }
[ "protected", "function", "_formatPriceItemResponse", "(", "$", "mPrice", ",", "$", "mLineItem", ")", "{", "if", "(", "!", "is_null", "(", "$", "mLineItem", ")", "and", "is_object", "(", "$", "mPrice", ")", ")", "{", "return", "$", "this", "->", "_getCostSummary", "(", "(", "int", ")", "$", "mLineItem", ",", "'oxpayment'", ",", "$", "mPrice", ")", ";", "}", "return", "$", "mPrice", ";", "}" ]
If line item requested, then return line item data array, otherwise price object fdirectly. @param array|oxPrice $mPrice @param null|int $mLineItem @return array|oxPrice
[ "If", "line", "item", "requested", "then", "return", "line", "item", "data", "array", "otherwise", "price", "object", "fdirectly", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L421-L428
27,671
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._loadPaymentMethodSurcharge
protected function _loadPaymentMethodSurcharge( $sPaymentId ) { /** @var oxPayment $oPaymentMethod */ $oPaymentMethod = oxNew( 'oxPayment' ); if ( !$oPaymentMethod->load( $sPaymentId ) or !$oPaymentMethod->getId() ) { return array(); } $oPaymentMethod->calculate( $this ); $oSurchargePrice = $oPaymentMethod->getPrice(); if ( empty( $oSurchargePrice ) ) { return array(); } return $oSurchargePrice; }
php
protected function _loadPaymentMethodSurcharge( $sPaymentId ) { /** @var oxPayment $oPaymentMethod */ $oPaymentMethod = oxNew( 'oxPayment' ); if ( !$oPaymentMethod->load( $sPaymentId ) or !$oPaymentMethod->getId() ) { return array(); } $oPaymentMethod->calculate( $this ); $oSurchargePrice = $oPaymentMethod->getPrice(); if ( empty( $oSurchargePrice ) ) { return array(); } return $oSurchargePrice; }
[ "protected", "function", "_loadPaymentMethodSurcharge", "(", "$", "sPaymentId", ")", "{", "/** @var oxPayment $oPaymentMethod */", "$", "oPaymentMethod", "=", "oxNew", "(", "'oxPayment'", ")", ";", "if", "(", "!", "$", "oPaymentMethod", "->", "load", "(", "$", "sPaymentId", ")", "or", "!", "$", "oPaymentMethod", "->", "getId", "(", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "oPaymentMethod", "->", "calculate", "(", "$", "this", ")", ";", "$", "oSurchargePrice", "=", "$", "oPaymentMethod", "->", "getPrice", "(", ")", ";", "if", "(", "empty", "(", "$", "oSurchargePrice", ")", ")", "{", "return", "array", "(", ")", ";", "}", "return", "$", "oSurchargePrice", ";", "}" ]
Load payment method by ID and calculate its surcharge for the basket. @param string $sPaymentId @return array|oxPrice Empty array on failure, price object on success.
[ "Load", "payment", "method", "by", "ID", "and", "calculate", "its", "surcharge", "for", "the", "basket", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L437-L454
27,672
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxbasket.php
OxpsPaymorrowOxBasket._getPaymorrowVouchersSummary
protected function _getPaymorrowVouchersSummary( $iLineItem ) { $sPmPrefix = OxpsPaymorrowOxBasketItem::getPaymorrowBasketSummaryLineItemPrefix( $iLineItem ); /** @var oxPrice $oVoucher */ $oVoucher = $this->getVoucherDiscount(); return array( $sPmPrefix . 'quantity' => 1, $sPmPrefix . 'articleId' => 'Voucher', $sPmPrefix . 'name' => 'VoucherCosts', $sPmPrefix . 'type' => 'VOUCHER', $sPmPrefix . 'unitPriceGross' => (double) $oVoucher->getBruttoPrice(), $sPmPrefix . 'grossAmount' => (double) $oVoucher->getBruttoPrice(), $sPmPrefix . 'vatAmount' => 0.0, $sPmPrefix . 'vatRate' => 0.0, ); }
php
protected function _getPaymorrowVouchersSummary( $iLineItem ) { $sPmPrefix = OxpsPaymorrowOxBasketItem::getPaymorrowBasketSummaryLineItemPrefix( $iLineItem ); /** @var oxPrice $oVoucher */ $oVoucher = $this->getVoucherDiscount(); return array( $sPmPrefix . 'quantity' => 1, $sPmPrefix . 'articleId' => 'Voucher', $sPmPrefix . 'name' => 'VoucherCosts', $sPmPrefix . 'type' => 'VOUCHER', $sPmPrefix . 'unitPriceGross' => (double) $oVoucher->getBruttoPrice(), $sPmPrefix . 'grossAmount' => (double) $oVoucher->getBruttoPrice(), $sPmPrefix . 'vatAmount' => 0.0, $sPmPrefix . 'vatRate' => 0.0, ); }
[ "protected", "function", "_getPaymorrowVouchersSummary", "(", "$", "iLineItem", ")", "{", "$", "sPmPrefix", "=", "OxpsPaymorrowOxBasketItem", "::", "getPaymorrowBasketSummaryLineItemPrefix", "(", "$", "iLineItem", ")", ";", "/** @var oxPrice $oVoucher */", "$", "oVoucher", "=", "$", "this", "->", "getVoucherDiscount", "(", ")", ";", "return", "array", "(", "$", "sPmPrefix", ".", "'quantity'", "=>", "1", ",", "$", "sPmPrefix", ".", "'articleId'", "=>", "'Voucher'", ",", "$", "sPmPrefix", ".", "'name'", "=>", "'VoucherCosts'", ",", "$", "sPmPrefix", ".", "'type'", "=>", "'VOUCHER'", ",", "$", "sPmPrefix", ".", "'unitPriceGross'", "=>", "(", "double", ")", "$", "oVoucher", "->", "getBruttoPrice", "(", ")", ",", "$", "sPmPrefix", ".", "'grossAmount'", "=>", "(", "double", ")", "$", "oVoucher", "->", "getBruttoPrice", "(", ")", ",", "$", "sPmPrefix", ".", "'vatAmount'", "=>", "0.0", ",", "$", "sPmPrefix", ".", "'vatRate'", "=>", "0.0", ",", ")", ";", "}" ]
Get voucher discount summary. @param $iLineItem - Paymorrow line item must be passed in order to properly merge line items. @return array
[ "Get", "voucher", "discount", "summary", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxbasket.php#L463-L480
27,673
contributte/thepay-api
src/Helper/ButtonMerchant.php
ButtonMerchant.setButtonStyle
public function setButtonStyle( ?string $buttonStyle, ?string $buttonText = null ): void { if (empty($buttonStyle)) { $buttonStyle = null; } $this->buttonStyle = $buttonStyle; if ($buttonText !== null) { $this->buttonText = $buttonText; } }
php
public function setButtonStyle( ?string $buttonStyle, ?string $buttonText = null ): void { if (empty($buttonStyle)) { $buttonStyle = null; } $this->buttonStyle = $buttonStyle; if ($buttonText !== null) { $this->buttonText = $buttonText; } }
[ "public", "function", "setButtonStyle", "(", "?", "string", "$", "buttonStyle", ",", "?", "string", "$", "buttonText", "=", "null", ")", ":", "void", "{", "if", "(", "empty", "(", "$", "buttonStyle", ")", ")", "{", "$", "buttonStyle", "=", "null", ";", "}", "$", "this", "->", "buttonStyle", "=", "$", "buttonStyle", ";", "if", "(", "$", "buttonText", "!==", "null", ")", "{", "$", "this", "->", "buttonText", "=", "$", "buttonText", ";", "}", "}" ]
Sets the buttonStyle property. @param string|null $buttonStyle String specifying the button style. Can be null for default text button, or one of button styles specified in the ThePay API documentation. @param string $buttonText Optional argument specifying the text that should be displayed on the button.
[ "Sets", "the", "buttonStyle", "property", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Helper/ButtonMerchant.php#L36-L50
27,674
contributte/thepay-api
src/Helper/ButtonMerchant.php
ButtonMerchant.render
public function render(): string { $targetUrl = Escaper::htmlEntityEncode(self::buildUrl()); if ($this->buttonStyle === null) { return "<a href=\"{$targetUrl}\">{$this->buttonText}</a>"; } $gateUrl = $this->payment->getMerchantConfig()->gateUrl; $buttonStyle = rawurlencode($this->buttonStyle); $src = Escaper::htmlEntityEncode($gateUrl . 'buttons/' . $buttonStyle . '.png'); $title = Escaper::htmlEntityEncode($this->buttonText); return "<a href=\"{$targetUrl}\"><img src=\"{$src}\" alt=\"{$title}\" title=\"{$title}\" /></a>"; }
php
public function render(): string { $targetUrl = Escaper::htmlEntityEncode(self::buildUrl()); if ($this->buttonStyle === null) { return "<a href=\"{$targetUrl}\">{$this->buttonText}</a>"; } $gateUrl = $this->payment->getMerchantConfig()->gateUrl; $buttonStyle = rawurlencode($this->buttonStyle); $src = Escaper::htmlEntityEncode($gateUrl . 'buttons/' . $buttonStyle . '.png'); $title = Escaper::htmlEntityEncode($this->buttonText); return "<a href=\"{$targetUrl}\"><img src=\"{$src}\" alt=\"{$title}\" title=\"{$title}\" /></a>"; }
[ "public", "function", "render", "(", ")", ":", "string", "{", "$", "targetUrl", "=", "Escaper", "::", "htmlEntityEncode", "(", "self", "::", "buildUrl", "(", ")", ")", ";", "if", "(", "$", "this", "->", "buttonStyle", "===", "null", ")", "{", "return", "\"<a href=\\\"{$targetUrl}\\\">{$this->buttonText}</a>\"", ";", "}", "$", "gateUrl", "=", "$", "this", "->", "payment", "->", "getMerchantConfig", "(", ")", "->", "gateUrl", ";", "$", "buttonStyle", "=", "rawurlencode", "(", "$", "this", "->", "buttonStyle", ")", ";", "$", "src", "=", "Escaper", "::", "htmlEntityEncode", "(", "$", "gateUrl", ".", "'buttons/'", ".", "$", "buttonStyle", ".", "'.png'", ")", ";", "$", "title", "=", "Escaper", "::", "htmlEntityEncode", "(", "$", "this", "->", "buttonText", ")", ";", "return", "\"<a href=\\\"{$targetUrl}\\\"><img src=\\\"{$src}\\\" alt=\\\"{$title}\\\" title=\\\"{$title}\\\" /></a>\"", ";", "}" ]
Return the HTML code for the button.
[ "Return", "the", "HTML", "code", "for", "the", "button", "." ]
7e28eaf30ad1880533add93cf9e7296e61c09b8e
https://github.com/contributte/thepay-api/blob/7e28eaf30ad1880533add93cf9e7296e61c09b8e/src/Helper/ButtonMerchant.php#L81-L96
27,675
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php
Standard.getListItems
protected function getListItems( array $items, array $include ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog/lists' ); $search = $manager->createSearch(); $expr = array( $search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ), $search->compare( '==', 'catalog.lists.domain', $include ), ); $search->setConditions( $search->combine( '&&', $expr ) ); return $manager->searchItems( $search ); }
php
protected function getListItems( array $items, array $include ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog/lists' ); $search = $manager->createSearch(); $expr = array( $search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ), $search->compare( '==', 'catalog.lists.domain', $include ), ); $search->setConditions( $search->combine( '&&', $expr ) ); return $manager->searchItems( $search ); }
[ "protected", "function", "getListItems", "(", "array", "$", "items", ",", "array", "$", "include", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ")", ",", "'catalog/lists'", ")", ";", "$", "search", "=", "$", "manager", "->", "createSearch", "(", ")", ";", "$", "expr", "=", "array", "(", "$", "search", "->", "compare", "(", "'=='", ",", "'catalog.lists.parentid'", ",", "array_keys", "(", "$", "items", ")", ")", ",", "$", "search", "->", "compare", "(", "'=='", ",", "'catalog.lists.domain'", ",", "$", "include", ")", ",", ")", ";", "$", "search", "->", "setConditions", "(", "$", "search", "->", "combine", "(", "'&&'", ",", "$", "expr", ")", ")", ";", "return", "$", "manager", "->", "searchItems", "(", "$", "search", ")", ";", "}" ]
Returns the list items for association relationships @param array $items List of items implementing \Aimeos\MShop\Common\Item\Iface @param array $include List of resource types that should be fetched @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
[ "Returns", "the", "list", "items", "for", "association", "relationships" ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php#L212-L224
27,676
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowpayment.php
OxpsPaymorrowPayment.validatePayment
public function validatePayment() { // Remove payment methods initialization data from session of any is set $this->_unsetSessionInitData(); $mReturn = $this->_OxpsPaymorrowPayment_validatePayment_parent(); if ($this->_isPaymorrowPayment(oxRegistry::getConfig()->getRequestParameter('paymentid')) and $this->_isPaymentResponseSessionInvalid() ) { oxRegistry::getSession()->setVariable('payerror', 1); return null; } return $mReturn; }
php
public function validatePayment() { // Remove payment methods initialization data from session of any is set $this->_unsetSessionInitData(); $mReturn = $this->_OxpsPaymorrowPayment_validatePayment_parent(); if ($this->_isPaymorrowPayment(oxRegistry::getConfig()->getRequestParameter('paymentid')) and $this->_isPaymentResponseSessionInvalid() ) { oxRegistry::getSession()->setVariable('payerror', 1); return null; } return $mReturn; }
[ "public", "function", "validatePayment", "(", ")", "{", "// Remove payment methods initialization data from session of any is set", "$", "this", "->", "_unsetSessionInitData", "(", ")", ";", "$", "mReturn", "=", "$", "this", "->", "_OxpsPaymorrowPayment_validatePayment_parent", "(", ")", ";", "if", "(", "$", "this", "->", "_isPaymorrowPayment", "(", "oxRegistry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "'paymentid'", ")", ")", "and", "$", "this", "->", "_isPaymentResponseSessionInvalid", "(", ")", ")", "{", "oxRegistry", "::", "getSession", "(", ")", "->", "setVariable", "(", "'payerror'", ",", "1", ")", ";", "return", "null", ";", "}", "return", "$", "mReturn", ";", "}" ]
Overridden parent method. Additionally checks if Paymorrow request was successful. It is needed for detecting cases, when JavaScript is disabled in user browser and no requests were sent. @return mixed
[ "Overridden", "parent", "method", ".", "Additionally", "checks", "if", "Paymorrow", "request", "was", "successful", ".", "It", "is", "needed", "for", "detecting", "cases", "when", "JavaScript", "is", "disabled", "in", "user", "browser", "and", "no", "requests", "were", "sent", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowpayment.php#L48-L64
27,677
OXID-eSales/paymorrow-module
controllers/oxpspaymorrowpayment.php
OxpsPaymorrowPayment._isPaymentResponseSessionInvalid
protected function _isPaymentResponseSessionInvalid() { /** @var OxpsPaymorrowModule $oModule */ $oModule = oxRegistry::get('OxpsPaymorrowModule'); // Get Paymorrow response from session $aPaymorrowResponse = $oModule->getPaymorrowResponseData(); // The response must exist and be valid return ( !isset($aPaymorrowResponse['order_status'], $aPaymorrowResponse['response_status']) or !in_array($aPaymorrowResponse['order_status'], array('VALIDATED', 'ACCEPTED')) or ($aPaymorrowResponse['response_status'] !== 'OK') ); }
php
protected function _isPaymentResponseSessionInvalid() { /** @var OxpsPaymorrowModule $oModule */ $oModule = oxRegistry::get('OxpsPaymorrowModule'); // Get Paymorrow response from session $aPaymorrowResponse = $oModule->getPaymorrowResponseData(); // The response must exist and be valid return ( !isset($aPaymorrowResponse['order_status'], $aPaymorrowResponse['response_status']) or !in_array($aPaymorrowResponse['order_status'], array('VALIDATED', 'ACCEPTED')) or ($aPaymorrowResponse['response_status'] !== 'OK') ); }
[ "protected", "function", "_isPaymentResponseSessionInvalid", "(", ")", "{", "/** @var OxpsPaymorrowModule $oModule */", "$", "oModule", "=", "oxRegistry", "::", "get", "(", "'OxpsPaymorrowModule'", ")", ";", "// Get Paymorrow response from session", "$", "aPaymorrowResponse", "=", "$", "oModule", "->", "getPaymorrowResponseData", "(", ")", ";", "// The response must exist and be valid", "return", "(", "!", "isset", "(", "$", "aPaymorrowResponse", "[", "'order_status'", "]", ",", "$", "aPaymorrowResponse", "[", "'response_status'", "]", ")", "or", "!", "in_array", "(", "$", "aPaymorrowResponse", "[", "'order_status'", "]", ",", "array", "(", "'VALIDATED'", ",", "'ACCEPTED'", ")", ")", "or", "(", "$", "aPaymorrowResponse", "[", "'response_status'", "]", "!==", "'OK'", ")", ")", ";", "}" ]
Check payment response in session fot errors. @return bool True is response is invalid, false otherwise.
[ "Check", "payment", "response", "in", "session", "fot", "errors", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/controllers/oxpspaymorrowpayment.php#L99-L113
27,678
moodev/php-weasel
lib/Weasel/JsonMarshaller/Config/AnnotationDriver.php
AnnotationDriver._getConfig
protected function _getConfig($class) { $rClass = new \ReflectionClass($class); // Delegate actually loading the config for the class to the ClassAnnotationDriver $classDriver = new ClassAnnotationDriver($rClass, $this->annotationReaderFactory, $this->annotationNamespace); return $classDriver->getConfig(); }
php
protected function _getConfig($class) { $rClass = new \ReflectionClass($class); // Delegate actually loading the config for the class to the ClassAnnotationDriver $classDriver = new ClassAnnotationDriver($rClass, $this->annotationReaderFactory, $this->annotationNamespace); return $classDriver->getConfig(); }
[ "protected", "function", "_getConfig", "(", "$", "class", ")", "{", "$", "rClass", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "// Delegate actually loading the config for the class to the ClassAnnotationDriver", "$", "classDriver", "=", "new", "ClassAnnotationDriver", "(", "$", "rClass", ",", "$", "this", "->", "annotationReaderFactory", ",", "$", "this", "->", "annotationNamespace", ")", ";", "return", "$", "classDriver", "->", "getConfig", "(", ")", ";", "}" ]
_Really_ obtain the config for a named class @param string $class The class to get the config for @return \Weasel\JsonMarshaller\Config\ClassMarshaller The config, or null if not found
[ "_Really_", "obtain", "the", "config", "for", "a", "named", "class" ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/JsonMarshaller/Config/AnnotationDriver.php#L68-L77
27,679
moodev/php-weasel
lib/Weasel/WeaselJsonConfigDrivenFactory.php
WeaselJsonConfigDrivenFactory.getXmlMapperInstance
public function getXmlMapperInstance() { if (!isset($this->_xmlMapper)) { $this->_xmlMapper = new XmlMapper($this->_getXmlConfigDriver()); } return $this->_xmlMapper; }
php
public function getXmlMapperInstance() { if (!isset($this->_xmlMapper)) { $this->_xmlMapper = new XmlMapper($this->_getXmlConfigDriver()); } return $this->_xmlMapper; }
[ "public", "function", "getXmlMapperInstance", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_xmlMapper", ")", ")", "{", "$", "this", "->", "_xmlMapper", "=", "new", "XmlMapper", "(", "$", "this", "->", "_getXmlConfigDriver", "(", ")", ")", ";", "}", "return", "$", "this", "->", "_xmlMapper", ";", "}" ]
Get a fully configured XmlMapper instance. @return XmlMapper
[ "Get", "a", "fully", "configured", "XmlMapper", "instance", "." ]
fecc7cc06cae719489cb4490f414ed6530e70831
https://github.com/moodev/php-weasel/blob/fecc7cc06cae719489cb4490f414ed6530e70831/lib/Weasel/WeaselJsonConfigDrivenFactory.php#L154-L160
27,680
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpayment.php
OxpsPaymorrowOxPayment.setPaymorrowPaymentMap
public function setPaymorrowPaymentMap($iType) { $blValidMapping = array_key_exists($iType, $this->_aPaymorrowValidPaymentTypes); if ($blValidMapping) { $this->oxpayments__oxpspaymorrowmap = new oxField($iType); } return $blValidMapping; }
php
public function setPaymorrowPaymentMap($iType) { $blValidMapping = array_key_exists($iType, $this->_aPaymorrowValidPaymentTypes); if ($blValidMapping) { $this->oxpayments__oxpspaymorrowmap = new oxField($iType); } return $blValidMapping; }
[ "public", "function", "setPaymorrowPaymentMap", "(", "$", "iType", ")", "{", "$", "blValidMapping", "=", "array_key_exists", "(", "$", "iType", ",", "$", "this", "->", "_aPaymorrowValidPaymentTypes", ")", ";", "if", "(", "$", "blValidMapping", ")", "{", "$", "this", "->", "oxpayments__oxpspaymorrowmap", "=", "new", "oxField", "(", "$", "iType", ")", ";", "}", "return", "$", "blValidMapping", ";", "}" ]
Set Paymorrow payment method ID. 0 - Off / none 1 - Paymorrow Invoice 2 - Paymorrow Direct Debit
[ "Set", "Paymorrow", "payment", "method", "ID", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpayment.php#L145-L154
27,681
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpayment.php
OxpsPaymorrowOxPayment.isValidPayment
public function isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId) { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ $blIsValid = (bool) $this->_OxpsPaymorrowOxPayment_isValidPayment_parent( $aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId ); $iErrorCode = (int) $this->getPaymentErrorNumber(); // In case it is Paymorrow payment method unset error code and tell than validation passed. if ($this->isPaymorrowActive() and !$blIsValid and ($iErrorCode === 1)) { $this->_iPaymentError = null; return true; } return $blIsValid; }
php
public function isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId) { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ $blIsValid = (bool) $this->_OxpsPaymorrowOxPayment_isValidPayment_parent( $aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId ); $iErrorCode = (int) $this->getPaymentErrorNumber(); // In case it is Paymorrow payment method unset error code and tell than validation passed. if ($this->isPaymorrowActive() and !$blIsValid and ($iErrorCode === 1)) { $this->_iPaymentError = null; return true; } return $blIsValid; }
[ "public", "function", "isValidPayment", "(", "$", "aDynValue", ",", "$", "sShopId", ",", "$", "oUser", ",", "$", "dBasketPrice", ",", "$", "sShipSetId", ")", "{", "/** @var OxpsPaymorrowOxPayment|oxPayment $this */", "$", "blIsValid", "=", "(", "bool", ")", "$", "this", "->", "_OxpsPaymorrowOxPayment_isValidPayment_parent", "(", "$", "aDynValue", ",", "$", "sShopId", ",", "$", "oUser", ",", "$", "dBasketPrice", ",", "$", "sShipSetId", ")", ";", "$", "iErrorCode", "=", "(", "int", ")", "$", "this", "->", "getPaymentErrorNumber", "(", ")", ";", "// In case it is Paymorrow payment method unset error code and tell than validation passed.", "if", "(", "$", "this", "->", "isPaymorrowActive", "(", ")", "and", "!", "$", "blIsValid", "and", "(", "$", "iErrorCode", "===", "1", ")", ")", "{", "$", "this", "->", "_iPaymentError", "=", "null", ";", "return", "true", ";", "}", "return", "$", "blIsValid", ";", "}" ]
Overridden parent method. Ignores default payment method form error in case method is converted to a Paymorrow payment method. @param $aDynValue @param $sShopId @param $oUser @param $dBasketPrice @param $sShipSetId @return bool
[ "Overridden", "parent", "method", ".", "Ignores", "default", "payment", "method", "form", "error", "in", "case", "method", "is", "converted", "to", "a", "Paymorrow", "payment", "method", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpayment.php#L178-L196
27,682
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpayment.php
OxpsPaymorrowOxPayment.loadPaymorrowDefault
public function loadPaymorrowDefault() { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ $query = sprintf( "SELECT * FROM `%s`WHERE %s AND `OXCHECKED` = 1 ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1", $this->getViewName(), $this->getPaymorrowMethodWhereClause() ); return $this->assignRecord($query); }
php
public function loadPaymorrowDefault() { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ $query = sprintf( "SELECT * FROM `%s`WHERE %s AND `OXCHECKED` = 1 ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1", $this->getViewName(), $this->getPaymorrowMethodWhereClause() ); return $this->assignRecord($query); }
[ "public", "function", "loadPaymorrowDefault", "(", ")", "{", "/** @var OxpsPaymorrowOxPayment|oxPayment $this */", "$", "query", "=", "sprintf", "(", "\"SELECT * FROM `%s`WHERE %s AND `OXCHECKED` = 1 ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1\"", ",", "$", "this", "->", "getViewName", "(", ")", ",", "$", "this", "->", "getPaymorrowMethodWhereClause", "(", ")", ")", ";", "return", "$", "this", "->", "assignRecord", "(", "$", "query", ")", ";", "}" ]
Load active, mapped and selected Paymorrow payment method. If several are selected loads it by sorting and last updated. @codeCoverageIgnore @return mixed
[ "Load", "active", "mapped", "and", "selected", "Paymorrow", "payment", "method", ".", "If", "several", "are", "selected", "loads", "it", "by", "sorting", "and", "last", "updated", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpayment.php#L206-L217
27,683
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpayment.php
OxpsPaymorrowOxPayment.loadByPaymorrowName
public function loadByPaymorrowName($methodName) { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ if (!array_key_exists($methodName, $this->paymorrowPaymentNameMap)) { return false; } $query = sprintf( "SELECT * FROM `%s` WHERE %s AND `OXPSPAYMORROWMAP` = %d ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1", $this->getViewName(), $this->getPaymorrowMethodWhereClause(), (int) $this->paymorrowPaymentNameMap[$methodName] ); return $this->assignRecord($query); }
php
public function loadByPaymorrowName($methodName) { /** @var OxpsPaymorrowOxPayment|oxPayment $this */ if (!array_key_exists($methodName, $this->paymorrowPaymentNameMap)) { return false; } $query = sprintf( "SELECT * FROM `%s` WHERE %s AND `OXPSPAYMORROWMAP` = %d ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1", $this->getViewName(), $this->getPaymorrowMethodWhereClause(), (int) $this->paymorrowPaymentNameMap[$methodName] ); return $this->assignRecord($query); }
[ "public", "function", "loadByPaymorrowName", "(", "$", "methodName", ")", "{", "/** @var OxpsPaymorrowOxPayment|oxPayment $this */", "if", "(", "!", "array_key_exists", "(", "$", "methodName", ",", "$", "this", "->", "paymorrowPaymentNameMap", ")", ")", "{", "return", "false", ";", "}", "$", "query", "=", "sprintf", "(", "\"SELECT * FROM `%s` WHERE %s AND `OXPSPAYMORROWMAP` = %d ORDER BY `OXSORT` ASC, `OXTIMESTAMP` DESC LIMIT 1\"", ",", "$", "this", "->", "getViewName", "(", ")", ",", "$", "this", "->", "getPaymorrowMethodWhereClause", "(", ")", ",", "(", "int", ")", "$", "this", "->", "paymorrowPaymentNameMap", "[", "$", "methodName", "]", ")", ";", "return", "$", "this", "->", "assignRecord", "(", "$", "query", ")", ";", "}" ]
Load active, mapped Paymorrow payment method by it's name. E.g. by value "INVOICE" or "SDD". @param string $methodName @codeCoverageIgnore @return bool
[ "Load", "active", "mapped", "Paymorrow", "payment", "method", "by", "it", "s", "name", ".", "E", ".", "g", ".", "by", "value", "INVOICE", "or", "SDD", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpayment.php#L229-L245
27,684
OXID-eSales/paymorrow-module
models/oxpspaymorrowoxpayment.php
OxpsPaymorrowOxPayment._OxpsPaymorrowOxPayment_isValidPayment_parent
protected function _OxpsPaymorrowOxPayment_isValidPayment_parent($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId) { return parent::isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId); }
php
protected function _OxpsPaymorrowOxPayment_isValidPayment_parent($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId) { return parent::isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId); }
[ "protected", "function", "_OxpsPaymorrowOxPayment_isValidPayment_parent", "(", "$", "aDynValue", ",", "$", "sShopId", ",", "$", "oUser", ",", "$", "dBasketPrice", ",", "$", "sShipSetId", ")", "{", "return", "parent", "::", "isValidPayment", "(", "$", "aDynValue", ",", "$", "sShopId", ",", "$", "oUser", ",", "$", "dBasketPrice", ",", "$", "sShipSetId", ")", ";", "}" ]
Parent `isValidPayment` call. @codeCoverageIgnore @param $aDynValue @param $sShopId @param $oUser @param $dBasketPrice @param $sShipSetId @return mixed
[ "Parent", "isValidPayment", "call", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/models/oxpspaymorrowoxpayment.php#L274-L278
27,685
techdivision/import-product
src/Observers/AbstractProductRelationObserver.php
AbstractProductRelationObserver.prepareProductRelationAttributes
protected function prepareProductRelationAttributes() { // initialize and return the entity return $this->initializeEntity( array( MemberNames::PARENT_ID => $this->parentId, MemberNames::CHILD_ID => $this->childId ) ); }
php
protected function prepareProductRelationAttributes() { // initialize and return the entity return $this->initializeEntity( array( MemberNames::PARENT_ID => $this->parentId, MemberNames::CHILD_ID => $this->childId ) ); }
[ "protected", "function", "prepareProductRelationAttributes", "(", ")", "{", "// initialize and return the entity", "return", "$", "this", "->", "initializeEntity", "(", "array", "(", "MemberNames", "::", "PARENT_ID", "=>", "$", "this", "->", "parentId", ",", "MemberNames", "::", "CHILD_ID", "=>", "$", "this", "->", "childId", ")", ")", ";", "}" ]
Prepare the product relation attributes that has to be persisted. @return array The prepared product relation attributes
[ "Prepare", "the", "product", "relation", "attributes", "that", "has", "to", "be", "persisted", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Observers/AbstractProductRelationObserver.php#L165-L175
27,686
techdivision/import-product
src/Actions/Processors/CategoryProductDeleteProcessor.php
CategoryProductDeleteProcessor.getStatements
protected function getStatements() { // return the array with the SQL statements that has to be prepared return array( SqlStatementKeys::DELETE_CATEGORY_PRODUCT => $this->loadStatement(SqlStatementKeys::DELETE_CATEGORY_PRODUCT), SqlStatementKeys::DELETE_CATEGORY_PRODUCT_BY_SKU => $this->loadStatement(SqlStatementKeys::DELETE_CATEGORY_PRODUCT_BY_SKU) ); }
php
protected function getStatements() { // return the array with the SQL statements that has to be prepared return array( SqlStatementKeys::DELETE_CATEGORY_PRODUCT => $this->loadStatement(SqlStatementKeys::DELETE_CATEGORY_PRODUCT), SqlStatementKeys::DELETE_CATEGORY_PRODUCT_BY_SKU => $this->loadStatement(SqlStatementKeys::DELETE_CATEGORY_PRODUCT_BY_SKU) ); }
[ "protected", "function", "getStatements", "(", ")", "{", "// return the array with the SQL statements that has to be prepared", "return", "array", "(", "SqlStatementKeys", "::", "DELETE_CATEGORY_PRODUCT", "=>", "$", "this", "->", "loadStatement", "(", "SqlStatementKeys", "::", "DELETE_CATEGORY_PRODUCT", ")", ",", "SqlStatementKeys", "::", "DELETE_CATEGORY_PRODUCT_BY_SKU", "=>", "$", "this", "->", "loadStatement", "(", "SqlStatementKeys", "::", "DELETE_CATEGORY_PRODUCT_BY_SKU", ")", ")", ";", "}" ]
Return's the array with the SQL statements that has to be prepared. @return array The SQL statements to be prepared @see \TechDivision\Import\Actions\Processors\AbstractBaseProcessor::getStatements()
[ "Return", "s", "the", "array", "with", "the", "SQL", "statements", "that", "has", "to", "be", "prepared", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Actions/Processors/CategoryProductDeleteProcessor.php#L44-L52
27,687
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm.php
JsonAdm.create
public static function create( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path, $name = null ) { $path = trim( $path, '/' ); if( empty( $path ) ) { return self::createRoot( $context, $aimeos, $path, $name ); } else { return self::createNew( $context, $aimeos, $path, $name ); } }
php
public static function create( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path, $name = null ) { $path = trim( $path, '/' ); if( empty( $path ) ) { return self::createRoot( $context, $aimeos, $path, $name ); } else { return self::createNew( $context, $aimeos, $path, $name ); } }
[ "public", "static", "function", "create", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "Bootstrap", "$", "aimeos", ",", "$", "path", ",", "$", "name", "=", "null", ")", "{", "$", "path", "=", "trim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "return", "self", "::", "createRoot", "(", "$", "context", ",", "$", "aimeos", ",", "$", "path", ",", "$", "name", ")", ";", "}", "else", "{", "return", "self", "::", "createNew", "(", "$", "context", ",", "$", "aimeos", ",", "$", "path", ",", "$", "name", ")", ";", "}", "}" ]
Creates the required client specified by the given path of client names. Clients are created by providing only the domain name, e.g. "product" for the \Aimeos\Admin\JsonAdm\Product\Standard or a path of names to retrieve a specific sub-client, e.g. "product/type" for the \Aimeos\Admin\JsonAdm\Product\Type\Standard client. @param \Aimeos\MShop\Context\Item\Iface $context Context object required by clients @param \Aimeos\Bootstrap $aimeos Aimeos Bootstrap object @param string $path Name of the client separated by slashes, e.g "product/property" @param string|null $name Name of the client implementation ("Standard" if null) @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
[ "Creates", "the", "required", "client", "specified", "by", "the", "given", "path", "of", "client", "names", "." ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm.php#L37-L47
27,688
aimeos/ai-admin-jsonadm
admin/jsonadm/src/Admin/JsonAdm.php
JsonAdm.createNew
protected static function createNew( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path, $name ) { $pname = $name; $parts = explode( '/', $path ); foreach( $parts as $key => $part ) { if( ctype_alnum( $part ) === false ) { $msg = sprintf( 'Invalid client "%1$s"', $path ); throw new \Aimeos\Admin\JsonAdm\Exception( $msg, 400 ); } $parts[$key] = ucwords( $part ); } if( $pname === null ) { $pname = $context->getConfig()->get( 'admin/jsonadm/' . $path . '/name', 'Standard' ); } $view = $context->getView(); $config = $context->getConfig(); if( $view->access( $config->get( 'admin/jsonadm/resource/' . $path . '/groups', [] ) ) !== true ) { throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Not allowed to access JsonAdm "%1$s" client', $path ) ); } $view = $context->getView(); $iface = \Aimeos\Admin\JsonAdm\Iface::class; $classname = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\' . $pname; if( ctype_alnum( $pname ) === false ) { $classname = is_string( $pname ) ? $classname : '<not a string>'; throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); } if( class_exists( $classname ) === false ) { return self::createRoot( $context, $aimeos, $path, $name ); } $client = self::createAdmin( $classname, $iface, $context, $path ); $client = self::addClientDecorators( $client, $context, $path ); return $client->setAimeos( $aimeos )->setView( $view ); }
php
protected static function createNew( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $path, $name ) { $pname = $name; $parts = explode( '/', $path ); foreach( $parts as $key => $part ) { if( ctype_alnum( $part ) === false ) { $msg = sprintf( 'Invalid client "%1$s"', $path ); throw new \Aimeos\Admin\JsonAdm\Exception( $msg, 400 ); } $parts[$key] = ucwords( $part ); } if( $pname === null ) { $pname = $context->getConfig()->get( 'admin/jsonadm/' . $path . '/name', 'Standard' ); } $view = $context->getView(); $config = $context->getConfig(); if( $view->access( $config->get( 'admin/jsonadm/resource/' . $path . '/groups', [] ) ) !== true ) { throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Not allowed to access JsonAdm "%1$s" client', $path ) ); } $view = $context->getView(); $iface = \Aimeos\Admin\JsonAdm\Iface::class; $classname = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\' . $pname; if( ctype_alnum( $pname ) === false ) { $classname = is_string( $pname ) ? $classname : '<not a string>'; throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); } if( class_exists( $classname ) === false ) { return self::createRoot( $context, $aimeos, $path, $name ); } $client = self::createAdmin( $classname, $iface, $context, $path ); $client = self::addClientDecorators( $client, $context, $path ); return $client->setAimeos( $aimeos )->setView( $view ); }
[ "protected", "static", "function", "createNew", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "Bootstrap", "$", "aimeos", ",", "$", "path", ",", "$", "name", ")", "{", "$", "pname", "=", "$", "name", ";", "$", "parts", "=", "explode", "(", "'/'", ",", "$", "path", ")", ";", "foreach", "(", "$", "parts", "as", "$", "key", "=>", "$", "part", ")", "{", "if", "(", "ctype_alnum", "(", "$", "part", ")", "===", "false", ")", "{", "$", "msg", "=", "sprintf", "(", "'Invalid client \"%1$s\"'", ",", "$", "path", ")", ";", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Exception", "(", "$", "msg", ",", "400", ")", ";", "}", "$", "parts", "[", "$", "key", "]", "=", "ucwords", "(", "$", "part", ")", ";", "}", "if", "(", "$", "pname", "===", "null", ")", "{", "$", "pname", "=", "$", "context", "->", "getConfig", "(", ")", "->", "get", "(", "'admin/jsonadm/'", ".", "$", "path", ".", "'/name'", ",", "'Standard'", ")", ";", "}", "$", "view", "=", "$", "context", "->", "getView", "(", ")", ";", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ";", "if", "(", "$", "view", "->", "access", "(", "$", "config", "->", "get", "(", "'admin/jsonadm/resource/'", ".", "$", "path", ".", "'/groups'", ",", "[", "]", ")", ")", "!==", "true", ")", "{", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JQAdm", "\\", "Exception", "(", "sprintf", "(", "'Not allowed to access JsonAdm \"%1$s\" client'", ",", "$", "path", ")", ")", ";", "}", "$", "view", "=", "$", "context", "->", "getView", "(", ")", ";", "$", "iface", "=", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Iface", "::", "class", ";", "$", "classname", "=", "'\\\\Aimeos\\\\Admin\\\\JsonAdm\\\\'", ".", "join", "(", "'\\\\'", ",", "$", "parts", ")", ".", "'\\\\'", ".", "$", "pname", ";", "if", "(", "ctype_alnum", "(", "$", "pname", ")", "===", "false", ")", "{", "$", "classname", "=", "is_string", "(", "$", "pname", ")", "?", "$", "classname", ":", "'<not a string>'", ";", "throw", "new", "\\", "Aimeos", "\\", "Admin", "\\", "JsonAdm", "\\", "Exception", "(", "sprintf", "(", "'Invalid class name \"%1$s\"'", ",", "$", "classname", ")", ")", ";", "}", "if", "(", "class_exists", "(", "$", "classname", ")", "===", "false", ")", "{", "return", "self", "::", "createRoot", "(", "$", "context", ",", "$", "aimeos", ",", "$", "path", ",", "$", "name", ")", ";", "}", "$", "client", "=", "self", "::", "createAdmin", "(", "$", "classname", ",", "$", "iface", ",", "$", "context", ",", "$", "path", ")", ";", "$", "client", "=", "self", "::", "addClientDecorators", "(", "$", "client", ",", "$", "context", ",", "$", "path", ")", ";", "return", "$", "client", "->", "setAimeos", "(", "$", "aimeos", ")", "->", "setView", "(", "$", "view", ")", ";", "}" ]
Creates a new client specified by the given path of client names. @param \Aimeos\MShop\Context\Item\Iface $context Context object required by clients @param \Aimeos\Bootstrap $aimeos Aimeos Bootstrap object @param string $path Name of the client separated by slashes, e.g "product/stock" @param string|null $name Name of the client implementation ("Standard" if null) @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
[ "Creates", "a", "new", "client", "specified", "by", "the", "given", "path", "of", "client", "names", "." ]
8e4dc6528afcd2199e6555b2e7ead4f75b221005
https://github.com/aimeos/ai-admin-jsonadm/blob/8e4dc6528afcd2199e6555b2e7ead4f75b221005/admin/jsonadm/src/Admin/JsonAdm.php#L60-L107
27,689
techdivision/import-product
src/Actions/Processors/StockItemUpdateProcessor.php
StockItemUpdateProcessor.execute
public function execute($row, $name = null) { // load the field names $keys = array_keys($row); // create a unique name for the prepared statement $name = sprintf('%s-%s', $name, md5(implode('-', $keys))); // query whether or not the statement has been prepared if (!$this->hasPreparedStatement($name)) { // initialize the array for the primary key fields $pks = array(); // load the last value as PK from the array with the keys $pks[] = $keys[array_search(MemberNames::ITEM_ID, $keys, true)]; // remove the entity status and the primary key from the keys unset($keys[array_search(MemberNames::ITEM_ID, $keys, true)]); unset($keys[array_search(EntityStatus::MEMBER_NAME, $keys, true)]); // prepare the SET part of the SQL statement array_walk($keys, function (&$value, $key) { $value = sprintf('%s=:%s', $value, $value); }); // prepare the SET part of the SQL statement array_walk($pks, function (&$value, $key) { $value = sprintf('%s=:%s', $value, $value); }); // create the prepared UPDATE statement $statement = sprintf($this->loadStatement(SqlStatementKeys::UPDATE_STOCK_ITEM), implode(',', $keys), implode(',', $pks)); // prepare the statement $this->addPreparedStatement($name, $this->getConnection()->prepare($statement)); } // pass the call to the parent method return parent::execute($row, $name); }
php
public function execute($row, $name = null) { // load the field names $keys = array_keys($row); // create a unique name for the prepared statement $name = sprintf('%s-%s', $name, md5(implode('-', $keys))); // query whether or not the statement has been prepared if (!$this->hasPreparedStatement($name)) { // initialize the array for the primary key fields $pks = array(); // load the last value as PK from the array with the keys $pks[] = $keys[array_search(MemberNames::ITEM_ID, $keys, true)]; // remove the entity status and the primary key from the keys unset($keys[array_search(MemberNames::ITEM_ID, $keys, true)]); unset($keys[array_search(EntityStatus::MEMBER_NAME, $keys, true)]); // prepare the SET part of the SQL statement array_walk($keys, function (&$value, $key) { $value = sprintf('%s=:%s', $value, $value); }); // prepare the SET part of the SQL statement array_walk($pks, function (&$value, $key) { $value = sprintf('%s=:%s', $value, $value); }); // create the prepared UPDATE statement $statement = sprintf($this->loadStatement(SqlStatementKeys::UPDATE_STOCK_ITEM), implode(',', $keys), implode(',', $pks)); // prepare the statement $this->addPreparedStatement($name, $this->getConnection()->prepare($statement)); } // pass the call to the parent method return parent::execute($row, $name); }
[ "public", "function", "execute", "(", "$", "row", ",", "$", "name", "=", "null", ")", "{", "// load the field names", "$", "keys", "=", "array_keys", "(", "$", "row", ")", ";", "// create a unique name for the prepared statement", "$", "name", "=", "sprintf", "(", "'%s-%s'", ",", "$", "name", ",", "md5", "(", "implode", "(", "'-'", ",", "$", "keys", ")", ")", ")", ";", "// query whether or not the statement has been prepared", "if", "(", "!", "$", "this", "->", "hasPreparedStatement", "(", "$", "name", ")", ")", "{", "// initialize the array for the primary key fields", "$", "pks", "=", "array", "(", ")", ";", "// load the last value as PK from the array with the keys", "$", "pks", "[", "]", "=", "$", "keys", "[", "array_search", "(", "MemberNames", "::", "ITEM_ID", ",", "$", "keys", ",", "true", ")", "]", ";", "// remove the entity status and the primary key from the keys", "unset", "(", "$", "keys", "[", "array_search", "(", "MemberNames", "::", "ITEM_ID", ",", "$", "keys", ",", "true", ")", "]", ")", ";", "unset", "(", "$", "keys", "[", "array_search", "(", "EntityStatus", "::", "MEMBER_NAME", ",", "$", "keys", ",", "true", ")", "]", ")", ";", "// prepare the SET part of the SQL statement", "array_walk", "(", "$", "keys", ",", "function", "(", "&", "$", "value", ",", "$", "key", ")", "{", "$", "value", "=", "sprintf", "(", "'%s=:%s'", ",", "$", "value", ",", "$", "value", ")", ";", "}", ")", ";", "// prepare the SET part of the SQL statement", "array_walk", "(", "$", "pks", ",", "function", "(", "&", "$", "value", ",", "$", "key", ")", "{", "$", "value", "=", "sprintf", "(", "'%s=:%s'", ",", "$", "value", ",", "$", "value", ")", ";", "}", ")", ";", "// create the prepared UPDATE statement", "$", "statement", "=", "sprintf", "(", "$", "this", "->", "loadStatement", "(", "SqlStatementKeys", "::", "UPDATE_STOCK_ITEM", ")", ",", "implode", "(", "','", ",", "$", "keys", ")", ",", "implode", "(", "','", ",", "$", "pks", ")", ")", ";", "// prepare the statement", "$", "this", "->", "addPreparedStatement", "(", "$", "name", ",", "$", "this", "->", "getConnection", "(", ")", "->", "prepare", "(", "$", "statement", ")", ")", ";", "}", "// pass the call to the parent method", "return", "parent", "::", "execute", "(", "$", "row", ",", "$", "name", ")", ";", "}" ]
Implements the CRUD functionality the processor is responsible for, can be one of CREATE, READ, UPDATE or DELETE a entity. @param array $row The data to handle @param string|null $name The name of the prepared statement to execute @return void
[ "Implements", "the", "CRUD", "functionality", "the", "processor", "is", "responsible", "for", "can", "be", "one", "of", "CREATE", "READ", "UPDATE", "or", "DELETE", "a", "entity", "." ]
a596e0c4b0495c918139935a709815c739d61e95
https://github.com/techdivision/import-product/blob/a596e0c4b0495c918139935a709815c739d61e95/src/Actions/Processors/StockItemUpdateProcessor.php#L49-L88
27,690
OXID-eSales/paymorrow-module
core/oxpspaymorrowresourcecache.php
OxpsPaymorrowResourceCache.push
public function push( $sFileName, $mFileContent ) { $sPath = $this->_getCacheFilePath( $sFileName ); if ( is_null( $sPath ) ) { return false; } return file_put_contents( $sPath, serialize( $mFileContent ) ); }
php
public function push( $sFileName, $mFileContent ) { $sPath = $this->_getCacheFilePath( $sFileName ); if ( is_null( $sPath ) ) { return false; } return file_put_contents( $sPath, serialize( $mFileContent ) ); }
[ "public", "function", "push", "(", "$", "sFileName", ",", "$", "mFileContent", ")", "{", "$", "sPath", "=", "$", "this", "->", "_getCacheFilePath", "(", "$", "sFileName", ")", ";", "if", "(", "is_null", "(", "$", "sPath", ")", ")", "{", "return", "false", ";", "}", "return", "file_put_contents", "(", "$", "sPath", ",", "serialize", "(", "$", "mFileContent", ")", ")", ";", "}" ]
Save file to cache. @param string $sFileName @param mixed $mFileContent @return bool|int
[ "Save", "file", "to", "cache", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresourcecache.php#L107-L116
27,691
OXID-eSales/paymorrow-module
core/oxpspaymorrowresourcecache.php
OxpsPaymorrowResourceCache.pop
public function pop( $sFileName ) { $sPath = $this->_getCacheFilePath( $sFileName ); if ( is_null( $sPath ) ) { return false; } if ( $this->_expired( $sPath ) ) { @unlink( $sPath ); return false; } return unserialize( file_get_contents( $sPath ) ); }
php
public function pop( $sFileName ) { $sPath = $this->_getCacheFilePath( $sFileName ); if ( is_null( $sPath ) ) { return false; } if ( $this->_expired( $sPath ) ) { @unlink( $sPath ); return false; } return unserialize( file_get_contents( $sPath ) ); }
[ "public", "function", "pop", "(", "$", "sFileName", ")", "{", "$", "sPath", "=", "$", "this", "->", "_getCacheFilePath", "(", "$", "sFileName", ")", ";", "if", "(", "is_null", "(", "$", "sPath", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "_expired", "(", "$", "sPath", ")", ")", "{", "@", "unlink", "(", "$", "sPath", ")", ";", "return", "false", ";", "}", "return", "unserialize", "(", "file_get_contents", "(", "$", "sPath", ")", ")", ";", "}" ]
Get file from cache. @param string $sFileName @return bool|mixed
[ "Get", "file", "from", "cache", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresourcecache.php#L125-L140
27,692
OXID-eSales/paymorrow-module
core/oxpspaymorrowresourcecache.php
OxpsPaymorrowResourceCache._getCacheFilePath
protected function _getCacheFilePath( $sFileName = '' ) { $sTmpDirFullPath = realpath( oxRegistry::getConfig()->getConfigParam( 'sCompileDir' ) ); $sResourceCacheFolderName = $this->getCacheFolder(); $sResourceCachePath = $sTmpDirFullPath . DIRECTORY_SEPARATOR . $sResourceCacheFolderName; // Try to create resource cache folder if it does not exist if ( !is_dir( $sResourceCachePath ) ) { @mkdir( $sResourceCachePath, 0777 ); } if ( !is_dir( $sResourceCachePath ) ) { return null; } return empty( $sFileName ) ? $sResourceCachePath : $sResourceCachePath . DIRECTORY_SEPARATOR . basename( $sFileName ); }
php
protected function _getCacheFilePath( $sFileName = '' ) { $sTmpDirFullPath = realpath( oxRegistry::getConfig()->getConfigParam( 'sCompileDir' ) ); $sResourceCacheFolderName = $this->getCacheFolder(); $sResourceCachePath = $sTmpDirFullPath . DIRECTORY_SEPARATOR . $sResourceCacheFolderName; // Try to create resource cache folder if it does not exist if ( !is_dir( $sResourceCachePath ) ) { @mkdir( $sResourceCachePath, 0777 ); } if ( !is_dir( $sResourceCachePath ) ) { return null; } return empty( $sFileName ) ? $sResourceCachePath : $sResourceCachePath . DIRECTORY_SEPARATOR . basename( $sFileName ); }
[ "protected", "function", "_getCacheFilePath", "(", "$", "sFileName", "=", "''", ")", "{", "$", "sTmpDirFullPath", "=", "realpath", "(", "oxRegistry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(", "'sCompileDir'", ")", ")", ";", "$", "sResourceCacheFolderName", "=", "$", "this", "->", "getCacheFolder", "(", ")", ";", "$", "sResourceCachePath", "=", "$", "sTmpDirFullPath", ".", "DIRECTORY_SEPARATOR", ".", "$", "sResourceCacheFolderName", ";", "// Try to create resource cache folder if it does not exist", "if", "(", "!", "is_dir", "(", "$", "sResourceCachePath", ")", ")", "{", "@", "mkdir", "(", "$", "sResourceCachePath", ",", "0777", ")", ";", "}", "if", "(", "!", "is_dir", "(", "$", "sResourceCachePath", ")", ")", "{", "return", "null", ";", "}", "return", "empty", "(", "$", "sFileName", ")", "?", "$", "sResourceCachePath", ":", "$", "sResourceCachePath", ".", "DIRECTORY_SEPARATOR", ".", "basename", "(", "$", "sFileName", ")", ";", "}" ]
Get full path to a file inside resource cache folder. @param string $sFileName If empty, full path to resource cache folder is returned @return null|string Null if resource cache folder is not available, full path string on success.
[ "Get", "full", "path", "to", "a", "file", "inside", "resource", "cache", "folder", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresourcecache.php#L158-L176
27,693
OXID-eSales/paymorrow-module
core/oxpspaymorrowresourcecache.php
OxpsPaymorrowResourceCache._expired
protected function _expired( $sFilePath ) { return ( !is_file( $sFilePath ) or ( filemtime( $sFilePath ) - 1000 <= strtotime( sprintf( 'now - %d second', $this->getCacheTtl() ) ) ) ); }
php
protected function _expired( $sFilePath ) { return ( !is_file( $sFilePath ) or ( filemtime( $sFilePath ) - 1000 <= strtotime( sprintf( 'now - %d second', $this->getCacheTtl() ) ) ) ); }
[ "protected", "function", "_expired", "(", "$", "sFilePath", ")", "{", "return", "(", "!", "is_file", "(", "$", "sFilePath", ")", "or", "(", "filemtime", "(", "$", "sFilePath", ")", "-", "1000", "<=", "strtotime", "(", "sprintf", "(", "'now - %d second'", ",", "$", "this", "->", "getCacheTtl", "(", ")", ")", ")", ")", ")", ";", "}" ]
Check if file exists and was created not too long ago. @param string $sFilePath @return bool False if file is missing or is too old/expired, True otherwise.
[ "Check", "if", "file", "exists", "and", "was", "created", "not", "too", "long", "ago", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpspaymorrowresourcecache.php#L185-L191
27,694
odan/csrf
src/CsrfMiddleware.php
CsrfMiddleware.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $tokenValue = $this->getToken(); $this->validate($request, $tokenValue); // Attach Request Attributes $request = $request->withAttribute('csrf_token', $tokenValue); /* @var Response $response */ $response = $handler->handle($request); return $this->injectTokenToResponse($response, $tokenValue); }
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $tokenValue = $this->getToken(); $this->validate($request, $tokenValue); // Attach Request Attributes $request = $request->withAttribute('csrf_token', $tokenValue); /* @var Response $response */ $response = $handler->handle($request); return $this->injectTokenToResponse($response, $tokenValue); }
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "$", "tokenValue", "=", "$", "this", "->", "getToken", "(", ")", ";", "$", "this", "->", "validate", "(", "$", "request", ",", "$", "tokenValue", ")", ";", "// Attach Request Attributes", "$", "request", "=", "$", "request", "->", "withAttribute", "(", "'csrf_token'", ",", "$", "tokenValue", ")", ";", "/* @var Response $response */", "$", "response", "=", "$", "handler", "->", "handle", "(", "$", "request", ")", ";", "return", "$", "this", "->", "injectTokenToResponse", "(", "$", "response", ",", "$", "tokenValue", ")", ";", "}" ]
Invoke middleware. @param ServerRequestInterface $request The request @param RequestHandlerInterface $handler The handler @return ResponseInterface The response
[ "Invoke", "middleware", "." ]
3022e03f610c7411b5ee6bc40e8560a5f56c169e
https://github.com/odan/csrf/blob/3022e03f610c7411b5ee6bc40e8560a5f56c169e/src/CsrfMiddleware.php#L72-L85
27,695
odan/csrf
src/CsrfMiddleware.php
CsrfMiddleware.setSessionId
public function setSessionId(string $sessionId): void { if (empty($sessionId)) { throw new RuntimeException('CSRF middleware failed. SessionId not found!'); } $this->sessionId = $sessionId; }
php
public function setSessionId(string $sessionId): void { if (empty($sessionId)) { throw new RuntimeException('CSRF middleware failed. SessionId not found!'); } $this->sessionId = $sessionId; }
[ "public", "function", "setSessionId", "(", "string", "$", "sessionId", ")", ":", "void", "{", "if", "(", "empty", "(", "$", "sessionId", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'CSRF middleware failed. SessionId not found!'", ")", ";", "}", "$", "this", "->", "sessionId", "=", "$", "sessionId", ";", "}" ]
Set session id. @param string $sessionId the session id
[ "Set", "session", "id", "." ]
3022e03f610c7411b5ee6bc40e8560a5f56c169e
https://github.com/odan/csrf/blob/3022e03f610c7411b5ee6bc40e8560a5f56c169e/src/CsrfMiddleware.php#L92-L99
27,696
odan/csrf
src/CsrfMiddleware.php
CsrfMiddleware.injectTokenToResponse
private function injectTokenToResponse(ResponseInterface $response, string $tokenValue): ResponseInterface { // Check if response is html $contentTypes = $response->getHeader('content-type'); $contentType = reset($contentTypes) ?: ''; if (strpos($contentType, 'text/html') === false) { return $response; } $content = $response->getBody()->__toString(); if ($this->protectForms) { $content = $this->injectFormHiddenFieldToResponse($content, $tokenValue); } if ($this->protectJqueryAjax) { $content = $this->injectJqueryToResponse($content, $tokenValue); } return $response->withBody($this->streamFactory->createStream($content)); }
php
private function injectTokenToResponse(ResponseInterface $response, string $tokenValue): ResponseInterface { // Check if response is html $contentTypes = $response->getHeader('content-type'); $contentType = reset($contentTypes) ?: ''; if (strpos($contentType, 'text/html') === false) { return $response; } $content = $response->getBody()->__toString(); if ($this->protectForms) { $content = $this->injectFormHiddenFieldToResponse($content, $tokenValue); } if ($this->protectJqueryAjax) { $content = $this->injectJqueryToResponse($content, $tokenValue); } return $response->withBody($this->streamFactory->createStream($content)); }
[ "private", "function", "injectTokenToResponse", "(", "ResponseInterface", "$", "response", ",", "string", "$", "tokenValue", ")", ":", "ResponseInterface", "{", "// Check if response is html", "$", "contentTypes", "=", "$", "response", "->", "getHeader", "(", "'content-type'", ")", ";", "$", "contentType", "=", "reset", "(", "$", "contentTypes", ")", "?", ":", "''", ";", "if", "(", "strpos", "(", "$", "contentType", ",", "'text/html'", ")", "===", "false", ")", "{", "return", "$", "response", ";", "}", "$", "content", "=", "$", "response", "->", "getBody", "(", ")", "->", "__toString", "(", ")", ";", "if", "(", "$", "this", "->", "protectForms", ")", "{", "$", "content", "=", "$", "this", "->", "injectFormHiddenFieldToResponse", "(", "$", "content", ",", "$", "tokenValue", ")", ";", "}", "if", "(", "$", "this", "->", "protectJqueryAjax", ")", "{", "$", "content", "=", "$", "this", "->", "injectJqueryToResponse", "(", "$", "content", ",", "$", "tokenValue", ")", ";", "}", "return", "$", "response", "->", "withBody", "(", "$", "this", "->", "streamFactory", "->", "createStream", "(", "$", "content", ")", ")", ";", "}" ]
Inject token to response object. @param ResponseInterface $response the response @param string $tokenValue token value @throws RuntimeException @return ResponseInterface the response
[ "Inject", "token", "to", "response", "object", "." ]
3022e03f610c7411b5ee6bc40e8560a5f56c169e
https://github.com/odan/csrf/blob/3022e03f610c7411b5ee6bc40e8560a5f56c169e/src/CsrfMiddleware.php#L222-L242
27,697
odan/csrf
src/CsrfMiddleware.php
CsrfMiddleware.injectFormHiddenFieldToResponse
private function injectFormHiddenFieldToResponse(string $body, string $tokenValue): string { $regex = '/(<form\b[^>]*>)(.*?)(<\/form>)/is'; $htmlHiddenField = sprintf('$1<input type="hidden" name="%s" value="%s">$2$3', $this->name, $tokenValue); $body = preg_replace($regex, $htmlHiddenField, $body); return (string)$body; }
php
private function injectFormHiddenFieldToResponse(string $body, string $tokenValue): string { $regex = '/(<form\b[^>]*>)(.*?)(<\/form>)/is'; $htmlHiddenField = sprintf('$1<input type="hidden" name="%s" value="%s">$2$3', $this->name, $tokenValue); $body = preg_replace($regex, $htmlHiddenField, $body); return (string)$body; }
[ "private", "function", "injectFormHiddenFieldToResponse", "(", "string", "$", "body", ",", "string", "$", "tokenValue", ")", ":", "string", "{", "$", "regex", "=", "'/(<form\\b[^>]*>)(.*?)(<\\/form>)/is'", ";", "$", "htmlHiddenField", "=", "sprintf", "(", "'$1<input type=\"hidden\" name=\"%s\" value=\"%s\">$2$3'", ",", "$", "this", "->", "name", ",", "$", "tokenValue", ")", ";", "$", "body", "=", "preg_replace", "(", "$", "regex", ",", "$", "htmlHiddenField", ",", "$", "body", ")", ";", "return", "(", "string", ")", "$", "body", ";", "}" ]
Inject hidden field. @param string $body body @param string $tokenValue token @return string html
[ "Inject", "hidden", "field", "." ]
3022e03f610c7411b5ee6bc40e8560a5f56c169e
https://github.com/odan/csrf/blob/3022e03f610c7411b5ee6bc40e8560a5f56c169e/src/CsrfMiddleware.php#L252-L259
27,698
odan/csrf
src/CsrfMiddleware.php
CsrfMiddleware.injectJqueryToResponse
private function injectJqueryToResponse(string $body, string $tokenValue): string { $regex = '/(.*?)(<\/body>)/is'; $jQueryCode = sprintf( '<script>$.ajaxSetup({beforeSend: function (xhr) { xhr.setRequestHeader("X-CSRF-Token","%s"); }});</script>', $tokenValue ); $body = preg_replace($regex, '$1' . $jQueryCode . '$2', $body, -1, $count) ?? ''; if (!$count) { // Inject JS code anyway $body .= $jQueryCode; } return $body; }
php
private function injectJqueryToResponse(string $body, string $tokenValue): string { $regex = '/(.*?)(<\/body>)/is'; $jQueryCode = sprintf( '<script>$.ajaxSetup({beforeSend: function (xhr) { xhr.setRequestHeader("X-CSRF-Token","%s"); }});</script>', $tokenValue ); $body = preg_replace($regex, '$1' . $jQueryCode . '$2', $body, -1, $count) ?? ''; if (!$count) { // Inject JS code anyway $body .= $jQueryCode; } return $body; }
[ "private", "function", "injectJqueryToResponse", "(", "string", "$", "body", ",", "string", "$", "tokenValue", ")", ":", "string", "{", "$", "regex", "=", "'/(.*?)(<\\/body>)/is'", ";", "$", "jQueryCode", "=", "sprintf", "(", "'<script>$.ajaxSetup({beforeSend: function (xhr) { xhr.setRequestHeader(\"X-CSRF-Token\",\"%s\"); }});</script>'", ",", "$", "tokenValue", ")", ";", "$", "body", "=", "preg_replace", "(", "$", "regex", ",", "'$1'", ".", "$", "jQueryCode", ".", "'$2'", ",", "$", "body", ",", "-", "1", ",", "$", "count", ")", "??", "''", ";", "if", "(", "!", "$", "count", ")", "{", "// Inject JS code anyway", "$", "body", ".=", "$", "jQueryCode", ";", "}", "return", "$", "body", ";", "}" ]
Inject jquery code. @param string $body body data @param string $tokenValue token value @return string html
[ "Inject", "jquery", "code", "." ]
3022e03f610c7411b5ee6bc40e8560a5f56c169e
https://github.com/odan/csrf/blob/3022e03f610c7411b5ee6bc40e8560a5f56c169e/src/CsrfMiddleware.php#L269-L284
27,699
OXID-eSales/paymorrow-module
core/oxpsoxid2paymorrow.php
OxpsOxid2Paymorrow.getBuiltPaymorrowResourceProxy
public function getBuiltPaymorrowResourceProxy() { /** @var $oPmResourceProxy PaymorrowResourceProxy */ $oPmResourceProxy = oxNew( 'PaymorrowResourceProxy' ); $oPmSettings = $this->getPaymorrowSettings(); $oPmResourceProxy->setMerchantId( $oPmSettings->getMerchantId() ); $oPmResourceProxy->setEndPointUrl( $oPmSettings->getPaymorrowResourcePath() ); return $oPmResourceProxy; }
php
public function getBuiltPaymorrowResourceProxy() { /** @var $oPmResourceProxy PaymorrowResourceProxy */ $oPmResourceProxy = oxNew( 'PaymorrowResourceProxy' ); $oPmSettings = $this->getPaymorrowSettings(); $oPmResourceProxy->setMerchantId( $oPmSettings->getMerchantId() ); $oPmResourceProxy->setEndPointUrl( $oPmSettings->getPaymorrowResourcePath() ); return $oPmResourceProxy; }
[ "public", "function", "getBuiltPaymorrowResourceProxy", "(", ")", "{", "/** @var $oPmResourceProxy PaymorrowResourceProxy */", "$", "oPmResourceProxy", "=", "oxNew", "(", "'PaymorrowResourceProxy'", ")", ";", "$", "oPmSettings", "=", "$", "this", "->", "getPaymorrowSettings", "(", ")", ";", "$", "oPmResourceProxy", "->", "setMerchantId", "(", "$", "oPmSettings", "->", "getMerchantId", "(", ")", ")", ";", "$", "oPmResourceProxy", "->", "setEndPointUrl", "(", "$", "oPmSettings", "->", "getPaymorrowResourcePath", "(", ")", ")", ";", "return", "$", "oPmResourceProxy", ";", "}" ]
Get built resource proxy with merchant and endpoint url set. @return PaymorrowResourceProxy
[ "Get", "built", "resource", "proxy", "with", "merchant", "and", "endpoint", "url", "set", "." ]
adb5d7f50c2fa5b566abd262161c483c42847b42
https://github.com/OXID-eSales/paymorrow-module/blob/adb5d7f50c2fa5b566abd262161c483c42847b42/core/oxpsoxid2paymorrow.php#L95-L106