repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
edmondscommerce/doctrine-static-meta | src/CodeGeneration/ReflectionHelper.php | ReflectionHelper.getMethodBody | public function getMethodBody(string $methodName, ReflectionClass $reflectionClass): string
{
$method = $reflectionClass->getMethod($methodName);
$startLine = $method->getStartLine() - 1;
$length = $method->getEndLine() - $startLine;
$lines = file($reflectionClass->getFileName());
$methodLines = \array_slice($lines, $startLine, $length);
return implode('', $methodLines);
} | php | public function getMethodBody(string $methodName, ReflectionClass $reflectionClass): string
{
$method = $reflectionClass->getMethod($methodName);
$startLine = $method->getStartLine() - 1;
$length = $method->getEndLine() - $startLine;
$lines = file($reflectionClass->getFileName());
$methodLines = \array_slice($lines, $startLine, $length);
return implode('', $methodLines);
} | [
"public",
"function",
"getMethodBody",
"(",
"string",
"$",
"methodName",
",",
"ReflectionClass",
"$",
"reflectionClass",
")",
":",
"string",
"{",
"$",
"method",
"=",
"$",
"reflectionClass",
"->",
"getMethod",
"(",
"$",
"methodName",
")",
";",
"$",
"startLine",... | Get the full method body using reflection
@param string $methodName
@param ReflectionClass $reflectionClass
@return string | [
"Get",
"the",
"full",
"method",
"body",
"using",
"reflection"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/ReflectionHelper.php#L141-L150 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Client.php | OffAmazonPaymentsNotifications_Client.parseRawMessage | public function parseRawMessage($headers, $body)
{
// Is this json, is this
// an sns message, do we have the fields we require
$snsMessage = SnsMessageParser::parseNotification($headers, $body);
// security validation - check that this message is
// from amazon and that it has been signed correctly
$this->_snsMessageValidator->validateMessage($snsMessage);
// Convert to object - convert from basic class to object
$ipnMessage = IpnNotificationParser::parseSnsMessage($snsMessage);
return XmlNotificationParser::parseIpnMessage($ipnMessage);
} | php | public function parseRawMessage($headers, $body)
{
// Is this json, is this
// an sns message, do we have the fields we require
$snsMessage = SnsMessageParser::parseNotification($headers, $body);
// security validation - check that this message is
// from amazon and that it has been signed correctly
$this->_snsMessageValidator->validateMessage($snsMessage);
// Convert to object - convert from basic class to object
$ipnMessage = IpnNotificationParser::parseSnsMessage($snsMessage);
return XmlNotificationParser::parseIpnMessage($ipnMessage);
} | [
"public",
"function",
"parseRawMessage",
"(",
"$",
"headers",
",",
"$",
"body",
")",
"{",
"// Is this json, is this",
"// an sns message, do we have the fields we require",
"$",
"snsMessage",
"=",
"SnsMessageParser",
"::",
"parseNotification",
"(",
"$",
"headers",
",",
... | Converts a http POST body and headers into
a notification object
@param array $headers post request headers
@param string $body post request body, should be json
@throws OffAmazonPaymentsNotifications_InvalidMessageException
@return OffAmazonPaymentsNotifications_Notification | [
"Converts",
"a",
"http",
"POST",
"body",
"and",
"headers",
"into",
"a",
"notification",
"object"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Client.php#L90-L103 | train |
comporu/compo-core | src/Compo/Sonata/SeoBundle/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php | BaseBreadcrumbMenuBlockService.getRootMenu | protected function getRootMenu(BlockContextInterface $blockContext)
{
$settings = $blockContext->getSettings();
$menu = $this->getFactory()->createItem('breadcrumb');
$menu->setChildrenAttribute('class', 'breadcrumb');
if (!$settings['current_uri']) {
$settings['current_uri'] = $this->getRequest()->getRequestUri();
}
if (method_exists($menu, 'setCurrentUri')) {
$menu->setCurrentUri($settings['current_uri']);
}
if (method_exists($menu, 'setCurrent')) {
$menu->setCurrent($settings['current_uri']);
}
$uri = $this->getContainer()->get('router')->generate(
'page_slug',
['path' => '/']
);
if ($settings['include_homepage_link']) {
$menu->addChild('sonata_seo_homepage_breadcrumb', ['uri' => $uri]);
}
return $menu;
} | php | protected function getRootMenu(BlockContextInterface $blockContext)
{
$settings = $blockContext->getSettings();
$menu = $this->getFactory()->createItem('breadcrumb');
$menu->setChildrenAttribute('class', 'breadcrumb');
if (!$settings['current_uri']) {
$settings['current_uri'] = $this->getRequest()->getRequestUri();
}
if (method_exists($menu, 'setCurrentUri')) {
$menu->setCurrentUri($settings['current_uri']);
}
if (method_exists($menu, 'setCurrent')) {
$menu->setCurrent($settings['current_uri']);
}
$uri = $this->getContainer()->get('router')->generate(
'page_slug',
['path' => '/']
);
if ($settings['include_homepage_link']) {
$menu->addChild('sonata_seo_homepage_breadcrumb', ['uri' => $uri]);
}
return $menu;
} | [
"protected",
"function",
"getRootMenu",
"(",
"BlockContextInterface",
"$",
"blockContext",
")",
"{",
"$",
"settings",
"=",
"$",
"blockContext",
"->",
"getSettings",
"(",
")",
";",
"$",
"menu",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createItem... | Initialize breadcrumb menu.
@param BlockContextInterface $blockContext
@return \Knp\Menu\ItemInterface | [
"Initialize",
"breadcrumb",
"menu",
"."
] | ebaa9fe8a4b831506c78fdf637da6b4deadec1e2 | https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/SeoBundle/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php#L55-L85 | train |
Erebot/Erebot | src/LineIO.php | LineIO.setSocket | public function setSocket($socket)
{
$this->socket = $socket;
$this->incomingData = "";
$this->rcvQueue = array();
$this->sndQueue = array();
} | php | public function setSocket($socket)
{
$this->socket = $socket;
$this->incomingData = "";
$this->rcvQueue = array();
$this->sndQueue = array();
} | [
"public",
"function",
"setSocket",
"(",
"$",
"socket",
")",
"{",
"$",
"this",
"->",
"socket",
"=",
"$",
"socket",
";",
"$",
"this",
"->",
"incomingData",
"=",
"\"\"",
";",
"$",
"this",
"->",
"rcvQueue",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->... | Sets the socket this line reader operates on.
\param resource $socket
The socket this reader will use from now on. | [
"Sets",
"the",
"socket",
"this",
"line",
"reader",
"operates",
"on",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/LineIO.php#L97-L103 | train |
Erebot/Erebot | src/LineIO.php | LineIO.getLine | protected function getLine()
{
$pos = false;
foreach ($this->eol as $eol) {
$pos = strpos($this->incomingData, $eol);
if ($pos !== false) {
break;
}
}
if ($pos === false) {
return false;
}
$len = strlen($eol);
$line = \Erebot\Utils::toUTF8(substr($this->incomingData, 0, $pos));
$this->incomingData = substr($this->incomingData, $pos + $len);
$this->rcvQueue[] = $line;
$logger = \Plop\Plop::getInstance();
$logger->debug(
'%(line)s',
array('line' => addcslashes($line, "\000..\037"))
);
return true;
} | php | protected function getLine()
{
$pos = false;
foreach ($this->eol as $eol) {
$pos = strpos($this->incomingData, $eol);
if ($pos !== false) {
break;
}
}
if ($pos === false) {
return false;
}
$len = strlen($eol);
$line = \Erebot\Utils::toUTF8(substr($this->incomingData, 0, $pos));
$this->incomingData = substr($this->incomingData, $pos + $len);
$this->rcvQueue[] = $line;
$logger = \Plop\Plop::getInstance();
$logger->debug(
'%(line)s',
array('line' => addcslashes($line, "\000..\037"))
);
return true;
} | [
"protected",
"function",
"getLine",
"(",
")",
"{",
"$",
"pos",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"eol",
"as",
"$",
"eol",
")",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"this",
"->",
"incomingData",
",",
"$",
"eol",
")",
";",
... | Retrieves a single line of text from the incoming buffer
and puts it in the incoming FIFO.
\retval true
Whether a line could be fetched from the buffer.
\retval false
... or not.
\note
Lines fetched by this method are always UTF-8 encoded. | [
"Retrieves",
"a",
"single",
"line",
"of",
"text",
"from",
"the",
"incoming",
"buffer",
"and",
"puts",
"it",
"in",
"the",
"incoming",
"FIFO",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/LineIO.php#L175-L199 | train |
Erebot/Erebot | src/LineIO.php | LineIO.read | public function read()
{
if ($this->socket === null) {
return false;
}
if (feof($this->socket)) {
return false;
}
$received = fread($this->socket, 4096);
if ($received === false) {
return false;
}
$this->incomingData .= $received;
// Workaround for issue #8.
$metadata = stream_get_meta_data($this->socket);
if ($metadata['stream_type'] == 'tcp_socket/ssl' && !feof($this->socket)) {
$blocking = (int) $metadata['blocked'];
stream_set_blocking($this->socket, 0);
$received = fread($this->socket, 4096);
stream_set_blocking($this->socket, $blocking);
if ($received !== false) {
$this->incomingData .= $received;
}
}
// Read all messages currently in the input buffer.
while ($this->getLine()) {
; // Nothing more to do.
}
return true;
} | php | public function read()
{
if ($this->socket === null) {
return false;
}
if (feof($this->socket)) {
return false;
}
$received = fread($this->socket, 4096);
if ($received === false) {
return false;
}
$this->incomingData .= $received;
// Workaround for issue #8.
$metadata = stream_get_meta_data($this->socket);
if ($metadata['stream_type'] == 'tcp_socket/ssl' && !feof($this->socket)) {
$blocking = (int) $metadata['blocked'];
stream_set_blocking($this->socket, 0);
$received = fread($this->socket, 4096);
stream_set_blocking($this->socket, $blocking);
if ($received !== false) {
$this->incomingData .= $received;
}
}
// Read all messages currently in the input buffer.
while ($this->getLine()) {
; // Nothing more to do.
}
return true;
} | [
"public",
"function",
"read",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"socket",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"feof",
"(",
"$",
"this",
"->",
"socket",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"re... | Reads as many lines from the socket
as possible.
\retval bool
\b true if lines were successfully read,
\b false is returned whenever EOF is reached
or if this method has been called while
the socket was still uninitialized..
\note
This method blocks until lines have
been read of EOF is reached (whichever
comes first). | [
"Reads",
"as",
"many",
"lines",
"from",
"the",
"socket",
"as",
"possible",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/LineIO.php#L216-L250 | train |
Erebot/Erebot | src/LineIO.php | LineIO.push | public function push($line)
{
if ($this->socket === null) {
throw new \Erebot\IllegalActionException('Uninitialized socket');
}
if (strcspn($line, "\r\n") != strlen($line)) {
throw new \Erebot\InvalidValueException(
'Line contains forbidden characters'
);
}
$this->sndQueue[] = $line;
} | php | public function push($line)
{
if ($this->socket === null) {
throw new \Erebot\IllegalActionException('Uninitialized socket');
}
if (strcspn($line, "\r\n") != strlen($line)) {
throw new \Erebot\InvalidValueException(
'Line contains forbidden characters'
);
}
$this->sndQueue[] = $line;
} | [
"public",
"function",
"push",
"(",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"socket",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"Erebot",
"\\",
"IllegalActionException",
"(",
"'Uninitialized socket'",
")",
";",
"}",
"if",
"(",
"strcspn",... | Adds a given line to the outgoing FIFO.
\param string $line
The line of text to send.
\throw Erebot::InvalidValueException
The $line contains invalid characters. | [
"Adds",
"a",
"given",
"line",
"to",
"the",
"outgoing",
"FIFO",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/LineIO.php#L279-L291 | train |
Erebot/Erebot | src/LineIO.php | LineIO.write | public function write()
{
if (!count($this->sndQueue)) {
return false;
}
$line = array_shift($this->sndQueue);
$logger = \Plop\Plop::getInstance();
// Make sure we send the whole line,
// with a trailing CR LF sequence.
$eol = $this->eol[count($this->eol) - 1];
$line .= $eol;
$len = strlen($line);
for ($written = 0; $written < $len; $written += $fwrite) {
$fwrite = @fwrite($this->socket, substr($line, $written));
if ($fwrite === false) {
return false;
}
}
$line = substr($line, 0, -strlen($eol));
$logger->debug(
'%(line)s',
array('line' => addcslashes($line, "\000..\037"))
);
return $written;
} | php | public function write()
{
if (!count($this->sndQueue)) {
return false;
}
$line = array_shift($this->sndQueue);
$logger = \Plop\Plop::getInstance();
// Make sure we send the whole line,
// with a trailing CR LF sequence.
$eol = $this->eol[count($this->eol) - 1];
$line .= $eol;
$len = strlen($line);
for ($written = 0; $written < $len; $written += $fwrite) {
$fwrite = @fwrite($this->socket, substr($line, $written));
if ($fwrite === false) {
return false;
}
}
$line = substr($line, 0, -strlen($eol));
$logger->debug(
'%(line)s',
array('line' => addcslashes($line, "\000..\037"))
);
return $written;
} | [
"public",
"function",
"write",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"sndQueue",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"line",
"=",
"array_shift",
"(",
"$",
"this",
"->",
"sndQueue",
")",
";",
"$",
"logger",
"... | Writes a single line from the output buffer
to the socket.
\retval int
The number of bytes successfully
written on the socket.
\retval false
The connection was lost while trying
to send the line or the output buffer
was empty. | [
"Writes",
"a",
"single",
"line",
"from",
"the",
"output",
"buffer",
"to",
"the",
"socket",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/LineIO.php#L306-L332 | train |
chameleon-system/chameleon-shop | src/ShopRatingService/Util/CacheUtil.php | CacheUtil.getCacheDirectory | public function getCacheDirectory()
{
$dir = $this->cacheBaseDir.'/RatingServicesCache/';
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
if (!file_exists($dir)) {
$dir = null;
}
}
if (!is_dir($dir) || !is_writable($dir)) {
$dir = null;
}
return $dir;
} | php | public function getCacheDirectory()
{
$dir = $this->cacheBaseDir.'/RatingServicesCache/';
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
if (!file_exists($dir)) {
$dir = null;
}
}
if (!is_dir($dir) || !is_writable($dir)) {
$dir = null;
}
return $dir;
} | [
"public",
"function",
"getCacheDirectory",
"(",
")",
"{",
"$",
"dir",
"=",
"$",
"this",
"->",
"cacheBaseDir",
".",
"'/RatingServicesCache/'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"dir",
")",
")",
"{",
"mkdir",
"(",
"$",
"dir",
",",
"0777",
","... | Returns the cache directory used for downloads.
@return string|null null if the directory could not be created or is not writable | [
"Returns",
"the",
"cache",
"directory",
"used",
"for",
"downloads",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingService/Util/CacheUtil.php#L34-L48 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/File/Writer.php | Writer.write | public function write(File $file): string
{
$this->createDirectoryIfRequired($file);
$file->create();
$file->putContents();
return $file->getPath();
} | php | public function write(File $file): string
{
$this->createDirectoryIfRequired($file);
$file->create();
$file->putContents();
return $file->getPath();
} | [
"public",
"function",
"write",
"(",
"File",
"$",
"file",
")",
":",
"string",
"{",
"$",
"this",
"->",
"createDirectoryIfRequired",
"(",
"$",
"file",
")",
";",
"$",
"file",
"->",
"create",
"(",
")",
";",
"$",
"file",
"->",
"putContents",
"(",
")",
";",... | Write a file object to the filesystem and return the created path
@param File $file
@return string
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException | [
"Write",
"a",
"file",
"object",
"to",
"the",
"filesystem",
"and",
"return",
"the",
"created",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/File/Writer.php#L17-L24 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReviewList.class.php | TPkgShopArticleReviewShopArticleReviewList.GetReviewsForArticleSortedByRate | public static function GetReviewsForArticleSortedByRate($iShopArticleId)
{
$sQuery = "SELECT * FROM `shop_article_review`
WHERE `shop_article_review`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopArticleId)."'
AND `shop_article_review`.`publish` = '1'
ORDER BY `shop_article_review`.`helpful_count` DESC , `shop_article_review`.`datecreated` DESC";
$oList = &TdbShopArticleReviewList::GetList($sQuery);
return $oList;
} | php | public static function GetReviewsForArticleSortedByRate($iShopArticleId)
{
$sQuery = "SELECT * FROM `shop_article_review`
WHERE `shop_article_review`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopArticleId)."'
AND `shop_article_review`.`publish` = '1'
ORDER BY `shop_article_review`.`helpful_count` DESC , `shop_article_review`.`datecreated` DESC";
$oList = &TdbShopArticleReviewList::GetList($sQuery);
return $oList;
} | [
"public",
"static",
"function",
"GetReviewsForArticleSortedByRate",
"(",
"$",
"iShopArticleId",
")",
"{",
"$",
"sQuery",
"=",
"\"SELECT * FROM `shop_article_review`\n WHERE `shop_article_review`.`shop_article_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInst... | Get reviews for aarticel sorted by positive rate.
@param $iShopArticleId
@return TdbShopArticleReviewList | [
"Get",
"reviews",
"for",
"aarticel",
"sorted",
"by",
"positive",
"rate",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReviewList.class.php#L21-L30 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php | TShopPaymentHandlerOgone.GetExternalPaymentHandlerURL | protected function GetExternalPaymentHandlerURL(TdbShopOrder $oOrder)
{
$oUser = TdbDataExtranetUser::GetInstance();
$oCountry = $oUser->GetCountry();
$sActiveFrontEndLanguageCode = self::getLanguageService()->getLanguageIsoCode();
$aParameter = array(
'PSPID' => $this->GetPSPID(),
'ORDERID' => $oOrder->fieldOrdernumber,
'AMOUNT' => $oOrder->fieldValueTotal * 100,
'CURRENCY' => $this->GetCurrency(),
'LANGUAGE' => strtolower($sActiveFrontEndLanguageCode).'_'.strtoupper($sActiveFrontEndLanguageCode),
'CN' => $oUser->fieldFirstname.' '.$oUser->fieldLastname,
'EMAIL' => $oUser->fieldName,
'OWNERADDRESS' => $oUser->fieldStreet.' '.$oUser->fieldStreetnr,
'OWNERCTY' => $oCountry->fieldName,
'OWNERTOWN' => $oUser->fieldCity,
'OWNERZIP' => $oUser->fieldPostalcode,
'PARAMPLUS' => 'PAYCALL='.self::URL_IDENTIFIER.'&PAYHAID='.$this->sqlData['cmsident'], 'PARAMVAR' => self::URL_IDENTIFIER_NOTIFY, );
$this->AddCustomParameter($aParameter);
$sOgonePaymentLayoutPageURL = $this->GetOgonePaymentLayoutPage();
if ($sOgonePaymentLayoutPageURL) {
$aParameter['TP'] = $sOgonePaymentLayoutPageURL;
}
$aParameter['ACCEPTURL'] = $this->GetResponseURL('success');
$aParameter['DECLINEURL'] = $this->GetResponseURL('decline');
$aParameter['SHASIGN'] = $this->BuildOutgoingHash($aParameter);
$sExternalHandlerURL = $this->GetPaymentURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
return $sExternalHandlerURL;
} | php | protected function GetExternalPaymentHandlerURL(TdbShopOrder $oOrder)
{
$oUser = TdbDataExtranetUser::GetInstance();
$oCountry = $oUser->GetCountry();
$sActiveFrontEndLanguageCode = self::getLanguageService()->getLanguageIsoCode();
$aParameter = array(
'PSPID' => $this->GetPSPID(),
'ORDERID' => $oOrder->fieldOrdernumber,
'AMOUNT' => $oOrder->fieldValueTotal * 100,
'CURRENCY' => $this->GetCurrency(),
'LANGUAGE' => strtolower($sActiveFrontEndLanguageCode).'_'.strtoupper($sActiveFrontEndLanguageCode),
'CN' => $oUser->fieldFirstname.' '.$oUser->fieldLastname,
'EMAIL' => $oUser->fieldName,
'OWNERADDRESS' => $oUser->fieldStreet.' '.$oUser->fieldStreetnr,
'OWNERCTY' => $oCountry->fieldName,
'OWNERTOWN' => $oUser->fieldCity,
'OWNERZIP' => $oUser->fieldPostalcode,
'PARAMPLUS' => 'PAYCALL='.self::URL_IDENTIFIER.'&PAYHAID='.$this->sqlData['cmsident'], 'PARAMVAR' => self::URL_IDENTIFIER_NOTIFY, );
$this->AddCustomParameter($aParameter);
$sOgonePaymentLayoutPageURL = $this->GetOgonePaymentLayoutPage();
if ($sOgonePaymentLayoutPageURL) {
$aParameter['TP'] = $sOgonePaymentLayoutPageURL;
}
$aParameter['ACCEPTURL'] = $this->GetResponseURL('success');
$aParameter['DECLINEURL'] = $this->GetResponseURL('decline');
$aParameter['SHASIGN'] = $this->BuildOutgoingHash($aParameter);
$sExternalHandlerURL = $this->GetPaymentURL().'?'.str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
return $sExternalHandlerURL;
} | [
"protected",
"function",
"GetExternalPaymentHandlerURL",
"(",
"TdbShopOrder",
"$",
"oOrder",
")",
"{",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oCountry",
"=",
"$",
"oUser",
"->",
"GetCountry",
"(",
")",
";",
"$",
"... | return url to ogone payment service with all needed parameter.
@param TdbShopOrder $oOrder
@return string | [
"return",
"url",
"to",
"ogone",
"payment",
"service",
"with",
"all",
"needed",
"parameter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php#L50-L79 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php | TShopPaymentHandlerOgone.GetPSPID | protected function GetPSPID()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPSPID = $this->GetConfigParameter('user_id');
} else {
$sPSPID = $this->GetConfigParameter('user_id_test');
}
return $sPSPID;
} | php | protected function GetPSPID()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPSPID = $this->GetConfigParameter('user_id');
} else {
$sPSPID = $this->GetConfigParameter('user_id_test');
}
return $sPSPID;
} | [
"protected",
"function",
"GetPSPID",
"(",
")",
"{",
"if",
"(",
"IPkgShopOrderPaymentConfig",
"::",
"ENVIRONMENT_PRODUCTION",
"===",
"$",
"this",
"->",
"getEnvironment",
"(",
")",
")",
"{",
"$",
"sPSPID",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'use... | Returns the PSPID for test or live modus.
@return string | [
"Returns",
"the",
"PSPID",
"for",
"test",
"or",
"live",
"modus",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php#L90-L99 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php | TShopPaymentHandlerOgone.GetOgonePaymentLayoutPage | protected function GetOgonePaymentLayoutPage()
{
$sOgonePaymentLayoutSystemPage = trim($this->GetConfigParameter('layout_system_page'));
$sOgonePaymentLayoutPageURL = false;
if (!empty($sOgonePaymentLayoutSystemPage)) {
$oShop = TdbShop::GetInstance();
$sOgonePaymentLayoutPageURL = $oShop->GetLinkToSystemPage($sOgonePaymentLayoutSystemPage, null, true);
$sOgonePaymentLayoutPageURL = str_replace('https://', '', $sOgonePaymentLayoutPageURL);
$sOgonePaymentLayoutPageURL = str_replace('http://', '', $sOgonePaymentLayoutPageURL);
$sOgonePaymentLayoutPageURL = 'https://'.$sOgonePaymentLayoutPageURL;
}
return $sOgonePaymentLayoutPageURL;
} | php | protected function GetOgonePaymentLayoutPage()
{
$sOgonePaymentLayoutSystemPage = trim($this->GetConfigParameter('layout_system_page'));
$sOgonePaymentLayoutPageURL = false;
if (!empty($sOgonePaymentLayoutSystemPage)) {
$oShop = TdbShop::GetInstance();
$sOgonePaymentLayoutPageURL = $oShop->GetLinkToSystemPage($sOgonePaymentLayoutSystemPage, null, true);
$sOgonePaymentLayoutPageURL = str_replace('https://', '', $sOgonePaymentLayoutPageURL);
$sOgonePaymentLayoutPageURL = str_replace('http://', '', $sOgonePaymentLayoutPageURL);
$sOgonePaymentLayoutPageURL = 'https://'.$sOgonePaymentLayoutPageURL;
}
return $sOgonePaymentLayoutPageURL;
} | [
"protected",
"function",
"GetOgonePaymentLayoutPage",
"(",
")",
"{",
"$",
"sOgonePaymentLayoutSystemPage",
"=",
"trim",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'layout_system_page'",
")",
")",
";",
"$",
"sOgonePaymentLayoutPageURL",
"=",
"false",
";",
"i... | Get the URL to the payment layout.
Return false if not configured.
@return bool|mixed|string | [
"Get",
"the",
"URL",
"to",
"the",
"payment",
"layout",
".",
"Return",
"false",
"if",
"not",
"configured",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgone.class.php#L107-L120 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/File.php | File.getSplFileObject | public function getSplFileObject(): \SplFileObject
{
$this->assertExists();
if (null !== $this->splFileObject && $this->path === $this->splFileObject->getRealPath()) {
return $this->splFileObject;
}
$this->splFileObject = new \SplFileObject($this->path);
return $this->splFileObject;
} | php | public function getSplFileObject(): \SplFileObject
{
$this->assertExists();
if (null !== $this->splFileObject && $this->path === $this->splFileObject->getRealPath()) {
return $this->splFileObject;
}
$this->splFileObject = new \SplFileObject($this->path);
return $this->splFileObject;
} | [
"public",
"function",
"getSplFileObject",
"(",
")",
":",
"\\",
"SplFileObject",
"{",
"$",
"this",
"->",
"assertExists",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"splFileObject",
"&&",
"$",
"this",
"->",
"path",
"===",
"$",
"this",
"-... | Provide an SplFileObject object, asserting that the path exists
@return \SplFileObject
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException | [
"Provide",
"an",
"SplFileObject",
"object",
"asserting",
"that",
"the",
"path",
"exists"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/File.php#L105-L114 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php | MTShopOrderHistory.getOrderList | protected function getOrderList(TdbShopOrderList $oOrderList, $bCachingEnabled, IMapperCacheTriggerRestricted $oCacheTriggerManager)
{
$aOrderList = array();
while ($oOrder = &$oOrderList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oOrder->table, $oOrder->id);
}
$aOrder = $this->getOrder($oOrder, $bCachingEnabled, $oCacheTriggerManager);
$aOrder['bActive'] = $this->showDetail($oOrder);
$aOrderList[] = $aOrder;
}
return $aOrderList;
} | php | protected function getOrderList(TdbShopOrderList $oOrderList, $bCachingEnabled, IMapperCacheTriggerRestricted $oCacheTriggerManager)
{
$aOrderList = array();
while ($oOrder = &$oOrderList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oOrder->table, $oOrder->id);
}
$aOrder = $this->getOrder($oOrder, $bCachingEnabled, $oCacheTriggerManager);
$aOrder['bActive'] = $this->showDetail($oOrder);
$aOrderList[] = $aOrder;
}
return $aOrderList;
} | [
"protected",
"function",
"getOrderList",
"(",
"TdbShopOrderList",
"$",
"oOrderList",
",",
"$",
"bCachingEnabled",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
")",
"{",
"$",
"aOrderList",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"oOrde... | get the value list for the whole order list.
@param TdbShopOrderList $oOrderList
@param bool $bCachingEnabled
@param IMapperCacheTriggerRestricted $oCacheTriggerManager
@return array | [
"get",
"the",
"value",
"list",
"for",
"the",
"whole",
"order",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php#L46-L59 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php | MTShopOrderHistory.GetActiveOrderRequest | protected function GetActiveOrderRequest()
{
$sActiveOrderParameter = false;
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists($this->getActiveOrderParameter())) {
$sActiveOrderParameter = $oGlobal->GetUserData($this->getActiveOrderParameter());
}
return $sActiveOrderParameter;
} | php | protected function GetActiveOrderRequest()
{
$sActiveOrderParameter = false;
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists($this->getActiveOrderParameter())) {
$sActiveOrderParameter = $oGlobal->GetUserData($this->getActiveOrderParameter());
}
return $sActiveOrderParameter;
} | [
"protected",
"function",
"GetActiveOrderRequest",
"(",
")",
"{",
"$",
"sActiveOrderParameter",
"=",
"false",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"$",
"this",
"->",
"g... | Retuirns the active order parameter from url parameter.
@return bool | [
"Retuirns",
"the",
"active",
"order",
"parameter",
"from",
"url",
"parameter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php#L96-L105 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php | MTShopOrderHistory.showDetail | protected function showDetail(TdbShopOrder $oOrder)
{
$oGlobal = TGlobal::instance();
return true === $oGlobal->UserDataExists($this->getActiveOrderParameter()) && $oOrder->fieldOrdernumber == $oGlobal->GetUserData($this->getActiveOrderParameter());
} | php | protected function showDetail(TdbShopOrder $oOrder)
{
$oGlobal = TGlobal::instance();
return true === $oGlobal->UserDataExists($this->getActiveOrderParameter()) && $oOrder->fieldOrdernumber == $oGlobal->GetUserData($this->getActiveOrderParameter());
} | [
"protected",
"function",
"showDetail",
"(",
"TdbShopOrder",
"$",
"oOrder",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"return",
"true",
"===",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"$",
"this",
"->",
"getActiveOrderPara... | returns true if order number of given order is equal to the parameter in the url.
@param TdbShopOrder $oOrder
@return bool | [
"returns",
"true",
"if",
"order",
"number",
"of",
"given",
"order",
"is",
"equal",
"to",
"the",
"parameter",
"in",
"the",
"url",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php#L114-L119 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php | MTShopOrderHistory.getOrder | private function getOrder(TdbShopOrder $oOrder, $bCachingEnabled, IMapperCacheTriggerRestricted $oCacheTriggerManager)
{
$aOrder = array();
$oLocal = TCMSLocal::GetActive();
$aOrder['sOrderDate'] = $oLocal->FormatDate($oOrder->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);
$aOrder['sOrdernumber'] = $oOrder->fieldOrdernumber;
$aOrder['sSumGrandTotal'] = $oOrder->fieldValueTotalFormated;
$aOrder['sShippingAddress'] = $this->getShippingAddress($oOrder, $bCachingEnabled, $oCacheTriggerManager);
$aOrder['sDetailLink'] = $this->getDetailLink($oOrder);
$orderCurrency = $oOrder->GetFieldPkgShopCurrency();
if (null !== $orderCurrency) {
$aOrder['currencyIso'] = $orderCurrency->fieldIso4217;
$aOrder['currencySymbol'] = $orderCurrency->fieldSymbol;
}
$aOrder['bActive'] = false;
return $aOrder;
} | php | private function getOrder(TdbShopOrder $oOrder, $bCachingEnabled, IMapperCacheTriggerRestricted $oCacheTriggerManager)
{
$aOrder = array();
$oLocal = TCMSLocal::GetActive();
$aOrder['sOrderDate'] = $oLocal->FormatDate($oOrder->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);
$aOrder['sOrdernumber'] = $oOrder->fieldOrdernumber;
$aOrder['sSumGrandTotal'] = $oOrder->fieldValueTotalFormated;
$aOrder['sShippingAddress'] = $this->getShippingAddress($oOrder, $bCachingEnabled, $oCacheTriggerManager);
$aOrder['sDetailLink'] = $this->getDetailLink($oOrder);
$orderCurrency = $oOrder->GetFieldPkgShopCurrency();
if (null !== $orderCurrency) {
$aOrder['currencyIso'] = $orderCurrency->fieldIso4217;
$aOrder['currencySymbol'] = $orderCurrency->fieldSymbol;
}
$aOrder['bActive'] = false;
return $aOrder;
} | [
"private",
"function",
"getOrder",
"(",
"TdbShopOrder",
"$",
"oOrder",
",",
"$",
"bCachingEnabled",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
")",
"{",
"$",
"aOrder",
"=",
"array",
"(",
")",
";",
"$",
"oLocal",
"=",
"TCMSLocal",
"::",
... | value map for one order.
@param TdbShopOrder $oOrder
@param bool $bCachingEnabled
@param IMapperCacheTriggerRestricted $oCacheTriggerManager
@return array | [
"value",
"map",
"for",
"one",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php#L130-L149 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php | MTShopOrderHistory.getDetailLink | protected function getDetailLink(TdbShopOrder $oOrder)
{
$aParameters = array(
$this->getActiveOrderParameter() => $oOrder->fieldOrdernumber,
);
return '?'.TTools::GetArrayAsURL($aParameters);
} | php | protected function getDetailLink(TdbShopOrder $oOrder)
{
$aParameters = array(
$this->getActiveOrderParameter() => $oOrder->fieldOrdernumber,
);
return '?'.TTools::GetArrayAsURL($aParameters);
} | [
"protected",
"function",
"getDetailLink",
"(",
"TdbShopOrder",
"$",
"oOrder",
")",
"{",
"$",
"aParameters",
"=",
"array",
"(",
"$",
"this",
"->",
"getActiveOrderParameter",
"(",
")",
"=>",
"$",
"oOrder",
"->",
"fieldOrdernumber",
",",
")",
";",
"return",
"'?... | get the detail link for the given order
takes active page as base url and adds only the parameter for the active order.
@param TdbShopOrder $oOrder
@return string | [
"get",
"the",
"detail",
"link",
"for",
"the",
"given",
"order",
"takes",
"active",
"page",
"as",
"base",
"url",
"and",
"adds",
"only",
"the",
"parameter",
"for",
"the",
"active",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderHistory.class.php#L225-L232 | train |
PGB-LIV/php-ms | src/Core/Spectra/IonTrait.php | IonTrait.setIntensity | public function setIntensity($intensity)
{
if (! (is_int($intensity) || is_float($intensity))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($intensity));
}
$this->intensity = $intensity;
} | php | public function setIntensity($intensity)
{
if (! (is_int($intensity) || is_float($intensity))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($intensity));
}
$this->intensity = $intensity;
} | [
"public",
"function",
"setIntensity",
"(",
"$",
"intensity",
")",
"{",
"if",
"(",
"!",
"(",
"is_int",
"(",
"$",
"intensity",
")",
"||",
"is_float",
"(",
"$",
"intensity",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argume... | Sets the intensity value for this ion
@param float $intensity
The intensity value to set
@throws \InvalidArgumentException If the intensity is not of type float | [
"Sets",
"the",
"intensity",
"value",
"for",
"this",
"ion"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/IonTrait.php#L76-L84 | train |
PGB-LIV/php-ms | src/Core/Spectra/IonTrait.php | IonTrait.setRetentionTime | public function setRetentionTime($retentionTime)
{
if (! (is_int($retentionTime) || is_float($retentionTime))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($retentionTime));
}
$this->retentionTimeWindow = $retentionTime;
} | php | public function setRetentionTime($retentionTime)
{
if (! (is_int($retentionTime) || is_float($retentionTime))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($retentionTime));
}
$this->retentionTimeWindow = $retentionTime;
} | [
"public",
"function",
"setRetentionTime",
"(",
"$",
"retentionTime",
")",
"{",
"if",
"(",
"!",
"(",
"is_int",
"(",
"$",
"retentionTime",
")",
"||",
"is_float",
"(",
"$",
"retentionTime",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | Sets the spectra elements retention time
@param float $retentionTime
Retention time of fragment | [
"Sets",
"the",
"spectra",
"elements",
"retention",
"time"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/IonTrait.php#L102-L110 | train |
PGB-LIV/php-ms | src/Core/Spectra/IonTrait.php | IonTrait.setRetentionTimeWindow | public function setRetentionTimeWindow($retentionTimeStart, $retentionTimeEnd)
{
if (! (is_int($retentionTimeStart) || is_float($retentionTimeStart))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($retentionTimeStart));
}
if (! (is_int($retentionTimeEnd) || is_float($retentionTimeEnd))) {
throw new \InvalidArgumentException(
'Argument 2 must be of type int or float. Value is of type ' . gettype($retentionTimeEnd));
}
$this->retentionTimeWindow = array();
$this->retentionTimeWindow[static::RETENTION_TIME_START] = $retentionTimeStart;
$this->retentionTimeWindow[static::RETENTION_TIME_END] = $retentionTimeEnd;
} | php | public function setRetentionTimeWindow($retentionTimeStart, $retentionTimeEnd)
{
if (! (is_int($retentionTimeStart) || is_float($retentionTimeStart))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($retentionTimeStart));
}
if (! (is_int($retentionTimeEnd) || is_float($retentionTimeEnd))) {
throw new \InvalidArgumentException(
'Argument 2 must be of type int or float. Value is of type ' . gettype($retentionTimeEnd));
}
$this->retentionTimeWindow = array();
$this->retentionTimeWindow[static::RETENTION_TIME_START] = $retentionTimeStart;
$this->retentionTimeWindow[static::RETENTION_TIME_END] = $retentionTimeEnd;
} | [
"public",
"function",
"setRetentionTimeWindow",
"(",
"$",
"retentionTimeStart",
",",
"$",
"retentionTimeEnd",
")",
"{",
"if",
"(",
"!",
"(",
"is_int",
"(",
"$",
"retentionTimeStart",
")",
"||",
"is_float",
"(",
"$",
"retentionTimeStart",
")",
")",
")",
"{",
... | Sets the spectra elements retention time or retention time window
@param float $retentionTimeStart
Retention time of fragment or start of retention time window
@param float $retentionTimeEnd
End of retention time window, or null if equal to start | [
"Sets",
"the",
"spectra",
"elements",
"retention",
"time",
"or",
"retention",
"time",
"window"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/IonTrait.php#L120-L135 | train |
PGB-LIV/php-ms | src/Core/Spectra/IonTrait.php | IonTrait.getRetentionTime | public function getRetentionTime()
{
if (is_array($this->retentionTimeWindow)) {
return ($this->retentionTimeWindow[static::RETENTION_TIME_START] +
$this->retentionTimeWindow[static::RETENTION_TIME_END]) / 2;
}
return $this->retentionTimeWindow;
} | php | public function getRetentionTime()
{
if (is_array($this->retentionTimeWindow)) {
return ($this->retentionTimeWindow[static::RETENTION_TIME_START] +
$this->retentionTimeWindow[static::RETENTION_TIME_END]) / 2;
}
return $this->retentionTimeWindow;
} | [
"public",
"function",
"getRetentionTime",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"retentionTimeWindow",
")",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"retentionTimeWindow",
"[",
"static",
"::",
"RETENTION_TIME_START",
"]",
"+",
"$",... | Gets the retention time in seconds, or the average if a window has been set
@return float | [
"Gets",
"the",
"retention",
"time",
"in",
"seconds",
"or",
"the",
"average",
"if",
"a",
"window",
"has",
"been",
"set"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/IonTrait.php#L142-L150 | train |
PGB-LIV/php-ms | src/Core/Spectra/IonTrait.php | IonTrait.getRetentionTimeWindow | public function getRetentionTimeWindow()
{
if (is_array($this->retentionTimeWindow)) {
return $this->retentionTimeWindow;
}
return array(
$this->retentionTimeWindow,
$this->retentionTimeWindow
);
} | php | public function getRetentionTimeWindow()
{
if (is_array($this->retentionTimeWindow)) {
return $this->retentionTimeWindow;
}
return array(
$this->retentionTimeWindow,
$this->retentionTimeWindow
);
} | [
"public",
"function",
"getRetentionTimeWindow",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"retentionTimeWindow",
")",
")",
"{",
"return",
"$",
"this",
"->",
"retentionTimeWindow",
";",
"}",
"return",
"array",
"(",
"$",
"this",
"->",
"re... | Gets the retention time window in seconds
@return array | [
"Gets",
"the",
"retention",
"time",
"window",
"in",
"seconds"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/IonTrait.php#L157-L167 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/File/FindReplace.php | FindReplace.findReplaceName | public function findReplaceName(
string $singularFindName,
string $singularReplaceName
): self {
$singularFindName = Inflector::classify($singularFindName);
$singularReplaceName = Inflector::classify($singularReplaceName);
$this->findReplace($singularFindName, $singularReplaceName);
$this->findReplace(\lcfirst($singularFindName), \lcfirst($singularReplaceName));
$this->findReplace(\strtoupper($singularFindName), \strtoupper($singularReplaceName));
$this->findReplace(
\strtoupper(Inflector::tableize($singularFindName)),
\strtoupper(Inflector::tableize($singularReplaceName))
);
$pluralFindName = $this->getPlural($singularFindName);
$pluralReplaceName = $this->getPlural($singularReplaceName);
$this->findReplace($pluralFindName, $pluralReplaceName);
$this->findReplace(\lcfirst($pluralFindName), \lcfirst($pluralReplaceName));
$this->findReplace(\strtoupper($pluralFindName), \strtoupper($pluralReplaceName));
$this->findReplace(
\strtoupper(Inflector::tableize($pluralFindName)),
\strtoupper(Inflector::tableize($pluralReplaceName))
);
return $this;
} | php | public function findReplaceName(
string $singularFindName,
string $singularReplaceName
): self {
$singularFindName = Inflector::classify($singularFindName);
$singularReplaceName = Inflector::classify($singularReplaceName);
$this->findReplace($singularFindName, $singularReplaceName);
$this->findReplace(\lcfirst($singularFindName), \lcfirst($singularReplaceName));
$this->findReplace(\strtoupper($singularFindName), \strtoupper($singularReplaceName));
$this->findReplace(
\strtoupper(Inflector::tableize($singularFindName)),
\strtoupper(Inflector::tableize($singularReplaceName))
);
$pluralFindName = $this->getPlural($singularFindName);
$pluralReplaceName = $this->getPlural($singularReplaceName);
$this->findReplace($pluralFindName, $pluralReplaceName);
$this->findReplace(\lcfirst($pluralFindName), \lcfirst($pluralReplaceName));
$this->findReplace(\strtoupper($pluralFindName), \strtoupper($pluralReplaceName));
$this->findReplace(
\strtoupper(Inflector::tableize($pluralFindName)),
\strtoupper(Inflector::tableize($pluralReplaceName))
);
return $this;
} | [
"public",
"function",
"findReplaceName",
"(",
"string",
"$",
"singularFindName",
",",
"string",
"$",
"singularReplaceName",
")",
":",
"self",
"{",
"$",
"singularFindName",
"=",
"Inflector",
"::",
"classify",
"(",
"$",
"singularFindName",
")",
";",
"$",
"singular... | Find all instances of a name in the various code styles
Handles replacing both singular and plural replacements
@param string $singularFindName
@param string $singularReplaceName
@return FindReplace | [
"Find",
"all",
"instances",
"of",
"a",
"name",
"in",
"the",
"various",
"code",
"styles"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/File/FindReplace.php#L37-L62 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/File/FindReplace.php | FindReplace.findReplace | public function findReplace(string $find, string $replace)
{
$contents = $this->file->getContents();
$contents = \str_replace($find, $replace, $contents);
$this->file->setContents($contents);
return $this;
} | php | public function findReplace(string $find, string $replace)
{
$contents = $this->file->getContents();
$contents = \str_replace($find, $replace, $contents);
$this->file->setContents($contents);
return $this;
} | [
"public",
"function",
"findReplace",
"(",
"string",
"$",
"find",
",",
"string",
"$",
"replace",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"file",
"->",
"getContents",
"(",
")",
";",
"$",
"contents",
"=",
"\\",
"str_replace",
"(",
"$",
"find",
... | Find and replace using simple case sensitive str_replace
@param string $find
@param string $replace
@return FindReplace | [
"Find",
"and",
"replace",
"using",
"simple",
"case",
"sensitive",
"str_replace"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/File/FindReplace.php#L72-L79 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/Filesystem/File/FindReplace.php | FindReplace.findReplaceRegex | public function findReplaceRegex(string $find, string $replace)
{
$contents = $this->file->getContents();
$contents = \preg_replace($find, $replace, $contents, -1/*, $count*/);
$this->file->setContents($contents);
} | php | public function findReplaceRegex(string $find, string $replace)
{
$contents = $this->file->getContents();
$contents = \preg_replace($find, $replace, $contents, -1/*, $count*/);
$this->file->setContents($contents);
} | [
"public",
"function",
"findReplaceRegex",
"(",
"string",
"$",
"find",
",",
"string",
"$",
"replace",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"file",
"->",
"getContents",
"(",
")",
";",
"$",
"contents",
"=",
"\\",
"preg_replace",
"(",
"$",
"f... | Find and replace using preg_replace
@param string $find
@param string $replace | [
"Find",
"and",
"replace",
"using",
"preg_replace"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Filesystem/File/FindReplace.php#L97-L103 | train |
chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php | TPkgShopListfilterItemShopAttributeNumeric.GetActiveStartValue | public function GetActiveStartValue()
{
$sStartValue = false;
if (is_array($this->aActiveFilterData) && array_key_exists(self::URL_PARAMETER_FILTER_START_VALUE, $this->aActiveFilterData)) {
$sStartValue = $this->aActiveFilterData[self::URL_PARAMETER_FILTER_START_VALUE];
}
return $sStartValue;
} | php | public function GetActiveStartValue()
{
$sStartValue = false;
if (is_array($this->aActiveFilterData) && array_key_exists(self::URL_PARAMETER_FILTER_START_VALUE, $this->aActiveFilterData)) {
$sStartValue = $this->aActiveFilterData[self::URL_PARAMETER_FILTER_START_VALUE];
}
return $sStartValue;
} | [
"public",
"function",
"GetActiveStartValue",
"(",
")",
"{",
"$",
"sStartValue",
"=",
"false",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"aActiveFilterData",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_PARAMETER_FILTER_START_VALUE",
",",
"$",... | return active start value.
@return float | [
"return",
"active",
"start",
"value",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php#L38-L46 | train |
chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php | TPkgShopListfilterItemShopAttributeNumeric.GetActiveEndValue | public function GetActiveEndValue()
{
$sEndValue = false;
if (is_array($this->aActiveFilterData) && array_key_exists(self::URL_PARAMETER_FILTER_END_VALUE, $this->aActiveFilterData)) {
$sEndValue = $this->aActiveFilterData[self::URL_PARAMETER_FILTER_END_VALUE];
}
return $sEndValue;
} | php | public function GetActiveEndValue()
{
$sEndValue = false;
if (is_array($this->aActiveFilterData) && array_key_exists(self::URL_PARAMETER_FILTER_END_VALUE, $this->aActiveFilterData)) {
$sEndValue = $this->aActiveFilterData[self::URL_PARAMETER_FILTER_END_VALUE];
}
return $sEndValue;
} | [
"public",
"function",
"GetActiveEndValue",
"(",
")",
"{",
"$",
"sEndValue",
"=",
"false",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"aActiveFilterData",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"URL_PARAMETER_FILTER_END_VALUE",
",",
"$",
"th... | return active end value.
@return float | [
"return",
"active",
"end",
"value",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php#L53-L61 | train |
chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php | TPkgShopListfilterItemShopAttributeNumeric.GetSQLQueryForQueryRestrictionForActiveFilter | protected function GetSQLQueryForQueryRestrictionForActiveFilter()
{
$dStartValue = $this->GetActiveStartValue();
$dEndValue = $this->GetActiveEndValue();
$sQuery = '';
if (false !== $dStartValue && false !== $dEndValue) {
$sEscapedTargetTable = MySqlLegacySupport::getInstance()->real_escape_string($this->sItemTableName);
$sEscapedTargetMLTTable = MySqlLegacySupport::getInstance()->real_escape_string('shop_article_'.$this->sItemTableName.'_mlt');
$oShopAttribute = $this->GetFieldShopAttribute();
$sQuery = "SELECT `{$sEscapedTargetMLTTable}`.*
FROM `{$sEscapedTargetTable}`
INNER JOIN `{$sEscapedTargetMLTTable}` ON `{$sEscapedTargetTable}`.`id` = `{$sEscapedTargetMLTTable}`.`target_id`
WHERE ".$this->GetTargetTableNameField().' >= '.MySqlLegacySupport::getInstance()->real_escape_string($dStartValue).'
AND '.$this->GetTargetTableNameField().' <= '.MySqlLegacySupport::getInstance()->real_escape_string($dEndValue)."
AND `{$sEscapedTargetTable}`.`shop_attribute_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oShopAttribute->id)."'";
}
return $sQuery;
} | php | protected function GetSQLQueryForQueryRestrictionForActiveFilter()
{
$dStartValue = $this->GetActiveStartValue();
$dEndValue = $this->GetActiveEndValue();
$sQuery = '';
if (false !== $dStartValue && false !== $dEndValue) {
$sEscapedTargetTable = MySqlLegacySupport::getInstance()->real_escape_string($this->sItemTableName);
$sEscapedTargetMLTTable = MySqlLegacySupport::getInstance()->real_escape_string('shop_article_'.$this->sItemTableName.'_mlt');
$oShopAttribute = $this->GetFieldShopAttribute();
$sQuery = "SELECT `{$sEscapedTargetMLTTable}`.*
FROM `{$sEscapedTargetTable}`
INNER JOIN `{$sEscapedTargetMLTTable}` ON `{$sEscapedTargetTable}`.`id` = `{$sEscapedTargetMLTTable}`.`target_id`
WHERE ".$this->GetTargetTableNameField().' >= '.MySqlLegacySupport::getInstance()->real_escape_string($dStartValue).'
AND '.$this->GetTargetTableNameField().' <= '.MySqlLegacySupport::getInstance()->real_escape_string($dEndValue)."
AND `{$sEscapedTargetTable}`.`shop_attribute_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oShopAttribute->id)."'";
}
return $sQuery;
} | [
"protected",
"function",
"GetSQLQueryForQueryRestrictionForActiveFilter",
"(",
")",
"{",
"$",
"dStartValue",
"=",
"$",
"this",
"->",
"GetActiveStartValue",
"(",
")",
";",
"$",
"dEndValue",
"=",
"$",
"this",
"->",
"GetActiveEndValue",
"(",
")",
";",
"$",
"sQuery"... | builds the sql query for the GetItemName method that is usual used as callback in the GetOptions method
we only want to show results that are values of the selected shop attribute in the filter item.
@return string | [
"builds",
"the",
"sql",
"query",
"for",
"the",
"GetItemName",
"method",
"that",
"is",
"usual",
"used",
"as",
"callback",
"in",
"the",
"GetOptions",
"method",
"we",
"only",
"want",
"to",
"show",
"results",
"that",
"are",
"values",
"of",
"the",
"selected",
"... | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemShopAttributeNumeric.class.php#L85-L104 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingType.class.php | TShopShippingType.isValidForCurrentPortal | public function isValidForCurrentPortal()
{
$aPortalIdList = $this->getShopShippingTypeDataAccess()->getPermittedPortalIds($this->id);
if (!is_array($aPortalIdList) || count($aPortalIdList) < 1) {
$bIsValidForPortal = true;
} else {
$oActivePortal = $this->getPortalDomainService()->getActivePortal();
if (null === $oActivePortal) {
$bIsValidForPortal = false;
} else {
$bIsValidForPortal = in_array($oActivePortal->id, $aPortalIdList);
}
}
return $bIsValidForPortal;
} | php | public function isValidForCurrentPortal()
{
$aPortalIdList = $this->getShopShippingTypeDataAccess()->getPermittedPortalIds($this->id);
if (!is_array($aPortalIdList) || count($aPortalIdList) < 1) {
$bIsValidForPortal = true;
} else {
$oActivePortal = $this->getPortalDomainService()->getActivePortal();
if (null === $oActivePortal) {
$bIsValidForPortal = false;
} else {
$bIsValidForPortal = in_array($oActivePortal->id, $aPortalIdList);
}
}
return $bIsValidForPortal;
} | [
"public",
"function",
"isValidForCurrentPortal",
"(",
")",
"{",
"$",
"aPortalIdList",
"=",
"$",
"this",
"->",
"getShopShippingTypeDataAccess",
"(",
")",
"->",
"getPermittedPortalIds",
"(",
"$",
"this",
"->",
"id",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"... | return true if the shipping group is allowed for the current portal.
If no active portal was found and group was restricted to portal return false.
@return bool | [
"return",
"true",
"if",
"the",
"shipping",
"group",
"is",
"allowed",
"for",
"the",
"current",
"portal",
".",
"If",
"no",
"active",
"portal",
"was",
"found",
"and",
"group",
"was",
"restricted",
"to",
"portal",
"return",
"false",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingType.class.php#L173-L188 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingType.class.php | TShopShippingType.IsValidForBasket | public function IsValidForBasket()
{
$bValidForBasket = false;
$oArticles = &$this->GetAffectedBasketArticles();
$bValidForBasket = ($oArticles->Length() > 0);
return $bValidForBasket;
} | php | public function IsValidForBasket()
{
$bValidForBasket = false;
$oArticles = &$this->GetAffectedBasketArticles();
$bValidForBasket = ($oArticles->Length() > 0);
return $bValidForBasket;
} | [
"public",
"function",
"IsValidForBasket",
"(",
")",
"{",
"$",
"bValidForBasket",
"=",
"false",
";",
"$",
"oArticles",
"=",
"&",
"$",
"this",
"->",
"GetAffectedBasketArticles",
"(",
")",
";",
"$",
"bValidForBasket",
"=",
"(",
"$",
"oArticles",
"->",
"Length",... | checks if the current shipping type is available for the current basket
affected articles in the basket will be marked with the shipping type.
@return bool | [
"checks",
"if",
"the",
"current",
"shipping",
"type",
"is",
"available",
"for",
"the",
"current",
"basket",
"affected",
"articles",
"in",
"the",
"basket",
"will",
"be",
"marked",
"with",
"the",
"shipping",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingType.class.php#L196-L203 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingType.class.php | TShopShippingType.ArticleAffected | public function ArticleAffected(TShopBasketArticle &$oArticle)
{
$shopShippingTypeDataAccess = $this->getShopShippingTypeDataAccess();
$bAffected = false;
$oArticleShippingType = &$oArticle->GetActingShippingType();
// if the article is already marked with this shipping type, then we keep it
if (!is_null($oArticleShippingType) && $oArticleShippingType->id == $this->id) {
$bAffected = true;
} elseif (is_null($oArticleShippingType)) {
// article has no shipping type yet...
// check article groups
$bArticleGroupValid = false;
$aGroupRestriction = $shopShippingTypeDataAccess->getPermittedArticleGroupIds($this->id);
if (!is_array($aGroupRestriction) || count($aGroupRestriction) < 1) {
$bArticleGroupValid = true;
} else {
$bArticleGroupValid = $oArticle->IsInArticleGroups($aGroupRestriction);
}
// check product categories
$bArticleCategoryValid = false;
if ($bArticleGroupValid) {
$aCategoryRestriction = $shopShippingTypeDataAccess->getPermittedCategoryIds($this->id);
if (!is_array($aCategoryRestriction) || count($aCategoryRestriction) < 1) {
$bArticleCategoryValid = true;
} else {
$bArticleCategoryValid = $oArticle->IsInCategory($aCategoryRestriction);
}
}
// check articles
$bArticleValid = false;
if ($bArticleGroupValid && $bArticleCategoryValid) {
$aArticleRestriction = $shopShippingTypeDataAccess->getPermittedArticleIds($this->id);
if (!is_array($aArticleRestriction) || count($aArticleRestriction) < 1) {
$bArticleValid = true;
} else {
if (in_array($oArticle->id, $aArticleRestriction)) {
$bArticleValid = true;
}
}
}
$bAffected = ($bArticleGroupValid && $bArticleCategoryValid && $bArticleValid);
}
return $bAffected;
} | php | public function ArticleAffected(TShopBasketArticle &$oArticle)
{
$shopShippingTypeDataAccess = $this->getShopShippingTypeDataAccess();
$bAffected = false;
$oArticleShippingType = &$oArticle->GetActingShippingType();
// if the article is already marked with this shipping type, then we keep it
if (!is_null($oArticleShippingType) && $oArticleShippingType->id == $this->id) {
$bAffected = true;
} elseif (is_null($oArticleShippingType)) {
// article has no shipping type yet...
// check article groups
$bArticleGroupValid = false;
$aGroupRestriction = $shopShippingTypeDataAccess->getPermittedArticleGroupIds($this->id);
if (!is_array($aGroupRestriction) || count($aGroupRestriction) < 1) {
$bArticleGroupValid = true;
} else {
$bArticleGroupValid = $oArticle->IsInArticleGroups($aGroupRestriction);
}
// check product categories
$bArticleCategoryValid = false;
if ($bArticleGroupValid) {
$aCategoryRestriction = $shopShippingTypeDataAccess->getPermittedCategoryIds($this->id);
if (!is_array($aCategoryRestriction) || count($aCategoryRestriction) < 1) {
$bArticleCategoryValid = true;
} else {
$bArticleCategoryValid = $oArticle->IsInCategory($aCategoryRestriction);
}
}
// check articles
$bArticleValid = false;
if ($bArticleGroupValid && $bArticleCategoryValid) {
$aArticleRestriction = $shopShippingTypeDataAccess->getPermittedArticleIds($this->id);
if (!is_array($aArticleRestriction) || count($aArticleRestriction) < 1) {
$bArticleValid = true;
} else {
if (in_array($oArticle->id, $aArticleRestriction)) {
$bArticleValid = true;
}
}
}
$bAffected = ($bArticleGroupValid && $bArticleCategoryValid && $bArticleValid);
}
return $bAffected;
} | [
"public",
"function",
"ArticleAffected",
"(",
"TShopBasketArticle",
"&",
"$",
"oArticle",
")",
"{",
"$",
"shopShippingTypeDataAccess",
"=",
"$",
"this",
"->",
"getShopShippingTypeDataAccess",
"(",
")",
";",
"$",
"bAffected",
"=",
"false",
";",
"$",
"oArticleShippi... | checks if a basket article should be affected by this shipping type
this can only happen if the article is not affected by any other shipping type.
@param TShopBasketArticle $oArticle
@return bool | [
"checks",
"if",
"a",
"basket",
"article",
"should",
"be",
"affected",
"by",
"this",
"shipping",
"type",
"this",
"can",
"only",
"happen",
"if",
"the",
"article",
"is",
"not",
"affected",
"by",
"any",
"other",
"shipping",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingType.class.php#L238-L285 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingType.class.php | TShopShippingType.GetPrice | public function GetPrice()
{
if (is_null($this->dPrice)) {
$this->dPrice = 0;
// price based on basket
if ($this->fieldValueBasedOnEntireBasket) {
$oBasket = TShopBasket::GetInstance();
$iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation = 0;
$iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation = 0;
$oItemList = $oBasket->GetBasketContents();
$oItemList->GoToStart();
while ($oItem = &$oItemList->Next()) {
if ($oItem->fieldExcludeFromShippingCostCalculation) {
$iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation += $oItem->dAmount;
$iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation += $oItem->dPriceTotalAfterDiscount;
}
}
$oItemList->GoToStart();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
if ($this->fieldAddValueForEachArticle ||
($iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation > 0 &&
$oBasket->dTotalNumberOfArticles == $iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation
)
) {
$this->dPrice = ($oBasket->dTotalNumberOfArticles - $iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation) * $this->dPrice;
}
} else {
$this->dPrice = round($this->ApplyPriceModifiers(($oBasket->dCostArticlesTotalAfterDiscounts - $iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation) * ($this->fieldValue / 100)), 2);
}
} else {
// price based on current list
/** @var $oArticleList TShopBasketArticleList */
$oArticleList = &$this->GetAffectedBasketArticles();
if (!is_null($oArticleList)) {
$iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation = 0;
$iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation = 0;
$oArticleList->GoToStart();
while ($oArticle = &$oArticleList->Next()) {
if ($oArticle->fieldExcludeFromShippingCostCalculation) {
$iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation += $oArticle->dAmount;
$iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation += $oArticle->dPriceTotalAfterDiscount;
}
}
$oArticleList->GoToStart();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
if ($this->fieldAddValueForEachArticle ||
($iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation > 0 &&
$oArticleList->dNumberOfItems == $iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation
)
) {
$this->dPrice = ($oArticleList->dNumberOfItems - $iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation) * $this->dPrice;
}
} else {
$this->dPrice = round($this->ApplyPriceModifiers(($oArticleList->dProductPrice - $iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation) * ($this->fieldValue / 100)), 2);
}
}
}
}
return $this->dPrice;
} | php | public function GetPrice()
{
if (is_null($this->dPrice)) {
$this->dPrice = 0;
// price based on basket
if ($this->fieldValueBasedOnEntireBasket) {
$oBasket = TShopBasket::GetInstance();
$iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation = 0;
$iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation = 0;
$oItemList = $oBasket->GetBasketContents();
$oItemList->GoToStart();
while ($oItem = &$oItemList->Next()) {
if ($oItem->fieldExcludeFromShippingCostCalculation) {
$iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation += $oItem->dAmount;
$iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation += $oItem->dPriceTotalAfterDiscount;
}
}
$oItemList->GoToStart();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
if ($this->fieldAddValueForEachArticle ||
($iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation > 0 &&
$oBasket->dTotalNumberOfArticles == $iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation
)
) {
$this->dPrice = ($oBasket->dTotalNumberOfArticles - $iTotalNumberOfArticlesInBasketThatAreExcludedFromShippingCostCalculation) * $this->dPrice;
}
} else {
$this->dPrice = round($this->ApplyPriceModifiers(($oBasket->dCostArticlesTotalAfterDiscounts - $iTotalDiscountedPriceOfArticlesInBasketThatAreExcludedFromShippingCostCalculation) * ($this->fieldValue / 100)), 2);
}
} else {
// price based on current list
/** @var $oArticleList TShopBasketArticleList */
$oArticleList = &$this->GetAffectedBasketArticles();
if (!is_null($oArticleList)) {
$iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation = 0;
$iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation = 0;
$oArticleList->GoToStart();
while ($oArticle = &$oArticleList->Next()) {
if ($oArticle->fieldExcludeFromShippingCostCalculation) {
$iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation += $oArticle->dAmount;
$iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation += $oArticle->dPriceTotalAfterDiscount;
}
}
$oArticleList->GoToStart();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
if ($this->fieldAddValueForEachArticle ||
($iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation > 0 &&
$oArticleList->dNumberOfItems == $iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation
)
) {
$this->dPrice = ($oArticleList->dNumberOfItems - $iTotalNumberOfArticlesInListThatAreExcludedFromShippingCostCalculation) * $this->dPrice;
}
} else {
$this->dPrice = round($this->ApplyPriceModifiers(($oArticleList->dProductPrice - $iTotalDiscountedPriceOfArticlesInListThatAreExcludedFromShippingCostCalculation) * ($this->fieldValue / 100)), 2);
}
}
}
}
return $this->dPrice;
} | [
"public",
"function",
"GetPrice",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dPrice",
")",
")",
"{",
"$",
"this",
"->",
"dPrice",
"=",
"0",
";",
"// price based on basket",
"if",
"(",
"$",
"this",
"->",
"fieldValueBasedOnEntireBasket",
... | return shipping type cost.
@return float | [
"return",
"shipping",
"type",
"cost",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingType.class.php#L332-L397 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingType.class.php | TShopShippingType.ApplyPriceModifiers | protected function ApplyPriceModifiers($dPrice)
{
if ($this->fieldValueMin > 0 && $dPrice < $this->fieldValueMin) {
$dPrice = $this->fieldValueMin;
}
if ($this->fieldValueMax > 0 && $dPrice > $this->fieldValueMax) {
$dPrice = $this->fieldValueMax;
}
if ($this->fieldValueAdditional > 0) {
$dPrice = $dPrice + $this->fieldValueAdditional;
}
return $dPrice;
} | php | protected function ApplyPriceModifiers($dPrice)
{
if ($this->fieldValueMin > 0 && $dPrice < $this->fieldValueMin) {
$dPrice = $this->fieldValueMin;
}
if ($this->fieldValueMax > 0 && $dPrice > $this->fieldValueMax) {
$dPrice = $this->fieldValueMax;
}
if ($this->fieldValueAdditional > 0) {
$dPrice = $dPrice + $this->fieldValueAdditional;
}
return $dPrice;
} | [
"protected",
"function",
"ApplyPriceModifiers",
"(",
"$",
"dPrice",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fieldValueMin",
">",
"0",
"&&",
"$",
"dPrice",
"<",
"$",
"this",
"->",
"fieldValueMin",
")",
"{",
"$",
"dPrice",
"=",
"$",
"this",
"->",
"field... | Applies additional price modifiers as defined in the shipping type
record.
@param float $dPrice
@return float $dPrice | [
"Applies",
"additional",
"price",
"modifiers",
"as",
"defined",
"in",
"the",
"shipping",
"type",
"record",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingType.class.php#L456-L469 | train |
PGB-LIV/php-ms | src/Reader/FastaEntry/PeffFastaEntry.php | PeffFastaEntry.parseAttributes | private function parseAttributes(Protein $protein, array $attributes)
{
if (isset($attributes[PsiVerb::NCBI_TAX_ID])) {
$organism = Organism::getInstance($attributes[PsiVerb::NCBI_TAX_ID]);
$protein->setOrganism($organism);
}
if (isset($attributes[PsiVerb::TAX_NAME])) {
if (! $protein->getOrganism()) {
$protein->setOrganism(new Organism());
}
$protein->getOrganism()->setName($attributes[PsiVerb::TAX_NAME]);
}
foreach ($attributes as $key => $value) {
switch ($key) {
case 'DbUniqueId':
$protein->setAccession($value);
break;
case 'GName':
$gene = Gene::getInstance($value);
$protein->setGene($gene);
break;
case 'SV':
$protein->getDatabaseEntry()->setSequenceVersion($value);
break;
case 'EV':
$protein->getDatabaseEntry()->setEntryVersion($value);
break;
case 'PE':
$protein->getDatabaseEntry()->setEvidence($value);
break;
case 'PName':
$protein->setDescription($value);
break;
case 'ModRes':
case 'ModResPsi':
case 'ModResUnimod':
$modifications = self::parseModifications($value);
$protein->addModifications($modifications);
break;
case PsiVerb::NCBI_TAX_ID:
case PsiVerb::TAX_NAME:
// Safe to ignore - already handled
break;
case 'Length':
case 'VariantSimple ':
case 'VariantComplex':
case 'Processed':
// Not supported
break;
default:
// Not supported
break;
}
}
} | php | private function parseAttributes(Protein $protein, array $attributes)
{
if (isset($attributes[PsiVerb::NCBI_TAX_ID])) {
$organism = Organism::getInstance($attributes[PsiVerb::NCBI_TAX_ID]);
$protein->setOrganism($organism);
}
if (isset($attributes[PsiVerb::TAX_NAME])) {
if (! $protein->getOrganism()) {
$protein->setOrganism(new Organism());
}
$protein->getOrganism()->setName($attributes[PsiVerb::TAX_NAME]);
}
foreach ($attributes as $key => $value) {
switch ($key) {
case 'DbUniqueId':
$protein->setAccession($value);
break;
case 'GName':
$gene = Gene::getInstance($value);
$protein->setGene($gene);
break;
case 'SV':
$protein->getDatabaseEntry()->setSequenceVersion($value);
break;
case 'EV':
$protein->getDatabaseEntry()->setEntryVersion($value);
break;
case 'PE':
$protein->getDatabaseEntry()->setEvidence($value);
break;
case 'PName':
$protein->setDescription($value);
break;
case 'ModRes':
case 'ModResPsi':
case 'ModResUnimod':
$modifications = self::parseModifications($value);
$protein->addModifications($modifications);
break;
case PsiVerb::NCBI_TAX_ID:
case PsiVerb::TAX_NAME:
// Safe to ignore - already handled
break;
case 'Length':
case 'VariantSimple ':
case 'VariantComplex':
case 'Processed':
// Not supported
break;
default:
// Not supported
break;
}
}
} | [
"private",
"function",
"parseAttributes",
"(",
"Protein",
"$",
"protein",
",",
"array",
"$",
"attributes",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"attributes",
"[",
"PsiVerb",
"::",
"NCBI_TAX_ID",
"]",
")",
")",
"{",
"$",
"organism",
"=",
"Organism",
":... | Parses the attribute array and inputs the data into the protein
@param Protein $protein
Object to input values to
@param array $attributes
Array to read from
@return void | [
"Parses",
"the",
"attribute",
"array",
"and",
"inputs",
"the",
"data",
"into",
"the",
"protein"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/FastaEntry/PeffFastaEntry.php#L89-L146 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AddressConsentSample.php | AddressConsentSample.getOrderReferenceDetails | public function getOrderReferenceDetails($addressConsentToken = null)
{
$getOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest();
$getOrderReferenceDetailsRequest->setSellerId($this->_sellerId);
$getOrderReferenceDetailsRequest->setAmazonOrderReferenceId($this->_amazonOrderReferenceId);
if (is_null($addressConsentToken) == FALSE) {
$decodedToken = urldecode($addressConsentToken);
$getOrderReferenceDetailsRequest->setAddressConsentToken($decodedToken);
}
return $this->_service->getOrderReferenceDetails($getOrderReferenceDetailsRequest);
} | php | public function getOrderReferenceDetails($addressConsentToken = null)
{
$getOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest();
$getOrderReferenceDetailsRequest->setSellerId($this->_sellerId);
$getOrderReferenceDetailsRequest->setAmazonOrderReferenceId($this->_amazonOrderReferenceId);
if (is_null($addressConsentToken) == FALSE) {
$decodedToken = urldecode($addressConsentToken);
$getOrderReferenceDetailsRequest->setAddressConsentToken($decodedToken);
}
return $this->_service->getOrderReferenceDetails($getOrderReferenceDetailsRequest);
} | [
"public",
"function",
"getOrderReferenceDetails",
"(",
"$",
"addressConsentToken",
"=",
"null",
")",
"{",
"$",
"getOrderReferenceDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest",
"(",
")",
";",
"$",
"getOrderReferenceDetailsRequest",... | Use the order reference object to query the order information, including
the current physical delivery address as selected by the buyer
@return OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse service response | [
"Use",
"the",
"order",
"reference",
"object",
"to",
"query",
"the",
"order",
"information",
"including",
"the",
"current",
"physical",
"delivery",
"address",
"as",
"selected",
"by",
"the",
"buyer"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AddressConsentSample.php#L64-L76 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php | XmlNotificationParser.parseIpnMessage | public static function parseIpnMessage(Message $ipnMsg)
{
$xmlDocumentElement = self::_getXmlFromIpnMessage($ipnMsg);
return self::_createNotificationForNotificationType(
$ipnMsg,
$xmlDocumentElement
);
} | php | public static function parseIpnMessage(Message $ipnMsg)
{
$xmlDocumentElement = self::_getXmlFromIpnMessage($ipnMsg);
return self::_createNotificationForNotificationType(
$ipnMsg,
$xmlDocumentElement
);
} | [
"public",
"static",
"function",
"parseIpnMessage",
"(",
"Message",
"$",
"ipnMsg",
")",
"{",
"$",
"xmlDocumentElement",
"=",
"self",
"::",
"_getXmlFromIpnMessage",
"(",
"$",
"ipnMsg",
")",
";",
"return",
"self",
"::",
"_createNotificationForNotificationType",
"(",
... | Converts a ipn message into a
notification object
@param JsonMesssage $ipnMsg ipnMessage
@throws OffAmazonPaymentsNotifications if there is an error
@return Message | [
"Converts",
"a",
"ipn",
"message",
"into",
"a",
"notification",
"object"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php#L41-L49 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php | XmlNotificationParser._getXmlFromIpnMessage | private static function _getXmlFromIpnMessage(Message $ipnMsg)
{
// Try and load the notification data as xml
$notificationData = $ipnMsg->getMandatoryField("NotificationData");
$dom = new DOMDocument();
try {
$dom->loadXML($notificationData);
} catch (Exception $ex) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with ipn message - NotificationData field does not contain xml, " .
"contents: " . $notificationData
);
}
return $dom->documentElement;
} | php | private static function _getXmlFromIpnMessage(Message $ipnMsg)
{
// Try and load the notification data as xml
$notificationData = $ipnMsg->getMandatoryField("NotificationData");
$dom = new DOMDocument();
try {
$dom->loadXML($notificationData);
} catch (Exception $ex) {
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with ipn message - NotificationData field does not contain xml, " .
"contents: " . $notificationData
);
}
return $dom->documentElement;
} | [
"private",
"static",
"function",
"_getXmlFromIpnMessage",
"(",
"Message",
"$",
"ipnMsg",
")",
"{",
"// Try and load the notification data as xml",
"$",
"notificationData",
"=",
"$",
"ipnMsg",
"->",
"getMandatoryField",
"(",
"\"NotificationData\"",
")",
";",
"$",
"dom",
... | Convert the xml message from the ipn payload
into an xml document
@param Message $ipnMsg ipn message
@throws OffAmazonPaymentsNotifications_InvalidMessageException
@return XmlElement xml document element | [
"Convert",
"the",
"xml",
"message",
"from",
"the",
"ipn",
"payload",
"into",
"an",
"xml",
"document"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php#L61-L77 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php | XmlNotificationParser._createNotificationForNotificationType | private static function _createNotificationForNotificationType(
Message $ipnMsg,
$xmlDocumentElement
) {
// Construct an instance of the notification class
switch ($ipnMsg->getMandatoryField("NotificationType")) {
case "OrderReferenceNotification":
$notification
= new OffAmazonPaymentsNotifications_Model_OrderReferenceNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "BillingAgreementNotification":
$notification
= new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentAuthorize":
$notification
= new OffAmazonPaymentsNotifications_Model_AuthorizationNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentCapture":
$notification
= new OffAmazonPaymentsNotifications_Model_CaptureNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentRefund":
$notification
= new OffAmazonPaymentsNotifications_Model_RefundNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
default:
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with IPN notification - unknown notification " .
$ipnMsg->getMandatoryField("NotificationType")
);
}
return $notification;
} | php | private static function _createNotificationForNotificationType(
Message $ipnMsg,
$xmlDocumentElement
) {
// Construct an instance of the notification class
switch ($ipnMsg->getMandatoryField("NotificationType")) {
case "OrderReferenceNotification":
$notification
= new OffAmazonPaymentsNotifications_Model_OrderReferenceNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "BillingAgreementNotification":
$notification
= new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentAuthorize":
$notification
= new OffAmazonPaymentsNotifications_Model_AuthorizationNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentCapture":
$notification
= new OffAmazonPaymentsNotifications_Model_CaptureNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
case "PaymentRefund":
$notification
= new OffAmazonPaymentsNotifications_Model_RefundNotification(
$ipnMsg->getNotificationMetadata(),
$xmlDocumentElement
);
break;
default:
throw new OffAmazonPaymentsNotifications_InvalidMessageException(
"Error with IPN notification - unknown notification " .
$ipnMsg->getMandatoryField("NotificationType")
);
}
return $notification;
} | [
"private",
"static",
"function",
"_createNotificationForNotificationType",
"(",
"Message",
"$",
"ipnMsg",
",",
"$",
"xmlDocumentElement",
")",
"{",
"// Construct an instance of the notification class",
"switch",
"(",
"$",
"ipnMsg",
"->",
"getMandatoryField",
"(",
"\"Notific... | Return a notification object initialised by the xml
@param Message $ipnMsg ipn message
@param XmlNode $xmlDocumentElement xml message
@throws OffAmazonPaymentsNotifications_InvalidMessageException
@return OffAmazonPaymentsNotifications_Notification | [
"Return",
"a",
"notification",
"object",
"initialised",
"by",
"the",
"xml"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php#L91-L140 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php | TShopPaymentHandlerMontrada.GetMontradaRequstHash | protected function GetMontradaRequstHash($aInput)
{
$sDelimiter = '-';
$sString = $this->GetConfigParameter('secret').$sDelimiter;
$sString .= $this->GetConfigParameter('merchid').$sDelimiter;
$sString .= $aInput['orderid'].$sDelimiter;
$sString .= $this->GetConfigParameter('payments').$sDelimiter;
$sString .= $aInput['amount'].$sDelimiter;
$sString .= $aInput['currency'].$sDelimiter;
$sString .= $aInput['command'].$sDelimiter;
$sString .= $aInput['timestamp'];
return hash('sha256', $sString);
} | php | protected function GetMontradaRequstHash($aInput)
{
$sDelimiter = '-';
$sString = $this->GetConfigParameter('secret').$sDelimiter;
$sString .= $this->GetConfigParameter('merchid').$sDelimiter;
$sString .= $aInput['orderid'].$sDelimiter;
$sString .= $this->GetConfigParameter('payments').$sDelimiter;
$sString .= $aInput['amount'].$sDelimiter;
$sString .= $aInput['currency'].$sDelimiter;
$sString .= $aInput['command'].$sDelimiter;
$sString .= $aInput['timestamp'];
return hash('sha256', $sString);
} | [
"protected",
"function",
"GetMontradaRequstHash",
"(",
"$",
"aInput",
")",
"{",
"$",
"sDelimiter",
"=",
"'-'",
";",
"$",
"sString",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'secret'",
")",
".",
"$",
"sDelimiter",
";",
"$",
"sString",
".=",
"$",
... | calculate request hash.
@param array $aInput
@return string | [
"calculate",
"request",
"hash",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php#L64-L78 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php | TShopPaymentHandlerMontrada.GetMontradaResponseHash | protected function GetMontradaResponseHash($aInput)
{
$sDelimiter = '-';
$sString = $this->GetConfigParameter('secret').$sDelimiter;
$sString .= $this->GetConfigParameter('merchid').$sDelimiter;
$sString .= $aInput['orderid'].$sDelimiter;
$sString .= $aInput['amount'].$sDelimiter;
$sString .= $aInput['currency'].$sDelimiter;
$sString .= $aInput['result'].$sDelimiter;
if (array_key_exists('trefnum', $aInput) && !empty($aInput['trefnum'])) {
$sString .= $aInput['trefnum'].$sDelimiter;
}
$sString .= $aInput['timestamp'];
return hash('sha256', $sString);
} | php | protected function GetMontradaResponseHash($aInput)
{
$sDelimiter = '-';
$sString = $this->GetConfigParameter('secret').$sDelimiter;
$sString .= $this->GetConfigParameter('merchid').$sDelimiter;
$sString .= $aInput['orderid'].$sDelimiter;
$sString .= $aInput['amount'].$sDelimiter;
$sString .= $aInput['currency'].$sDelimiter;
$sString .= $aInput['result'].$sDelimiter;
if (array_key_exists('trefnum', $aInput) && !empty($aInput['trefnum'])) {
$sString .= $aInput['trefnum'].$sDelimiter;
}
$sString .= $aInput['timestamp'];
return hash('sha256', $sString);
} | [
"protected",
"function",
"GetMontradaResponseHash",
"(",
"$",
"aInput",
")",
"{",
"$",
"sDelimiter",
"=",
"'-'",
";",
"$",
"sString",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'secret'",
")",
".",
"$",
"sDelimiter",
";",
"$",
"sString",
".=",
"$"... | calculate response hash.
@param array $aInput
@return string | [
"calculate",
"response",
"hash",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php#L87-L103 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php | TShopPaymentHandlerMontrada.GetAnswerFromServer | public function GetAnswerFromServer($aData, $sMessageConsumer)
{
$bSuccess = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->GetConfigParameter('url'));
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
$aParameter = array();
foreach ($aData as $sKey => $sVal) {
if (!array_key_exists($sKey, $aParameter)) {
$aParameter[$sKey] = $sVal;
}
}
$sData = str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
curl_setopt($ch, CURLOPT_POSTFIELDS, $sData);
$response = curl_exec($ch);
if (curl_errno($ch)) {
TTools::WriteLogEntry('Call Montrada Page: '.print_r($aData, true).' - '.curl_errno($ch).' - '.curl_error($ch), 1, __FILE__, __LINE__);
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.payment_montrada.error_request'))));
return $bSuccess;
} else {
curl_close($ch);
}
$aParts = explode("\n", $response);
foreach ($aParts as $sHeader) {
header($sHeader);
}
return $bSuccess;
} | php | public function GetAnswerFromServer($aData, $sMessageConsumer)
{
$bSuccess = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->GetConfigParameter('url'));
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
$aParameter = array();
foreach ($aData as $sKey => $sVal) {
if (!array_key_exists($sKey, $aParameter)) {
$aParameter[$sKey] = $sVal;
}
}
$sData = str_replace('&', '&', TTools::GetArrayAsURL($aParameter));
curl_setopt($ch, CURLOPT_POSTFIELDS, $sData);
$response = curl_exec($ch);
if (curl_errno($ch)) {
TTools::WriteLogEntry('Call Montrada Page: '.print_r($aData, true).' - '.curl_errno($ch).' - '.curl_error($ch), 1, __FILE__, __LINE__);
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.payment_montrada.error_request'))));
return $bSuccess;
} else {
curl_close($ch);
}
$aParts = explode("\n", $response);
foreach ($aParts as $sHeader) {
header($sHeader);
}
return $bSuccess;
} | [
"public",
"function",
"GetAnswerFromServer",
"(",
"$",
"aData",
",",
"$",
"sMessageConsumer",
")",
"{",
"$",
"bSuccess",
"=",
"false",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"this",
... | Send Call per POST to montrada. Response is a moved permanently header which we pass through.
@param array $aData - the post data to be send to montrada | [
"Send",
"Call",
"per",
"POST",
"to",
"montrada",
".",
"Response",
"is",
"a",
"moved",
"permanently",
"header",
"which",
"we",
"pass",
"through",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php#L193-L233 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php | TShopPaymentHandlerMontrada.ExecutePayment | public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
{
$bPaymentOk = parent::ExecutePayment($oOrder);
$aCommand = array('trefnum' => $this->sMontradaTransactionId, 'amount' => round($oOrder->fieldValueTotal * 100));
$aAnswer = $this->ExecuteRequestCall('capture', $aCommand);
if (array_key_exists('rc', $aAnswer) && '000' == $aAnswer['rc']) {
$bPaymentOk = true;
// add the response data to the order
foreach ($aAnswer as $sKey => $sVal) {
if (!array_key_exists($sKey, $this->aPaymentUserData)) {
$this->aPaymentUserData[$sKey] = $sVal;
}
}
$this->SaveUserPaymentDataToOrder($oOrder->id);
$oOrder->SetStatusPaid();
} else {
$bPaymentOk = false;
}
if (!$bPaymentOk) {
// error!
$sMsg = 'unbekannt';
if (array_key_exists('rmsg', $aAnswer)) {
$sMsg = $aAnswer['rmsg'];
}
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => $sMsg));
}
return $bPaymentOk;
} | php | public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
{
$bPaymentOk = parent::ExecutePayment($oOrder);
$aCommand = array('trefnum' => $this->sMontradaTransactionId, 'amount' => round($oOrder->fieldValueTotal * 100));
$aAnswer = $this->ExecuteRequestCall('capture', $aCommand);
if (array_key_exists('rc', $aAnswer) && '000' == $aAnswer['rc']) {
$bPaymentOk = true;
// add the response data to the order
foreach ($aAnswer as $sKey => $sVal) {
if (!array_key_exists($sKey, $this->aPaymentUserData)) {
$this->aPaymentUserData[$sKey] = $sVal;
}
}
$this->SaveUserPaymentDataToOrder($oOrder->id);
$oOrder->SetStatusPaid();
} else {
$bPaymentOk = false;
}
if (!$bPaymentOk) {
// error!
$sMsg = 'unbekannt';
if (array_key_exists('rmsg', $aAnswer)) {
$sMsg = $aAnswer['rmsg'];
}
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => $sMsg));
}
return $bPaymentOk;
} | [
"public",
"function",
"ExecutePayment",
"(",
"TdbShopOrder",
"&",
"$",
"oOrder",
",",
"$",
"sMessageConsumer",
"=",
"''",
")",
"{",
"$",
"bPaymentOk",
"=",
"parent",
"::",
"ExecutePayment",
"(",
"$",
"oOrder",
")",
";",
"$",
"aCommand",
"=",
"array",
"(",
... | executes payment for order - in this case, we commit the montrada payment.
@param TdbShopOrder $oOrder
@param string $sMessageConsumer - send error messages here
@return bool | [
"executes",
"payment",
"for",
"order",
"-",
"in",
"this",
"case",
"we",
"commit",
"the",
"montrada",
"payment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerMontrada.class.php#L290-L321 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PostProcessor/FileOverrider.php | FileOverrider.createNewOverride | public function createNewOverride(string $pathToFileInProject): string
{
$relativePathToFileInProject = $this->getRelativePathToFile($pathToFileInProject);
if (null !== $this->getOverrideForPath($relativePathToFileInProject)) {
throw new \RuntimeException('Override already exists for path ' . $relativePathToFileInProject);
}
$overridePath =
$this->getOverrideDirectoryForFile($relativePathToFileInProject) .
'/' . $this->getFileNameNoExtensionForPathInProject($relativePathToFileInProject) .
'.' . $this->getProjectFileHash($relativePathToFileInProject) .
'.php.override';
$pathToFileInProject = $this->pathToProjectRoot . '/' . $relativePathToFileInProject;
if (false === is_file($pathToFileInProject)) {
throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
}
copy($pathToFileInProject, $overridePath);
return $this->getRelativePathToFile($overridePath);
} | php | public function createNewOverride(string $pathToFileInProject): string
{
$relativePathToFileInProject = $this->getRelativePathToFile($pathToFileInProject);
if (null !== $this->getOverrideForPath($relativePathToFileInProject)) {
throw new \RuntimeException('Override already exists for path ' . $relativePathToFileInProject);
}
$overridePath =
$this->getOverrideDirectoryForFile($relativePathToFileInProject) .
'/' . $this->getFileNameNoExtensionForPathInProject($relativePathToFileInProject) .
'.' . $this->getProjectFileHash($relativePathToFileInProject) .
'.php.override';
$pathToFileInProject = $this->pathToProjectRoot . '/' . $relativePathToFileInProject;
if (false === is_file($pathToFileInProject)) {
throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
}
copy($pathToFileInProject, $overridePath);
return $this->getRelativePathToFile($overridePath);
} | [
"public",
"function",
"createNewOverride",
"(",
"string",
"$",
"pathToFileInProject",
")",
":",
"string",
"{",
"$",
"relativePathToFileInProject",
"=",
"$",
"this",
"->",
"getRelativePathToFile",
"(",
"$",
"pathToFileInProject",
")",
";",
"if",
"(",
"null",
"!==",... | Create a new Override File by copying the file from the project into the project's overrides directory
@param string $pathToFileInProject
@return string | [
"Create",
"a",
"new",
"Override",
"File",
"by",
"copying",
"the",
"file",
"from",
"the",
"project",
"into",
"the",
"project",
"s",
"overrides",
"directory"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PostProcessor/FileOverrider.php#L74-L92 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PostProcessor/FileOverrider.php | FileOverrider.updateOverrideFiles | public function updateOverrideFiles(): array
{
$filesUpdated = [];
$fileSame = [];
foreach ($this->getOverridesIterator() as $pathToFileInOverrides) {
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
if ($this->projectFileIsSameAsOverride($pathToFileInOverrides)) {
$fileSame[] = $relativePathToFileInProject;
continue;
}
$pathToFileInProject = $this->pathToProjectRoot . $relativePathToFileInProject;
if (false === is_file($pathToFileInProject)) {
throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
}
copy($pathToFileInProject, $pathToFileInOverrides);
$filesUpdated[] = $relativePathToFileInProject;
}
return [$this->sortFiles($filesUpdated), $this->sortFiles($fileSame)];
} | php | public function updateOverrideFiles(): array
{
$filesUpdated = [];
$fileSame = [];
foreach ($this->getOverridesIterator() as $pathToFileInOverrides) {
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
if ($this->projectFileIsSameAsOverride($pathToFileInOverrides)) {
$fileSame[] = $relativePathToFileInProject;
continue;
}
$pathToFileInProject = $this->pathToProjectRoot . $relativePathToFileInProject;
if (false === is_file($pathToFileInProject)) {
throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
}
copy($pathToFileInProject, $pathToFileInOverrides);
$filesUpdated[] = $relativePathToFileInProject;
}
return [$this->sortFiles($filesUpdated), $this->sortFiles($fileSame)];
} | [
"public",
"function",
"updateOverrideFiles",
"(",
")",
":",
"array",
"{",
"$",
"filesUpdated",
"=",
"[",
"]",
";",
"$",
"fileSame",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getOverridesIterator",
"(",
")",
"as",
"$",
"pathToFileInOverrides",... | Loop over all the override files and update with the file contents from the project
@return array[] the file paths that have been updated | [
"Loop",
"over",
"all",
"the",
"override",
"files",
"and",
"update",
"with",
"the",
"file",
"contents",
"from",
"the",
"project"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PostProcessor/FileOverrider.php#L170-L189 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PostProcessor/FileOverrider.php | FileOverrider.getOverridesIterator | private function getOverridesIterator(): \Generator
{
try {
$recursiveIterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(
$this->getPathToOverridesDirectory(),
\RecursiveDirectoryIterator::SKIP_DOTS
),
\RecursiveIteratorIterator::SELF_FIRST
);
foreach ($recursiveIterator as $fileInfo) {
/**
* @var \SplFileInfo $fileInfo
*/
if ($fileInfo->isFile()) {
if (self::OVERRIDE_EXTENSION !== substr(
$fileInfo->getFilename(),
-strlen(self::OVERRIDE_EXTENSION)
)
) {
continue;
}
yield $fileInfo->getPathname();
}
}
} finally {
$recursiveIterator = null;
unset($recursiveIterator);
}
} | php | private function getOverridesIterator(): \Generator
{
try {
$recursiveIterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(
$this->getPathToOverridesDirectory(),
\RecursiveDirectoryIterator::SKIP_DOTS
),
\RecursiveIteratorIterator::SELF_FIRST
);
foreach ($recursiveIterator as $fileInfo) {
/**
* @var \SplFileInfo $fileInfo
*/
if ($fileInfo->isFile()) {
if (self::OVERRIDE_EXTENSION !== substr(
$fileInfo->getFilename(),
-strlen(self::OVERRIDE_EXTENSION)
)
) {
continue;
}
yield $fileInfo->getPathname();
}
}
} finally {
$recursiveIterator = null;
unset($recursiveIterator);
}
} | [
"private",
"function",
"getOverridesIterator",
"(",
")",
":",
"\\",
"Generator",
"{",
"try",
"{",
"$",
"recursiveIterator",
"=",
"new",
"\\",
"RecursiveIteratorIterator",
"(",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"getPathToOverridesDire... | Yield file paths in the override folder
@return \Generator|string[] | [
"Yield",
"file",
"paths",
"in",
"the",
"override",
"folder"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PostProcessor/FileOverrider.php#L196-L225 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PostProcessor/FileOverrider.php | FileOverrider.projectFileIsSameAsOverride | private function projectFileIsSameAsOverride(string $pathToFileInOverrides): bool
{
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
return $this->getFileHash($this->pathToProjectRoot . '/' . $relativePathToFileInProject) ===
$this->getFileHash($pathToFileInOverrides);
} | php | private function projectFileIsSameAsOverride(string $pathToFileInOverrides): bool
{
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
return $this->getFileHash($this->pathToProjectRoot . '/' . $relativePathToFileInProject) ===
$this->getFileHash($pathToFileInOverrides);
} | [
"private",
"function",
"projectFileIsSameAsOverride",
"(",
"string",
"$",
"pathToFileInOverrides",
")",
":",
"bool",
"{",
"$",
"relativePathToFileInProject",
"=",
"$",
"this",
"->",
"getRelativePathInProjectFromOverridePath",
"(",
"$",
"pathToFileInOverrides",
")",
";",
... | Is the file in the project the same as the override file already?
@param string $pathToFileInOverrides
@return bool | [
"Is",
"the",
"file",
"in",
"the",
"project",
"the",
"same",
"as",
"the",
"override",
"file",
"already?"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PostProcessor/FileOverrider.php#L246-L252 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PostProcessor/FileOverrider.php | FileOverrider.applyOverrides | public function applyOverrides(): array
{
$filesUpdated = [];
$filesSame = [];
$errors = [];
foreach ($this->getOverridesIterator() as $pathToFileInOverrides) {
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
if ($this->overrideFileHashIsCorrect($pathToFileInOverrides)) {
if (false === is_file($pathToFileInOverrides)) {
throw new \RuntimeException('path ' . $pathToFileInOverrides . ' is not a file');
}
copy($pathToFileInOverrides, $this->pathToProjectRoot . $relativePathToFileInProject);
$filesUpdated[] = $relativePathToFileInProject;
continue;
}
if ($this->projectFileIsSameAsOverride($pathToFileInOverrides)) {
$filesSame[] = $relativePathToFileInProject;
continue;
}
$errors[$pathToFileInOverrides] = $this->getProjectFileHash($relativePathToFileInProject);
}
if ([] !== $errors) {
throw new \RuntimeException('These file hashes were not up to date:' . print_r($errors, true));
}
return [$this->sortFiles($filesUpdated), $this->sortFiles($filesSame)];
} | php | public function applyOverrides(): array
{
$filesUpdated = [];
$filesSame = [];
$errors = [];
foreach ($this->getOverridesIterator() as $pathToFileInOverrides) {
$relativePathToFileInProject = $this->getRelativePathInProjectFromOverridePath($pathToFileInOverrides);
if ($this->overrideFileHashIsCorrect($pathToFileInOverrides)) {
if (false === is_file($pathToFileInOverrides)) {
throw new \RuntimeException('path ' . $pathToFileInOverrides . ' is not a file');
}
copy($pathToFileInOverrides, $this->pathToProjectRoot . $relativePathToFileInProject);
$filesUpdated[] = $relativePathToFileInProject;
continue;
}
if ($this->projectFileIsSameAsOverride($pathToFileInOverrides)) {
$filesSame[] = $relativePathToFileInProject;
continue;
}
$errors[$pathToFileInOverrides] = $this->getProjectFileHash($relativePathToFileInProject);
}
if ([] !== $errors) {
throw new \RuntimeException('These file hashes were not up to date:' . print_r($errors, true));
}
return [$this->sortFiles($filesUpdated), $this->sortFiles($filesSame)];
} | [
"public",
"function",
"applyOverrides",
"(",
")",
":",
"array",
"{",
"$",
"filesUpdated",
"=",
"[",
"]",
";",
"$",
"filesSame",
"=",
"[",
"]",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getOverridesIterator",
"(",
")"... | Loop over all the override files and copy into the project
@return array[] the file paths that have been updated | [
"Loop",
"over",
"all",
"the",
"override",
"files",
"and",
"copy",
"into",
"the",
"project"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PostProcessor/FileOverrider.php#L266-L292 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageParser.php | SnsMessageParser.parseNotification | public static function parseNotification($headers, $jsonString)
{
self::_validateHeaders($headers);
$snsMsg = new Message($jsonString);
self::_checkForCorrectMessageType($snsMsg);
self::_setMetadataForMessage($snsMsg);
return $snsMsg;
} | php | public static function parseNotification($headers, $jsonString)
{
self::_validateHeaders($headers);
$snsMsg = new Message($jsonString);
self::_checkForCorrectMessageType($snsMsg);
self::_setMetadataForMessage($snsMsg);
return $snsMsg;
} | [
"public",
"static",
"function",
"parseNotification",
"(",
"$",
"headers",
",",
"$",
"jsonString",
")",
"{",
"self",
"::",
"_validateHeaders",
"(",
"$",
"headers",
")",
";",
"$",
"snsMsg",
"=",
"new",
"Message",
"(",
"$",
"jsonString",
")",
";",
"self",
"... | Convert a json string to a json msg that
meets our expections of a SnsMessage
@param string $jsonString raw data as json string
@throws OffAmazonPaymentsNotifications_InvalidMessageException if not valid json
@return Message converted message | [
"Convert",
"a",
"json",
"string",
"to",
"a",
"json",
"msg",
"that",
"meets",
"our",
"expections",
"of",
"a",
"SnsMessage"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/SnsMessageParser.php#L37-L44 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopInfoCore/MTShopInfoCore.class.php | MTShopInfoCore.& | protected function &GetModuleConfig()
{
if (is_null($this->oModuleConfig)) {
$this->oModuleConfig = TdbShopSystemInfoModuleConfig::GetNewInstance();
if (!$this->oModuleConfig->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) {
$this->oModuleConfig = null;
}
}
return $this->oModuleConfig;
} | php | protected function &GetModuleConfig()
{
if (is_null($this->oModuleConfig)) {
$this->oModuleConfig = TdbShopSystemInfoModuleConfig::GetNewInstance();
if (!$this->oModuleConfig->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) {
$this->oModuleConfig = null;
}
}
return $this->oModuleConfig;
} | [
"protected",
"function",
"&",
"GetModuleConfig",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oModuleConfig",
")",
")",
"{",
"$",
"this",
"->",
"oModuleConfig",
"=",
"TdbShopSystemInfoModuleConfig",
"::",
"GetNewInstance",
"(",
")",
";",
"if... | return config record for modul instance.
@return TdbShopSystemInfoModuleConfig | [
"return",
"config",
"record",
"for",
"modul",
"instance",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopInfoCore/MTShopInfoCore.class.php#L41-L51 | train |
Erebot/Erebot | src/Prompt.php | Prompt.handleMessage | protected function handleMessage($line)
{
$pos = strpos($line, ' ');
if ($pos === false) {
return;
}
$pattern = preg_quote(substr($line, 0, $pos), '@');
$pattern = strtr($pattern, array('\\?' => '.?', '\\*' => '.*'));
$line = substr($line, $pos + 1);
if ($line === false) {
return;
}
foreach ($this->bot->getConnections() as $connection) {
if (!($connection instanceof \Erebot\Interfaces\SendingConnection) || $connection == $this) {
continue;
}
$config = $connection->getConfig(null);
$netConfig = $config->getNetworkCfg();
if (preg_match('@^'.$pattern.'$@Di', $netConfig->getName())) {
$connection->getIO()->push($line);
}
}
} | php | protected function handleMessage($line)
{
$pos = strpos($line, ' ');
if ($pos === false) {
return;
}
$pattern = preg_quote(substr($line, 0, $pos), '@');
$pattern = strtr($pattern, array('\\?' => '.?', '\\*' => '.*'));
$line = substr($line, $pos + 1);
if ($line === false) {
return;
}
foreach ($this->bot->getConnections() as $connection) {
if (!($connection instanceof \Erebot\Interfaces\SendingConnection) || $connection == $this) {
continue;
}
$config = $connection->getConfig(null);
$netConfig = $config->getNetworkCfg();
if (preg_match('@^'.$pattern.'$@Di', $netConfig->getName())) {
$connection->getIO()->push($line);
}
}
} | [
"protected",
"function",
"handleMessage",
"(",
"$",
"line",
")",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"line",
",",
"' '",
")",
";",
"if",
"(",
"$",
"pos",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"pattern",
"=",
"preg_quote",
"(",
... | Handles a line received from the prompt.
\param string $line
A single line of text received from the prompt,
with the end-of-line sequence stripped. | [
"Handles",
"a",
"line",
"received",
"from",
"the",
"prompt",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Prompt.php#L224-L249 | train |
chameleon-system/chameleon-shop | src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemSpot.class.php | TPkgImageHotspotItemSpot.& | public function &GetSpotObject()
{
$oObject = &$this->GetFromInternalCache('oObjectAssignedToSpot');
if (is_null($oObject)) {
$oObject = $this->GetFieldLinkedRecord();
$this->SetInternalCache('oObjectAssignedToSpot', $oObject);
}
return $oObject;
} | php | public function &GetSpotObject()
{
$oObject = &$this->GetFromInternalCache('oObjectAssignedToSpot');
if (is_null($oObject)) {
$oObject = $this->GetFieldLinkedRecord();
$this->SetInternalCache('oObjectAssignedToSpot', $oObject);
}
return $oObject;
} | [
"public",
"function",
"&",
"GetSpotObject",
"(",
")",
"{",
"$",
"oObject",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oObjectAssignedToSpot'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oObject",
")",
")",
"{",
"$",
"oObject",
"=",
"$",
... | return a pointer to the object assigned to the spot.
@return TCMSRecord | [
"return",
"a",
"pointer",
"to",
"the",
"object",
"assigned",
"to",
"the",
"spot",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemSpot.class.php#L21-L30 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.LoadArticleList | public static function LoadArticleList($sOrderString = null, $iLimit = -1, $aFilter = array())
{
if (is_null($sOrderString)) {
$sOrderString = '`shop_article`.`list_rank` DESC, `shop_article`.`name` ASC';
}
$query = "SELECT `shop_article`.*
FROM `shop_article`
WHERE `shop_article`.`variant_parent_id` = ''
";
$sActiveArticleSnippid = TdbShopArticleList::GetActiveArticleQueryRestriction();
if (!empty($sActiveArticleSnippid)) {
$query .= ' AND ('.$sActiveArticleSnippid.')';
}
if (count($aFilter) > 0) {
$aTmpFilter = array();
foreach ($aFilter as $sKey => $sField) {
$aTmpFilter[] = MySqlLegacySupport::getInstance()->real_escape_string($sKey)."='".MySqlLegacySupport::getInstance()->real_escape_string($sField)."'";
}
$query .= ' AND ('.implode(' AND ', $aTmpFilter).')';
}
if (!empty($sOrderString)) {
$query .= ' ORDER BY '.$sOrderString;
}
if ($iLimit > 0) {
$query .= ' LIMIT 0,'.$iLimit;
}
$oList = &TdbShopArticleList::GetList($query);
return $oList;
} | php | public static function LoadArticleList($sOrderString = null, $iLimit = -1, $aFilter = array())
{
if (is_null($sOrderString)) {
$sOrderString = '`shop_article`.`list_rank` DESC, `shop_article`.`name` ASC';
}
$query = "SELECT `shop_article`.*
FROM `shop_article`
WHERE `shop_article`.`variant_parent_id` = ''
";
$sActiveArticleSnippid = TdbShopArticleList::GetActiveArticleQueryRestriction();
if (!empty($sActiveArticleSnippid)) {
$query .= ' AND ('.$sActiveArticleSnippid.')';
}
if (count($aFilter) > 0) {
$aTmpFilter = array();
foreach ($aFilter as $sKey => $sField) {
$aTmpFilter[] = MySqlLegacySupport::getInstance()->real_escape_string($sKey)."='".MySqlLegacySupport::getInstance()->real_escape_string($sField)."'";
}
$query .= ' AND ('.implode(' AND ', $aTmpFilter).')';
}
if (!empty($sOrderString)) {
$query .= ' ORDER BY '.$sOrderString;
}
if ($iLimit > 0) {
$query .= ' LIMIT 0,'.$iLimit;
}
$oList = &TdbShopArticleList::GetList($query);
return $oList;
} | [
"public",
"static",
"function",
"LoadArticleList",
"(",
"$",
"sOrderString",
"=",
"null",
",",
"$",
"iLimit",
"=",
"-",
"1",
",",
"$",
"aFilter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sOrderString",
")",
")",
"{",
"$",
... | return active article list.
@param int $iCategoryId
@param string $sOrderString
@param int $iLimit
@param array $aFilter - any filters you want to add to the list
@return TdbShopArticleList | [
"return",
"active",
"article",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L168-L199 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.Render | public function Render($sViewName = 'standard', $sViewType = 'Core', $aCallTimeVars = array())
{
$oView = new TViewParser();
$sViewIdentKey = $this->StoreListObjectInSession($sViewName, $sViewType, $aCallTimeVars);
$this->GoToStart();
$oView->AddVar('oArticleList', $this);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$oView->AddVar('sViewIdentKey', $sViewIdentKey);
$aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, TdbShopArticleList::VIEW_PATH, $sViewType);
} | php | public function Render($sViewName = 'standard', $sViewType = 'Core', $aCallTimeVars = array())
{
$oView = new TViewParser();
$sViewIdentKey = $this->StoreListObjectInSession($sViewName, $sViewType, $aCallTimeVars);
$this->GoToStart();
$oView->AddVar('oArticleList', $this);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$oView->AddVar('sViewIdentKey', $sViewIdentKey);
$aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, TdbShopArticleList::VIEW_PATH, $sViewType);
} | [
"public",
"function",
"Render",
"(",
"$",
"sViewName",
"=",
"'standard'",
",",
"$",
"sViewType",
"=",
"'Core'",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oView",
"=",
"new",
"TViewParser",
"(",
")",
";",
"$",
"sViewIdentKey",
"... | used to display the article list.
@param string $sViewName - the view to use
@param string $sViewType - where the view is located (Core, Custom-Core, Customer)
@param array $aCallTimeVars - place any custom vars that you want to pass through the call here
@return string | [
"used",
"to",
"display",
"the",
"article",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L210-L222 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.GetListIdentKey | public function GetListIdentKey()
{
if (null === $this->sListIdentKey) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$this->sListIdentKey = $oExecutingModule->sModuleSpotName;
}
return $this->sListIdentKey;
} | php | public function GetListIdentKey()
{
if (null === $this->sListIdentKey) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$this->sListIdentKey = $oExecutingModule->sModuleSpotName;
}
return $this->sListIdentKey;
} | [
"public",
"function",
"GetListIdentKey",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"sListIdentKey",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oExecutingModule",
"=",
"&",
"$",
"oGlobal",
"->",
"G... | return an IdentKey for this list.
@return string | [
"return",
"an",
"IdentKey",
"for",
"this",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L229-L238 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.StoreListObjectInSession | public function StoreListObjectInSession($sViewName = null, $sViewType = null, $aCallTimeVars = null)
{
$oGlobal = TGlobal::instance();
$sItemKey = $this->GetListIdentKey();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
if (!array_key_exists(TdbShopArticleList::SESSIN_DUMP_NAME, $_SESSION)) {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME] = array();
}
if (!array_key_exists($sItemKey, $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME])) {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey] = array();
}
$aOldData = $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey];
if (is_null($sViewName) && array_key_exists('sViewName', $aOldData)) {
$sViewName = $aOldData['sViewName'];
}
if (is_null($sViewType) && array_key_exists('sViewType', $aOldData)) {
$sViewType = $aOldData['sViewType'];
}
if (is_null($aCallTimeVars) && array_key_exists('aCallTimeVars', $aOldData)) {
$aCallTimeVars = $aOldData['aCallTimeVars'];
}
if (0 === $this->GetPageSize()) {
unset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey]);
} else {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey] = array( // 'oExecutingModule'=>$oExecutingModule,
'lastchanged' => time(), 'sObjectDump' => base64_encode(serialize($this)), 'iStartRecord' => $this->GetStartRecordNumber(), 'iPageSize' => $this->GetPageSize(), 'sViewName' => $sViewName, 'sViewType' => $sViewType, 'aCallTimeVars' => $aCallTimeVars, );
}
return $sItemKey;
} | php | public function StoreListObjectInSession($sViewName = null, $sViewType = null, $aCallTimeVars = null)
{
$oGlobal = TGlobal::instance();
$sItemKey = $this->GetListIdentKey();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
if (!array_key_exists(TdbShopArticleList::SESSIN_DUMP_NAME, $_SESSION)) {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME] = array();
}
if (!array_key_exists($sItemKey, $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME])) {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey] = array();
}
$aOldData = $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey];
if (is_null($sViewName) && array_key_exists('sViewName', $aOldData)) {
$sViewName = $aOldData['sViewName'];
}
if (is_null($sViewType) && array_key_exists('sViewType', $aOldData)) {
$sViewType = $aOldData['sViewType'];
}
if (is_null($aCallTimeVars) && array_key_exists('aCallTimeVars', $aOldData)) {
$aCallTimeVars = $aOldData['aCallTimeVars'];
}
if (0 === $this->GetPageSize()) {
unset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey]);
} else {
$_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sItemKey] = array( // 'oExecutingModule'=>$oExecutingModule,
'lastchanged' => time(), 'sObjectDump' => base64_encode(serialize($this)), 'iStartRecord' => $this->GetStartRecordNumber(), 'iPageSize' => $this->GetPageSize(), 'sViewName' => $sViewName, 'sViewType' => $sViewType, 'aCallTimeVars' => $aCallTimeVars, );
}
return $sItemKey;
} | [
"public",
"function",
"StoreListObjectInSession",
"(",
"$",
"sViewName",
"=",
"null",
",",
"$",
"sViewType",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=",
"null",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sItemKey",
... | restore serialized dump in session. returns id key for item. also calls
session cleanup method.
@return string | [
"restore",
"serialized",
"dump",
"in",
"session",
".",
"returns",
"id",
"key",
"for",
"item",
".",
"also",
"calls",
"session",
"cleanup",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L246-L277 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.& | public static function &GetInstanceFromSession($sListSessionKey)
{
$oList = null;
$aListData = TdbShopArticleList::GetInstanceDataFromSession($sListSessionKey);
if (!is_null($aListData)) {
if (array_key_exists('sObjectDump', $aListData)) {
$oList = unserialize(base64_decode($aListData['sObjectDump']));
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists(TdbShopArticleList::URL_LIST_KEY_NAME)) {
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sListSessionKey == $callingIdentKey) {
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$oList->HandleURLRequest($sRequest);
}
}
}
}
return $oList;
} | php | public static function &GetInstanceFromSession($sListSessionKey)
{
$oList = null;
$aListData = TdbShopArticleList::GetInstanceDataFromSession($sListSessionKey);
if (!is_null($aListData)) {
if (array_key_exists('sObjectDump', $aListData)) {
$oList = unserialize(base64_decode($aListData['sObjectDump']));
$oGlobal = TGlobal::instance();
if ($oGlobal->UserDataExists(TdbShopArticleList::URL_LIST_KEY_NAME)) {
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sListSessionKey == $callingIdentKey) {
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$oList->HandleURLRequest($sRequest);
}
}
}
}
return $oList;
} | [
"public",
"static",
"function",
"&",
"GetInstanceFromSession",
"(",
"$",
"sListSessionKey",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"$",
"aListData",
"=",
"TdbShopArticleList",
"::",
"GetInstanceDataFromSession",
"(",
"$",
"sListSessionKey",
")",
";",
"if",
"(... | create a list based on the session data for the session key passed
returns NULL if the object can not be found.
@param string $sSessionKey
@return TdbShopArticleList | [
"create",
"a",
"list",
"based",
"on",
"the",
"session",
"data",
"for",
"the",
"session",
"key",
"passed",
"returns",
"NULL",
"if",
"the",
"object",
"can",
"not",
"be",
"found",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L308-L327 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.removeInstanceFromSession | public static function removeInstanceFromSession($sListSessionKey)
{
if (isset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME]) &&
isset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sListSessionKey])) {
unset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sListSessionKey]);
}
} | php | public static function removeInstanceFromSession($sListSessionKey)
{
if (isset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME]) &&
isset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sListSessionKey])) {
unset($_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sListSessionKey]);
}
} | [
"public",
"static",
"function",
"removeInstanceFromSession",
"(",
"$",
"sListSessionKey",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"TdbShopArticleList",
"::",
"SESSIN_DUMP_NAME",
"]",
")",
"&&",
"isset",
"(",
"$",
"_SESSION",
"[",
"TdbShopArticle... | remove serialized dump from session.
@param string $sListSessionKey | [
"remove",
"serialized",
"dump",
"from",
"session",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L334-L340 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.RestorePagingInfoFromSession | public function RestorePagingInfoFromSession($iStartRecord, $iPageSize)
{
$identKey = $this->GetListIdentKey();
$aTmpData = TdbShopArticleList::GetInstanceDataFromSession($identKey);
$bPagingWasRestoredFromSession = false;
if (!is_null($aTmpData)) {
$bPagingWasRestoredFromSession = $this->SetPagingInfo($aTmpData['iStartRecord'], $aTmpData['iPageSize']);
}
if (false === $bPagingWasRestoredFromSession) {
// use default... BUT if there is a post request for this list (ie list key given) and a page
// is transfered, we use it
$oGlobal = TGlobal::instance();
$sRequestKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sRequestKey == $identKey) {
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$iRequestStartPage = intval($iRequestStartPage);
if ($iRequestStartPage > 0) {
$iStartRecord = $iPageSize * ($iRequestStartPage - 1);
}
$this->SetPagingInfo($iStartRecord, $iPageSize);
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$this->HandleURLRequest($sRequest);
} else {
if (false === $this->SetPagingInfo($iStartRecord, $iPageSize)) {
$this->SetPagingInfo(0, $iPageSize);
}
}
}
} | php | public function RestorePagingInfoFromSession($iStartRecord, $iPageSize)
{
$identKey = $this->GetListIdentKey();
$aTmpData = TdbShopArticleList::GetInstanceDataFromSession($identKey);
$bPagingWasRestoredFromSession = false;
if (!is_null($aTmpData)) {
$bPagingWasRestoredFromSession = $this->SetPagingInfo($aTmpData['iStartRecord'], $aTmpData['iPageSize']);
}
if (false === $bPagingWasRestoredFromSession) {
// use default... BUT if there is a post request for this list (ie list key given) and a page
// is transfered, we use it
$oGlobal = TGlobal::instance();
$sRequestKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sRequestKey == $identKey) {
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$iRequestStartPage = intval($iRequestStartPage);
if ($iRequestStartPage > 0) {
$iStartRecord = $iPageSize * ($iRequestStartPage - 1);
}
$this->SetPagingInfo($iStartRecord, $iPageSize);
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$this->HandleURLRequest($sRequest);
} else {
if (false === $this->SetPagingInfo($iStartRecord, $iPageSize)) {
$this->SetPagingInfo(0, $iPageSize);
}
}
}
} | [
"public",
"function",
"RestorePagingInfoFromSession",
"(",
"$",
"iStartRecord",
",",
"$",
"iPageSize",
")",
"{",
"$",
"identKey",
"=",
"$",
"this",
"->",
"GetListIdentKey",
"(",
")",
";",
"$",
"aTmpData",
"=",
"TdbShopArticleList",
"::",
"GetInstanceDataFromSessio... | set the paging info from session.. if no value is set in session, use the passed values.
@param int $iStartRecord
@param int $iPageSize | [
"set",
"the",
"paging",
"info",
"from",
"session",
"..",
"if",
"no",
"value",
"is",
"set",
"in",
"session",
"use",
"the",
"passed",
"values",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L364-L392 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.GetNextPageLink | public function GetNextPageLink()
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ChangePage', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage', TdbShopArticleList::URL_LIST_CURRENT_PAGE => $this->GetCurrentPageNumber());
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
}
return $sLink;
} | php | public function GetNextPageLink()
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ChangePage', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage', TdbShopArticleList::URL_LIST_CURRENT_PAGE => $this->GetCurrentPageNumber());
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
}
return $sLink;
} | [
"public",
"function",
"GetNextPageLink",
"(",
")",
"{",
"$",
"sLink",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"HasNextPage",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oExecutingModule",
"=",
"... | return link to next page, or false if there is no next page.
@return string | [
"return",
"link",
"to",
"next",
"page",
"or",
"false",
"if",
"there",
"is",
"no",
"next",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L399-L410 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.GetNextPageLinkAsAJAXCall | public function GetNextPageLinkAsAJAXCall($bGetAsJSFunction = true)
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ExecuteAjaxCall', '_fnc' => 'ChangePageAjax', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage',
);
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
if ($bGetAsJSFunction) {
$sLink = "GetAjaxCall('{$sLink}', ShowListItems)";
}
}
return $sLink;
} | php | public function GetNextPageLinkAsAJAXCall($bGetAsJSFunction = true)
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ExecuteAjaxCall', '_fnc' => 'ChangePageAjax', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage',
);
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
if ($bGetAsJSFunction) {
$sLink = "GetAjaxCall('{$sLink}', ShowListItems)";
}
}
return $sLink;
} | [
"public",
"function",
"GetNextPageLinkAsAJAXCall",
"(",
"$",
"bGetAsJSFunction",
"=",
"true",
")",
"{",
"$",
"sLink",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"HasNextPage",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(... | returns the javascript call to fetch the items for the next page.
@param bool $bGetAsJSFunction - set to false if you just want the link
@return string | [
"returns",
"the",
"javascript",
"call",
"to",
"fetch",
"the",
"items",
"for",
"the",
"next",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L419-L434 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.HandleURLRequest | public function HandleURLRequest($sRequest, $bCheckIdentKey = false)
{
$bAllowRequest = true;
if ($bCheckIdentKey) {
$currentListKey = $this->GetListIdentKey();
$oGlobal = TGlobal::instance();
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($callingIdentKey != $currentListKey) {
$bAllowRequest = false;
}
}
if ($bAllowRequest) {
switch ($sRequest) {
case 'NextPage':
$this->SetPagingInfoNextPage();
break;
case 'PreviousPage':
$this->SetPagingInfoPreviousPage();
break;
case 'GoToPage':
$oGlobal = TGlobal::instance();
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$this->JumpToPage($iRequestStartPage);
break;
default:
break;
}
}
$this->StoreListObjectInSession();
} | php | public function HandleURLRequest($sRequest, $bCheckIdentKey = false)
{
$bAllowRequest = true;
if ($bCheckIdentKey) {
$currentListKey = $this->GetListIdentKey();
$oGlobal = TGlobal::instance();
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($callingIdentKey != $currentListKey) {
$bAllowRequest = false;
}
}
if ($bAllowRequest) {
switch ($sRequest) {
case 'NextPage':
$this->SetPagingInfoNextPage();
break;
case 'PreviousPage':
$this->SetPagingInfoPreviousPage();
break;
case 'GoToPage':
$oGlobal = TGlobal::instance();
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$this->JumpToPage($iRequestStartPage);
break;
default:
break;
}
}
$this->StoreListObjectInSession();
} | [
"public",
"function",
"HandleURLRequest",
"(",
"$",
"sRequest",
",",
"$",
"bCheckIdentKey",
"=",
"false",
")",
"{",
"$",
"bAllowRequest",
"=",
"true",
";",
"if",
"(",
"$",
"bCheckIdentKey",
")",
"{",
"$",
"currentListKey",
"=",
"$",
"this",
"->",
"GetListI... | process any request made for this item.
@param string $sRequest
@param bool $bCheckIdentKey | [
"process",
"any",
"request",
"made",
"for",
"this",
"item",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L538-L569 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getEnzyme | private function getEnzyme(\SimpleXMLElement $xmlEnzyme)
{
$enzyme = array();
foreach ($xmlEnzyme->attributes() as $attribute => $value) {
switch ($attribute) {
case 'cTermGain':
$enzyme['cTermGain'] = (string) $value;
break;
case 'id':
$enzyme['id'] = (string) $value;
break;
case 'minDistance':
$enzyme['minDistance'] = (int) $value;
break;
case 'missedCleavages':
$enzyme['missedCleavages'] = (int) $value;
break;
case 'nTermGain':
$enzyme['nTermGain'] = (string) $value;
break;
case 'name':
$enzyme['name'] = (string) $value;
break;
case 'semiSpecific':
$enzyme['semiSpecific'] = (string) $value == 'true';
break;
default:
// Unknown element
break;
}
}
if (isset($xmlEnzyme->EnzymeName)) {
$enzyme['EnzymeName'] = $this->getEnzymeName($xmlEnzyme->EnzymeName);
}
return $enzyme;
} | php | private function getEnzyme(\SimpleXMLElement $xmlEnzyme)
{
$enzyme = array();
foreach ($xmlEnzyme->attributes() as $attribute => $value) {
switch ($attribute) {
case 'cTermGain':
$enzyme['cTermGain'] = (string) $value;
break;
case 'id':
$enzyme['id'] = (string) $value;
break;
case 'minDistance':
$enzyme['minDistance'] = (int) $value;
break;
case 'missedCleavages':
$enzyme['missedCleavages'] = (int) $value;
break;
case 'nTermGain':
$enzyme['nTermGain'] = (string) $value;
break;
case 'name':
$enzyme['name'] = (string) $value;
break;
case 'semiSpecific':
$enzyme['semiSpecific'] = (string) $value == 'true';
break;
default:
// Unknown element
break;
}
}
if (isset($xmlEnzyme->EnzymeName)) {
$enzyme['EnzymeName'] = $this->getEnzymeName($xmlEnzyme->EnzymeName);
}
return $enzyme;
} | [
"private",
"function",
"getEnzyme",
"(",
"\\",
"SimpleXMLElement",
"$",
"xmlEnzyme",
")",
"{",
"$",
"enzyme",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xmlEnzyme",
"->",
"attributes",
"(",
")",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
... | The details of an individual cleavage enzyme should be provided by giving a regular expression or a CV term if a "standard" enzyme cleavage has been
performed.
@param \SimpleXMLElement $xmlEnzyme
The XML element
@return string[]|number[]|boolean[]|NULL[]|string[][] | [
"The",
"details",
"of",
"an",
"individual",
"cleavage",
"enzyme",
"should",
"be",
"provided",
"by",
"giving",
"a",
"regular",
"expression",
"or",
"a",
"CV",
"term",
"if",
"a",
"standard",
"enzyme",
"cleavage",
"has",
"been",
"performed",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L304-L342 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getEnzymes | protected function getEnzymes(\SimpleXMLElement $xml)
{
$enzymes = array();
foreach ($xml->Enzyme as $xmlEnzyme) {
$enzyme = $this->getEnzyme($xmlEnzyme);
if (isset($enzyme['id'])) {
$enzymes[$enzyme['id']] = $enzyme;
continue;
}
$enzymes[] = $enzyme;
}
return $enzymes;
} | php | protected function getEnzymes(\SimpleXMLElement $xml)
{
$enzymes = array();
foreach ($xml->Enzyme as $xmlEnzyme) {
$enzyme = $this->getEnzyme($xmlEnzyme);
if (isset($enzyme['id'])) {
$enzymes[$enzyme['id']] = $enzyme;
continue;
}
$enzymes[] = $enzyme;
}
return $enzymes;
} | [
"protected",
"function",
"getEnzymes",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"enzymes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"Enzyme",
"as",
"$",
"xmlEnzyme",
")",
"{",
"$",
"enzyme",
"=",
"$",
"this",
"-... | The list of enzymes used in experiment
@param \SimpleXMLElement $xml
@return array | [
"The",
"list",
"of",
"enzymes",
"used",
"in",
"experiment"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L359-L375 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getFileFormat | private function getFileFormat(\SimpleXMLElement $xml)
{
$formats = array();
foreach ($xml->cvParam as $xmlCvParam) {
$cvParam = $this->getCvParam($xmlCvParam);
$formats[] = $cvParam[PsiVerb::CV_ACCESSION];
}
return $formats;
} | php | private function getFileFormat(\SimpleXMLElement $xml)
{
$formats = array();
foreach ($xml->cvParam as $xmlCvParam) {
$cvParam = $this->getCvParam($xmlCvParam);
$formats[] = $cvParam[PsiVerb::CV_ACCESSION];
}
return $formats;
} | [
"private",
"function",
"getFileFormat",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"formats",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"cvParam",
"as",
"$",
"xmlCvParam",
")",
"{",
"$",
"cvParam",
"=",
"$",
"this",
... | The format of the ExternalData file, for example "tiff" for image files.
@param \SimpleXMLElement $xml
XML to parse | [
"The",
"format",
"of",
"the",
"ExternalData",
"file",
"for",
"example",
"tiff",
"for",
"image",
"files",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L393-L404 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getPeptideHypothesis | private function getPeptideHypothesis(\SimpleXMLElement $xml)
{
$hypothesis = array();
$ref = (string) $xml->attributes()->peptideEvidence_ref;
$hypothesis['peptide'] = $ref;
$hypothesis['spectra'] = array();
// TODO: Nothing we can currently do with this data - yet
foreach ($xml->SpectrumIdentificationItemRef as $spectrumIdentificationItemRef) {
$hypothesis['spectra'][] = $this->getSpectrumIdentificationItemRef($spectrumIdentificationItemRef);
}
return $hypothesis;
} | php | private function getPeptideHypothesis(\SimpleXMLElement $xml)
{
$hypothesis = array();
$ref = (string) $xml->attributes()->peptideEvidence_ref;
$hypothesis['peptide'] = $ref;
$hypothesis['spectra'] = array();
// TODO: Nothing we can currently do with this data - yet
foreach ($xml->SpectrumIdentificationItemRef as $spectrumIdentificationItemRef) {
$hypothesis['spectra'][] = $this->getSpectrumIdentificationItemRef($spectrumIdentificationItemRef);
}
return $hypothesis;
} | [
"private",
"function",
"getPeptideHypothesis",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"hypothesis",
"=",
"array",
"(",
")",
";",
"$",
"ref",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"peptideEvidence_ref",
... | Peptide evidence on which this ProteinHypothesis is based by reference to a PeptideEvidence element.
@param \SimpleXMLElement $xml
XML to parse | [
"Peptide",
"evidence",
"on",
"which",
"this",
"ProteinHypothesis",
"is",
"based",
"by",
"reference",
"to",
"a",
"PeptideEvidence",
"element",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L612-L626 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getProteinAmbiguityGroup | private function getProteinAmbiguityGroup(\SimpleXMLElement $xml)
{
$hypos = array();
foreach ($xml->ProteinDetectionHypothesis as $proteinDetectionHypothesis) {
$hypo = $this->getProteinDetectionHypothesis($proteinDetectionHypothesis);
$hypos[$hypo['id']] = $hypo;
}
return $hypos;
} | php | private function getProteinAmbiguityGroup(\SimpleXMLElement $xml)
{
$hypos = array();
foreach ($xml->ProteinDetectionHypothesis as $proteinDetectionHypothesis) {
$hypo = $this->getProteinDetectionHypothesis($proteinDetectionHypothesis);
$hypos[$hypo['id']] = $hypo;
}
return $hypos;
} | [
"private",
"function",
"getProteinAmbiguityGroup",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"hypos",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"ProteinDetectionHypothesis",
"as",
"$",
"proteinDetectionHypothesis",
")",
"{",
... | A set of logically related results from a protein detection, for example to represent conflicting assignments of peptides to proteins.
@param \SimpleXMLElement $xml
XML to parse | [
"A",
"set",
"of",
"logically",
"related",
"results",
"from",
"a",
"protein",
"detection",
"for",
"example",
"to",
"represent",
"conflicting",
"assignments",
"of",
"peptides",
"to",
"proteins",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L644-L653 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getProteinDetectionList | public function getProteinDetectionList()
{
$this->getSequenceCollection();
$groups = array();
if (! isset($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup)) {
return null;
}
foreach ($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup as $proteinAmbiguityGroup) {
$group = $this->getProteinAmbiguityGroup($proteinAmbiguityGroup);
$groupId = $this->getAttributeId($proteinAmbiguityGroup);
// Reprocess each group to change refs to element
foreach ($group as $id => $value) {
$group[$id]['protein'] = $this->proteins[$value['protein']];
foreach ($value['peptides'] as $pepId => $peptide) {
$group[$id]['peptides'][$pepId] = $this->peptides[$this->evidence[$peptide['peptide']]['peptide']];
}
}
$groups[$groupId] = $group;
}
return $groups;
} | php | public function getProteinDetectionList()
{
$this->getSequenceCollection();
$groups = array();
if (! isset($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup)) {
return null;
}
foreach ($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup as $proteinAmbiguityGroup) {
$group = $this->getProteinAmbiguityGroup($proteinAmbiguityGroup);
$groupId = $this->getAttributeId($proteinAmbiguityGroup);
// Reprocess each group to change refs to element
foreach ($group as $id => $value) {
$group[$id]['protein'] = $this->proteins[$value['protein']];
foreach ($value['peptides'] as $pepId => $peptide) {
$group[$id]['peptides'][$pepId] = $this->peptides[$this->evidence[$peptide['peptide']]['peptide']];
}
}
$groups[$groupId] = $group;
}
return $groups;
} | [
"public",
"function",
"getProteinDetectionList",
"(",
")",
"{",
"$",
"this",
"->",
"getSequenceCollection",
"(",
")",
";",
"$",
"groups",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"xmlReader",
"->",
"DataCollection",
"... | The protein list resulting from a protein detection process. | [
"The",
"protein",
"list",
"resulting",
"from",
"a",
"protein",
"detection",
"process",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L702-L728 | train |
PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getSpectrumIdFormat | private function getSpectrumIdFormat(\SimpleXMLElement $xml)
{
$cvParam = $this->getCvParam($xml->cvParam);
return $cvParam[PsiVerb::CV_ACCESSION];
} | php | private function getSpectrumIdFormat(\SimpleXMLElement $xml)
{
$cvParam = $this->getCvParam($xml->cvParam);
return $cvParam[PsiVerb::CV_ACCESSION];
} | [
"private",
"function",
"getSpectrumIdFormat",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"cvParam",
"=",
"$",
"this",
"->",
"getCvParam",
"(",
"$",
"xml",
"->",
"cvParam",
")",
";",
"return",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSI... | The format of the spectrum identifier within the source file.
@param \SimpleXMLElement $xml
XML to parse
@return string | [
"The",
"format",
"of",
"the",
"spectrum",
"identifier",
"within",
"the",
"source",
"file",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L997-L1002 | train |
PGB-LIV/php-ms | src/Core/ProteinTrait.php | ProteinTrait.addProtein | public function addProtein(Protein $protein, $start = null, $end = null)
{
$entry = new ProteinEntry($protein);
if (! is_null($start)) {
$entry->setStart($start);
}
if (! is_null($end)) {
$entry->setEnd($end);
}
$this->addProteinEntry($entry);
} | php | public function addProtein(Protein $protein, $start = null, $end = null)
{
$entry = new ProteinEntry($protein);
if (! is_null($start)) {
$entry->setStart($start);
}
if (! is_null($end)) {
$entry->setEnd($end);
}
$this->addProteinEntry($entry);
} | [
"public",
"function",
"addProtein",
"(",
"Protein",
"$",
"protein",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
")",
"{",
"$",
"entry",
"=",
"new",
"ProteinEntry",
"(",
"$",
"protein",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$"... | Add a new protein mapping to this object.
Start and end positions on the protein sequence can be specified
@param Protein $protein
The protein to map to
@param int $start
The start position of this peptide in the sequence
@param int $end
The end position this peptide in the sequence | [
"Add",
"a",
"new",
"protein",
"mapping",
"to",
"this",
"object",
".",
"Start",
"and",
"end",
"positions",
"on",
"the",
"protein",
"sequence",
"can",
"be",
"specified"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ProteinTrait.php#L47-L59 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostInsertHook | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an customer number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new customer number to the shop class
if (empty($this->sqlData['customer_number']) || empty($this->sqlData['shop_id'])) {
$aUpdateData = array();
if (empty($this->sqlData['customer_number'])) {
$aUpdateData['customer_number'] = $this->GetCustomerNumber();
}
if (empty($this->sqlData['shop_id'])) {
$oShop = TdbShop::GetInstance();
$aUpdateData['shop_id'] = $oShop->id;
}
if (count($aUpdateData) > 0) {
$this->SaveFieldsFast($aUpdateData);
}
}
TdbDataExtranetGroup::UpdateAutoAssignToUser($this);
} | php | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an customer number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new customer number to the shop class
if (empty($this->sqlData['customer_number']) || empty($this->sqlData['shop_id'])) {
$aUpdateData = array();
if (empty($this->sqlData['customer_number'])) {
$aUpdateData['customer_number'] = $this->GetCustomerNumber();
}
if (empty($this->sqlData['shop_id'])) {
$oShop = TdbShop::GetInstance();
$aUpdateData['shop_id'] = $oShop->id;
}
if (count($aUpdateData) > 0) {
$this->SaveFieldsFast($aUpdateData);
}
}
TdbDataExtranetGroup::UpdateAutoAssignToUser($this);
} | [
"protected",
"function",
"PostInsertHook",
"(",
")",
"{",
"parent",
"::",
"PostInsertHook",
"(",
")",
";",
"// we need to add an customer number to the order... since generation of this number may differ",
"// from shop to shop, we have added the method to fetch a new customer number to th... | we use the post insert hook to set the customer number. | [
"we",
"use",
"the",
"post",
"insert",
"hook",
"to",
"set",
"the",
"customer",
"number",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L39-L59 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetCustomerNumber | public function GetCustomerNumber()
{
$sCustNr = parent::GetCustomerNumber();
if (empty($sCustNr)) {
$oShop = TdbShop::GetInstance();
$sCustNr = $oShop->GetNextFreeCustomerNumber();
$aData = $this->sqlData;
$aData['customer_number'] = $sCustNr;
$this->LoadFromRow($aData);
}
return $this->fieldCustomerNumber;
} | php | public function GetCustomerNumber()
{
$sCustNr = parent::GetCustomerNumber();
if (empty($sCustNr)) {
$oShop = TdbShop::GetInstance();
$sCustNr = $oShop->GetNextFreeCustomerNumber();
$aData = $this->sqlData;
$aData['customer_number'] = $sCustNr;
$this->LoadFromRow($aData);
}
return $this->fieldCustomerNumber;
} | [
"public",
"function",
"GetCustomerNumber",
"(",
")",
"{",
"$",
"sCustNr",
"=",
"parent",
"::",
"GetCustomerNumber",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sCustNr",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",... | returns the users customer number, if set.
@return string | [
"returns",
"the",
"users",
"customer",
"number",
"if",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L108-L120 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostLoginHookMergeTemporaryHistoryWithDatabaseHistory | protected function PostLoginHookMergeTemporaryHistoryWithDatabaseHistory()
{
// merge current data with user data
$aHistory = $this->GetArticleViewHistory();
$aTmpList = array_reverse($aHistory, true);
foreach (array_keys($aTmpList) as $histKey) {
if (is_null($aTmpList[$histKey]->id)) {
$aData = $aTmpList[$histKey]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$histKey]->LoadFromRow($aData);
$aTmpList[$histKey]->AllowEditByAll(true);
$aTmpList[$histKey]->Save();
}
}
$this->aArticleViewHistory = null;
$this->GetArticleViewHistory();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_HISTORY, '', time() - 3600, '/', '.'.$domain, false, true);
} | php | protected function PostLoginHookMergeTemporaryHistoryWithDatabaseHistory()
{
// merge current data with user data
$aHistory = $this->GetArticleViewHistory();
$aTmpList = array_reverse($aHistory, true);
foreach (array_keys($aTmpList) as $histKey) {
if (is_null($aTmpList[$histKey]->id)) {
$aData = $aTmpList[$histKey]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$histKey]->LoadFromRow($aData);
$aTmpList[$histKey]->AllowEditByAll(true);
$aTmpList[$histKey]->Save();
}
}
$this->aArticleViewHistory = null;
$this->GetArticleViewHistory();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_HISTORY, '', time() - 3600, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"PostLoginHookMergeTemporaryHistoryWithDatabaseHistory",
"(",
")",
"{",
"// merge current data with user data",
"$",
"aHistory",
"=",
"$",
"this",
"->",
"GetArticleViewHistory",
"(",
")",
";",
"$",
"aTmpList",
"=",
"array_reverse",
"(",
"$",
"aH... | takes the article view history from session and merges it with the data
in the database. this is done when the user logs in to make the history permanent. | [
"takes",
"the",
"article",
"view",
"history",
"from",
"session",
"and",
"merges",
"it",
"with",
"the",
"data",
"in",
"the",
"database",
".",
"this",
"is",
"done",
"when",
"the",
"user",
"logs",
"in",
"to",
"make",
"the",
"history",
"permanent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L136-L158 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory | protected function PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory()
{
// merge current notice list with existing notice list
$aNoticeList = $this->GetNoticeListArticles();
$aTmpList = array_reverse($aNoticeList, true);
foreach (array_keys($aTmpList) as $iArticleId) {
if (is_null($aTmpList[$iArticleId]->id)) {
// check if the user has such an item on the list... if he does, no change
$oItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oItem TdbShopUserNoticeList */
if (!$oItem->LoadFromFields(array('data_extranet_user_id' => $this->id, 'shop_article_id' => $iArticleId))) {
$aData = $aTmpList[$iArticleId]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$iArticleId]->LoadFromRow($aData);
$aTmpList[$iArticleId]->AllowEditByAll(true);
$aTmpList[$iArticleId]->Save();
}
}
}
$this->aNoticeList = null;
$this->GetNoticeListArticles();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, '', time() - 3600, '/', '.'.$domain, false, true);
} | php | protected function PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory()
{
// merge current notice list with existing notice list
$aNoticeList = $this->GetNoticeListArticles();
$aTmpList = array_reverse($aNoticeList, true);
foreach (array_keys($aTmpList) as $iArticleId) {
if (is_null($aTmpList[$iArticleId]->id)) {
// check if the user has such an item on the list... if he does, no change
$oItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oItem TdbShopUserNoticeList */
if (!$oItem->LoadFromFields(array('data_extranet_user_id' => $this->id, 'shop_article_id' => $iArticleId))) {
$aData = $aTmpList[$iArticleId]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$iArticleId]->LoadFromRow($aData);
$aTmpList[$iArticleId]->AllowEditByAll(true);
$aTmpList[$iArticleId]->Save();
}
}
}
$this->aNoticeList = null;
$this->GetNoticeListArticles();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, '', time() - 3600, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory",
"(",
")",
"{",
"// merge current notice list with existing notice list",
"$",
"aNoticeList",
"=",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"$",
"aTmpList",
"=",
"array_rever... | takes the notice list from session and merges it with the data
in the database. this is done when the user logs in to make the notice list permanent. | [
"takes",
"the",
"notice",
"list",
"from",
"session",
"and",
"merges",
"it",
"with",
"the",
"data",
"in",
"the",
"database",
".",
"this",
"is",
"done",
"when",
"the",
"user",
"logs",
"in",
"to",
"make",
"the",
"notice",
"list",
"permanent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L164-L191 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetUserAlias | public function GetUserAlias()
{
$sAlias = trim($this->fieldAliasName);
if (empty($sAlias)) {
$sAlias = $this->fieldFirstname.' '.mb_substr($this->fieldLastname, 0, 1).'.';
}
return $sAlias;
} | php | public function GetUserAlias()
{
$sAlias = trim($this->fieldAliasName);
if (empty($sAlias)) {
$sAlias = $this->fieldFirstname.' '.mb_substr($this->fieldLastname, 0, 1).'.';
}
return $sAlias;
} | [
"public",
"function",
"GetUserAlias",
"(",
")",
"{",
"$",
"sAlias",
"=",
"trim",
"(",
"$",
"this",
"->",
"fieldAliasName",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sAlias",
")",
")",
"{",
"$",
"sAlias",
"=",
"$",
"this",
"->",
"fieldFirstname",
".",
... | return alias for the user.
@return string | [
"return",
"alias",
"for",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L198-L206 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetArticleViewHistory | public function GetArticleViewHistory()
{
if (is_null($this->aArticleViewHistory)) {
$this->aArticleViewHistory = array();
$iMaxQueueLength = 100;
$shop = $this->getShopService()->getActiveShop();
if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount < $iMaxQueueLength && $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
$iMaxQueueLength = $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount;
}
if ($this->IsLoggedIn()) {
// fetch from user
$iNumRecsAdded = 0;
$oHistoryList = &$this->GetFieldDataExtranetUserShopArticleHistoryList();
while (($oHistoryItem = $oHistoryList->Next()) && $iNumRecsAdded <= $iMaxQueueLength) {
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
} else {
// fetch from cookie
$aTmpHist = null;
if (array_key_exists(TdbDataExtranetUser::COOKIE_NAME_HISTORY, $_COOKIE)) {
$sHistory = base64_decode($_COOKIE[TdbDataExtranetUser::COOKIE_NAME_HISTORY]);
$aTmpHist = json_decode($sHistory, true);
}
if (is_array($aTmpHist)) {
reset($aTmpHist);
foreach ($aTmpHist as $iKey => $aHistItemData) {
$oHistoryItem = TdbDataExtranetUserShopArticleHistory::GetNewInstance();
$oHistoryItem->LoadFromRow($aHistItemData);
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
}
}
}
$historyList = array();
foreach ($this->aArticleViewHistory as $item) {
$historyList[] = TdbDataExtranetUserShopArticleHistory::GetNewInstance($item);
}
return $historyList;
} | php | public function GetArticleViewHistory()
{
if (is_null($this->aArticleViewHistory)) {
$this->aArticleViewHistory = array();
$iMaxQueueLength = 100;
$shop = $this->getShopService()->getActiveShop();
if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount < $iMaxQueueLength && $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
$iMaxQueueLength = $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount;
}
if ($this->IsLoggedIn()) {
// fetch from user
$iNumRecsAdded = 0;
$oHistoryList = &$this->GetFieldDataExtranetUserShopArticleHistoryList();
while (($oHistoryItem = $oHistoryList->Next()) && $iNumRecsAdded <= $iMaxQueueLength) {
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
} else {
// fetch from cookie
$aTmpHist = null;
if (array_key_exists(TdbDataExtranetUser::COOKIE_NAME_HISTORY, $_COOKIE)) {
$sHistory = base64_decode($_COOKIE[TdbDataExtranetUser::COOKIE_NAME_HISTORY]);
$aTmpHist = json_decode($sHistory, true);
}
if (is_array($aTmpHist)) {
reset($aTmpHist);
foreach ($aTmpHist as $iKey => $aHistItemData) {
$oHistoryItem = TdbDataExtranetUserShopArticleHistory::GetNewInstance();
$oHistoryItem->LoadFromRow($aHistItemData);
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
}
}
}
$historyList = array();
foreach ($this->aArticleViewHistory as $item) {
$historyList[] = TdbDataExtranetUserShopArticleHistory::GetNewInstance($item);
}
return $historyList;
} | [
"public",
"function",
"GetArticleViewHistory",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"aArticleViewHistory",
")",
")",
"{",
"$",
"this",
"->",
"aArticleViewHistory",
"=",
"array",
"(",
")",
";",
"$",
"iMaxQueueLength",
"=",
"100",
";"... | returns the ids of up to the last 100 articles viewed.
@return array | [
"returns",
"the",
"ids",
"of",
"up",
"to",
"the",
"last",
"100",
"articles",
"viewed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L330-L371 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.AddArticleIdToNoticeList | public function AddArticleIdToNoticeList($iArticleId, $iAmount = 1)
{
$dNewAmountOnList = 0;
if (is_null($this->aNoticeList)) {
$this->GetNoticeListArticles();
}
// check if the item being pushed is already in the end of the queue
$iMaxQueueLength = 1000;
$queNotEmpty = (count($this->aNoticeList) > 0);
if (array_key_exists($iArticleId, $this->aNoticeList)) {
// we do not allow placing an article more than once on the notice list
$dNewAmountOnList = false;
} else {
$oNoticeListItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oNoticeListItem TdbShopUserNoticeList */
$aData = array('shop_article_id' => $iArticleId, 'date_added' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id, 'amount' => $iAmount);
$oNoticeListItem->LoadFromRow($aData);
if (!is_null($this->id) && $this->IsLoggedIn()) {
$oNoticeListItem->Save();
}
$this->aNoticeList[$oNoticeListItem->fieldShopArticleId] = $oNoticeListItem->sqlData;
}
if (false !== $dNewAmountOnList) {
// remove item if amount drops to zero
if ($this->aNoticeList[$iArticleId]['amount'] <= 0) {
unset($this->aNoticeList[$iArticleId]);
} else {
$dNewAmountOnList = $this->aNoticeList[$iArticleId]['amount'];
}
// if the list is full, remove last item
if (count($this->aNoticeList) > $iMaxQueueLength) {
array_pop($this->aNoticeList);
}
// save list to cookie for users not signed in
if (!$this->IsLoggedIn()) {
$this->CommitNoticeListToCookie();
}
}
return $dNewAmountOnList;
} | php | public function AddArticleIdToNoticeList($iArticleId, $iAmount = 1)
{
$dNewAmountOnList = 0;
if (is_null($this->aNoticeList)) {
$this->GetNoticeListArticles();
}
// check if the item being pushed is already in the end of the queue
$iMaxQueueLength = 1000;
$queNotEmpty = (count($this->aNoticeList) > 0);
if (array_key_exists($iArticleId, $this->aNoticeList)) {
// we do not allow placing an article more than once on the notice list
$dNewAmountOnList = false;
} else {
$oNoticeListItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oNoticeListItem TdbShopUserNoticeList */
$aData = array('shop_article_id' => $iArticleId, 'date_added' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id, 'amount' => $iAmount);
$oNoticeListItem->LoadFromRow($aData);
if (!is_null($this->id) && $this->IsLoggedIn()) {
$oNoticeListItem->Save();
}
$this->aNoticeList[$oNoticeListItem->fieldShopArticleId] = $oNoticeListItem->sqlData;
}
if (false !== $dNewAmountOnList) {
// remove item if amount drops to zero
if ($this->aNoticeList[$iArticleId]['amount'] <= 0) {
unset($this->aNoticeList[$iArticleId]);
} else {
$dNewAmountOnList = $this->aNoticeList[$iArticleId]['amount'];
}
// if the list is full, remove last item
if (count($this->aNoticeList) > $iMaxQueueLength) {
array_pop($this->aNoticeList);
}
// save list to cookie for users not signed in
if (!$this->IsLoggedIn()) {
$this->CommitNoticeListToCookie();
}
}
return $dNewAmountOnList;
} | [
"public",
"function",
"AddArticleIdToNoticeList",
"(",
"$",
"iArticleId",
",",
"$",
"iAmount",
"=",
"1",
")",
"{",
"$",
"dNewAmountOnList",
"=",
"0",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
")",
"{",
"$",
"this",
"->",
"G... | add an article to the notice list.
@param int $iArticleId
@param float $iAmount
@return float - new amount on list | [
"add",
"an",
"article",
"to",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L427-L473 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.CommitNoticeListToCookie | protected function CommitNoticeListToCookie()
{
$aNoticeList = array();
reset($this->aNoticeList);
foreach (array_keys($this->aNoticeList) as $iItemId) {
$aNoticeList[$iItemId] = $this->aNoticeList[$iItemId];
}
$sNoticeList = json_encode($aNoticeList);
$sNoticeList = base64_encode($sNoticeList);
$iLifeTime = 31536000; // 1 year
if ($iLifeTime > CHAMELEON_MAX_COOKIE_LIFETIME) {
$iLifeTime = CHAMELEON_MAX_COOKIE_LIFETIME;
}
$expireTime = $iLifeTime + time();
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
// drop 'www' subdomain
if ('www.' === substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, $sNoticeList, $expireTime, '/', '.'.$domain, false, true);
} | php | protected function CommitNoticeListToCookie()
{
$aNoticeList = array();
reset($this->aNoticeList);
foreach (array_keys($this->aNoticeList) as $iItemId) {
$aNoticeList[$iItemId] = $this->aNoticeList[$iItemId];
}
$sNoticeList = json_encode($aNoticeList);
$sNoticeList = base64_encode($sNoticeList);
$iLifeTime = 31536000; // 1 year
if ($iLifeTime > CHAMELEON_MAX_COOKIE_LIFETIME) {
$iLifeTime = CHAMELEON_MAX_COOKIE_LIFETIME;
}
$expireTime = $iLifeTime + time();
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
// drop 'www' subdomain
if ('www.' === substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, $sNoticeList, $expireTime, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"CommitNoticeListToCookie",
"(",
")",
"{",
"$",
"aNoticeList",
"=",
"array",
"(",
")",
";",
"reset",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
"as",
... | save user notice list to cookie. | [
"save",
"user",
"notice",
"list",
"to",
"cookie",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L478-L498 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.RemoveArticleFromNoticeList | public function RemoveArticleFromNoticeList($sArticleId)
{
$this->GetNoticeListArticles();
if (array_key_exists($sArticleId, $this->aNoticeList)) {
unset($this->aNoticeList[$sArticleId]);
if ($this->IsLoggedIn()) {
$noticeListItemObject = TdbShopUserNoticeList::GetNewInstance();
if (true === $noticeListItemObject->LoadFromFields(
array(
'data_extranet_user_id' => $this->id,
'shop_article_id' => $sArticleId,
)
)) {
$noticeListItemObject->Delete();
}
} else {
$this->CommitNoticeListToCookie();
}
}
} | php | public function RemoveArticleFromNoticeList($sArticleId)
{
$this->GetNoticeListArticles();
if (array_key_exists($sArticleId, $this->aNoticeList)) {
unset($this->aNoticeList[$sArticleId]);
if ($this->IsLoggedIn()) {
$noticeListItemObject = TdbShopUserNoticeList::GetNewInstance();
if (true === $noticeListItemObject->LoadFromFields(
array(
'data_extranet_user_id' => $this->id,
'shop_article_id' => $sArticleId,
)
)) {
$noticeListItemObject->Delete();
}
} else {
$this->CommitNoticeListToCookie();
}
}
} | [
"public",
"function",
"RemoveArticleFromNoticeList",
"(",
"$",
"sArticleId",
")",
"{",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"sArticleId",
",",
"$",
"this",
"->",
"aNoticeList",
")",
")",
"{",
"un... | remove an article form the notice list.
@param string $sArticleId | [
"remove",
"an",
"article",
"form",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L505-L524 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.ValidateData | public function ValidateData($sFormDataName = null)
{
if (is_null($sFormDataName)) {
$sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
}
$bIsValid = parent::ValidateData($sFormDataName);
$oMsgManager = TCMSMessageManager::GetInstance();
// check postal code for country
$bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
$bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
if ($bHasCountry && $bHasPostalcode) {
$oCountry = TdbDataCountry::GetNewInstance();
/** @var $oCountry TdbDataCountry */
if ($oCountry->Load($this->sqlData['data_country_id'])) {
if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
$oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
$bIsValid = false;
}
}
}
return $bIsValid;
} | php | public function ValidateData($sFormDataName = null)
{
if (is_null($sFormDataName)) {
$sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
}
$bIsValid = parent::ValidateData($sFormDataName);
$oMsgManager = TCMSMessageManager::GetInstance();
// check postal code for country
$bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
$bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
if ($bHasCountry && $bHasPostalcode) {
$oCountry = TdbDataCountry::GetNewInstance();
/** @var $oCountry TdbDataCountry */
if ($oCountry->Load($this->sqlData['data_country_id'])) {
if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
$oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
$bIsValid = false;
}
}
}
return $bIsValid;
} | [
"public",
"function",
"ValidateData",
"(",
"$",
"sFormDataName",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sFormDataName",
")",
")",
"{",
"$",
"sFormDataName",
"=",
"TdbDataExtranetUser",
"::",
"MSG_FORM_FIELD",
";",
"}",
"$",
"bIsValid",
"=",
... | validates the user data.
@param string $sFormDataName - the array name used for the form. send error messages here
@return bool | [
"validates",
"the",
"user",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L533-L556 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetTotalOrderValue | public function GetTotalOrderValue($sStartDate = null, $sEndDate = null)
{
$query = "SELECT SUM(value_total) AS ordervalue
FROM `shop_order`
WHERE `data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND (`shop_order`.`id` IS NULL OR `shop_order`.`canceled` = '0')
";
if (!is_null($sStartDate)) {
$query .= " AND `datecreated` >= '".MySqlLegacySupport::getInstance()->real_escape_string($sStartDate)."' ";
}
if (!is_null($sEndDate)) {
$query .= " AND `datecreated` <= '".MySqlLegacySupport::getInstance()->real_escape_string($sEndDate)."' ";
}
$query .= ' GROUP BY `data_extranet_user_id`';
$dValue = 0;
if ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$dValue = $aRow['ordervalue'];
}
return $dValue;
} | php | public function GetTotalOrderValue($sStartDate = null, $sEndDate = null)
{
$query = "SELECT SUM(value_total) AS ordervalue
FROM `shop_order`
WHERE `data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND (`shop_order`.`id` IS NULL OR `shop_order`.`canceled` = '0')
";
if (!is_null($sStartDate)) {
$query .= " AND `datecreated` >= '".MySqlLegacySupport::getInstance()->real_escape_string($sStartDate)."' ";
}
if (!is_null($sEndDate)) {
$query .= " AND `datecreated` <= '".MySqlLegacySupport::getInstance()->real_escape_string($sEndDate)."' ";
}
$query .= ' GROUP BY `data_extranet_user_id`';
$dValue = 0;
if ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$dValue = $aRow['ordervalue'];
}
return $dValue;
} | [
"public",
"function",
"GetTotalOrderValue",
"(",
"$",
"sStartDate",
"=",
"null",
",",
"$",
"sEndDate",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"\"SELECT SUM(value_total) AS ordervalue\n FROM `shop_order`\n WHERE `data_extranet_user_id` = '\"",
... | return the total order value of the customer.
@param string|null $sStartDate
@param string|null $sEndDate
@return float | [
"return",
"the",
"total",
"order",
"value",
"of",
"the",
"customer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L566-L586 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.Logout | public function Logout()
{
$oBasket = TShopBasket::GetInstance();
if (is_array($oBasket->aCompletedOrderStepList)) {
reset($oBasket->aCompletedOrderStepList);
foreach ($oBasket->aCompletedOrderStepList as $sStepName => $bValue) {
$oBasket->aCompletedOrderStepList[$sStepName] = false;
}
}
parent::Logout();
if (SHOP_CLEAR_BASKET_CONTENTS_ON_LOGOUT) {
if (class_exists('TShopBasket')) {
$oBasket = TShopBasket::GetInstance();
$oBasket->ClearBasket();
}
}
} | php | public function Logout()
{
$oBasket = TShopBasket::GetInstance();
if (is_array($oBasket->aCompletedOrderStepList)) {
reset($oBasket->aCompletedOrderStepList);
foreach ($oBasket->aCompletedOrderStepList as $sStepName => $bValue) {
$oBasket->aCompletedOrderStepList[$sStepName] = false;
}
}
parent::Logout();
if (SHOP_CLEAR_BASKET_CONTENTS_ON_LOGOUT) {
if (class_exists('TShopBasket')) {
$oBasket = TShopBasket::GetInstance();
$oBasket->ClearBasket();
}
}
} | [
"public",
"function",
"Logout",
"(",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
")",
")",
"{",
"reset",
"(",
"$",
"oBasket",
"->",
"aCompl... | logs the user out. | [
"logs",
"the",
"user",
"out",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L605-L622 | train |
chameleon-system/chameleon-shop | src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php | ShopPaymentConfigLoader.isApplicable | private function isApplicable(ShopPaymentConfigRawValue $value, $environment, $portalId)
{
return (($environment === $value->getEnvironment()) || (IPkgShopOrderPaymentConfig::ENVIRONMENT_COMMON === $value->getEnvironment()))
&& (($portalId === $value->getPortalId()) || ('' === $value->getPortalId()));
} | php | private function isApplicable(ShopPaymentConfigRawValue $value, $environment, $portalId)
{
return (($environment === $value->getEnvironment()) || (IPkgShopOrderPaymentConfig::ENVIRONMENT_COMMON === $value->getEnvironment()))
&& (($portalId === $value->getPortalId()) || ('' === $value->getPortalId()));
} | [
"private",
"function",
"isApplicable",
"(",
"ShopPaymentConfigRawValue",
"$",
"value",
",",
"$",
"environment",
",",
"$",
"portalId",
")",
"{",
"return",
"(",
"(",
"$",
"environment",
"===",
"$",
"value",
"->",
"getEnvironment",
"(",
")",
")",
"||",
"(",
"... | Returns true if the given config value can be applied, i.e. the environment and portal do match.
@param ShopPaymentConfigRawValue $value
@param string $environment one of IPkgShopOrderPaymentConfig::ENVIRONMENT_*
@param string $portalId
@return bool | [
"Returns",
"true",
"if",
"the",
"given",
"config",
"value",
"can",
"be",
"applied",
"i",
".",
"e",
".",
"the",
"environment",
"and",
"portal",
"do",
"match",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php#L301-L305 | train |
chameleon-system/chameleon-shop | src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php | ShopPaymentConfigLoader.hasHigherPriority | private function hasHigherPriority(
ShopPaymentConfigRawValue $value1,
ShopPaymentConfigRawValue $value2,
$environment,
$portalId
) {
if ($this->hasHigherSourcePriority($value1, $value2)) {
return true;
}
if ($this->hasHigherPortalPriority($value1, $value2, $portalId)) {
return true;
}
if ($this->hasHigherEnvironmentPriority($value1, $value2, $environment)) {
return true;
}
return false;
} | php | private function hasHigherPriority(
ShopPaymentConfigRawValue $value1,
ShopPaymentConfigRawValue $value2,
$environment,
$portalId
) {
if ($this->hasHigherSourcePriority($value1, $value2)) {
return true;
}
if ($this->hasHigherPortalPriority($value1, $value2, $portalId)) {
return true;
}
if ($this->hasHigherEnvironmentPriority($value1, $value2, $environment)) {
return true;
}
return false;
} | [
"private",
"function",
"hasHigherPriority",
"(",
"ShopPaymentConfigRawValue",
"$",
"value1",
",",
"ShopPaymentConfigRawValue",
"$",
"value2",
",",
"$",
"environment",
",",
"$",
"portalId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasHigherSourcePriority",
"(",
"$"... | Returns true if value1 has a higher priority than value2.
@param ShopPaymentConfigRawValue $value1
@param ShopPaymentConfigRawValue $value2
@param string $environment one of IPkgShopOrderPaymentConfig::ENVIRONMENT_*
@param string $portalId
@return bool | [
"Returns",
"true",
"if",
"value1",
"has",
"a",
"higher",
"priority",
"than",
"value2",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php#L317-L334 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php | WebServerExample.waitForNotificationToBeProcessedBeforeContinuing | protected function waitForNotificationToBeProcessedBeforeContinuing(
$identifier,
$notificationType
) {
$fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
// timeout after 1 minute
$totalChecks = 0;
while (!file_exists($fileName) && $totalChecks < 20) {
sleep(5);
$totalChecks += 1;
}
if ($totalChecks >= 20) {
throw new ErrorException(
"IPN has not been received within timeout period exiting sample"
);
}
} | php | protected function waitForNotificationToBeProcessedBeforeContinuing(
$identifier,
$notificationType
) {
$fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
// timeout after 1 minute
$totalChecks = 0;
while (!file_exists($fileName) && $totalChecks < 20) {
sleep(5);
$totalChecks += 1;
}
if ($totalChecks >= 20) {
throw new ErrorException(
"IPN has not been received within timeout period exiting sample"
);
}
} | [
"protected",
"function",
"waitForNotificationToBeProcessedBeforeContinuing",
"(",
"$",
"identifier",
",",
"$",
"notificationType",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"folderPath",
".",
"$",
"identifier",
".",
"\"_\"",
".",
"$",
"notificationType",
... | Check that we have received an IPN notification for the defined event
For PHP, there is an IPN handler that will write the contents of the IPN to
a file in the format of
<amazonOrderReferenceId>_<amazonAuthorizationId>_Authorization.
This method will check for the presnece of this file
and will loop/timeout until the notification has been handled.
Merchants can use alternative approaches such as memory caches,
shared memory or database storage so that scripts serving user
pages are able to check on the status of a notification
@param string $identifier transaction that we are waiting to query
@param string $notificationType notificationType notification type
that we expect
@return void | [
"Check",
"that",
"we",
"have",
"received",
"an",
"IPN",
"notification",
"for",
"the",
"defined",
"event"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php#L105-L122 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php | WebServerExample.printResponseToWebpage | protected function printResponseToWebpage($stepName, $arg=array())
{
ob_start();
call_user_func_array($stepName, $arg);
$result = ob_get_contents();
ob_clean();
$result = preg_replace("/(\\n)/", HTML_LB, $result);
$result = preg_replace("/(\\s)/", " ", $result);
print $result;
} | php | protected function printResponseToWebpage($stepName, $arg=array())
{
ob_start();
call_user_func_array($stepName, $arg);
$result = ob_get_contents();
ob_clean();
$result = preg_replace("/(\\n)/", HTML_LB, $result);
$result = preg_replace("/(\\s)/", " ", $result);
print $result;
} | [
"protected",
"function",
"printResponseToWebpage",
"(",
"$",
"stepName",
",",
"$",
"arg",
"=",
"array",
"(",
")",
")",
"{",
"ob_start",
"(",
")",
";",
"call_user_func_array",
"(",
"$",
"stepName",
",",
"$",
"arg",
")",
";",
"$",
"result",
"=",
"ob_get_co... | Invoke the passed in function and print the results out in
html format to the output buffer
@param string $stepName Name of the function to call
@param array $arg Function arguments
@return void | [
"Invoke",
"the",
"passed",
"in",
"function",
"and",
"print",
"the",
"results",
"out",
"in",
"html",
"format",
"to",
"the",
"output",
"buffer"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php#L160-L169 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.getBillingAgreementDetails | public function getBillingAgreementDetails ()
{
$getBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest();
$getBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$getBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
return $this->_service->getBillingAgreementDetails($getBillingAgreementDetailsRequest);
} | php | public function getBillingAgreementDetails ()
{
$getBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest();
$getBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$getBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
return $this->_service->getBillingAgreementDetails($getBillingAgreementDetailsRequest);
} | [
"public",
"function",
"getBillingAgreementDetails",
"(",
")",
"{",
"$",
"getBillingAgreementDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest",
"(",
")",
";",
"$",
"getBillingAgreementDetailsRequest",
"->",
"setSellerId",
"(",
"$",
... | Use the billing agreement object to query the automatic payment
information, including the current physical delivery address as selected
by the buyer
@return OffAmazonPaymentsService_Model_GetBillingAgreementDetailsResponse
service response | [
"Use",
"the",
"billing",
"agreement",
"object",
"to",
"query",
"the",
"automatic",
"payment",
"information",
"including",
"the",
"current",
"physical",
"delivery",
"address",
"as",
"selected",
"by",
"the",
"buyer"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L87-L95 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.calculatePaymentAmountBasedOnBuyerDetails | public function calculatePaymentAmountBasedOnBuyerDetails ($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType)
{
return $this->_shippingAndTaxCostHelper->calculateTotalAmount($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType);
} | php | public function calculatePaymentAmountBasedOnBuyerDetails ($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType)
{
return $this->_shippingAndTaxCostHelper->calculateTotalAmount($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType);
} | [
"public",
"function",
"calculatePaymentAmountBasedOnBuyerDetails",
"(",
"$",
"BillingAgreementDetails",
",",
"$",
"orderAmountPreTaxAndShipping",
",",
"$",
"shippingType",
")",
"{",
"return",
"$",
"this",
"->",
"_shippingAndTaxCostHelper",
"->",
"calculateTotalAmount",
"(",... | Calculate the amount to charge the buyer for each payment, based on the
buyer destination address
Note that until the billing agreement is confirmed, the name & address
fields will not be returned to the client.
@param OffAmazonPaymentsService_Model_BillingAgreementDetails $BillingAgreementDetails
response
@param string $orderAmountPreTaxAndShipping
order amount
@param int $shippingType
shipping type
@return float total amount for the order, with shipping and tax included | [
"Calculate",
"the",
"amount",
"to",
"charge",
"the",
"buyer",
"for",
"each",
"payment",
"based",
"on",
"the",
"buyer",
"destination",
"address"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L113-L118 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.addSellerInformationToBillingAgreement | public function addSellerInformationToBillingAgreement ()
{
$sellerBillingAgreementAttributes = new OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes();
$sellerBillingAgreementAttributes->setSellerBillingAgreementId(
$this->_amazonBillingAgreementId);
$sellerBillingAgreementAttributes->setStoreName("Your store name here");
$sellerBillingAgreementAttributes->setCustomInformation(
"Additional information you wish to include with this billing agreement.");
$billingAgreementAttributes = new OffAmazonPaymentsService_Model_BillingAgreementAttributes();
$billingAgreementAttributes->setSellerNote(
"Description of the billing agreement that is displayed to the buyer in the emails.");
$billingAgreementAttributes->setSellerBillingAgreementAttributes(
$sellerBillingAgreementAttributes);
$setBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_SetBillingAgreementDetailsRequest();
$setBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$setBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$setBillingAgreementDetailsRequest->setBillingAgreementAttributes(
$billingAgreementAttributes);
return $this->_service->setBillingAgreementDetails($setBillingAgreementDetailsRequest);
} | php | public function addSellerInformationToBillingAgreement ()
{
$sellerBillingAgreementAttributes = new OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes();
$sellerBillingAgreementAttributes->setSellerBillingAgreementId(
$this->_amazonBillingAgreementId);
$sellerBillingAgreementAttributes->setStoreName("Your store name here");
$sellerBillingAgreementAttributes->setCustomInformation(
"Additional information you wish to include with this billing agreement.");
$billingAgreementAttributes = new OffAmazonPaymentsService_Model_BillingAgreementAttributes();
$billingAgreementAttributes->setSellerNote(
"Description of the billing agreement that is displayed to the buyer in the emails.");
$billingAgreementAttributes->setSellerBillingAgreementAttributes(
$sellerBillingAgreementAttributes);
$setBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_SetBillingAgreementDetailsRequest();
$setBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$setBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$setBillingAgreementDetailsRequest->setBillingAgreementAttributes(
$billingAgreementAttributes);
return $this->_service->setBillingAgreementDetails($setBillingAgreementDetailsRequest);
} | [
"public",
"function",
"addSellerInformationToBillingAgreement",
"(",
")",
"{",
"$",
"sellerBillingAgreementAttributes",
"=",
"new",
"OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes",
"(",
")",
";",
"$",
"sellerBillingAgreementAttributes",
"->",
"setSellerBillingAgre... | Set seller specific information to the billing agreement details.
@return OffAmazonPaymentsService_Model_SetBillingAgreementDetailsResponse
service response | [
"Set",
"seller",
"specific",
"information",
"to",
"the",
"billing",
"agreement",
"details",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L126-L148 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.confirmBillingAgreement | public function confirmBillingAgreement ()
{
$confirmBillingAgreementRequest = new OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest();
$confirmBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$confirmBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->confirmBillingAgreement($confirmBillingAgreementRequest);
} | php | public function confirmBillingAgreement ()
{
$confirmBillingAgreementRequest = new OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest();
$confirmBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$confirmBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->confirmBillingAgreement($confirmBillingAgreementRequest);
} | [
"public",
"function",
"confirmBillingAgreement",
"(",
")",
"{",
"$",
"confirmBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest",
"(",
")",
";",
"$",
"confirmBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$... | Confirm the billing agreement information, allowing for authorizations
and captures to be created
@return OffAmazonPaymentsService_Model_ConfirmBillingAgreementResponse
service response | [
"Confirm",
"the",
"billing",
"agreement",
"information",
"allowing",
"for",
"authorizations",
"and",
"captures",
"to",
"be",
"created"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L157-L165 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.validateBillingAgreement | public function validateBillingAgreement ()
{
$validateBillingAgreementRequest = new OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest();
$validateBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$validateBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->validateBillingAgreement($validateBillingAgreementRequest);
} | php | public function validateBillingAgreement ()
{
$validateBillingAgreementRequest = new OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest();
$validateBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$validateBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->validateBillingAgreement($validateBillingAgreementRequest);
} | [
"public",
"function",
"validateBillingAgreement",
"(",
")",
"{",
"$",
"validateBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest",
"(",
")",
";",
"$",
"validateBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
... | Check that the billing agreement is in valid status and the selected payment
method is also valid.
@return OffAmazonPaymentsService_Model_ValidateBillingAgreementResponse
service response | [
"Check",
"that",
"the",
"billing",
"agreement",
"is",
"in",
"valid",
"status",
"and",
"the",
"selected",
"payment",
"method",
"is",
"also",
"valid",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L174-L182 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.authorizePaymentAmount | public function authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, false);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | php | public function authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, false);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | [
"public",
"function",
"authorizePaymentAmount",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"$",
"this",
"->",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizationAmount",
... | Perform the authorize call on the billing agreement
@param float $authorizationAmount
amount to authorize from the buyer
@param string $authorizationReferenceId
seller provided authorization reference id
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementResponse
service response | [
"Perform",
"the",
"authorize",
"call",
"on",
"the",
"billing",
"agreement"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L196-L201 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.authorizePaymentAmountWithCaptureNow | public function authorizePaymentAmountWithCaptureNow ($authorizationAmount,
$authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, true);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | php | public function authorizePaymentAmountWithCaptureNow ($authorizationAmount,
$authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, true);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | [
"public",
"function",
"authorizePaymentAmountWithCaptureNow",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"$",
"this",
"->",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizat... | Authorize on the billing agreement with auto capture
@param float $authorizationAmount
amount to authorize from the buyer
@param string $authorizationReferenceId
seller provided authorization reference id
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementResponse
service response | [
"Authorize",
"on",
"the",
"billing",
"agreement",
"with",
"auto",
"capture"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L215-L221 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample._createAuthorizeOnBillingAgreementRequest | private function _createAuthorizeOnBillingAgreementRequest ($authorizationAmount,
$authorizationReferenceId, $CaptureNow)
{
$authorizeOnBillingAgreementRequest = new OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest();
$authorizeOnBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$authorizeOnBillingAgreementRequest->setSellerId($this->_sellerId);
$authorizeOnBillingAgreementRequest->setAuthorizationReferenceId($authorizationReferenceId);
$authorizeOnBillingAgreementRequest->setAuthorizationAmount(
new OffAmazonPaymentsService_Model_Price());
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setAmount(
$authorizationAmount);
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setCurrencyCode(
$this->_service->getMerchantValues()
->getCurrency());
$authorizeOnBillingAgreementRequest->setCaptureNow($CaptureNow);
return $authorizeOnBillingAgreementRequest;
} | php | private function _createAuthorizeOnBillingAgreementRequest ($authorizationAmount,
$authorizationReferenceId, $CaptureNow)
{
$authorizeOnBillingAgreementRequest = new OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest();
$authorizeOnBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$authorizeOnBillingAgreementRequest->setSellerId($this->_sellerId);
$authorizeOnBillingAgreementRequest->setAuthorizationReferenceId($authorizationReferenceId);
$authorizeOnBillingAgreementRequest->setAuthorizationAmount(
new OffAmazonPaymentsService_Model_Price());
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setAmount(
$authorizationAmount);
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setCurrencyCode(
$this->_service->getMerchantValues()
->getCurrency());
$authorizeOnBillingAgreementRequest->setCaptureNow($CaptureNow);
return $authorizeOnBillingAgreementRequest;
} | [
"private",
"function",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
",",
"$",
"CaptureNow",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_AuthorizeOnBillingAg... | Create AuthorizeOnBillingAgreement request
@param float $authorizationAmount
@param string $authorizationReferenceId
@param bool $CaptureNow
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest | [
"Create",
"AuthorizeOnBillingAgreement",
"request"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L232-L249 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.getCaptureDetails | public function getCaptureDetails ($amazonCaptureId)
{
$captureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest();
$captureDetailsRequest->setSellerId($this->_sellerId);
$captureDetailsRequest->setAmazonCaptureId($amazonCaptureId);
return $this->_service->getCaptureDetails($captureDetailsRequest);
} | php | public function getCaptureDetails ($amazonCaptureId)
{
$captureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest();
$captureDetailsRequest->setSellerId($this->_sellerId);
$captureDetailsRequest->setAmazonCaptureId($amazonCaptureId);
return $this->_service->getCaptureDetails($captureDetailsRequest);
} | [
"public",
"function",
"getCaptureDetails",
"(",
"$",
"amazonCaptureId",
")",
"{",
"$",
"captureDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetCaptureDetailsRequest",
"(",
")",
";",
"$",
"captureDetailsRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->... | Perform the get capture details call for the order
@param string $amazonCaptureId
capture it to get details for
@return OffAmazonPaymentsService_Model_CaptureResponse service response | [
"Perform",
"the",
"get",
"capture",
"details",
"call",
"for",
"the",
"order"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L338-L345 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.closeBillingAgreement | public function closeBillingAgreement ()
{
$closeBillingAgreementRequest = new OffAmazonPaymentsService_Model_CloseBillingAgreementRequest();
$closeBillingAgreementRequest->setSellerId($this->_sellerId);
$closeBillingAgreementRequest->setAmazonBillingAgreementId($this->_amazonBillingAgreementId);
$closeBillingAgreementRequest->setClosureReason("Automatic payment complete");
return $this->_service->closeBillingAgreement($closeBillingAgreementRequest);
} | php | public function closeBillingAgreement ()
{
$closeBillingAgreementRequest = new OffAmazonPaymentsService_Model_CloseBillingAgreementRequest();
$closeBillingAgreementRequest->setSellerId($this->_sellerId);
$closeBillingAgreementRequest->setAmazonBillingAgreementId($this->_amazonBillingAgreementId);
$closeBillingAgreementRequest->setClosureReason("Automatic payment complete");
return $this->_service->closeBillingAgreement($closeBillingAgreementRequest);
} | [
"public",
"function",
"closeBillingAgreement",
"(",
")",
"{",
"$",
"closeBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_CloseBillingAgreementRequest",
"(",
")",
";",
"$",
"closeBillingAgreementRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"... | Close this billing agreement to indicate that the billing agreement is
complete, and
no further authorizations and captures will be performed on this billing
agreement.
@return OffAmazonPaymentsService_Model_CloseBillingAgreementResponse
service response | [
"Close",
"this",
"billing",
"agreement",
"to",
"indicate",
"that",
"the",
"billing",
"agreement",
"is",
"complete",
"and",
"no",
"further",
"authorizations",
"and",
"captures",
"will",
"be",
"performed",
"on",
"this",
"billing",
"agreement",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L356-L364 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetArticleCategories($iArticleId, $sLanguageID = null)
{
$oList = null;
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sCategoryRestriction = ' AND '.$sCategoryRestriction;
}
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'SELECT `shop_category`.*, 1 AS isprimary
FROM `shop_article`
INNER JOIN `shop_category` ON `shop_article`.`shop_category_id` = `shop_category`.`id`
WHERE `shop_article`.`id` = '.$db->quote($iArticleId)."
{$sCategoryRestriction}
UNION DISTINCT
SELECT `shop_category`.*, if (`shop_category`.`id` = `shop_article`.`shop_category_id`, 1, 0) AS isprimary
FROM `shop_category`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_category`.`id` = `shop_article_shop_category_mlt`.`target_id`
INNER JOIN `shop_article` on `shop_article_shop_category_mlt`.`source_id` = `shop_article`.`id`
WHERE `shop_article_shop_category_mlt`.`source_id` = ".$db->quote($iArticleId)."
{$sCategoryRestriction}
ORDER BY isprimary DESC, position ASC
";
return TdbShopCategoryList::GetList($query, $sLanguageID);
} | php | public static function &GetArticleCategories($iArticleId, $sLanguageID = null)
{
$oList = null;
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sCategoryRestriction = ' AND '.$sCategoryRestriction;
}
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'SELECT `shop_category`.*, 1 AS isprimary
FROM `shop_article`
INNER JOIN `shop_category` ON `shop_article`.`shop_category_id` = `shop_category`.`id`
WHERE `shop_article`.`id` = '.$db->quote($iArticleId)."
{$sCategoryRestriction}
UNION DISTINCT
SELECT `shop_category`.*, if (`shop_category`.`id` = `shop_article`.`shop_category_id`, 1, 0) AS isprimary
FROM `shop_category`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_category`.`id` = `shop_article_shop_category_mlt`.`target_id`
INNER JOIN `shop_article` on `shop_article_shop_category_mlt`.`source_id` = `shop_article`.`id`
WHERE `shop_article_shop_category_mlt`.`source_id` = ".$db->quote($iArticleId)."
{$sCategoryRestriction}
ORDER BY isprimary DESC, position ASC
";
return TdbShopCategoryList::GetList($query, $sLanguageID);
} | [
"public",
"static",
"function",
"&",
"GetArticleCategories",
"(",
"$",
"iArticleId",
",",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"$",
"sCategoryRestriction",
"=",
"TdbShopCategoryList",
"::",
"GetActiveCategoryQueryRestriction",
... | return all categories connected to the article
Add main category from article to list on first position.
@param int $iArticleId
@param string $sLanguageID
@return TdbShopCategoryList | [
"return",
"all",
"categories",
"connected",
"to",
"the",
"article",
"Add",
"main",
"category",
"from",
"article",
"to",
"list",
"on",
"first",
"position",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L29-L57 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetRootCategoryList($sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getMyLanguageService()->getActiveLanguageId();
}
$sRestriction = "(`shop_category`.`shop_category_id` = '0' OR `shop_category`.`shop_category_id` = '')";
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sRestriction = $sRestriction.' AND '.$sCategoryRestriction;
}
$sQuery = self::GetDefaultQuery($sLanguageID, $sRestriction);
return TdbShopCategoryList::GetList($sQuery, $sLanguageID);
} | php | public static function &GetRootCategoryList($sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getMyLanguageService()->getActiveLanguageId();
}
$sRestriction = "(`shop_category`.`shop_category_id` = '0' OR `shop_category`.`shop_category_id` = '')";
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sRestriction = $sRestriction.' AND '.$sCategoryRestriction;
}
$sQuery = self::GetDefaultQuery($sLanguageID, $sRestriction);
return TdbShopCategoryList::GetList($sQuery, $sLanguageID);
} | [
"public",
"static",
"function",
"&",
"GetRootCategoryList",
"(",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"sLanguageID",
")",
"{",
"$",
"sLanguageID",
"=",
"self",
"::",
"getMyLanguageService",
"(",
")",
"->",
"getActiveLangu... | return root category list.
@param string|null $sLanguageID
@return TdbShopCategoryList | [
"return",
"root",
"category",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L66-L79 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.