id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
43,800 | keenlabs/KeenClient-PHP | src/Client/KeenIOClient.php | KeenIOClient.unpadString | protected function unpadString($string)
{
$len = strlen($string);
$pad = ord($string[$len - 1]);
return substr($string, 0, $len - $pad);
} | php | protected function unpadString($string)
{
$len = strlen($string);
$pad = ord($string[$len - 1]);
return substr($string, 0, $len - $pad);
} | [
"protected",
"function",
"unpadString",
"(",
"$",
"string",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"pad",
"=",
"ord",
"(",
"$",
"string",
"[",
"$",
"len",
"-",
"1",
"]",
")",
";",
"return",
"substr",
"(",
"$",
"... | Remove padding for a PKCS7-padded string
@param string $string
@return string | [
"Remove",
"padding",
"for",
"a",
"PKCS7",
"-",
"padded",
"string"
] | 883b75cb64327211d83d5756caa3fd7a17eabdbc | https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L422-L428 |
43,801 | keenlabs/KeenClient-PHP | src/Client/KeenIOClient.php | KeenIOClient.parseConfig | protected static function parseConfig($config, $default)
{
array_walk($default, function ($value, $key) use (&$config) {
if (empty($config[$key]) || !isset($config[$key])) {
$config[$key] = $value;
}
});
return $config;
} | php | protected static function parseConfig($config, $default)
{
array_walk($default, function ($value, $key) use (&$config) {
if (empty($config[$key]) || !isset($config[$key])) {
$config[$key] = $value;
}
});
return $config;
} | [
"protected",
"static",
"function",
"parseConfig",
"(",
"$",
"config",
",",
"$",
"default",
")",
"{",
"array_walk",
"(",
"$",
"default",
",",
"function",
"(",
"$",
"value",
",",
"$",
"key",
")",
"use",
"(",
"&",
"$",
"config",
")",
"{",
"if",
"(",
"... | Attempt to parse config and apply defaults
@param array $config
@param array $default
@return array Returns the updated config array | [
"Attempt",
"to",
"parse",
"config",
"and",
"apply",
"defaults"
] | 883b75cb64327211d83d5756caa3fd7a17eabdbc | https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L438-L447 |
43,802 | keenlabs/KeenClient-PHP | src/Client/KeenIOClient.php | KeenIOClient.combineEventCollectionArgs | private static function combineEventCollectionArgs(array $args)
{
$formattedArgs = array();
if (isset($args[0]) && is_string($args[0])) {
$formattedArgs['event_collection'] = $args[0];
if (isset($args[1]) && is_array($args[1])) {
$formattedArgs = array_merge($formattedArgs, $args[1]);
}
} elseif (isset($args[0]) && is_array($args[0])) {
$formattedArgs = $args[0];
}
return $formattedArgs;
} | php | private static function combineEventCollectionArgs(array $args)
{
$formattedArgs = array();
if (isset($args[0]) && is_string($args[0])) {
$formattedArgs['event_collection'] = $args[0];
if (isset($args[1]) && is_array($args[1])) {
$formattedArgs = array_merge($formattedArgs, $args[1]);
}
} elseif (isset($args[0]) && is_array($args[0])) {
$formattedArgs = $args[0];
}
return $formattedArgs;
} | [
"private",
"static",
"function",
"combineEventCollectionArgs",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"formattedArgs",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
"&&",
"is_string",
"(",
"$",
"args",
"[",
... | Translate a set of args to merge a lone event_collection into
an array with the other params
@param array $args Arguments to be formatted
@return array A single array with event_collection merged in
@access private | [
"Translate",
"a",
"set",
"of",
"args",
"to",
"merge",
"a",
"lone",
"event_collection",
"into",
"an",
"array",
"with",
"the",
"other",
"params"
] | 883b75cb64327211d83d5756caa3fd7a17eabdbc | https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L458-L473 |
43,803 | unclecheese/silverstripe-display-logic | src/Extensions/DisplayLogic.php | DisplayLogic.displayIf | public function displayIf($master)
{
$class ="display-logic display-logic-hidden display-logic-display";
$this->owner->addExtraClass($class);
if ($this->owner->hasMethod('addHolderClass')) {
$this->owner->addHolderClass($class);
}
return $this->setDisplayLogicCriteria(Criteria::create($this->owner, $master));
} | php | public function displayIf($master)
{
$class ="display-logic display-logic-hidden display-logic-display";
$this->owner->addExtraClass($class);
if ($this->owner->hasMethod('addHolderClass')) {
$this->owner->addHolderClass($class);
}
return $this->setDisplayLogicCriteria(Criteria::create($this->owner, $master));
} | [
"public",
"function",
"displayIf",
"(",
"$",
"master",
")",
"{",
"$",
"class",
"=",
"\"display-logic display-logic-hidden display-logic-display\"",
";",
"$",
"this",
"->",
"owner",
"->",
"addExtraClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"this",
"->... | If the criteria evaluate true, the field should display
@param string $master The name of the master field
@return Criteria | [
"If",
"the",
"criteria",
"evaluate",
"true",
"the",
"field",
"should",
"display"
] | 845ab12189439422b6dcd1becd20c9d5a94eb558 | https://github.com/unclecheese/silverstripe-display-logic/blob/845ab12189439422b6dcd1becd20c9d5a94eb558/src/Extensions/DisplayLogic.php#L40-L50 |
43,804 | unclecheese/silverstripe-display-logic | src/Extensions/DisplayLogic.php | DisplayLogic.DisplayLogic | public function DisplayLogic()
{
if ($criteria = $this->getDisplayLogicCriteria()) {
Requirements::javascript('unclecheese/display-logic: client/dist/js/bundle.js');
Requirements::css('unclecheese/display-logic: client/dist/styles/bundle.css');
return $criteria->toScript();
}
return false;
} | php | public function DisplayLogic()
{
if ($criteria = $this->getDisplayLogicCriteria()) {
Requirements::javascript('unclecheese/display-logic: client/dist/js/bundle.js');
Requirements::css('unclecheese/display-logic: client/dist/styles/bundle.css');
return $criteria->toScript();
}
return false;
} | [
"public",
"function",
"DisplayLogic",
"(",
")",
"{",
"if",
"(",
"$",
"criteria",
"=",
"$",
"this",
"->",
"getDisplayLogicCriteria",
"(",
")",
")",
"{",
"Requirements",
"::",
"javascript",
"(",
"'unclecheese/display-logic: client/dist/js/bundle.js'",
")",
";",
"Req... | Loads the dependencies and renders the JavaScript-readable logic to the form HTML
@return string | [
"Loads",
"the",
"dependencies",
"and",
"renders",
"the",
"JavaScript",
"-",
"readable",
"logic",
"to",
"the",
"form",
"HTML"
] | 845ab12189439422b6dcd1becd20c9d5a94eb558 | https://github.com/unclecheese/silverstripe-display-logic/blob/845ab12189439422b6dcd1becd20c9d5a94eb558/src/Extensions/DisplayLogic.php#L127-L136 |
43,805 | unclecheese/silverstripe-display-logic | src/Criteria.php | Criteria.set_default_animation | public static function set_default_animation($animation)
{
if (in_array($animation, Config::inst()->get(__CLASS__, 'animations'))) {
Config::modify()->set(__CLASS__, 'default_animation', $animation);
}
} | php | public static function set_default_animation($animation)
{
if (in_array($animation, Config::inst()->get(__CLASS__, 'animations'))) {
Config::modify()->set(__CLASS__, 'default_animation', $animation);
}
} | [
"public",
"static",
"function",
"set_default_animation",
"(",
"$",
"animation",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"animation",
",",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"__CLASS__",
",",
"'animations'",
")",
")",
")",
"{",
"Config... | Changes the configured default animation method
@param string $animation | [
"Changes",
"the",
"configured",
"default",
"animation",
"method"
] | 845ab12189439422b6dcd1becd20c9d5a94eb558 | https://github.com/unclecheese/silverstripe-display-logic/blob/845ab12189439422b6dcd1becd20c9d5a94eb558/src/Criteria.php#L73-L78 |
43,806 | unclecheese/silverstripe-display-logic | src/Criteria.php | Criteria.toScript | public function toScript()
{
$script = "(";
$first = true;
foreach ($this->getCriteria() as $c) {
$script .= $first ? "" : " {$this->getLogicalOperator()} ";
$script .= $c->toScript();
$first = false;
}
$script .= ")";
return $script;
} | php | public function toScript()
{
$script = "(";
$first = true;
foreach ($this->getCriteria() as $c) {
$script .= $first ? "" : " {$this->getLogicalOperator()} ";
$script .= $c->toScript();
$first = false;
}
$script .= ")";
return $script;
} | [
"public",
"function",
"toScript",
"(",
")",
"{",
"$",
"script",
"=",
"\"(\"",
";",
"$",
"first",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCriteria",
"(",
")",
"as",
"$",
"c",
")",
"{",
"$",
"script",
".=",
"$",
"first",
"?",
"\"\"... | Creates a JavaScript readable representation of the logic
@return string | [
"Creates",
"a",
"JavaScript",
"readable",
"representation",
"of",
"the",
"logic"
] | 845ab12189439422b6dcd1becd20c9d5a94eb558 | https://github.com/unclecheese/silverstripe-display-logic/blob/845ab12189439422b6dcd1becd20c9d5a94eb558/src/Criteria.php#L271-L282 |
43,807 | Sylius/SyliusResourceBundle | src/Bundle/Controller/RequestConfiguration.php | RequestConfiguration.getRedirectReferer | public function getRedirectReferer()
{
$redirect = $this->parameters->get('redirect');
$referer = $this->request->headers->get('referer');
if (!is_array($redirect) || empty($redirect['referer'])) {
return $referer;
}
if ($redirect['referer'] === true) {
return $referer;
}
return $redirect['referer'];
} | php | public function getRedirectReferer()
{
$redirect = $this->parameters->get('redirect');
$referer = $this->request->headers->get('referer');
if (!is_array($redirect) || empty($redirect['referer'])) {
return $referer;
}
if ($redirect['referer'] === true) {
return $referer;
}
return $redirect['referer'];
} | [
"public",
"function",
"getRedirectReferer",
"(",
")",
"{",
"$",
"redirect",
"=",
"$",
"this",
"->",
"parameters",
"->",
"get",
"(",
"'redirect'",
")",
";",
"$",
"referer",
"=",
"$",
"this",
"->",
"request",
"->",
"headers",
"->",
"get",
"(",
"'referer'",... | Get redirect referer, This will detected by configuration
If not exists, The `referrer` from headers will be used.
@return string | [
"Get",
"redirect",
"referer",
"This",
"will",
"detected",
"by",
"configuration",
"If",
"not",
"exists",
"The",
"referrer",
"from",
"headers",
"will",
"be",
"used",
"."
] | 92c8e365a7c15aa436429b07dd14e7b2f8965f2f | https://github.com/Sylius/SyliusResourceBundle/blob/92c8e365a7c15aa436429b07dd14e7b2f8965f2f/src/Bundle/Controller/RequestConfiguration.php#L203-L217 |
43,808 | Sylius/SyliusResourceBundle | src/Bundle/AbstractResourceBundle.php | AbstractResourceBundle.getMappingCompilerPassInfo | protected function getMappingCompilerPassInfo(string $driverType): array
{
switch ($driverType) {
case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:
@trigger_error(sprintf(
'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.',
$driverType
), \E_USER_DEPRECATED);
$mappingsPassClassname = DoctrineMongoDBMappingsPass::class;
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:
$mappingsPassClassname = DoctrineOrmMappingsPass::class;
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:
@trigger_error(sprintf(
'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.',
$driverType
), \E_USER_DEPRECATED);
$mappingsPassClassname = DoctrinePhpcrMappingsPass::class;
break;
default:
throw new UnknownDriverException($driverType);
}
$compilerPassMethod = sprintf('create%sMappingDriver', ucfirst($this->mappingFormat));
return [$mappingsPassClassname, $compilerPassMethod];
} | php | protected function getMappingCompilerPassInfo(string $driverType): array
{
switch ($driverType) {
case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:
@trigger_error(sprintf(
'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.',
$driverType
), \E_USER_DEPRECATED);
$mappingsPassClassname = DoctrineMongoDBMappingsPass::class;
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:
$mappingsPassClassname = DoctrineOrmMappingsPass::class;
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:
@trigger_error(sprintf(
'The "%s" driver is deprecated in Sylius 1.3. Doctrine MongoDB and PHPCR will no longer be supported in Sylius 2.0.',
$driverType
), \E_USER_DEPRECATED);
$mappingsPassClassname = DoctrinePhpcrMappingsPass::class;
break;
default:
throw new UnknownDriverException($driverType);
}
$compilerPassMethod = sprintf('create%sMappingDriver', ucfirst($this->mappingFormat));
return [$mappingsPassClassname, $compilerPassMethod];
} | [
"protected",
"function",
"getMappingCompilerPassInfo",
"(",
"string",
"$",
"driverType",
")",
":",
"array",
"{",
"switch",
"(",
"$",
"driverType",
")",
"{",
"case",
"SyliusResourceBundle",
"::",
"DRIVER_DOCTRINE_MONGODB_ODM",
":",
"@",
"trigger_error",
"(",
"sprintf... | Return mapping compiler pass class depending on driver.
@throws UnknownDriverException | [
"Return",
"mapping",
"compiler",
"pass",
"class",
"depending",
"on",
"driver",
"."
] | 92c8e365a7c15aa436429b07dd14e7b2f8965f2f | https://github.com/Sylius/SyliusResourceBundle/blob/92c8e365a7c15aa436429b07dd14e7b2f8965f2f/src/Bundle/AbstractResourceBundle.php#L108-L140 |
43,809 | Sylius/SyliusResourceBundle | src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php | AbstractDoctrineDriver.getObjectManagerName | protected function getObjectManagerName(MetadataInterface $metadata): ?string
{
$objectManagerName = null;
if ($metadata->hasParameter('options') && isset($metadata->getParameter('options')['object_manager'])) {
$objectManagerName = $metadata->getParameter('options')['object_manager'];
}
return $objectManagerName;
} | php | protected function getObjectManagerName(MetadataInterface $metadata): ?string
{
$objectManagerName = null;
if ($metadata->hasParameter('options') && isset($metadata->getParameter('options')['object_manager'])) {
$objectManagerName = $metadata->getParameter('options')['object_manager'];
}
return $objectManagerName;
} | [
"protected",
"function",
"getObjectManagerName",
"(",
"MetadataInterface",
"$",
"metadata",
")",
":",
"?",
"string",
"{",
"$",
"objectManagerName",
"=",
"null",
";",
"if",
"(",
"$",
"metadata",
"->",
"hasParameter",
"(",
"'options'",
")",
"&&",
"isset",
"(",
... | Return the configured object managre name, or NULL if the default
manager should be used. | [
"Return",
"the",
"configured",
"object",
"managre",
"name",
"or",
"NULL",
"if",
"the",
"default",
"manager",
"should",
"be",
"used",
"."
] | 92c8e365a7c15aa436429b07dd14e7b2f8965f2f | https://github.com/Sylius/SyliusResourceBundle/blob/92c8e365a7c15aa436429b07dd14e7b2f8965f2f/src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php#L61-L70 |
43,810 | silverstripe/silverstripe-redirectedurls | src/Extension/RedirectedURLHandler.php | RedirectedURLHandler.arrayToLowercase | protected function arrayToLowercase($vars)
{
$result = array();
foreach ($vars as $k => $v) {
if (is_array($v)) {
$result[strtolower($k)] = $this->arrayToLowercase($v);
} else {
$result[strtolower($k)] = strtolower($v);
}
}
return $result;
} | php | protected function arrayToLowercase($vars)
{
$result = array();
foreach ($vars as $k => $v) {
if (is_array($v)) {
$result[strtolower($k)] = $this->arrayToLowercase($v);
} else {
$result[strtolower($k)] = strtolower($v);
}
}
return $result;
} | [
"protected",
"function",
"arrayToLowercase",
"(",
"$",
"vars",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"v",
")",
")",
"{",
"$"... | Converts an array of key value pairs to lowercase
@param array $vars key value pairs
@return array | [
"Converts",
"an",
"array",
"of",
"key",
"value",
"pairs",
"to",
"lowercase"
] | c0d4cde3a52744aa87f52780b553e24d94a2d397 | https://github.com/silverstripe/silverstripe-redirectedurls/blob/c0d4cde3a52744aa87f52780b553e24d94a2d397/src/Extension/RedirectedURLHandler.php#L34-L47 |
43,811 | silverstripe/silverstripe-redirectedurls | src/Admin/RedirectedURLAdmin.php | RedirectedURLAdmin.getExportFields | public function getExportFields()
{
$fields = array();
foreach (DataObject::getSchema()->databaseFields($this->modelClass) as $field => $spec) {
$fields[$field] = $field;
}
return $fields;
} | php | public function getExportFields()
{
$fields = array();
foreach (DataObject::getSchema()->databaseFields($this->modelClass) as $field => $spec) {
$fields[$field] = $field;
}
return $fields;
} | [
"public",
"function",
"getExportFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"DataObject",
"::",
"getSchema",
"(",
")",
"->",
"databaseFields",
"(",
"$",
"this",
"->",
"modelClass",
")",
"as",
"$",
"field",
"=>",
... | Overriden so that the CSV column headings have the exact field names of the DataObject
To prevent field name conversion in DataObject::summaryFields() during export
e.g. 'FromBase' is output as 'From Base'
@return array | [
"Overriden",
"so",
"that",
"the",
"CSV",
"column",
"headings",
"have",
"the",
"exact",
"field",
"names",
"of",
"the",
"DataObject"
] | c0d4cde3a52744aa87f52780b553e24d94a2d397 | https://github.com/silverstripe/silverstripe-redirectedurls/blob/c0d4cde3a52744aa87f52780b553e24d94a2d397/src/Admin/RedirectedURLAdmin.php#L73-L80 |
43,812 | commerceguys/guzzle-oauth2-plugin | src/Oauth2Subscriber.php | Oauth2Subscriber.acquireAccessToken | protected function acquireAccessToken()
{
$accessToken = null;
if ($this->refreshTokenGrantType) {
// Get an access token using the stored refresh token.
if ($this->refreshToken) {
$this->refreshTokenGrantType->setRefreshToken($this->refreshToken->getToken());
}
if ($this->refreshTokenGrantType->hasRefreshToken()) {
$accessToken = $this->refreshTokenGrantType->getToken();
}
}
if (!$accessToken && $this->grantType) {
// Get a new access token.
$accessToken = $this->grantType->getToken();
}
return $accessToken ?: null;
} | php | protected function acquireAccessToken()
{
$accessToken = null;
if ($this->refreshTokenGrantType) {
// Get an access token using the stored refresh token.
if ($this->refreshToken) {
$this->refreshTokenGrantType->setRefreshToken($this->refreshToken->getToken());
}
if ($this->refreshTokenGrantType->hasRefreshToken()) {
$accessToken = $this->refreshTokenGrantType->getToken();
}
}
if (!$accessToken && $this->grantType) {
// Get a new access token.
$accessToken = $this->grantType->getToken();
}
return $accessToken ?: null;
} | [
"protected",
"function",
"acquireAccessToken",
"(",
")",
"{",
"$",
"accessToken",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"refreshTokenGrantType",
")",
"{",
"// Get an access token using the stored refresh token.",
"if",
"(",
"$",
"this",
"->",
"refreshToken... | Get a new access token.
@return AccessToken|null | [
"Get",
"a",
"new",
"access",
"token",
"."
] | f7ed19171c3c5accfb6f0b3d1209eb5815ef8148 | https://github.com/commerceguys/guzzle-oauth2-plugin/blob/f7ed19171c3c5accfb6f0b3d1209eb5815ef8148/src/Oauth2Subscriber.php#L72-L92 |
43,813 | commerceguys/guzzle-oauth2-plugin | src/Oauth2Subscriber.php | Oauth2Subscriber.setRefreshToken | public function setRefreshToken($refreshToken)
{
if (is_string($refreshToken)) {
$refreshToken = new AccessToken($refreshToken, 'refresh_token');
} elseif (!$refreshToken instanceof AccessToken) {
throw new \InvalidArgumentException('Invalid refresh token');
}
$this->refreshToken = $refreshToken;
} | php | public function setRefreshToken($refreshToken)
{
if (is_string($refreshToken)) {
$refreshToken = new AccessToken($refreshToken, 'refresh_token');
} elseif (!$refreshToken instanceof AccessToken) {
throw new \InvalidArgumentException('Invalid refresh token');
}
$this->refreshToken = $refreshToken;
} | [
"public",
"function",
"setRefreshToken",
"(",
"$",
"refreshToken",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"refreshToken",
")",
")",
"{",
"$",
"refreshToken",
"=",
"new",
"AccessToken",
"(",
"$",
"refreshToken",
",",
"'refresh_token'",
")",
";",
"}",
"... | Set the refresh token.
@param AccessToken|string $refreshToken The refresh token | [
"Set",
"the",
"refresh",
"token",
"."
] | f7ed19171c3c5accfb6f0b3d1209eb5815ef8148 | https://github.com/commerceguys/guzzle-oauth2-plugin/blob/f7ed19171c3c5accfb6f0b3d1209eb5815ef8148/src/Oauth2Subscriber.php#L166-L174 |
43,814 | commerceguys/guzzle-oauth2-plugin | src/GrantType/JwtBearer.php | JwtBearer.computeJwt | protected function computeJwt()
{
$payload = [
'iss' => $this->config->get('client_id'),
'aud' => sprintf('%s/%s', rtrim($this->client->getBaseUrl(), '/'), ltrim($this->config->get('token_url'), '/')),
'exp' => time() + 60 * 60,
'iat' => time()
];
return JWT::encode($payload, $this->readPrivateKey($this->config->get('private_key')), 'RS256');
} | php | protected function computeJwt()
{
$payload = [
'iss' => $this->config->get('client_id'),
'aud' => sprintf('%s/%s', rtrim($this->client->getBaseUrl(), '/'), ltrim($this->config->get('token_url'), '/')),
'exp' => time() + 60 * 60,
'iat' => time()
];
return JWT::encode($payload, $this->readPrivateKey($this->config->get('private_key')), 'RS256');
} | [
"protected",
"function",
"computeJwt",
"(",
")",
"{",
"$",
"payload",
"=",
"[",
"'iss'",
"=>",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'client_id'",
")",
",",
"'aud'",
"=>",
"sprintf",
"(",
"'%s/%s'",
",",
"rtrim",
"(",
"$",
"this",
"->",
"cl... | Compute JWT, signing with provided private key | [
"Compute",
"JWT",
"signing",
"with",
"provided",
"private",
"key"
] | f7ed19171c3c5accfb6f0b3d1209eb5815ef8148 | https://github.com/commerceguys/guzzle-oauth2-plugin/blob/f7ed19171c3c5accfb6f0b3d1209eb5815ef8148/src/GrantType/JwtBearer.php#L55-L65 |
43,815 | commerceguys/guzzle-oauth2-plugin | src/GrantType/JwtBearer.php | JwtBearer.readPrivateKey | protected function readPrivateKey(SplFileObject $privateKey)
{
$key = '';
while (!$privateKey->eof()) {
$key .= $privateKey->fgets();
}
return $key;
} | php | protected function readPrivateKey(SplFileObject $privateKey)
{
$key = '';
while (!$privateKey->eof()) {
$key .= $privateKey->fgets();
}
return $key;
} | [
"protected",
"function",
"readPrivateKey",
"(",
"SplFileObject",
"$",
"privateKey",
")",
"{",
"$",
"key",
"=",
"''",
";",
"while",
"(",
"!",
"$",
"privateKey",
"->",
"eof",
"(",
")",
")",
"{",
"$",
"key",
".=",
"$",
"privateKey",
"->",
"fgets",
"(",
... | Read private key
@param SplFileObject $privateKey
@return string | [
"Read",
"private",
"key"
] | f7ed19171c3c5accfb6f0b3d1209eb5815ef8148 | https://github.com/commerceguys/guzzle-oauth2-plugin/blob/f7ed19171c3c5accfb6f0b3d1209eb5815ef8148/src/GrantType/JwtBearer.php#L74-L81 |
43,816 | neos/Neos.Demo | Classes/Controller/RegistrationController.php | RegistrationController.newAccountAction | public function newAccountAction()
{
$uniqueUsername = 'demo' . (time() - 1302876012);
$registration = new Registration();
$registration->setFirstName('John');
$registration->setLastName('Doe');
$registration->setUsername($uniqueUsername);
$registration->setPassword('demo');
$this->view->assign('registration', $registration);
} | php | public function newAccountAction()
{
$uniqueUsername = 'demo' . (time() - 1302876012);
$registration = new Registration();
$registration->setFirstName('John');
$registration->setLastName('Doe');
$registration->setUsername($uniqueUsername);
$registration->setPassword('demo');
$this->view->assign('registration', $registration);
} | [
"public",
"function",
"newAccountAction",
"(",
")",
"{",
"$",
"uniqueUsername",
"=",
"'demo'",
".",
"(",
"time",
"(",
")",
"-",
"1302876012",
")",
";",
"$",
"registration",
"=",
"new",
"Registration",
"(",
")",
";",
"$",
"registration",
"->",
"setFirstName... | Displays a form that creates a temporary account
@return void | [
"Displays",
"a",
"form",
"that",
"creates",
"a",
"temporary",
"account"
] | 4c1a7770db2a7359cae20ddcafb7cfc4efdbf420 | https://github.com/neos/Neos.Demo/blob/4c1a7770db2a7359cae20ddcafb7cfc4efdbf420/Classes/Controller/RegistrationController.php#L68-L78 |
43,817 | neos/Neos.Demo | Classes/Controller/RegistrationController.php | RegistrationController.createAccountAction | public function createAccountAction(Registration $registration)
{
$accountIdentifier = $registration->getUsername();
$existingAccount = $this->accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, 'Neos.Neos:Backend');
if ($existingAccount !== null) {
$this->addFlashMessage('An account with the username "%s" already exists.', 'Account already exists', Message::SEVERITY_ERROR, array($accountIdentifier));
$this->forward('newAccount');
}
$this->createTemporaryAccount($accountIdentifier, $registration->getPassword(), $registration->getFirstName(), $registration->getLastName());
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($this->request->getParentRequest());
$redirectUri = $uriBuilder
->setCreateAbsoluteUri(true)
->uriFor('index', array('username' => $accountIdentifier), 'Login', 'Neos.Neos');
$this->redirectToUri($redirectUri);
} | php | public function createAccountAction(Registration $registration)
{
$accountIdentifier = $registration->getUsername();
$existingAccount = $this->accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, 'Neos.Neos:Backend');
if ($existingAccount !== null) {
$this->addFlashMessage('An account with the username "%s" already exists.', 'Account already exists', Message::SEVERITY_ERROR, array($accountIdentifier));
$this->forward('newAccount');
}
$this->createTemporaryAccount($accountIdentifier, $registration->getPassword(), $registration->getFirstName(), $registration->getLastName());
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($this->request->getParentRequest());
$redirectUri = $uriBuilder
->setCreateAbsoluteUri(true)
->uriFor('index', array('username' => $accountIdentifier), 'Login', 'Neos.Neos');
$this->redirectToUri($redirectUri);
} | [
"public",
"function",
"createAccountAction",
"(",
"Registration",
"$",
"registration",
")",
"{",
"$",
"accountIdentifier",
"=",
"$",
"registration",
"->",
"getUsername",
"(",
")",
";",
"$",
"existingAccount",
"=",
"$",
"this",
"->",
"accountRepository",
"->",
"f... | Action for creating a temporary account
@param Registration $registration
@return void | [
"Action",
"for",
"creating",
"a",
"temporary",
"account"
] | 4c1a7770db2a7359cae20ddcafb7cfc4efdbf420 | https://github.com/neos/Neos.Demo/blob/4c1a7770db2a7359cae20ddcafb7cfc4efdbf420/Classes/Controller/RegistrationController.php#L86-L103 |
43,818 | neos/Neos.Demo | Classes/Controller/RegistrationController.php | RegistrationController.createTemporaryAccount | protected function createTemporaryAccount($accountIdentifier, $password, $firstName, $lastName)
{
if (strlen($firstName) === 0 && strlen($lastName) === 0) {
$firstName = 'Santa';
$lastName = 'Claus';
}
$user = new User();
$user->setName(new PersonName('', $firstName, '', $lastName));
$user->getPreferences()->set('context.workspace', 'user-' . $accountIdentifier);
$this->partyRepository->add($user);
$account = $this->accountFactory->createAccountWithPassword($accountIdentifier, $password, array('Neos.Neos:Editor'), 'Neos.Neos:Backend');
$this->partyService->assignAccountToParty($account, $user);
$account->setExpirationDate(new \DateTime('+1 week'));
$this->accountRepository->add($account);
} | php | protected function createTemporaryAccount($accountIdentifier, $password, $firstName, $lastName)
{
if (strlen($firstName) === 0 && strlen($lastName) === 0) {
$firstName = 'Santa';
$lastName = 'Claus';
}
$user = new User();
$user->setName(new PersonName('', $firstName, '', $lastName));
$user->getPreferences()->set('context.workspace', 'user-' . $accountIdentifier);
$this->partyRepository->add($user);
$account = $this->accountFactory->createAccountWithPassword($accountIdentifier, $password, array('Neos.Neos:Editor'), 'Neos.Neos:Backend');
$this->partyService->assignAccountToParty($account, $user);
$account->setExpirationDate(new \DateTime('+1 week'));
$this->accountRepository->add($account);
} | [
"protected",
"function",
"createTemporaryAccount",
"(",
"$",
"accountIdentifier",
",",
"$",
"password",
",",
"$",
"firstName",
",",
"$",
"lastName",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"firstName",
")",
"===",
"0",
"&&",
"strlen",
"(",
"$",
"lastName"... | Creates a temporary account
@param string $accountIdentifier
@param string $password
@param string $firstName
@param string $lastName
@return Account | [
"Creates",
"a",
"temporary",
"account"
] | 4c1a7770db2a7359cae20ddcafb7cfc4efdbf420 | https://github.com/neos/Neos.Demo/blob/4c1a7770db2a7359cae20ddcafb7cfc4efdbf420/Classes/Controller/RegistrationController.php#L114-L131 |
43,819 | guzzle/retry-subscriber | src/RetrySubscriber.php | RetrySubscriber.createLoggingDelay | public static function createLoggingDelay(
callable $delayFn,
LoggerInterface $logger,
$formatter = null
) {
if (!$formatter) {
$formatter = new Formatter(self::MSG_FORMAT);
} elseif (!($formatter instanceof Formatter)) {
$formatter = new Formatter($formatter);
}
return function (
$retries,
AbstractTransferEvent $event
) use ($delayFn, $logger, $formatter) {
$delay = $delayFn($retries, $event);
$logger->log(LogLevel::NOTICE, $formatter->format(
$event->getRequest(),
$event->getResponse(),
$event instanceof ErrorEvent ? $event->getException() : null,
[
'retries' => $retries + 1,
'delay' => $delay
] + $event->getTransferInfo()
));
return $delay;
};
} | php | public static function createLoggingDelay(
callable $delayFn,
LoggerInterface $logger,
$formatter = null
) {
if (!$formatter) {
$formatter = new Formatter(self::MSG_FORMAT);
} elseif (!($formatter instanceof Formatter)) {
$formatter = new Formatter($formatter);
}
return function (
$retries,
AbstractTransferEvent $event
) use ($delayFn, $logger, $formatter) {
$delay = $delayFn($retries, $event);
$logger->log(LogLevel::NOTICE, $formatter->format(
$event->getRequest(),
$event->getResponse(),
$event instanceof ErrorEvent ? $event->getException() : null,
[
'retries' => $retries + 1,
'delay' => $delay
] + $event->getTransferInfo()
));
return $delay;
};
} | [
"public",
"static",
"function",
"createLoggingDelay",
"(",
"callable",
"$",
"delayFn",
",",
"LoggerInterface",
"$",
"logger",
",",
"$",
"formatter",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"formatter",
")",
"{",
"$",
"formatter",
"=",
"new",
"Formatter... | Creates a delay function that logs each retry before proxying to a
wrapped delay function.
@param callable $delayFn Delay function to proxy to
@param LoggerInterface $logger Logger used to log messages
@param string|Formatter $formatter Message formatter to format messages
@return callable | [
"Creates",
"a",
"delay",
"function",
"that",
"logs",
"each",
"retry",
"before",
"proxying",
"to",
"a",
"wrapped",
"delay",
"function",
"."
] | 68f89b0b00b8e0dc7978cbbe16cee190e2bed650 | https://github.com/guzzle/retry-subscriber/blob/68f89b0b00b8e0dc7978cbbe16cee190e2bed650/src/RetrySubscriber.php#L114-L141 |
43,820 | guzzle/retry-subscriber | src/RetrySubscriber.php | RetrySubscriber.createStatusFilter | public static function createStatusFilter(
array $failureStatuses = [500, 503]
) {
// Convert the array of values into a set for hash lookups
$failureStatuses = array_fill_keys($failureStatuses, true);
return function (
$retries,
AbstractTransferEvent $event
) use ($failureStatuses) {
if (!($response = $event->getResponse())) {
return false;
}
return isset($failureStatuses[$response->getStatusCode()]);
};
} | php | public static function createStatusFilter(
array $failureStatuses = [500, 503]
) {
// Convert the array of values into a set for hash lookups
$failureStatuses = array_fill_keys($failureStatuses, true);
return function (
$retries,
AbstractTransferEvent $event
) use ($failureStatuses) {
if (!($response = $event->getResponse())) {
return false;
}
return isset($failureStatuses[$response->getStatusCode()]);
};
} | [
"public",
"static",
"function",
"createStatusFilter",
"(",
"array",
"$",
"failureStatuses",
"=",
"[",
"500",
",",
"503",
"]",
")",
"{",
"// Convert the array of values into a set for hash lookups",
"$",
"failureStatuses",
"=",
"array_fill_keys",
"(",
"$",
"failureStatus... | Creates a retry filter based on HTTP status codes
@param array $failureStatuses Pass an array of status codes to override
the default of [500, 503].
@return callable | [
"Creates",
"a",
"retry",
"filter",
"based",
"on",
"HTTP",
"status",
"codes"
] | 68f89b0b00b8e0dc7978cbbe16cee190e2bed650 | https://github.com/guzzle/retry-subscriber/blob/68f89b0b00b8e0dc7978cbbe16cee190e2bed650/src/RetrySubscriber.php#L150-L165 |
43,821 | guzzle/retry-subscriber | src/RetrySubscriber.php | RetrySubscriber.createIdempotentFilter | public static function createIdempotentFilter()
{
static $retry = ['GET' => true, 'HEAD' => true, 'PUT' => true,
'DELETE' => true, 'OPTIONS' => true, 'TRACE' => true];
return function ($retries, AbstractTransferEvent $e) use ($retry) {
return isset($retry[$e->getRequest()->getMethod()])
? self::DEFER
: self::BREAK_CHAIN;
};
} | php | public static function createIdempotentFilter()
{
static $retry = ['GET' => true, 'HEAD' => true, 'PUT' => true,
'DELETE' => true, 'OPTIONS' => true, 'TRACE' => true];
return function ($retries, AbstractTransferEvent $e) use ($retry) {
return isset($retry[$e->getRequest()->getMethod()])
? self::DEFER
: self::BREAK_CHAIN;
};
} | [
"public",
"static",
"function",
"createIdempotentFilter",
"(",
")",
"{",
"static",
"$",
"retry",
"=",
"[",
"'GET'",
"=>",
"true",
",",
"'HEAD'",
"=>",
"true",
",",
"'PUT'",
"=>",
"true",
",",
"'DELETE'",
"=>",
"true",
",",
"'OPTIONS'",
"=>",
"true",
",",... | Creates a retry filter based on whether an HTTP method is considered
"safe" or "idempotent" based on RFC 7231.
If the HTTP request method is a PUT, POST, or PATCH request, then the
request will not be retried. Otherwise, the filter will defer to other
filters if added to a filter chain via `createChainFilter()`.
@return callable
@link http://tools.ietf.org/html/rfc7231#section-4.2.2 | [
"Creates",
"a",
"retry",
"filter",
"based",
"on",
"whether",
"an",
"HTTP",
"method",
"is",
"considered",
"safe",
"or",
"idempotent",
"based",
"on",
"RFC",
"7231",
"."
] | 68f89b0b00b8e0dc7978cbbe16cee190e2bed650 | https://github.com/guzzle/retry-subscriber/blob/68f89b0b00b8e0dc7978cbbe16cee190e2bed650/src/RetrySubscriber.php#L178-L188 |
43,822 | guzzle/retry-subscriber | src/RetrySubscriber.php | RetrySubscriber.createCurlFilter | public static function createCurlFilter($errorCodes = null)
{
// Only use the cURL filter if cURL is loaded.
if (!extension_loaded('curl')) {
return function () { return false; };
}
$errorCodes = $errorCodes ?: [
CURLE_OPERATION_TIMEOUTED,
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
CURLE_SSL_CONNECT_ERROR,
CURLE_GOT_NOTHING
];
$errorCodes = array_fill_keys($errorCodes, 1);
return function ($retries, AbstractTransferEvent $e) use ($errorCodes) {
return isset($errorCodes[(int) $e->getTransferInfo('errno')]);
};
} | php | public static function createCurlFilter($errorCodes = null)
{
// Only use the cURL filter if cURL is loaded.
if (!extension_loaded('curl')) {
return function () { return false; };
}
$errorCodes = $errorCodes ?: [
CURLE_OPERATION_TIMEOUTED,
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
CURLE_SSL_CONNECT_ERROR,
CURLE_GOT_NOTHING
];
$errorCodes = array_fill_keys($errorCodes, 1);
return function ($retries, AbstractTransferEvent $e) use ($errorCodes) {
return isset($errorCodes[(int) $e->getTransferInfo('errno')]);
};
} | [
"public",
"static",
"function",
"createCurlFilter",
"(",
"$",
"errorCodes",
"=",
"null",
")",
"{",
"// Only use the cURL filter if cURL is loaded.",
"if",
"(",
"!",
"extension_loaded",
"(",
"'curl'",
")",
")",
"{",
"return",
"function",
"(",
")",
"{",
"return",
... | Creates a retry filter based on cURL error codes.
@param array $errorCodes Pass an array of curl error codes to override
the default list of error codes.
@return callable | [
"Creates",
"a",
"retry",
"filter",
"based",
"on",
"cURL",
"error",
"codes",
"."
] | 68f89b0b00b8e0dc7978cbbe16cee190e2bed650 | https://github.com/guzzle/retry-subscriber/blob/68f89b0b00b8e0dc7978cbbe16cee190e2bed650/src/RetrySubscriber.php#L197-L217 |
43,823 | jeremyharris/cakephp-lazyload | src/ORM/LazyLoadEntityTrait.php | LazyLoadEntityTrait.has | public function has($property)
{
foreach ((array)$property as $prop) {
$has = $this->_parentHas($prop);
if ($has === false) {
$has = $this->_lazyLoad($prop);
if ($has === null) {
return false;
}
}
}
return true;
} | php | public function has($property)
{
foreach ((array)$property as $prop) {
$has = $this->_parentHas($prop);
if ($has === false) {
$has = $this->_lazyLoad($prop);
if ($has === null) {
return false;
}
}
}
return true;
} | [
"public",
"function",
"has",
"(",
"$",
"property",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"property",
"as",
"$",
"prop",
")",
"{",
"$",
"has",
"=",
"$",
"this",
"->",
"_parentHas",
"(",
"$",
"prop",
")",
";",
"if",
"(",
"$",
"has",
"... | Overrides has method to account for a lazy loaded property
@param string|array $property Property
@return bool | [
"Overrides",
"has",
"method",
"to",
"account",
"for",
"a",
"lazy",
"loaded",
"property"
] | 9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0 | https://github.com/jeremyharris/cakephp-lazyload/blob/9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0/src/ORM/LazyLoadEntityTrait.php#L61-L75 |
43,824 | jeremyharris/cakephp-lazyload | src/ORM/LazyLoadEntityTrait.php | LazyLoadEntityTrait.unsetProperty | public function unsetProperty($property)
{
$property = (array)$property;
foreach ($property as $prop) {
$this->_unsetProperties[] = $prop;
}
return Entity::unsetProperty($property);
} | php | public function unsetProperty($property)
{
$property = (array)$property;
foreach ($property as $prop) {
$this->_unsetProperties[] = $prop;
}
return Entity::unsetProperty($property);
} | [
"public",
"function",
"unsetProperty",
"(",
"$",
"property",
")",
"{",
"$",
"property",
"=",
"(",
"array",
")",
"$",
"property",
";",
"foreach",
"(",
"$",
"property",
"as",
"$",
"prop",
")",
"{",
"$",
"this",
"->",
"_unsetProperties",
"[",
"]",
"=",
... | Unsets a property, marking it as not to be lazily loaded in the future
@param array|string $property Property
@return $this | [
"Unsets",
"a",
"property",
"marking",
"it",
"as",
"not",
"to",
"be",
"lazily",
"loaded",
"in",
"the",
"future"
] | 9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0 | https://github.com/jeremyharris/cakephp-lazyload/blob/9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0/src/ORM/LazyLoadEntityTrait.php#L94-L102 |
43,825 | jeremyharris/cakephp-lazyload | src/ORM/LazyLoadEntityTrait.php | LazyLoadEntityTrait._lazyLoad | protected function _lazyLoad($property)
{
// check if the property has been unset at some point
if (array_search($property, $this->_unsetProperties) !== false) {
return null;
}
// check if the property was set as null to begin with
if (array_key_exists($property, $this->_properties)) {
return $this->_properties[$property];
}
$repository = $this->_repository($property);
if (!($repository instanceof RepositoryInterface)) {
return null;
}
$association = $repository
->associations()
->getByProperty($property);
if ($association === null) {
return null;
}
$repository->loadInto($this, [$association->getName()]);
// check if the association didn't exist and therefore didn't load
if (!isset($this->_properties[$property])) {
return null;
}
return $this->_properties[$property];
} | php | protected function _lazyLoad($property)
{
// check if the property has been unset at some point
if (array_search($property, $this->_unsetProperties) !== false) {
return null;
}
// check if the property was set as null to begin with
if (array_key_exists($property, $this->_properties)) {
return $this->_properties[$property];
}
$repository = $this->_repository($property);
if (!($repository instanceof RepositoryInterface)) {
return null;
}
$association = $repository
->associations()
->getByProperty($property);
if ($association === null) {
return null;
}
$repository->loadInto($this, [$association->getName()]);
// check if the association didn't exist and therefore didn't load
if (!isset($this->_properties[$property])) {
return null;
}
return $this->_properties[$property];
} | [
"protected",
"function",
"_lazyLoad",
"(",
"$",
"property",
")",
"{",
"// check if the property has been unset at some point",
"if",
"(",
"array_search",
"(",
"$",
"property",
",",
"$",
"this",
"->",
"_unsetProperties",
")",
"!==",
"false",
")",
"{",
"return",
"nu... | Lazy loads association data onto the entity
@param string $property Property
@return mixed | [
"Lazy",
"loads",
"association",
"data",
"onto",
"the",
"entity"
] | 9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0 | https://github.com/jeremyharris/cakephp-lazyload/blob/9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0/src/ORM/LazyLoadEntityTrait.php#L110-L143 |
43,826 | jeremyharris/cakephp-lazyload | src/ORM/LazyLoadEntityTrait.php | LazyLoadEntityTrait._repository | protected function _repository()
{
$source = $this->getSource();
if ($source === null) {
list(, $class) = namespaceSplit(get_class($this));
$source = Inflector::pluralize($class);
}
return TableRegistry::getTableLocator()->get($source);
} | php | protected function _repository()
{
$source = $this->getSource();
if ($source === null) {
list(, $class) = namespaceSplit(get_class($this));
$source = Inflector::pluralize($class);
}
return TableRegistry::getTableLocator()->get($source);
} | [
"protected",
"function",
"_repository",
"(",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"getSource",
"(",
")",
";",
"if",
"(",
"$",
"source",
"===",
"null",
")",
"{",
"list",
"(",
",",
"$",
"class",
")",
"=",
"namespaceSplit",
"(",
"get_class",... | Gets the repository for this entity
@return Table | [
"Gets",
"the",
"repository",
"for",
"this",
"entity"
] | 9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0 | https://github.com/jeremyharris/cakephp-lazyload/blob/9c4298a2aec0317e2d3223bbaa8d583fc69eb6a0/src/ORM/LazyLoadEntityTrait.php#L150-L159 |
43,827 | joomla-framework/database | src/Mysql/MysqlImporter.php | MysqlImporter.getKeySql | protected function getKeySql($columns)
{
// TODO Error checking on array and element types.
$kNonUnique = (string) $columns[0]['Non_unique'];
$kName = (string) $columns[0]['Key_name'];
$kColumn = (string) $columns[0]['Column_name'];
$prefix = '';
if ($kName === 'PRIMARY')
{
$prefix = 'PRIMARY ';
}
elseif ($kNonUnique == 0)
{
$prefix = 'UNIQUE ';
}
$nColumns = \count($columns);
$kColumns = array();
if ($nColumns === 1)
{
$kColumns[] = $this->db->quoteName($kColumn);
}
else
{
foreach ($columns as $column)
{
$kColumns[] = (string) $column['Column_name'];
}
}
$sql = $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
return $sql;
} | php | protected function getKeySql($columns)
{
// TODO Error checking on array and element types.
$kNonUnique = (string) $columns[0]['Non_unique'];
$kName = (string) $columns[0]['Key_name'];
$kColumn = (string) $columns[0]['Column_name'];
$prefix = '';
if ($kName === 'PRIMARY')
{
$prefix = 'PRIMARY ';
}
elseif ($kNonUnique == 0)
{
$prefix = 'UNIQUE ';
}
$nColumns = \count($columns);
$kColumns = array();
if ($nColumns === 1)
{
$kColumns[] = $this->db->quoteName($kColumn);
}
else
{
foreach ($columns as $column)
{
$kColumns[] = (string) $column['Column_name'];
}
}
$sql = $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
return $sql;
} | [
"protected",
"function",
"getKeySql",
"(",
"$",
"columns",
")",
"{",
"// TODO Error checking on array and element types.",
"$",
"kNonUnique",
"=",
"(",
"string",
")",
"$",
"columns",
"[",
"0",
"]",
"[",
"'Non_unique'",
"]",
";",
"$",
"kName",
"=",
"(",
"string... | Get the SQL syntax for a key.
@param array $columns An array of SimpleXMLElement objects comprising the key.
@return string
@since 1.0 | [
"Get",
"the",
"SQL",
"syntax",
"for",
"a",
"key",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysql/MysqlImporter.php#L338-L375 |
43,828 | joomla-framework/database | src/DatabaseDriver.php | DatabaseDriver.getServerType | public function getServerType()
{
if (empty($this->serverType))
{
$name = $this->getName();
if (stristr($name, 'mysql') !== false)
{
$this->serverType = 'mysql';
}
elseif (stristr($name, 'postgre') !== false)
{
$this->serverType = 'postgresql';
}
elseif (stristr($name, 'pgsql') !== false)
{
$this->serverType = 'postgresql';
}
elseif (stristr($name, 'oracle') !== false)
{
$this->serverType = 'oracle';
}
elseif (stristr($name, 'sqlite') !== false)
{
$this->serverType = 'sqlite';
}
elseif (stristr($name, 'sqlsrv') !== false)
{
$this->serverType = 'mssql';
}
elseif (stristr($name, 'sqlazure') !== false)
{
$this->serverType = 'mssql';
}
elseif (stristr($name, 'mssql') !== false)
{
$this->serverType = 'mssql';
}
else
{
$this->serverType = $name;
}
}
return $this->serverType;
} | php | public function getServerType()
{
if (empty($this->serverType))
{
$name = $this->getName();
if (stristr($name, 'mysql') !== false)
{
$this->serverType = 'mysql';
}
elseif (stristr($name, 'postgre') !== false)
{
$this->serverType = 'postgresql';
}
elseif (stristr($name, 'pgsql') !== false)
{
$this->serverType = 'postgresql';
}
elseif (stristr($name, 'oracle') !== false)
{
$this->serverType = 'oracle';
}
elseif (stristr($name, 'sqlite') !== false)
{
$this->serverType = 'sqlite';
}
elseif (stristr($name, 'sqlsrv') !== false)
{
$this->serverType = 'mssql';
}
elseif (stristr($name, 'sqlazure') !== false)
{
$this->serverType = 'mssql';
}
elseif (stristr($name, 'mssql') !== false)
{
$this->serverType = 'mssql';
}
else
{
$this->serverType = $name;
}
}
return $this->serverType;
} | [
"public",
"function",
"getServerType",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"serverType",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"stristr",
"(",
"$",
"name",
",",
"'mysql'",
... | Get the server family type.
If $this->serverType is not set it will attempt guessing the server family type from the driver name. If this is not possible the driver
name will be returned instead.
@return string
@since 1.4.0 | [
"Get",
"the",
"server",
"family",
"type",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseDriver.php#L735-L780 |
43,829 | joomla-framework/database | src/DatabaseDriver.php | DatabaseDriver.getQuery | public function getQuery($new = false)
{
if ($new)
{
// Derive the class name from the driver.
$class = '\\Joomla\\Database\\' . ucfirst($this->name) . '\\' . ucfirst($this->name) . 'Query';
// Make sure we have a query class for this driver.
if (!class_exists($class))
{
// If it doesn't exist we are at an impasse so throw an exception.
throw new Exception\UnsupportedAdapterException('Database Query Class not found.');
}
return new $class($this);
}
return $this->sql;
} | php | public function getQuery($new = false)
{
if ($new)
{
// Derive the class name from the driver.
$class = '\\Joomla\\Database\\' . ucfirst($this->name) . '\\' . ucfirst($this->name) . 'Query';
// Make sure we have a query class for this driver.
if (!class_exists($class))
{
// If it doesn't exist we are at an impasse so throw an exception.
throw new Exception\UnsupportedAdapterException('Database Query Class not found.');
}
return new $class($this);
}
return $this->sql;
} | [
"public",
"function",
"getQuery",
"(",
"$",
"new",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"new",
")",
"{",
"// Derive the class name from the driver.",
"$",
"class",
"=",
"'\\\\Joomla\\\\Database\\\\'",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"name",
")",
"... | Get the current query object or a new DatabaseQuery object.
@param boolean $new False to return the current query object, True to return a new DatabaseQuery object.
@return DatabaseQuery The current query object or a new object extending the DatabaseQuery class.
@since 1.0
@throws \RuntimeException | [
"Get",
"the",
"current",
"query",
"object",
"or",
"a",
"new",
"DatabaseQuery",
"object",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseDriver.php#L881-L899 |
43,830 | joomla-framework/database | src/DatabaseDriver.php | DatabaseDriver.quoteNameString | protected function quoteNameString($name, $asSinglePart = false)
{
$q = $this->nameQuote . $this->nameQuote;
// Double quote reserved keyword
$name = str_replace($q[1], $q[1] . $q[1], $name);
if ($asSinglePart)
{
return $q[0] . $name . $q[1];
}
return $q[0] . str_replace('.', "$q[1].$q[0]", $name) . $q[1];
} | php | protected function quoteNameString($name, $asSinglePart = false)
{
$q = $this->nameQuote . $this->nameQuote;
// Double quote reserved keyword
$name = str_replace($q[1], $q[1] . $q[1], $name);
if ($asSinglePart)
{
return $q[0] . $name . $q[1];
}
return $q[0] . str_replace('.', "$q[1].$q[0]", $name) . $q[1];
} | [
"protected",
"function",
"quoteNameString",
"(",
"$",
"name",
",",
"$",
"asSinglePart",
"=",
"false",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
"nameQuote",
".",
"$",
"this",
"->",
"nameQuote",
";",
"// Double quote reserved keyword",
"$",
"name",
"=",
"... | Quote string coming from quoteName call.
@param string $name Identifier name to be quoted.
@param boolean $asSinglePart Treat the name as a single part of the identifier.
@return string Quoted identifier string.
@since 1.7.0 | [
"Quote",
"string",
"coming",
"from",
"quoteName",
"call",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseDriver.php#L1548-L1561 |
43,831 | joomla-framework/database | src/DatabaseDriver.php | DatabaseDriver.setDebug | public function setDebug($level)
{
$previous = $this->debug;
$this->debug = (bool) $level;
return $previous;
} | php | public function setDebug($level)
{
$previous = $this->debug;
$this->debug = (bool) $level;
return $previous;
} | [
"public",
"function",
"setDebug",
"(",
"$",
"level",
")",
"{",
"$",
"previous",
"=",
"$",
"this",
"->",
"debug",
";",
"$",
"this",
"->",
"debug",
"=",
"(",
"bool",
")",
"$",
"level",
";",
"return",
"$",
"previous",
";",
"}"
] | Sets the database debugging state for the driver.
@param boolean $level True to enable debugging.
@return boolean The old debugging level.
@since 1.0 | [
"Sets",
"the",
"database",
"debugging",
"state",
"for",
"the",
"driver",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseDriver.php#L1739-L1745 |
43,832 | joomla-framework/database | src/Mysqli/MysqliDriver.php | MysqliDriver.setUtf | public function setUtf()
{
// If UTF is not supported return false immediately
if (!$this->utf)
{
return false;
}
// Make sure we're connected to the server
$this->connect();
// Which charset should I use, plain utf8 or multibyte utf8mb4?
$charset = $this->utf8mb4 && $this->options['utf8mb4'] ? 'utf8mb4' : 'utf8';
$result = @$this->connection->set_charset($charset);
/*
* If I could not set the utf8mb4 charset then the server doesn't support utf8mb4 despite claiming otherwise. This happens on old MySQL
* server versions (less than 5.5.3) using the mysqlnd PHP driver. Since mysqlnd masks the server version and reports only its own we
* can not be sure if the server actually does support UTF-8 Multibyte (i.e. it's MySQL 5.5.3 or later). Since the utf8mb4 charset is
* undefined in this case we catch the error and determine that utf8mb4 is not supported!
*/
if (!$result && $this->utf8mb4 && $this->options['utf8mb4'])
{
$this->utf8mb4 = false;
$result = @$this->connection->set_charset('utf8');
}
return $result;
} | php | public function setUtf()
{
// If UTF is not supported return false immediately
if (!$this->utf)
{
return false;
}
// Make sure we're connected to the server
$this->connect();
// Which charset should I use, plain utf8 or multibyte utf8mb4?
$charset = $this->utf8mb4 && $this->options['utf8mb4'] ? 'utf8mb4' : 'utf8';
$result = @$this->connection->set_charset($charset);
/*
* If I could not set the utf8mb4 charset then the server doesn't support utf8mb4 despite claiming otherwise. This happens on old MySQL
* server versions (less than 5.5.3) using the mysqlnd PHP driver. Since mysqlnd masks the server version and reports only its own we
* can not be sure if the server actually does support UTF-8 Multibyte (i.e. it's MySQL 5.5.3 or later). Since the utf8mb4 charset is
* undefined in this case we catch the error and determine that utf8mb4 is not supported!
*/
if (!$result && $this->utf8mb4 && $this->options['utf8mb4'])
{
$this->utf8mb4 = false;
$result = @$this->connection->set_charset('utf8');
}
return $result;
} | [
"public",
"function",
"setUtf",
"(",
")",
"{",
"// If UTF is not supported return false immediately",
"if",
"(",
"!",
"$",
"this",
"->",
"utf",
")",
"{",
"return",
"false",
";",
"}",
"// Make sure we're connected to the server",
"$",
"this",
"->",
"connect",
"(",
... | Set the connection to use UTF-8 character encoding.
@return boolean True on success.
@since 1.0 | [
"Set",
"the",
"connection",
"to",
"use",
"UTF",
"-",
"8",
"character",
"encoding",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliDriver.php#L800-L829 |
43,833 | joomla-framework/database | src/Mysqli/MysqliDriver.php | MysqliDriver.executeUnpreparedQuery | protected function executeUnpreparedQuery($sql)
{
$this->connect();
$cursor = $this->connection->query($sql);
// If an error occurred handle it.
if (!$cursor)
{
$this->errorNum = (int) $this->connection->errno;
$this->errorMsg = (string) $this->connection->error;
// Check if the server was disconnected.
if (!$this->connected())
{
try
{
// Attempt to reconnect.
$this->connection = null;
$this->connect();
}
catch (ConnectionFailureException $e)
{
// If connect fails, ignore that exception and throw the normal exception.
$this->log(
Log\LogLevel::ERROR,
'Database query failed (error #{code}): {message}; Failed query: {sql}',
array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
);
throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
}
// Since we were able to reconnect, run the query again.
return $this->executeUnpreparedQuery($sql);
}
// The server was not disconnected.
$this->log(
Log\LogLevel::ERROR,
'Database query failed (error #{code}): {message}; Failed query: {sql}',
array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
);
throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
}
$this->freeResult($cursor);
return true;
} | php | protected function executeUnpreparedQuery($sql)
{
$this->connect();
$cursor = $this->connection->query($sql);
// If an error occurred handle it.
if (!$cursor)
{
$this->errorNum = (int) $this->connection->errno;
$this->errorMsg = (string) $this->connection->error;
// Check if the server was disconnected.
if (!$this->connected())
{
try
{
// Attempt to reconnect.
$this->connection = null;
$this->connect();
}
catch (ConnectionFailureException $e)
{
// If connect fails, ignore that exception and throw the normal exception.
$this->log(
Log\LogLevel::ERROR,
'Database query failed (error #{code}): {message}; Failed query: {sql}',
array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
);
throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
}
// Since we were able to reconnect, run the query again.
return $this->executeUnpreparedQuery($sql);
}
// The server was not disconnected.
$this->log(
Log\LogLevel::ERROR,
'Database query failed (error #{code}): {message}; Failed query: {sql}',
array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
);
throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
}
$this->freeResult($cursor);
return true;
} | [
"protected",
"function",
"executeUnpreparedQuery",
"(",
"$",
"sql",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"cursor",
"=",
"$",
"this",
"->",
"connection",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"// If an error occurred handle it.",
... | Internal method to execute queries which cannot be run as prepared statements.
@param string $sql SQL statement to execute.
@return boolean
@since 1.5.0 | [
"Internal",
"method",
"to",
"execute",
"queries",
"which",
"cannot",
"be",
"run",
"as",
"prepared",
"statements",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliDriver.php#L931-L981 |
43,834 | joomla-framework/database | src/Sqlsrv/SqlsrvQuery.php | SqlsrvQuery.charLength | public function charLength($field, $operator = null, $condition = null)
{
return 'DATALENGTH(' . $field . ')' . (isset($operator, $condition) ? ' ' . $operator . ' ' . $condition : '');
} | php | public function charLength($field, $operator = null, $condition = null)
{
return 'DATALENGTH(' . $field . ')' . (isset($operator, $condition) ? ' ' . $operator . ' ' . $condition : '');
} | [
"public",
"function",
"charLength",
"(",
"$",
"field",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"condition",
"=",
"null",
")",
"{",
"return",
"'DATALENGTH('",
".",
"$",
"field",
".",
"')'",
".",
"(",
"isset",
"(",
"$",
"operator",
",",
"$",
"cond... | Gets the function to determine the length of a character string.
@param string $field A value.
@param string $operator Comparison operator between charLength integer value and $condition
@param string $condition Integer value to compare charLength with.
@return string The required char length call.
@since 1.0 | [
"Gets",
"the",
"function",
"to",
"determine",
"the",
"length",
"of",
"a",
"character",
"string",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvQuery.php#L226-L229 |
43,835 | joomla-framework/database | src/Pgsql/PgsqlDriver.php | PgsqlDriver.showTables | public function showTables()
{
$query = $this->getQuery(true)
->select('table_name')
->from('information_schema.tables')
->where('table_type=' . $this->quote('BASE TABLE'))
->where('table_schema NOT IN (' . $this->quote('pg_catalog') . ', ' . $this->quote('information_schema') . ' )');
$this->setQuery($query);
return $this->loadColumn();
} | php | public function showTables()
{
$query = $this->getQuery(true)
->select('table_name')
->from('information_schema.tables')
->where('table_type=' . $this->quote('BASE TABLE'))
->where('table_schema NOT IN (' . $this->quote('pg_catalog') . ', ' . $this->quote('information_schema') . ' )');
$this->setQuery($query);
return $this->loadColumn();
} | [
"public",
"function",
"showTables",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getQuery",
"(",
"true",
")",
"->",
"select",
"(",
"'table_name'",
")",
"->",
"from",
"(",
"'information_schema.tables'",
")",
"->",
"where",
"(",
"'table_type='",
"."... | Returns an array containing database's table list.
@return array The database's table list.
@since 1.5.0 | [
"Returns",
"an",
"array",
"containing",
"database",
"s",
"table",
"list",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Pgsql/PgsqlDriver.php#L723-L734 |
43,836 | joomla-framework/database | src/Pgsql/PgsqlDriver.php | PgsqlDriver.getCreateDbQuery | public function getCreateDbQuery($options, $utf)
{
$query = 'CREATE DATABASE ' . $this->quoteName($options->db_name) . ' OWNER ' . $this->quoteName($options->db_user);
if ($utf)
{
$query .= ' ENCODING ' . $this->quote('UTF-8');
}
return $query;
} | php | public function getCreateDbQuery($options, $utf)
{
$query = 'CREATE DATABASE ' . $this->quoteName($options->db_name) . ' OWNER ' . $this->quoteName($options->db_user);
if ($utf)
{
$query .= ' ENCODING ' . $this->quote('UTF-8');
}
return $query;
} | [
"public",
"function",
"getCreateDbQuery",
"(",
"$",
"options",
",",
"$",
"utf",
")",
"{",
"$",
"query",
"=",
"'CREATE DATABASE '",
".",
"$",
"this",
"->",
"quoteName",
"(",
"$",
"options",
"->",
"db_name",
")",
".",
"' OWNER '",
".",
"$",
"this",
"->",
... | Get the query string to create new Database in correct PostgreSQL syntax.
@param object $options object coming from "initialise" function to pass user and database name to database driver.
@param boolean $utf True if the database supports the UTF-8 character set, not used in PostgreSQL "CREATE DATABASE" query.
@return string The query that creates database, owned by $options['user']
@since 1.5.0 | [
"Get",
"the",
"query",
"string",
"to",
"create",
"new",
"Database",
"in",
"correct",
"PostgreSQL",
"syntax",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Pgsql/PgsqlDriver.php#L793-L803 |
43,837 | joomla-framework/database | src/DatabaseExporter.php | DatabaseExporter.from | public function from($from)
{
if (\is_string($from))
{
$this->from = array($from);
}
elseif (\is_array($from))
{
$this->from = $from;
}
else
{
throw new \Exception('The exporter requires either a single table name or array of table names');
}
return $this;
} | php | public function from($from)
{
if (\is_string($from))
{
$this->from = array($from);
}
elseif (\is_array($from))
{
$this->from = $from;
}
else
{
throw new \Exception('The exporter requires either a single table name or array of table names');
}
return $this;
} | [
"public",
"function",
"from",
"(",
"$",
"from",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"from",
")",
")",
"{",
"$",
"this",
"->",
"from",
"=",
"array",
"(",
"$",
"from",
")",
";",
"}",
"elseif",
"(",
"\\",
"is_array",
"(",
"$",
"from"... | Specifies a list of table names to export.
@param mixed $from The name of a single table, or an array of the table names to export.
@return DatabaseExporter Method supports chaining.
@since 1.0
@throws \Exception if input is not a string or array. | [
"Specifies",
"a",
"list",
"of",
"table",
"names",
"to",
"export",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseExporter.php#L170-L186 |
43,838 | joomla-framework/database | src/DatabaseExporter.php | DatabaseExporter.getGenericTableName | protected function getGenericTableName($table)
{
$prefix = $this->db->getPrefix();
// Replace the magic prefix if found.
$table = preg_replace("|^$prefix|", '#__', $table);
return $table;
} | php | protected function getGenericTableName($table)
{
$prefix = $this->db->getPrefix();
// Replace the magic prefix if found.
$table = preg_replace("|^$prefix|", '#__', $table);
return $table;
} | [
"protected",
"function",
"getGenericTableName",
"(",
"$",
"table",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"db",
"->",
"getPrefix",
"(",
")",
";",
"// Replace the magic prefix if found.",
"$",
"table",
"=",
"preg_replace",
"(",
"\"|^$prefix|\"",
",",
... | Get the generic name of the table, converting the database prefix to the wildcard string.
@param string $table The name of the table.
@return string The name of the table with the database prefix replaced with #__.
@since 1.0 | [
"Get",
"the",
"generic",
"name",
"of",
"the",
"table",
"converting",
"the",
"database",
"prefix",
"to",
"the",
"wildcard",
"string",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseExporter.php#L197-L205 |
43,839 | joomla-framework/database | src/DatabaseIterator.php | DatabaseIterator.next | public function next()
{
// Set the default key as being the number of fetched object
$this->key = $this->fetched;
// Try to get an object
$this->current = $this->fetchObject();
// If an object has been found
if ($this->current)
{
// Set the key as being the indexed column (if it exists)
if (isset($this->current->{$this->column}))
{
$this->key = $this->current->{$this->column};
}
// Update the number of fetched object
$this->fetched++;
}
} | php | public function next()
{
// Set the default key as being the number of fetched object
$this->key = $this->fetched;
// Try to get an object
$this->current = $this->fetchObject();
// If an object has been found
if ($this->current)
{
// Set the key as being the indexed column (if it exists)
if (isset($this->current->{$this->column}))
{
$this->key = $this->current->{$this->column};
}
// Update the number of fetched object
$this->fetched++;
}
} | [
"public",
"function",
"next",
"(",
")",
"{",
"// Set the default key as being the number of fetched object",
"$",
"this",
"->",
"key",
"=",
"$",
"this",
"->",
"fetched",
";",
"// Try to get an object",
"$",
"this",
"->",
"current",
"=",
"$",
"this",
"->",
"fetchOb... | Moves forward to the next result from the SQL query.
@return void
@see Iterator::next()
@since 1.0 | [
"Moves",
"forward",
"to",
"the",
"next",
"result",
"from",
"the",
"SQL",
"query",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseIterator.php#L147-L167 |
43,840 | joomla-framework/database | src/DatabaseImporter.php | DatabaseImporter.getAddColumnSQL | protected function getAddColumnSQL($table, \SimpleXMLElement $field)
{
$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD COLUMN ' . $this->getColumnSQL($field);
return $sql;
} | php | protected function getAddColumnSQL($table, \SimpleXMLElement $field)
{
$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD COLUMN ' . $this->getColumnSQL($field);
return $sql;
} | [
"protected",
"function",
"getAddColumnSQL",
"(",
"$",
"table",
",",
"\\",
"SimpleXMLElement",
"$",
"field",
")",
"{",
"$",
"sql",
"=",
"'ALTER TABLE '",
".",
"$",
"this",
"->",
"db",
"->",
"quoteName",
"(",
"$",
"table",
")",
".",
"' ADD COLUMN '",
".",
... | Get the SQL syntax to add a column.
@param string $table The table name.
@param \SimpleXMLElement $field The XML field definition.
@return string
@since 1.0 | [
"Get",
"the",
"SQL",
"syntax",
"to",
"add",
"a",
"column",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseImporter.php#L134-L139 |
43,841 | joomla-framework/database | src/DatabaseImporter.php | DatabaseImporter.getRealTableName | protected function getRealTableName($table)
{
$prefix = $this->db->getPrefix();
// Replace the magic prefix if found.
$table = preg_replace('|^#__|', $prefix, $table);
return $table;
} | php | protected function getRealTableName($table)
{
$prefix = $this->db->getPrefix();
// Replace the magic prefix if found.
$table = preg_replace('|^#__|', $prefix, $table);
return $table;
} | [
"protected",
"function",
"getRealTableName",
"(",
"$",
"table",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"db",
"->",
"getPrefix",
"(",
")",
";",
"// Replace the magic prefix if found.",
"$",
"table",
"=",
"preg_replace",
"(",
"'|^#__|'",
",",
"$",
"p... | Get the real name of the table, converting the prefix wildcard string if present.
@param string $table The name of the table.
@return string The real name of the table.
@since 1.0 | [
"Get",
"the",
"real",
"name",
"of",
"the",
"table",
"converting",
"the",
"prefix",
"wildcard",
"string",
"if",
"present",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseImporter.php#L221-L229 |
43,842 | joomla-framework/database | src/Mysqli/MysqliExporter.php | MysqliExporter.buildXml | protected function buildXml()
{
$buffer = array();
$buffer[] = '<?xml version="1.0"?>';
$buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
$buffer[] = ' <database name="">';
$buffer = array_merge($buffer, $this->buildXmlStructure());
$buffer[] = ' </database>';
$buffer[] = '</mysqldump>';
return implode("\n", $buffer);
} | php | protected function buildXml()
{
$buffer = array();
$buffer[] = '<?xml version="1.0"?>';
$buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
$buffer[] = ' <database name="">';
$buffer = array_merge($buffer, $this->buildXmlStructure());
$buffer[] = ' </database>';
$buffer[] = '</mysqldump>';
return implode("\n", $buffer);
} | [
"protected",
"function",
"buildXml",
"(",
")",
"{",
"$",
"buffer",
"=",
"array",
"(",
")",
";",
"$",
"buffer",
"[",
"]",
"=",
"'<?xml version=\"1.0\"?>'",
";",
"$",
"buffer",
"[",
"]",
"=",
"'<mysqldump xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'",
"... | Builds the XML data for the tables to export.
@return string An XML string
@since 1.0
@throws \Exception if an error occurs. | [
"Builds",
"the",
"XML",
"data",
"for",
"the",
"tables",
"to",
"export",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliExporter.php#L28-L42 |
43,843 | joomla-framework/database | src/Postgresql/PostgresqlQuery.php | PostgresqlQuery.forUpdate | public function forUpdate($table_name, $glue = ',')
{
$this->type = 'forUpdate';
if ($this->forUpdate === null)
{
$glue = strtoupper($glue);
$this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $table_name, "$glue ");
}
else
{
$this->forUpdate->append($table_name);
}
return $this;
} | php | public function forUpdate($table_name, $glue = ',')
{
$this->type = 'forUpdate';
if ($this->forUpdate === null)
{
$glue = strtoupper($glue);
$this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $table_name, "$glue ");
}
else
{
$this->forUpdate->append($table_name);
}
return $this;
} | [
"public",
"function",
"forUpdate",
"(",
"$",
"table_name",
",",
"$",
"glue",
"=",
"','",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"'forUpdate'",
";",
"if",
"(",
"$",
"this",
"->",
"forUpdate",
"===",
"null",
")",
"{",
"$",
"glue",
"=",
"strtoupper",... | Sets the FOR UPDATE lock on select's output row
@param string $table_name The table to lock
@param string $glue The glue by which to join the conditions. Defaults to ',' .
@return PostgresqlQuery FOR UPDATE query element
@since 1.0 | [
"Sets",
"the",
"FOR",
"UPDATE",
"lock",
"on",
"select",
"s",
"output",
"row"
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L435-L450 |
43,844 | joomla-framework/database | src/Postgresql/PostgresqlQuery.php | PostgresqlQuery.noWait | public function noWait()
{
$this->type = 'noWait';
if ($this->noWait === null)
{
$this->noWait = new QueryElement('NOWAIT', null);
}
return $this;
} | php | public function noWait()
{
$this->type = 'noWait';
if ($this->noWait === null)
{
$this->noWait = new QueryElement('NOWAIT', null);
}
return $this;
} | [
"public",
"function",
"noWait",
"(",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"'noWait'",
";",
"if",
"(",
"$",
"this",
"->",
"noWait",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"noWait",
"=",
"new",
"QueryElement",
"(",
"'NOWAIT'",
",",
"null",
... | Sets the NOWAIT lock on select's output row
@return PostgresqlQuery NOWAIT query element
@since 1.0 | [
"Sets",
"the",
"NOWAIT",
"lock",
"on",
"select",
"s",
"output",
"row"
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L588-L598 |
43,845 | joomla-framework/database | src/Postgresql/PostgresqlQuery.php | PostgresqlQuery.setLimit | public function setLimit($limit = 0, $offset = 0)
{
$this->limit = (int) $limit;
$this->offset = (int) $offset;
return $this;
} | php | public function setLimit($limit = 0, $offset = 0)
{
$this->limit = (int) $limit;
$this->offset = (int) $offset;
return $this;
} | [
"public",
"function",
"setLimit",
"(",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"limit",
"=",
"(",
"int",
")",
"$",
"limit",
";",
"$",
"this",
"->",
"offset",
"=",
"(",
"int",
")",
"$",
"offset",
";",
... | Sets the offset and limit for the result set, if the database driver supports it.
Usage:
$query->setLimit(100, 0); (retrieve 100 rows, starting at first record)
$query->setLimit(50, 50); (retrieve 50 rows, starting at 50th record)
@param integer $limit The limit for the result set
@param integer $offset The offset for the result set
@return PostgresqlQuery Returns this object to allow chaining.
@since 1.0 | [
"Sets",
"the",
"offset",
"and",
"limit",
"for",
"the",
"result",
"set",
"if",
"the",
"database",
"driver",
"supports",
"it",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L671-L677 |
43,846 | joomla-framework/database | src/Postgresql/PostgresqlQuery.php | PostgresqlQuery.dateAdd | public function dateAdd($date, $interval, $datePart)
{
if (substr($interval, 0, 1) !== '-')
{
return "timestamp " . $date . " + interval '" . $interval . " " . $datePart . "'";
}
return "timestamp " . $date . " - interval '" . ltrim($interval, '-') . " " . $datePart . "'";
} | php | public function dateAdd($date, $interval, $datePart)
{
if (substr($interval, 0, 1) !== '-')
{
return "timestamp " . $date . " + interval '" . $interval . " " . $datePart . "'";
}
return "timestamp " . $date . " - interval '" . ltrim($interval, '-') . " " . $datePart . "'";
} | [
"public",
"function",
"dateAdd",
"(",
"$",
"date",
",",
"$",
"interval",
",",
"$",
"datePart",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"interval",
",",
"0",
",",
"1",
")",
"!==",
"'-'",
")",
"{",
"return",
"\"timestamp \"",
".",
"$",
"date",
".",
... | Add to the current date and time.
Usage:
$query->select($query->dateAdd());
Prefixing the interval with a - (negative sign) will cause subtraction to be used.
@param string $date The db quoted string representation of the date to add to
@param string $interval The string representation of the appropriate number of units
@param string $datePart The part of the date to perform the addition on
@return string The string with the appropriate sql for addition of dates
@since 1.5.0
@link http://www.postgresql.org/docs/9.0/static/functions-datetime.html. | [
"Add",
"to",
"the",
"current",
"date",
"and",
"time",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L724-L732 |
43,847 | joomla-framework/database | src/Mysqli/MysqliImporter.php | MysqliImporter.xmlToCreate | protected function xmlToCreate(\SimpleXMLElement $table)
{
$existingTables = $this->db->getTableList();
$tableName = (string) $table['name'];
if (\in_array($tableName, $existingTables, true))
{
throw new \RuntimeException('The table you are trying to create already exists');
}
$createTableStatement = 'CREATE TABLE ' . $this->db->quoteName($tableName) . ' (';
foreach ($table->xpath('field') as $field)
{
$createTableStatement .= $this->getColumnSQL($field) . ', ';
}
foreach ($table->xpath('key') as $key)
{
$createTableStatement .= $this->getKeySQL(array($key)) . ', ';
}
$createTableStatement = rtrim($createTableStatement, ', ');
$createTableStatement .= ')';
return $createTableStatement;
} | php | protected function xmlToCreate(\SimpleXMLElement $table)
{
$existingTables = $this->db->getTableList();
$tableName = (string) $table['name'];
if (\in_array($tableName, $existingTables, true))
{
throw new \RuntimeException('The table you are trying to create already exists');
}
$createTableStatement = 'CREATE TABLE ' . $this->db->quoteName($tableName) . ' (';
foreach ($table->xpath('field') as $field)
{
$createTableStatement .= $this->getColumnSQL($field) . ', ';
}
foreach ($table->xpath('key') as $key)
{
$createTableStatement .= $this->getKeySQL(array($key)) . ', ';
}
$createTableStatement = rtrim($createTableStatement, ', ');
$createTableStatement .= ')';
return $createTableStatement;
} | [
"protected",
"function",
"xmlToCreate",
"(",
"\\",
"SimpleXMLElement",
"$",
"table",
")",
"{",
"$",
"existingTables",
"=",
"$",
"this",
"->",
"db",
"->",
"getTableList",
"(",
")",
";",
"$",
"tableName",
"=",
"(",
"string",
")",
"$",
"table",
"[",
"'name'... | Get the SQL syntax to add a table.
@param \SimpleXMLElement $table The table information.
@return string
@since 1.4.0
@throws \RuntimeException | [
"Get",
"the",
"SQL",
"syntax",
"to",
"add",
"a",
"table",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliImporter.php#L55-L82 |
43,848 | joomla-framework/database | src/Mysqli/MysqliImporter.php | MysqliImporter.getColumnSql | protected function getColumnSql(\SimpleXMLElement $field)
{
// TODO Incorporate into parent class and use $this.
$blobs = array('text', 'smalltext', 'mediumtext', 'largetext');
$fName = (string) $field['Field'];
$fType = (string) $field['Type'];
$fNull = (string) $field['Null'];
$fDefault = isset($field['Default']) ? (string) $field['Default'] : null;
$fExtra = (string) $field['Extra'];
$sql = $this->db->quoteName($fName) . ' ' . $fType;
if ($fNull === 'NO')
{
if ($fDefault === null || \in_array($fType, $blobs, true))
{
$sql .= ' NOT NULL';
}
else
{
// TODO Don't quote numeric values.
$sql .= ' NOT NULL DEFAULT ' . $this->db->quote($fDefault);
}
}
else
{
if ($fDefault === null)
{
$sql .= ' DEFAULT NULL';
}
else
{
// TODO Don't quote numeric values.
$sql .= ' DEFAULT ' . $this->db->quote($fDefault);
}
}
if ($fExtra)
{
$sql .= ' ' . strtoupper($fExtra);
}
return $sql;
} | php | protected function getColumnSql(\SimpleXMLElement $field)
{
// TODO Incorporate into parent class and use $this.
$blobs = array('text', 'smalltext', 'mediumtext', 'largetext');
$fName = (string) $field['Field'];
$fType = (string) $field['Type'];
$fNull = (string) $field['Null'];
$fDefault = isset($field['Default']) ? (string) $field['Default'] : null;
$fExtra = (string) $field['Extra'];
$sql = $this->db->quoteName($fName) . ' ' . $fType;
if ($fNull === 'NO')
{
if ($fDefault === null || \in_array($fType, $blobs, true))
{
$sql .= ' NOT NULL';
}
else
{
// TODO Don't quote numeric values.
$sql .= ' NOT NULL DEFAULT ' . $this->db->quote($fDefault);
}
}
else
{
if ($fDefault === null)
{
$sql .= ' DEFAULT NULL';
}
else
{
// TODO Don't quote numeric values.
$sql .= ' DEFAULT ' . $this->db->quote($fDefault);
}
}
if ($fExtra)
{
$sql .= ' ' . strtoupper($fExtra);
}
return $sql;
} | [
"protected",
"function",
"getColumnSql",
"(",
"\\",
"SimpleXMLElement",
"$",
"field",
")",
"{",
"// TODO Incorporate into parent class and use $this.",
"$",
"blobs",
"=",
"array",
"(",
"'text'",
",",
"'smalltext'",
",",
"'mediumtext'",
",",
"'largetext'",
")",
";",
... | Get the SQL syntax for a single column that would be included in a table create or alter statement.
@param \SimpleXMLElement $field The XML field definition.
@return string
@since 1.0 | [
"Get",
"the",
"SQL",
"syntax",
"for",
"a",
"single",
"column",
"that",
"would",
"be",
"included",
"in",
"a",
"table",
"create",
"or",
"alter",
"statement",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliImporter.php#L277-L321 |
43,849 | joomla-framework/database | src/Sqlsrv/SqlsrvDriver.php | SqlsrvDriver.renameConstraints | protected function renameConstraints($constraints = array(), $prefix = null, $backup = null)
{
$this->connect();
foreach ($constraints as $constraint)
{
$this->setQuery('sp_rename ' . $constraint . ',' . str_replace($prefix, $backup, $constraint));
$this->execute();
}
} | php | protected function renameConstraints($constraints = array(), $prefix = null, $backup = null)
{
$this->connect();
foreach ($constraints as $constraint)
{
$this->setQuery('sp_rename ' . $constraint . ',' . str_replace($prefix, $backup, $constraint));
$this->execute();
}
} | [
"protected",
"function",
"renameConstraints",
"(",
"$",
"constraints",
"=",
"array",
"(",
")",
",",
"$",
"prefix",
"=",
"null",
",",
"$",
"backup",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"foreach",
"(",
"$",
"constraints",
... | Rename constraints.
@param array $constraints Array(strings) of table constraints
@param string $prefix A string
@param string $backup A string
@return void
@since 1.0 | [
"Rename",
"constraints",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L206-L215 |
43,850 | joomla-framework/database | src/Sqlsrv/SqlsrvDriver.php | SqlsrvDriver.checkFieldExists | protected function checkFieldExists($table, $field)
{
$this->connect();
$table = $this->replacePrefix((string) $table);
$this->setQuery(
"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field' ORDER BY ORDINAL_POSITION"
);
if ($this->loadResult())
{
return true;
}
return false;
} | php | protected function checkFieldExists($table, $field)
{
$this->connect();
$table = $this->replacePrefix((string) $table);
$this->setQuery(
"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field' ORDER BY ORDINAL_POSITION"
);
if ($this->loadResult())
{
return true;
}
return false;
} | [
"protected",
"function",
"checkFieldExists",
"(",
"$",
"table",
",",
"$",
"field",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"replacePrefix",
"(",
"(",
"string",
")",
"$",
"table",
")",
";",
"$",
"... | Method to check and see if a field exists in a table.
@param string $table The table in which to verify the field.
@param string $field The field to verify.
@return boolean True if the field exists in the table.
@since 1.0 | [
"Method",
"to",
"check",
"and",
"see",
"if",
"a",
"field",
"exists",
"in",
"a",
"table",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L1056-L1071 |
43,851 | joomla-framework/database | src/Sqlsrv/SqlsrvDriver.php | SqlsrvDriver.limit | protected function limit($sql, $limit, $offset)
{
$orderBy = stristr($sql, 'ORDER BY');
if ($orderBy === null || empty($orderBy))
{
$orderBy = 'ORDER BY (select 0)';
}
$sql = str_ireplace($orderBy, '', $sql);
$rowNumberText = ',ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM ';
$sql = preg_replace('/\\s+FROM/', '\\1 ' . $rowNumberText . ' ', $sql, 1);
$sql = 'SELECT TOP ' . $this->limit . ' * FROM (' . $sql . ') _myResults WHERE RowNumber > ' . $this->offset;
return $sql;
} | php | protected function limit($sql, $limit, $offset)
{
$orderBy = stristr($sql, 'ORDER BY');
if ($orderBy === null || empty($orderBy))
{
$orderBy = 'ORDER BY (select 0)';
}
$sql = str_ireplace($orderBy, '', $sql);
$rowNumberText = ',ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM ';
$sql = preg_replace('/\\s+FROM/', '\\1 ' . $rowNumberText . ' ', $sql, 1);
$sql = 'SELECT TOP ' . $this->limit . ' * FROM (' . $sql . ') _myResults WHERE RowNumber > ' . $this->offset;
return $sql;
} | [
"protected",
"function",
"limit",
"(",
"$",
"sql",
",",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"$",
"orderBy",
"=",
"stristr",
"(",
"$",
"sql",
",",
"'ORDER BY'",
")",
";",
"if",
"(",
"$",
"orderBy",
"===",
"null",
"||",
"empty",
"(",
"$",
"... | Method to wrap an SQL statement to provide a LIMIT and OFFSET behavior for scrolling through a result set.
@param string $sql The SQL statement to process.
@param integer $limit The maximum affected rows to set.
@param integer $offset The affected row offset to set.
@return string The processed SQL statement.
@since 1.0 | [
"Method",
"to",
"wrap",
"an",
"SQL",
"statement",
"to",
"provide",
"a",
"LIMIT",
"and",
"OFFSET",
"behavior",
"for",
"scrolling",
"through",
"a",
"result",
"set",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L1084-L1101 |
43,852 | joomla-framework/database | src/DatabaseQuery.php | DatabaseQuery.extendWhere | public function extendWhere($outerGlue, $conditions, $innerGlue = 'AND')
{
// Replace the current WHERE with a new one which has the old one as an unnamed child.
$this->where = new Query\QueryElement('WHERE', $this->where->setName('()'), " $outerGlue ");
// Append the new conditions as a new unnamed child.
$this->where->append(new Query\QueryElement('()', $conditions, " $innerGlue "));
return $this;
} | php | public function extendWhere($outerGlue, $conditions, $innerGlue = 'AND')
{
// Replace the current WHERE with a new one which has the old one as an unnamed child.
$this->where = new Query\QueryElement('WHERE', $this->where->setName('()'), " $outerGlue ");
// Append the new conditions as a new unnamed child.
$this->where->append(new Query\QueryElement('()', $conditions, " $innerGlue "));
return $this;
} | [
"public",
"function",
"extendWhere",
"(",
"$",
"outerGlue",
",",
"$",
"conditions",
",",
"$",
"innerGlue",
"=",
"'AND'",
")",
"{",
"// Replace the current WHERE with a new one which has the old one as an unnamed child.",
"$",
"this",
"->",
"where",
"=",
"new",
"Query",
... | Extend the WHERE clause with a single condition or an array of conditions, with a potentially
different logical operator from the one in the current WHERE clause.
Usage:
$query->where(array('a = 1', 'b = 2'))->extendWhere('XOR', array('c = 3', 'd = 4'));
will produce: WHERE ((a = 1 AND b = 2) XOR (c = 3 AND d = 4)
@param string $outerGlue The glue by which to join the conditions to the current WHERE conditions.
@param mixed $conditions A string or array of WHERE conditions.
@param string $innerGlue The glue by which to join the conditions. Defaults to AND.
@return DatabaseQuery Returns this object to allow chaining.
@since 1.3.0 | [
"Extend",
"the",
"WHERE",
"clause",
"with",
"a",
"single",
"condition",
"or",
"an",
"array",
"of",
"conditions",
"with",
"a",
"potentially",
"different",
"logical",
"operator",
"from",
"the",
"one",
"in",
"the",
"current",
"WHERE",
"clause",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseQuery.php#L1524-L1533 |
43,853 | joomla-framework/database | src/DatabaseQuery.php | DatabaseQuery.unionDistinct | public function unionDistinct($query, $glue = '')
{
$distinct = true;
// Apply the distinct flag to the union.
return $this->union($query, $distinct, $glue);
} | php | public function unionDistinct($query, $glue = '')
{
$distinct = true;
// Apply the distinct flag to the union.
return $this->union($query, $distinct, $glue);
} | [
"public",
"function",
"unionDistinct",
"(",
"$",
"query",
",",
"$",
"glue",
"=",
"''",
")",
"{",
"$",
"distinct",
"=",
"true",
";",
"// Apply the distinct flag to the union.",
"return",
"$",
"this",
"->",
"union",
"(",
"$",
"query",
",",
"$",
"distinct",
"... | Add a query to UNION DISTINCT with the current query. Simply a proxy to Union with the Distinct clause.
Usage:
$query->unionDistinct('SELECT name FROM #__foo')
@param DatabaseQuery|string $query The DatabaseQuery object or string to union.
@param string $glue The glue by which to join the conditions.
@return DatabaseQuery Returns this object to allow chaining.
@since 1.0 | [
"Add",
"a",
"query",
"to",
"UNION",
"DISTINCT",
"with",
"the",
"current",
"query",
".",
"Simply",
"a",
"proxy",
"to",
"Union",
"with",
"the",
"Distinct",
"clause",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseQuery.php#L1698-L1704 |
43,854 | joomla-framework/database | src/Postgresql/PostgresqlDriver.php | PostgresqlDriver.getQuery | public function getQuery($new = false, $asObj = false)
{
if ($new)
{
// Make sure we have a query class for this driver.
if (!class_exists('\\Joomla\\Database\\Postgresql\\PostgresqlQuery'))
{
throw new UnsupportedAdapterException('\\Joomla\\Database\\Postgresql\\PostgresqlQuery Class not found.');
}
$this->queryObject = new PostgresqlQuery($this);
return $this->queryObject;
}
if ($asObj)
{
return $this->queryObject;
}
return $this->sql;
} | php | public function getQuery($new = false, $asObj = false)
{
if ($new)
{
// Make sure we have a query class for this driver.
if (!class_exists('\\Joomla\\Database\\Postgresql\\PostgresqlQuery'))
{
throw new UnsupportedAdapterException('\\Joomla\\Database\\Postgresql\\PostgresqlQuery Class not found.');
}
$this->queryObject = new PostgresqlQuery($this);
return $this->queryObject;
}
if ($asObj)
{
return $this->queryObject;
}
return $this->sql;
} | [
"public",
"function",
"getQuery",
"(",
"$",
"new",
"=",
"false",
",",
"$",
"asObj",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"new",
")",
"{",
"// Make sure we have a query class for this driver.",
"if",
"(",
"!",
"class_exists",
"(",
"'\\\\Joomla\\\\Database\\\\P... | Get the current or query, or new DatabaseQuery object.
@param boolean $new False to return the last query set, True to return a new Query object.
@param boolean $asObj False to return last query as string, true to get Postgresql query object.
@return PostgresqlQuery The current query object or a new object extending the Query class.
@since 1.0
@throws \RuntimeException | [
"Get",
"the",
"current",
"or",
"query",
"or",
"new",
"DatabaseQuery",
"object",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L375-L396 |
43,855 | joomla-framework/database | src/Postgresql/PostgresqlDriver.php | PostgresqlDriver.getStringPositionSql | public function getStringPositionSql($substring, $string)
{
$this->connect();
$query = "SELECT POSITION( $substring IN $string )";
$this->setQuery($query);
$position = $this->loadRow();
return $position['position'];
} | php | public function getStringPositionSql($substring, $string)
{
$this->connect();
$query = "SELECT POSITION( $substring IN $string )";
$this->setQuery($query);
$position = $this->loadRow();
return $position['position'];
} | [
"public",
"function",
"getStringPositionSql",
"(",
"$",
"substring",
",",
"$",
"string",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"query",
"=",
"\"SELECT POSITION( $substring IN $string )\"",
";",
"$",
"this",
"->",
"setQuery",
"(",
"$",
"... | Get the substring position inside a string
@param string $substring The string being sought
@param string $string The string/column being searched
@return integer The position of $substring in $string
@since 1.0 | [
"Get",
"the",
"substring",
"position",
"inside",
"a",
"string"
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1323-L1332 |
43,856 | joomla-framework/database | src/Postgresql/PostgresqlDriver.php | PostgresqlDriver.releaseTransactionSavepoint | public function releaseTransactionSavepoint($savepointName)
{
$this->connect();
$this->setQuery('RELEASE SAVEPOINT ' . $this->quoteName($this->escape($savepointName)));
$this->execute();
} | php | public function releaseTransactionSavepoint($savepointName)
{
$this->connect();
$this->setQuery('RELEASE SAVEPOINT ' . $this->quoteName($this->escape($savepointName)));
$this->execute();
} | [
"public",
"function",
"releaseTransactionSavepoint",
"(",
"$",
"savepointName",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"this",
"->",
"setQuery",
"(",
"'RELEASE SAVEPOINT '",
".",
"$",
"this",
"->",
"quoteName",
"(",
"$",
"this",
"->",
... | Method to release a savepoint.
@param string $savepointName Savepoint's name to release
@return void
@since 1.0 | [
"Method",
"to",
"release",
"a",
"savepoint",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1476-L1481 |
43,857 | joomla-framework/database | src/Postgresql/PostgresqlDriver.php | PostgresqlDriver.transactionSavepoint | public function transactionSavepoint($savepointName)
{
$this->connect();
$this->setQuery('SAVEPOINT ' . $this->quoteName($this->escape($savepointName)));
$this->execute();
} | php | public function transactionSavepoint($savepointName)
{
$this->connect();
$this->setQuery('SAVEPOINT ' . $this->quoteName($this->escape($savepointName)));
$this->execute();
} | [
"public",
"function",
"transactionSavepoint",
"(",
"$",
"savepointName",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"this",
"->",
"setQuery",
"(",
"'SAVEPOINT '",
".",
"$",
"this",
"->",
"quoteName",
"(",
"$",
"this",
"->",
"escape",
"("... | Method to create a savepoint.
@param string $savepointName Savepoint's name to create
@return void
@since 1.0 | [
"Method",
"to",
"create",
"a",
"savepoint",
"."
] | 90a6b42fec66f735e5e871d1fb2a8202c2a3216f | https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1492-L1497 |
43,858 | webcomm/magento-boilerplate | src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Resource/Setup.php | Webcomm_MagentoBoilerplate_Helper_Resource_Setup.removeConfigData | public function removeConfigData($path)
{
$values = Mage::getModel('core/config_data')
->getCollection()
->addFieldToFilter('path', $path);
foreach ($values as $value) {
$value->delete();
}
return $this;
} | php | public function removeConfigData($path)
{
$values = Mage::getModel('core/config_data')
->getCollection()
->addFieldToFilter('path', $path);
foreach ($values as $value) {
$value->delete();
}
return $this;
} | [
"public",
"function",
"removeConfigData",
"(",
"$",
"path",
")",
"{",
"$",
"values",
"=",
"Mage",
"::",
"getModel",
"(",
"'core/config_data'",
")",
"->",
"getCollection",
"(",
")",
"->",
"addFieldToFilter",
"(",
"'path'",
",",
"$",
"path",
")",
";",
"forea... | Remove config data with the given path. These may be a string
that matches the key to remove, or an array suitable to
be passed to Magento's query builder instead.
@param mixed $path
@return void | [
"Remove",
"config",
"data",
"with",
"the",
"given",
"path",
".",
"These",
"may",
"be",
"a",
"string",
"that",
"matches",
"the",
"key",
"to",
"remove",
"or",
"an",
"array",
"suitable",
"to",
"be",
"passed",
"to",
"Magento",
"s",
"query",
"builder",
"inste... | 02e09af4520e6dc44bb74928dc79ac20c8fe801e | https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Resource/Setup.php#L13-L24 |
43,859 | webcomm/magento-boilerplate | src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php | Webcomm_MagentoBoilerplate_Helper_Data.getAsset | protected function getAsset($name)
{
$manifest = $this->getAssetsManifest();
if (array_key_exists($name, $manifest)) {
return $manifest[$name];
}
return $name;
} | php | protected function getAsset($name)
{
$manifest = $this->getAssetsManifest();
if (array_key_exists($name, $manifest)) {
return $manifest[$name];
}
return $name;
} | [
"protected",
"function",
"getAsset",
"(",
"$",
"name",
")",
"{",
"$",
"manifest",
"=",
"$",
"this",
"->",
"getAssetsManifest",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"manifest",
")",
")",
"{",
"return",
"$",
"manifest... | Get an asset by name, utilising the manifest where possibel.
@param string $name
@return string | [
"Get",
"an",
"asset",
"by",
"name",
"utilising",
"the",
"manifest",
"where",
"possibel",
"."
] | 02e09af4520e6dc44bb74928dc79ac20c8fe801e | https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php#L38-L47 |
43,860 | webcomm/magento-boilerplate | src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php | Webcomm_MagentoBoilerplate_Helper_Data.getAssetsManifest | protected function getAssetsManifest()
{
if ($this->assetsManifest === null) {
$assetsJsonFile = Mage::getDesign()->getSkinBaseDir().'/rev-manifest.json';
if (file_exists($assetsJsonFile)) {
$this->assetsManifest = json_decode(file_get_contents($assetsJsonFile), true);
} else {
$this->assetsManifest = [];
}
}
return $this->assetsManifest;
} | php | protected function getAssetsManifest()
{
if ($this->assetsManifest === null) {
$assetsJsonFile = Mage::getDesign()->getSkinBaseDir().'/rev-manifest.json';
if (file_exists($assetsJsonFile)) {
$this->assetsManifest = json_decode(file_get_contents($assetsJsonFile), true);
} else {
$this->assetsManifest = [];
}
}
return $this->assetsManifest;
} | [
"protected",
"function",
"getAssetsManifest",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"assetsManifest",
"===",
"null",
")",
"{",
"$",
"assetsJsonFile",
"=",
"Mage",
"::",
"getDesign",
"(",
")",
"->",
"getSkinBaseDir",
"(",
")",
".",
"'/rev-manifest.json... | Get the assets manifest payload, lazily-loading the contents of the file.
@return array | [
"Get",
"the",
"assets",
"manifest",
"payload",
"lazily",
"-",
"loading",
"the",
"contents",
"of",
"the",
"file",
"."
] | 02e09af4520e6dc44bb74928dc79ac20c8fe801e | https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php#L54-L67 |
43,861 | albertcht/lumen-testing | src/Concerns/RefreshDatabase.php | RefreshDatabase.beginDatabaseTransaction | public function beginDatabaseTransaction()
{
$database = $this->app->make('db');
foreach ($this->connectionsToTransact() as $name) {
$connection = $database->connection($name);
$dispatcher = $connection->getEventDispatcher();
$connection->unsetEventDispatcher();
$connection->beginTransaction();
$connection->setEventDispatcher($dispatcher);
}
$this->beforeApplicationDestroyed(function () use ($database) {
foreach ($this->connectionsToTransact() as $name) {
$connection = $database->connection($name);
$dispatcher = $connection->getEventDispatcher();
$connection->unsetEventDispatcher();
$connection->rollback();
$connection->setEventDispatcher($dispatcher);
$connection->disconnect();
}
});
} | php | public function beginDatabaseTransaction()
{
$database = $this->app->make('db');
foreach ($this->connectionsToTransact() as $name) {
$connection = $database->connection($name);
$dispatcher = $connection->getEventDispatcher();
$connection->unsetEventDispatcher();
$connection->beginTransaction();
$connection->setEventDispatcher($dispatcher);
}
$this->beforeApplicationDestroyed(function () use ($database) {
foreach ($this->connectionsToTransact() as $name) {
$connection = $database->connection($name);
$dispatcher = $connection->getEventDispatcher();
$connection->unsetEventDispatcher();
$connection->rollback();
$connection->setEventDispatcher($dispatcher);
$connection->disconnect();
}
});
} | [
"public",
"function",
"beginDatabaseTransaction",
"(",
")",
"{",
"$",
"database",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'db'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"connectionsToTransact",
"(",
")",
"as",
"$",
"name",
")",
"{",
"$"... | Begin a database transaction on the testing database.
@return void | [
"Begin",
"a",
"database",
"transaction",
"on",
"the",
"testing",
"database",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/RefreshDatabase.php#L66-L90 |
43,862 | albertcht/lumen-testing | src/Concerns/InteractsWithDatabase.php | InteractsWithDatabase.assertSoftDeleted | protected function assertSoftDeleted($table, array $data, $connection = null)
{
$this->assertThat(
$table, new SoftDeletedInDatabase($this->getConnection($connection), $data)
);
return $this;
} | php | protected function assertSoftDeleted($table, array $data, $connection = null)
{
$this->assertThat(
$table, new SoftDeletedInDatabase($this->getConnection($connection), $data)
);
return $this;
} | [
"protected",
"function",
"assertSoftDeleted",
"(",
"$",
"table",
",",
"array",
"$",
"data",
",",
"$",
"connection",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertThat",
"(",
"$",
"table",
",",
"new",
"SoftDeletedInDatabase",
"(",
"$",
"this",
"->",
"g... | Assert the given record has been deleted.
@param string $table
@param array $data
@param string $connection
@return $this | [
"Assert",
"the",
"given",
"record",
"has",
"been",
"deleted",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/InteractsWithDatabase.php#L43-L50 |
43,863 | albertcht/lumen-testing | src/Concerns/InteractsWithDatabase.php | InteractsWithDatabase.getConnection | protected function getConnection($connection = null)
{
$database = $this->app->make('db');
$connection = $connection ?: $database->getDefaultConnection();
return $database->connection($connection);
} | php | protected function getConnection($connection = null)
{
$database = $this->app->make('db');
$connection = $connection ?: $database->getDefaultConnection();
return $database->connection($connection);
} | [
"protected",
"function",
"getConnection",
"(",
"$",
"connection",
"=",
"null",
")",
"{",
"$",
"database",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'db'",
")",
";",
"$",
"connection",
"=",
"$",
"connection",
"?",
":",
"$",
"database",
"->",
... | Get the database connection.
@param string|null $connection
@return \Illuminate\Database\Connection | [
"Get",
"the",
"database",
"connection",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/InteractsWithDatabase.php#L58-L65 |
43,864 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.withHeader | public function withHeader(string $name, string $value)
{
$this->defaultHeaders[$name] = $value;
return $this;
} | php | public function withHeader(string $name, string $value)
{
$this->defaultHeaders[$name] = $value;
return $this;
} | [
"public",
"function",
"withHeader",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"defaultHeaders",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Add a header to be sent with the request.
@param string $name
@param string $value
@return $this | [
"Add",
"a",
"header",
"to",
"be",
"sent",
"with",
"the",
"request",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L54-L59 |
43,865 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.withMiddleware | public function withMiddleware($middleware = null)
{
if (is_null($middleware)) {
unset($this->app['middleware.disable']);
return $this;
}
foreach ((array) $middleware as $abstract) {
unset($this->app[$abstract]);
}
return $this;
} | php | public function withMiddleware($middleware = null)
{
if (is_null($middleware)) {
unset($this->app['middleware.disable']);
return $this;
}
foreach ((array) $middleware as $abstract) {
unset($this->app[$abstract]);
}
return $this;
} | [
"public",
"function",
"withMiddleware",
"(",
"$",
"middleware",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"middleware",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"app",
"[",
"'middleware.disable'",
"]",
")",
";",
"return",
"$",
"this... | Enable the given middleware for the test.
@param string|array $middleware
@return $this | [
"Enable",
"the",
"given",
"middleware",
"for",
"the",
"test",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L118-L131 |
43,866 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.get | public function get($uri, array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('GET', $uri, [], [], [], $server);
} | php | public function get($uri, array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('GET', $uri, [], [], [], $server);
} | [
"public",
"function",
"get",
"(",
"$",
"uri",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"transformHeadersToServerVars",
"(",
"$",
"headers",
")",
";",
"return",
"$",
"this",
"->",
"call",
"(",
"'GET... | Visit the given URI with a GET request.
@param string $uri
@param array $headers
@return TestResponse | [
"Visit",
"the",
"given",
"URI",
"with",
"a",
"GET",
"request",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L163-L168 |
43,867 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.post | public function post($uri, array $data = [], array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('POST', $uri, $data, [], [], $server);
} | php | public function post($uri, array $data = [], array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('POST', $uri, $data, [], [], $server);
} | [
"public",
"function",
"post",
"(",
"$",
"uri",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"transformHeadersToServerVars",
"(",
"$",
"headers",
")",
";",
"r... | Visit the given URI with a POST request.
@param string $uri
@param array $data
@param array $headers
@return TestResponse | [
"Visit",
"the",
"given",
"URI",
"with",
"a",
"POST",
"request",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L190-L195 |
43,868 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.put | public function put($uri, array $data = [], array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('PUT', $uri, $data, [], [], $server);
} | php | public function put($uri, array $data = [], array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('PUT', $uri, $data, [], [], $server);
} | [
"public",
"function",
"put",
"(",
"$",
"uri",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"transformHeadersToServerVars",
"(",
"$",
"headers",
")",
";",
"re... | Visit the given URI with a PUT request.
@param string $uri
@param array $data
@param array $headers
@return TestResponse | [
"Visit",
"the",
"given",
"URI",
"with",
"a",
"PUT",
"request",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L218-L223 |
43,869 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.prepareUrlForRequest | protected function prepareUrlForRequest($uri)
{
if (Str::startsWith($uri, '/')) {
$uri = substr($uri, 1);
}
if (! Str::startsWith($uri, 'http')) {
$uri = ($this->baseUrl ?? config('app.url')) . '/' . $uri;
}
return trim($uri, '/');
} | php | protected function prepareUrlForRequest($uri)
{
if (Str::startsWith($uri, '/')) {
$uri = substr($uri, 1);
}
if (! Str::startsWith($uri, 'http')) {
$uri = ($this->baseUrl ?? config('app.url')) . '/' . $uri;
}
return trim($uri, '/');
} | [
"protected",
"function",
"prepareUrlForRequest",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"Str",
"::",
"startsWith",
"(",
"$",
"uri",
",",
"'/'",
")",
")",
"{",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"1",
")",
";",
"}",
"if",
"(",
"!",
"... | Turn the given URI into a fully qualified URL.
@param string $uri
@return string | [
"Turn",
"the",
"given",
"URI",
"into",
"a",
"fully",
"qualified",
"URL",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L372-L383 |
43,870 | albertcht/lumen-testing | src/Concerns/MakesHttpRequests.php | MakesHttpRequests.followRedirects | protected function followRedirects($response)
{
while ($response->isRedirect()) {
$response = $this->get($response->headers->get('Location'));
}
$this->followRedirects = false;
return $response;
} | php | protected function followRedirects($response)
{
while ($response->isRedirect()) {
$response = $this->get($response->headers->get('Location'));
}
$this->followRedirects = false;
return $response;
} | [
"protected",
"function",
"followRedirects",
"(",
"$",
"response",
")",
"{",
"while",
"(",
"$",
"response",
"->",
"isRedirect",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"response",
"->",
"headers",
"->",
"get",
"(",
... | Follow a redirect chain until a non-redirect is received.
@param \Illuminate\Http\Response $response
@return \Illuminate\Http\Response | [
"Follow",
"a",
"redirect",
"chain",
"until",
"a",
"non",
"-",
"redirect",
"is",
"received",
"."
] | 02d787bf233583e766e32b528855af8166c6ffb2 | https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L448-L457 |
43,871 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.getPayPalConfig | public function getPayPalConfig()
{
if (!$this->payPalConfig) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->payPalConfig;
} | php | public function getPayPalConfig()
{
if (!$this->payPalConfig) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->payPalConfig;
} | [
"public",
"function",
"getPayPalConfig",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"payPalConfig",
")",
"{",
"/** @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception */",
"$",
"exception",
"=",
"oxNew",
"(",
"\\",
"OxidEsal... | Returns config object.
@return \OxidEsales\PayPalModule\Core\Config
@throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException | [
"Returns",
"config",
"object",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L168-L177 |
43,872 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.getBasket | public function getBasket()
{
if (is_null($this->basket)) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->basket;
} | php | public function getBasket()
{
if (is_null($this->basket)) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->basket;
} | [
"public",
"function",
"getBasket",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"basket",
")",
")",
"{",
"/** @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception */",
"$",
"exception",
"=",
"oxNew",
"(",
"\\",
"... | Returns basket object.
@return \OxidEsales\Eshop\Application\Model\Basket
@throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException | [
"Returns",
"basket",
"object",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L196-L205 |
43,873 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.getLang | public function getLang()
{
if (is_null($this->lang)) {
$this->lang = $this->getPayPalConfig()->getLang();
}
return $this->lang;
} | php | public function getLang()
{
if (is_null($this->lang)) {
$this->lang = $this->getPayPalConfig()->getLang();
}
return $this->lang;
} | [
"public",
"function",
"getLang",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"lang",
")",
")",
"{",
"$",
"this",
"->",
"lang",
"=",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
"->",
"getLang",
"(",
")",
";",
"}",
"return",
"$... | Returns Language object.
@return \OxidEsales\Eshop\Core\Language | [
"Returns",
"Language",
"object",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L242-L249 |
43,874 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.buildExpressCheckoutRequest | public function buildExpressCheckoutRequest()
{
$this->addBaseParams();
$this->addCallBackUrl();
$this->addBasketParams();
$this->addDescriptionParams();
$this->turnOffShippingAddressCollection();
$this->setMaximumOrderAmount();
if ($this->getShowCartInPayPal()) {
$this->addBasketItemParams();
} else {
$this->addBasketGrandTotalParams();
}
$this->addAddressParams();
return $this->getPayPalRequest();
} | php | public function buildExpressCheckoutRequest()
{
$this->addBaseParams();
$this->addCallBackUrl();
$this->addBasketParams();
$this->addDescriptionParams();
$this->turnOffShippingAddressCollection();
$this->setMaximumOrderAmount();
if ($this->getShowCartInPayPal()) {
$this->addBasketItemParams();
} else {
$this->addBasketGrandTotalParams();
}
$this->addAddressParams();
return $this->getPayPalRequest();
} | [
"public",
"function",
"buildExpressCheckoutRequest",
"(",
")",
"{",
"$",
"this",
"->",
"addBaseParams",
"(",
")",
";",
"$",
"this",
"->",
"addCallBackUrl",
"(",
")",
";",
"$",
"this",
"->",
"addBasketParams",
"(",
")",
";",
"$",
"this",
"->",
"addDescripti... | Builds PayPal request for express checkout.
@return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest | [
"Builds",
"PayPal",
"request",
"for",
"express",
"checkout",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L356-L373 |
43,875 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.buildStandardCheckoutRequest | public function buildStandardCheckoutRequest()
{
$this->addBaseParams();
$this->addBasketParams();
$this->addDescriptionParams();
$this->disableSelectingDifferentAddressInPayPal();
$this->setMaximumOrderAmount();
if ($this->getShowCartInPayPal()) {
$this->addBasketItemParams();
} else {
$this->addBasketGrandTotalParams();
}
$this->addAddressParams();
return $this->getPayPalRequest();
} | php | public function buildStandardCheckoutRequest()
{
$this->addBaseParams();
$this->addBasketParams();
$this->addDescriptionParams();
$this->disableSelectingDifferentAddressInPayPal();
$this->setMaximumOrderAmount();
if ($this->getShowCartInPayPal()) {
$this->addBasketItemParams();
} else {
$this->addBasketGrandTotalParams();
}
$this->addAddressParams();
return $this->getPayPalRequest();
} | [
"public",
"function",
"buildStandardCheckoutRequest",
"(",
")",
"{",
"$",
"this",
"->",
"addBaseParams",
"(",
")",
";",
"$",
"this",
"->",
"addBasketParams",
"(",
")",
";",
"$",
"this",
"->",
"addDescriptionParams",
"(",
")",
";",
"$",
"this",
"->",
"disab... | Builds PayPal request for standard checkout.
@return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest | [
"Builds",
"PayPal",
"request",
"for",
"standard",
"checkout",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L380-L396 |
43,876 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addBaseParams | public function addBaseParams()
{
$request = $this->getPayPalRequest();
$payPalConfig = $this->getPayPalConfig();
$request->setParameter("CALLBACKVERSION", "84.0");
$request->setParameter("LOCALECODE", $this->getLang()->translateString("OEPAYPAL_LOCALE"));
// enabled guest buy (Buyer does not need to create a PayPal account to check out)
$request->setParameter("SOLUTIONTYPE", ($payPalConfig->isGuestBuyEnabled() ? "Sole" : "Mark"));
$request->setParameter("BRANDNAME", $payPalConfig->getBrandName());
$request->setParameter("CARTBORDERCOLOR", $payPalConfig->getBorderColor());
$request->setParameter("RETURNURL", $this->getReturnUrl());
$request->setParameter("CANCELURL", $this->getCancelUrl());
if ($logoImage = $payPalConfig->getLogoUrl()) {
$request->setParameter("LOGOIMG", $logoImage);
}
$request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode());
} | php | public function addBaseParams()
{
$request = $this->getPayPalRequest();
$payPalConfig = $this->getPayPalConfig();
$request->setParameter("CALLBACKVERSION", "84.0");
$request->setParameter("LOCALECODE", $this->getLang()->translateString("OEPAYPAL_LOCALE"));
// enabled guest buy (Buyer does not need to create a PayPal account to check out)
$request->setParameter("SOLUTIONTYPE", ($payPalConfig->isGuestBuyEnabled() ? "Sole" : "Mark"));
$request->setParameter("BRANDNAME", $payPalConfig->getBrandName());
$request->setParameter("CARTBORDERCOLOR", $payPalConfig->getBorderColor());
$request->setParameter("RETURNURL", $this->getReturnUrl());
$request->setParameter("CANCELURL", $this->getCancelUrl());
if ($logoImage = $payPalConfig->getLogoUrl()) {
$request->setParameter("LOGOIMG", $logoImage);
}
$request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode());
} | [
"public",
"function",
"addBaseParams",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"payPalConfig",
"=",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
";",
"$",
"request",
"->",
"setParameter",
"(",
"\"... | Sets base parameters to request. | [
"Sets",
"base",
"parameters",
"to",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L401-L421 |
43,877 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addCallBackUrl | public function addCallBackUrl()
{
$request = $this->getPayPalRequest();
$request->setParameter("CALLBACK", $this->getCallbackUrl());
$request->setParameter("CALLBACKTIMEOUT", 6);
} | php | public function addCallBackUrl()
{
$request = $this->getPayPalRequest();
$request->setParameter("CALLBACK", $this->getCallbackUrl());
$request->setParameter("CALLBACKTIMEOUT", 6);
} | [
"public",
"function",
"addCallBackUrl",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"request",
"->",
"setParameter",
"(",
"\"CALLBACK\"",
",",
"$",
"this",
"->",
"getCallbackUrl",
"(",
")",
")",
";",
"$"... | Adds callback parameters to request. | [
"Adds",
"callback",
"parameters",
"to",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L426-L432 |
43,878 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addBasketParams | public function addBasketParams()
{
$request = $this->getPayPalRequest();
$basket = $this->getBasket();
$virtualBasket = $basket->isVirtualPayPalBasket();
// only downloadable products? missing getter on oxBasket yet
$request->setParameter("NOSHIPPING", $virtualBasket ? "1" : "0");
if ($virtualBasket) {
$request->setParameter("REQCONFIRMSHIPPING", "0");
}
// passing basket VAT (tax) value. It is required as in Net mode articles are without VAT, but basket is with VAT.
// PayPal need this value to check if all articles sum match basket sum.
if ($basket->isCalculationModeNetto()) {
$request->setParameter("PAYMENTREQUEST_0_TAXAMT", $this->formatFloat($basket->getPayPalBasketVatValue()));
}
$request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice()));
$request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name);
$request->setParameter("PAYMENTREQUEST_0_ITEMAMT", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket()));
$request->setParameter("PAYMENTREQUEST_0_SHIPPINGAMT", $this->formatFloat($basket->getDeliveryCosts()));
$request->setParameter("PAYMENTREQUEST_0_SHIPDISCAMT", $this->formatFloat($basket->getDiscountSumPayPalBasket() * -1));
$delivery = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
$deliveryName = ($delivery->load($basket->getShippingId())) ? $delivery->oxdeliveryset__oxtitle->value : "#1";
$request->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true");
$request->setParameter("L_SHIPPINGOPTIONNAME0", $deliveryName);
$request->setParameter("L_SHIPPINGOPTIONAMOUNT0", $this->formatFloat($basket->getDeliveryCosts()));
} | php | public function addBasketParams()
{
$request = $this->getPayPalRequest();
$basket = $this->getBasket();
$virtualBasket = $basket->isVirtualPayPalBasket();
// only downloadable products? missing getter on oxBasket yet
$request->setParameter("NOSHIPPING", $virtualBasket ? "1" : "0");
if ($virtualBasket) {
$request->setParameter("REQCONFIRMSHIPPING", "0");
}
// passing basket VAT (tax) value. It is required as in Net mode articles are without VAT, but basket is with VAT.
// PayPal need this value to check if all articles sum match basket sum.
if ($basket->isCalculationModeNetto()) {
$request->setParameter("PAYMENTREQUEST_0_TAXAMT", $this->formatFloat($basket->getPayPalBasketVatValue()));
}
$request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice()));
$request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name);
$request->setParameter("PAYMENTREQUEST_0_ITEMAMT", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket()));
$request->setParameter("PAYMENTREQUEST_0_SHIPPINGAMT", $this->formatFloat($basket->getDeliveryCosts()));
$request->setParameter("PAYMENTREQUEST_0_SHIPDISCAMT", $this->formatFloat($basket->getDiscountSumPayPalBasket() * -1));
$delivery = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
$deliveryName = ($delivery->load($basket->getShippingId())) ? $delivery->oxdeliveryset__oxtitle->value : "#1";
$request->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true");
$request->setParameter("L_SHIPPINGOPTIONNAME0", $deliveryName);
$request->setParameter("L_SHIPPINGOPTIONAMOUNT0", $this->formatFloat($basket->getDeliveryCosts()));
} | [
"public",
"function",
"addBasketParams",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"basket",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
";",
"$",
"virtualBasket",
"=",
"$",
"basket",
"->",
"isVir... | Sets basket parameters to request. | [
"Sets",
"basket",
"parameters",
"to",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L466-L497 |
43,879 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addDescriptionParams | public function addDescriptionParams()
{
$basket = $this->getBasket();
$config = $this->getPayPalConfig();
$request = $this->getPayPalRequest();
// description
$shopNameFull = $config->getBrandName();
$shopName = substr($shopNameFull, 0, 70);
if ($shopNameFull != $shopName) {
$shopName .= "...";
}
$subj = sprintf($this->getLang()->translateString("OEPAYPAL_ORDER_SUBJECT"), $shopName, $basket->getFPrice(), $basket->getBasketCurrency()->name);
$request->setParameter("PAYMENTREQUEST_0_DESC", $subj);
$request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj);
} | php | public function addDescriptionParams()
{
$basket = $this->getBasket();
$config = $this->getPayPalConfig();
$request = $this->getPayPalRequest();
// description
$shopNameFull = $config->getBrandName();
$shopName = substr($shopNameFull, 0, 70);
if ($shopNameFull != $shopName) {
$shopName .= "...";
}
$subj = sprintf($this->getLang()->translateString("OEPAYPAL_ORDER_SUBJECT"), $shopName, $basket->getFPrice(), $basket->getBasketCurrency()->name);
$request->setParameter("PAYMENTREQUEST_0_DESC", $subj);
$request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj);
} | [
"public",
"function",
"addDescriptionParams",
"(",
")",
"{",
"$",
"basket",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalR... | Sets transaction description parameters. | [
"Sets",
"transaction",
"description",
"parameters",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L502-L518 |
43,880 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addBasketItemParams | public function addBasketItemParams()
{
$basket = $this->getBasket();
$lang = $this->getLang();
$request = $this->getPayPalRequest();
$pos = 0;
foreach ($basket->getContents() as $basketItem) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle()));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount());
$request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink());
$basketProduct = $basketItem->getArticle();
$request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value);
$pos++;
}
//adding payment costs as product
if ($basket->getPayPalPaymentCosts() > 0) {
$paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT");
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle);
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
//adding wrapping as product
if ($basket->getPayPalWrappingCosts() > 0) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
//adding greeting card as product
if ($basket->getPayPalGiftCardCosts() > 0) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
} | php | public function addBasketItemParams()
{
$basket = $this->getBasket();
$lang = $this->getLang();
$request = $this->getPayPalRequest();
$pos = 0;
foreach ($basket->getContents() as $basketItem) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle()));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount());
$request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink());
$basketProduct = $basketItem->getArticle();
$request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value);
$pos++;
}
//adding payment costs as product
if ($basket->getPayPalPaymentCosts() > 0) {
$paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT");
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle);
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
//adding wrapping as product
if ($basket->getPayPalWrappingCosts() > 0) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
//adding greeting card as product
if ($basket->getPayPalGiftCardCosts() > 0) {
$request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);
$pos++;
}
} | [
"public",
"function",
"addBasketItemParams",
"(",
")",
"{",
"$",
"basket",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
";",
"$",
"lang",
"=",
"$",
"this",
"->",
"getLang",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
... | Sets basket items parameters to request. | [
"Sets",
"basket",
"items",
"parameters",
"to",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L523-L569 |
43,881 | OXID-eSales/paypal | Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php | SetExpressCheckoutRequestBuilder.addBasketGrandTotalParams | public function addBasketGrandTotalParams()
{
$basket = $this->getBasket();
$request = $this->getPayPalRequest();
$request->setParameter("L_PAYMENTREQUEST_0_NAME0", $this->getLang()->translateString("OEPAYPAL_GRAND_TOTAL"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT0", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY0", 1);
} | php | public function addBasketGrandTotalParams()
{
$basket = $this->getBasket();
$request = $this->getPayPalRequest();
$request->setParameter("L_PAYMENTREQUEST_0_NAME0", $this->getLang()->translateString("OEPAYPAL_GRAND_TOTAL"));
$request->setParameter("L_PAYMENTREQUEST_0_AMT0", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket()));
$request->setParameter("L_PAYMENTREQUEST_0_QTY0", 1);
} | [
"public",
"function",
"addBasketGrandTotalParams",
"(",
")",
"{",
"$",
"basket",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"request",
"->",
"setParameter",
"(",
"\"... | Sets basket Grand Total params to request. | [
"Sets",
"basket",
"Grand",
"Total",
"params",
"to",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L574-L582 |
43,882 | OXID-eSales/paypal | Core/ModelDbGateway.php | ModelDbGateway.getDb | protected function getDb()
{
return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
} | php | protected function getDb()
{
return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
} | [
"protected",
"function",
"getDb",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"FETCH_MODE_ASSOC",
")",
... | Returns data base resource.
@return \OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface | [
"Returns",
"data",
"base",
"resource",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ModelDbGateway.php#L36-L39 |
43,883 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.getPayment | public function getPayment()
{
if (is_null($this->payment)) {
$payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payPalPayment->load('oxidpaypal');
$this->setPayment($payPalPayment);
}
return $this->payment;
} | php | public function getPayment()
{
if (is_null($this->payment)) {
$payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payPalPayment->load('oxidpaypal');
$this->setPayment($payPalPayment);
}
return $this->payment;
} | [
"public",
"function",
"getPayment",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payment",
")",
")",
"{",
"$",
"payPalPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Payment",
... | Payment object getter
@return \OxidEsales\Eshop\Application\Model\Payment | [
"Payment",
"object",
"getter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L159-L168 |
43,884 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.isPaymentActive | public function isPaymentActive()
{
$result = false;
if ($payPalPayment = $this->getPayment()) {
$result = $payPalPayment->oxpayments__oxactive->value ? true : false;
}
return $result;
} | php | public function isPaymentActive()
{
$result = false;
if ($payPalPayment = $this->getPayment()) {
$result = $payPalPayment->oxpayments__oxactive->value ? true : false;
}
return $result;
} | [
"public",
"function",
"isPaymentActive",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"payPalPayment",
"=",
"$",
"this",
"->",
"getPayment",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"payPalPayment",
"->",
"oxpayments__oxactive",
"... | Checks if PayPal payment is active
@return boolean | [
"Checks",
"if",
"PayPal",
"payment",
"is",
"active"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L175-L183 |
43,885 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.isPaymentValid | public function isPaymentValid()
{
$isValid = $this->isPaymentActive();
if ($isValid && !is_null($this->getPrice())) {
$isValid = $this->checkPriceRange() && $this->checkMinOrderPrice();
}
$user = $this->getUser();
if ($isValid && $user && $user->hasAccount()) {
$isValid = $this->checkUserGroup();
}
if ($isValid && $user && $this->getCheckCountry()) {
$isValid = $this->checkUserCountry();
}
return $isValid;
} | php | public function isPaymentValid()
{
$isValid = $this->isPaymentActive();
if ($isValid && !is_null($this->getPrice())) {
$isValid = $this->checkPriceRange() && $this->checkMinOrderPrice();
}
$user = $this->getUser();
if ($isValid && $user && $user->hasAccount()) {
$isValid = $this->checkUserGroup();
}
if ($isValid && $user && $this->getCheckCountry()) {
$isValid = $this->checkUserCountry();
}
return $isValid;
} | [
"public",
"function",
"isPaymentValid",
"(",
")",
"{",
"$",
"isValid",
"=",
"$",
"this",
"->",
"isPaymentActive",
"(",
")",
";",
"if",
"(",
"$",
"isValid",
"&&",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getPrice",
"(",
")",
")",
")",
"{",
"$",
"isV... | Checks if payment is valid according to config, user and basket amount.
@return boolean | [
"Checks",
"if",
"payment",
"is",
"valid",
"according",
"to",
"config",
"user",
"and",
"basket",
"amount",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L191-L209 |
43,886 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.checkPriceRange | protected function checkPriceRange()
{
$isValid = true;
$payPalPayment = $this->getPayment();
if ($payPalPayment->oxpayments__oxfromamount->value != 0 ||
$payPalPayment->oxpayments__oxtoamount->value != 0
) {
$cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$price = $this->getPrice() / $cur->rate;
$isValid = (($price >= $payPalPayment->oxpayments__oxfromamount->value) &&
($price <= $payPalPayment->oxpayments__oxtoamount->value));
}
return $isValid;
} | php | protected function checkPriceRange()
{
$isValid = true;
$payPalPayment = $this->getPayment();
if ($payPalPayment->oxpayments__oxfromamount->value != 0 ||
$payPalPayment->oxpayments__oxtoamount->value != 0
) {
$cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$price = $this->getPrice() / $cur->rate;
$isValid = (($price >= $payPalPayment->oxpayments__oxfromamount->value) &&
($price <= $payPalPayment->oxpayments__oxtoamount->value));
}
return $isValid;
} | [
"protected",
"function",
"checkPriceRange",
"(",
")",
"{",
"$",
"isValid",
"=",
"true",
";",
"$",
"payPalPayment",
"=",
"$",
"this",
"->",
"getPayment",
"(",
")",
";",
"if",
"(",
"$",
"payPalPayment",
"->",
"oxpayments__oxfromamount",
"->",
"value",
"!=",
... | Checks if basket price is inside payment price range
If range is not set check returns true
@return bool | [
"Checks",
"if",
"basket",
"price",
"is",
"inside",
"payment",
"price",
"range",
"If",
"range",
"is",
"not",
"set",
"check",
"returns",
"true"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L217-L234 |
43,887 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.checkMinOrderPrice | protected function checkMinOrderPrice()
{
$isValid = true;
if ($minOrderPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iMinOrderPrice')) {
$isValid = $this->getPrice() > $minOrderPrice;
}
return $isValid;
} | php | protected function checkMinOrderPrice()
{
$isValid = true;
if ($minOrderPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iMinOrderPrice')) {
$isValid = $this->getPrice() > $minOrderPrice;
}
return $isValid;
} | [
"protected",
"function",
"checkMinOrderPrice",
"(",
")",
"{",
"$",
"isValid",
"=",
"true",
";",
"if",
"(",
"$",
"minOrderPrice",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(... | Checks if basket price is higher than minimum order price
If min price is not set check returns true
@return bool | [
"Checks",
"if",
"basket",
"price",
"is",
"higher",
"than",
"minimum",
"order",
"price",
"If",
"min",
"price",
"is",
"not",
"set",
"check",
"returns",
"true"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L242-L251 |
43,888 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.checkUserCountry | protected function checkUserCountry()
{
$isValid = true;
$payPalPayment = $this->getPayment();
$countries = $payPalPayment->getCountries();
if ($countries) {
$isValid = false;
foreach ($countries as $countryId) {
if ($countryId === $this->getShippingCountryId()) {
$isValid = true;
break;
}
}
}
return $isValid;
} | php | protected function checkUserCountry()
{
$isValid = true;
$payPalPayment = $this->getPayment();
$countries = $payPalPayment->getCountries();
if ($countries) {
$isValid = false;
foreach ($countries as $countryId) {
if ($countryId === $this->getShippingCountryId()) {
$isValid = true;
break;
}
}
}
return $isValid;
} | [
"protected",
"function",
"checkUserCountry",
"(",
")",
"{",
"$",
"isValid",
"=",
"true",
";",
"$",
"payPalPayment",
"=",
"$",
"this",
"->",
"getPayment",
"(",
")",
";",
"$",
"countries",
"=",
"$",
"payPalPayment",
"->",
"getCountries",
"(",
")",
";",
"if... | Checks if user country is among payment countries
If payment countries are not set returns true
@return bool | [
"Checks",
"if",
"user",
"country",
"is",
"among",
"payment",
"countries",
"If",
"payment",
"countries",
"are",
"not",
"set",
"returns",
"true"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L259-L277 |
43,889 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.checkUserGroup | protected function checkUserGroup()
{
$isValid = true;
$payPalPayment = $this->getPayment();
$groups = $payPalPayment->getGroups();
if ($groups && $groups->count() > 0) {
$isValid = $this->isUserAssignedToGroup($groups);
}
return $isValid;
} | php | protected function checkUserGroup()
{
$isValid = true;
$payPalPayment = $this->getPayment();
$groups = $payPalPayment->getGroups();
if ($groups && $groups->count() > 0) {
$isValid = $this->isUserAssignedToGroup($groups);
}
return $isValid;
} | [
"protected",
"function",
"checkUserGroup",
"(",
")",
"{",
"$",
"isValid",
"=",
"true",
";",
"$",
"payPalPayment",
"=",
"$",
"this",
"->",
"getPayment",
"(",
")",
";",
"$",
"groups",
"=",
"$",
"payPalPayment",
"->",
"getGroups",
"(",
")",
";",
"if",
"("... | Checks if user belongs group that is assigned to payment
If payment does not have any groups assigned returns true
@return bool | [
"Checks",
"if",
"user",
"belongs",
"group",
"that",
"is",
"assigned",
"to",
"payment",
"If",
"payment",
"does",
"not",
"have",
"any",
"groups",
"assigned",
"returns",
"true"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L285-L297 |
43,890 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.isUserAssignedToGroup | protected function isUserAssignedToGroup($groups)
{
$isValid = false;
$user = $this->getUser();
foreach ($groups as $group) {
if ($user->inGroup($group->getId())) {
$isValid = true;
break;
}
}
return $isValid;
} | php | protected function isUserAssignedToGroup($groups)
{
$isValid = false;
$user = $this->getUser();
foreach ($groups as $group) {
if ($user->inGroup($group->getId())) {
$isValid = true;
break;
}
}
return $isValid;
} | [
"protected",
"function",
"isUserAssignedToGroup",
"(",
"$",
"groups",
")",
"{",
"$",
"isValid",
"=",
"false",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"if",
"(",
... | Checks whether user is assigned to given groups array.
@param \OxidEsales\Eshop\Core\Model\ListModel $groups
@return bool | [
"Checks",
"whether",
"user",
"is",
"assigned",
"to",
"given",
"groups",
"array",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L306-L319 |
43,891 | OXID-eSales/paypal | Model/PaymentValidator.php | PaymentValidator.getShippingCountryId | protected function getShippingCountryId()
{
$user = $this->getUser();
if ($user->getSelectedAddressId()) {
$countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value;
} else {
$countryId = $user->oxuser__oxcountryid->value;
}
return $countryId;
} | php | protected function getShippingCountryId()
{
$user = $this->getUser();
if ($user->getSelectedAddressId()) {
$countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value;
} else {
$countryId = $user->oxuser__oxcountryid->value;
}
return $countryId;
} | [
"protected",
"function",
"getShippingCountryId",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"user",
"->",
"getSelectedAddressId",
"(",
")",
")",
"{",
"$",
"countryId",
"=",
"$",
"user",
"->",
"getSelec... | Returns shipping country ID.
@return string | [
"Returns",
"shipping",
"country",
"ID",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L326-L336 |
43,892 | OXID-eSales/paypal | Model/ArticleToExpressCheckoutValidator.php | ArticleToExpressCheckoutValidator.isArticleValid | public function isArticleValid()
{
$valid = true;
if ($this->isArticleAmountZero() || $this->isSameItemInBasket()) {
$valid = false;
}
return $valid;
} | php | public function isArticleValid()
{
$valid = true;
if ($this->isArticleAmountZero() || $this->isSameItemInBasket()) {
$valid = false;
}
return $valid;
} | [
"public",
"function",
"isArticleValid",
"(",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"isArticleAmountZero",
"(",
")",
"||",
"$",
"this",
"->",
"isSameItemInBasket",
"(",
")",
")",
"{",
"$",
"valid",
"=",
"false",
";",
... | Method returns if article valid
@return bool | [
"Method",
"returns",
"if",
"article",
"valid"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L88-L96 |
43,893 | OXID-eSales/paypal | Model/ArticleToExpressCheckoutValidator.php | ArticleToExpressCheckoutValidator.isSameItemInBasket | protected function isSameItemInBasket()
{
$basketContents = $this->getBasket()->getContents();
foreach ($basketContents as $basketItem) {
if ($this->isArticleParamsEqual($basketItem)) {
return true;
}
}
return false;
} | php | protected function isSameItemInBasket()
{
$basketContents = $this->getBasket()->getContents();
foreach ($basketContents as $basketItem) {
if ($this->isArticleParamsEqual($basketItem)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"isSameItemInBasket",
"(",
")",
"{",
"$",
"basketContents",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"foreach",
"(",
"$",
"basketContents",
"as",
"$",
"basketItem",
")",
"{",
"if",
"(",
"... | Check if same article is in basket.
@return bool | [
"Check",
"if",
"same",
"article",
"is",
"in",
"basket",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L103-L113 |
43,894 | OXID-eSales/paypal | Model/ArticleToExpressCheckoutValidator.php | ArticleToExpressCheckoutValidator.isArticleParamsEqual | protected function isArticleParamsEqual($basketItem)
{
return ($basketItem->getProductId() == $this->getItemToValidate()->getArticleId() &&
$basketItem->getPersParams() == $this->getItemToValidate()->getPersistParam() &&
$basketItem->getSelList() == $this->getItemToValidate()->getSelectList());
} | php | protected function isArticleParamsEqual($basketItem)
{
return ($basketItem->getProductId() == $this->getItemToValidate()->getArticleId() &&
$basketItem->getPersParams() == $this->getItemToValidate()->getPersistParam() &&
$basketItem->getSelList() == $this->getItemToValidate()->getSelectList());
} | [
"protected",
"function",
"isArticleParamsEqual",
"(",
"$",
"basketItem",
")",
"{",
"return",
"(",
"$",
"basketItem",
"->",
"getProductId",
"(",
")",
"==",
"$",
"this",
"->",
"getItemToValidate",
"(",
")",
"->",
"getArticleId",
"(",
")",
"&&",
"$",
"basketIte... | Checks if Article params equals with current items params.
@param \OxidEsales\Eshop\Application\Model\BasketItem $basketItem
@return bool | [
"Checks",
"if",
"Article",
"params",
"equals",
"with",
"current",
"items",
"params",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L122-L127 |
43,895 | OXID-eSales/paypal | Model/OrderPaymentStatusCalculator.php | OrderPaymentStatusCalculator.getStatus | public function getStatus()
{
if (is_null($this->getOrder())) {
return;
}
$status = $this->getOrderPaymentStatusFinal();
if (is_null($status)) {
$status = $this->getOrderPaymentStatusPaymentValid();
}
if (is_null($status)) {
$status = $this->getOrderPaymentStatusPayments();
}
return $status;
} | php | public function getStatus()
{
if (is_null($this->getOrder())) {
return;
}
$status = $this->getOrderPaymentStatusFinal();
if (is_null($status)) {
$status = $this->getOrderPaymentStatusPaymentValid();
}
if (is_null($status)) {
$status = $this->getOrderPaymentStatusPayments();
}
return $status;
} | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"getOrder",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"$",
"status",
"=",
"$",
"this",
"->",
"getOrderPaymentStatusFinal",
"(",
")",
";",
"if",
"(",
... | Returns order payment status which should be set after order creation or IPN.
@return string|null | [
"Returns",
"order",
"payment",
"status",
"which",
"should",
"be",
"set",
"after",
"order",
"creation",
"or",
"IPN",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L115-L131 |
43,896 | OXID-eSales/paypal | Model/OrderPaymentStatusCalculator.php | OrderPaymentStatusCalculator.getSuggestStatus | public function getSuggestStatus($action)
{
if (is_null($this->getOrder())) {
return;
}
$status = $this->getOrderPaymentStatusPaymentValid();
if (is_null($status)) {
$status = $this->getStatusByAction($action);
}
return $status;
} | php | public function getSuggestStatus($action)
{
if (is_null($this->getOrder())) {
return;
}
$status = $this->getOrderPaymentStatusPaymentValid();
if (is_null($status)) {
$status = $this->getStatusByAction($action);
}
return $status;
} | [
"public",
"function",
"getSuggestStatus",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"getOrder",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"$",
"status",
"=",
"$",
"this",
"->",
"getOrderPaymentStatusPaymentValid",
"("... | Returns order suggestion for payment status on given action and on given payment.
@param string $action - action with order payment: void, refund, capture, refund_partial, capture_partial
@return string|null | [
"Returns",
"order",
"suggestion",
"for",
"payment",
"status",
"on",
"given",
"action",
"and",
"on",
"given",
"payment",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L140-L152 |
43,897 | OXID-eSales/paypal | Model/OrderPaymentStatusCalculator.php | OrderPaymentStatusCalculator.getOrderPaymentStatusFinal | protected function getOrderPaymentStatusFinal()
{
$status = null;
if ($this->isOrderPaymentStatusFinal()) {
$status = $this->getOrder()->getPaymentStatus();
}
return $status;
} | php | protected function getOrderPaymentStatusFinal()
{
$status = null;
if ($this->isOrderPaymentStatusFinal()) {
$status = $this->getOrder()->getPaymentStatus();
}
return $status;
} | [
"protected",
"function",
"getOrderPaymentStatusFinal",
"(",
")",
"{",
"$",
"status",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"isOrderPaymentStatusFinal",
"(",
")",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
"->",
"getP... | Returns order payment status if order has final status.
@return string|null | [
"Returns",
"order",
"payment",
"status",
"if",
"order",
"has",
"final",
"status",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L159-L167 |
43,898 | OXID-eSales/paypal | Model/OrderPaymentStatusCalculator.php | OrderPaymentStatusCalculator.getOrderPaymentStatusPaymentValid | protected function getOrderPaymentStatusPaymentValid()
{
$status = null;
$orderPayment = $this->getOrderPayment();
if (isset($orderPayment) && !$orderPayment->getIsValid()) {
$status = 'failed';
}
return $status;
} | php | protected function getOrderPaymentStatusPaymentValid()
{
$status = null;
$orderPayment = $this->getOrderPayment();
if (isset($orderPayment) && !$orderPayment->getIsValid()) {
$status = 'failed';
}
return $status;
} | [
"protected",
"function",
"getOrderPaymentStatusPaymentValid",
"(",
")",
"{",
"$",
"status",
"=",
"null",
";",
"$",
"orderPayment",
"=",
"$",
"this",
"->",
"getOrderPayment",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"orderPayment",
")",
"&&",
"!",
"$",
... | Returns order payment status by checking if set payment is valid.
@return string|null | [
"Returns",
"order",
"payment",
"status",
"by",
"checking",
"if",
"set",
"payment",
"is",
"valid",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L174-L183 |
43,899 | OXID-eSales/paypal | Model/OrderPaymentStatusCalculator.php | OrderPaymentStatusCalculator.getOrderPaymentStatusPayments | protected function getOrderPaymentStatusPayments()
{
$status = 'completed';
$paymentList = $this->getOrder()->getPaymentList();
if ($paymentList->hasPendingPayment()) {
$status = 'pending';
} elseif ($paymentList->hasFailedPayment()) {
$status = 'failed';
}
return $status;
} | php | protected function getOrderPaymentStatusPayments()
{
$status = 'completed';
$paymentList = $this->getOrder()->getPaymentList();
if ($paymentList->hasPendingPayment()) {
$status = 'pending';
} elseif ($paymentList->hasFailedPayment()) {
$status = 'failed';
}
return $status;
} | [
"protected",
"function",
"getOrderPaymentStatusPayments",
"(",
")",
"{",
"$",
"status",
"=",
"'completed'",
";",
"$",
"paymentList",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
"->",
"getPaymentList",
"(",
")",
";",
"if",
"(",
"$",
"paymentList",
"->",
"... | Returns order payment status calculated from existing payments.
@return string|null | [
"Returns",
"order",
"payment",
"status",
"calculated",
"from",
"existing",
"payments",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L190-L202 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.