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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
24,700
|
CrunchPHP/fastcgi
|
src/Protocol/Role.php
|
Role.instance
|
public static function instance($role)
{
// @codeCoverageIgnoreStart
if (!self::$instances) {
self::$instances = [
self::RESPONDER => new self(self::RESPONDER),
self::AUTHORIZER => new self(self::AUTHORIZER),
self::FILTER => new self(self::FILTER),
];
}
// @codeCoverageIgnoreEnd
if (!array_key_exists($role, self::$instances)) {
throw new \InvalidArgumentException("Invalid Role $role");
}
return self::$instances[$role];
}
|
php
|
public static function instance($role)
{
// @codeCoverageIgnoreStart
if (!self::$instances) {
self::$instances = [
self::RESPONDER => new self(self::RESPONDER),
self::AUTHORIZER => new self(self::AUTHORIZER),
self::FILTER => new self(self::FILTER),
];
}
// @codeCoverageIgnoreEnd
if (!array_key_exists($role, self::$instances)) {
throw new \InvalidArgumentException("Invalid Role $role");
}
return self::$instances[$role];
}
|
[
"public",
"static",
"function",
"instance",
"(",
"$",
"role",
")",
"{",
"// @codeCoverageIgnoreStart",
"if",
"(",
"!",
"self",
"::",
"$",
"instances",
")",
"{",
"self",
"::",
"$",
"instances",
"=",
"[",
"self",
"::",
"RESPONDER",
"=>",
"new",
"self",
"(",
"self",
"::",
"RESPONDER",
")",
",",
"self",
"::",
"AUTHORIZER",
"=>",
"new",
"self",
"(",
"self",
"::",
"AUTHORIZER",
")",
",",
"self",
"::",
"FILTER",
"=>",
"new",
"self",
"(",
"self",
"::",
"FILTER",
")",
",",
"]",
";",
"}",
"// @codeCoverageIgnoreEnd",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"role",
",",
"self",
"::",
"$",
"instances",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Invalid Role $role\"",
")",
";",
"}",
"return",
"self",
"::",
"$",
"instances",
"[",
"$",
"role",
"]",
";",
"}"
] |
Returns an instance of the given role.
@param int $role
@throws \InvalidArgumentException
@return Role
|
[
"Returns",
"an",
"instance",
"of",
"the",
"given",
"role",
"."
] |
102437193e67e5a841ec5a897549ec345788d1bd
|
https://github.com/CrunchPHP/fastcgi/blob/102437193e67e5a841ec5a897549ec345788d1bd/src/Protocol/Role.php#L46-L63
|
24,701
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.config
|
public function config(
$eid, $secret, $country, $language, $currency,
$mode = Klarna::LIVE, $pcStorage = 'json', $pcURI = 'pclasses.json',
$ssl = true
) {
try {
KlarnaConfig::$store = false;
$this->config = new KlarnaConfig(null);
$this->config['eid'] = $eid;
$this->config['secret'] = $secret;
$this->config['country'] = $country;
$this->config['language'] = $language;
$this->config['currency'] = $currency;
$this->config['mode'] = $mode;
$this->config['ssl'] = $ssl;
$this->config['pcStorage'] = $pcStorage;
$this->config['pcURI'] = $pcURI;
$this->init();
} catch(Exception $e) {
$this->config = null;
throw new KlarnaException(
$e->getMessage(),
$e->getCode()
);
}
}
|
php
|
public function config(
$eid, $secret, $country, $language, $currency,
$mode = Klarna::LIVE, $pcStorage = 'json', $pcURI = 'pclasses.json',
$ssl = true
) {
try {
KlarnaConfig::$store = false;
$this->config = new KlarnaConfig(null);
$this->config['eid'] = $eid;
$this->config['secret'] = $secret;
$this->config['country'] = $country;
$this->config['language'] = $language;
$this->config['currency'] = $currency;
$this->config['mode'] = $mode;
$this->config['ssl'] = $ssl;
$this->config['pcStorage'] = $pcStorage;
$this->config['pcURI'] = $pcURI;
$this->init();
} catch(Exception $e) {
$this->config = null;
throw new KlarnaException(
$e->getMessage(),
$e->getCode()
);
}
}
|
[
"public",
"function",
"config",
"(",
"$",
"eid",
",",
"$",
"secret",
",",
"$",
"country",
",",
"$",
"language",
",",
"$",
"currency",
",",
"$",
"mode",
"=",
"Klarna",
"::",
"LIVE",
",",
"$",
"pcStorage",
"=",
"'json'",
",",
"$",
"pcURI",
"=",
"'pclasses.json'",
",",
"$",
"ssl",
"=",
"true",
")",
"{",
"try",
"{",
"KlarnaConfig",
"::",
"$",
"store",
"=",
"false",
";",
"$",
"this",
"->",
"config",
"=",
"new",
"KlarnaConfig",
"(",
"null",
")",
";",
"$",
"this",
"->",
"config",
"[",
"'eid'",
"]",
"=",
"$",
"eid",
";",
"$",
"this",
"->",
"config",
"[",
"'secret'",
"]",
"=",
"$",
"secret",
";",
"$",
"this",
"->",
"config",
"[",
"'country'",
"]",
"=",
"$",
"country",
";",
"$",
"this",
"->",
"config",
"[",
"'language'",
"]",
"=",
"$",
"language",
";",
"$",
"this",
"->",
"config",
"[",
"'currency'",
"]",
"=",
"$",
"currency",
";",
"$",
"this",
"->",
"config",
"[",
"'mode'",
"]",
"=",
"$",
"mode",
";",
"$",
"this",
"->",
"config",
"[",
"'ssl'",
"]",
"=",
"$",
"ssl",
";",
"$",
"this",
"->",
"config",
"[",
"'pcStorage'",
"]",
"=",
"$",
"pcStorage",
";",
"$",
"this",
"->",
"config",
"[",
"'pcURI'",
"]",
"=",
"$",
"pcURI",
";",
"$",
"this",
"->",
"init",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"null",
";",
"throw",
"new",
"KlarnaException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
")",
";",
"}",
"}"
] |
Method of ease for setting common config fields.
The storage module for PClasses:<br>
Use 'xml' for xmlstorage.class.php.<br>
Use 'mysql' for mysqlstorage.class.php.<br>
Use 'json' for jsonstorage.class.php.<br>
The storage URI for PClasses:<br>
Use the absolute or relative URI to a file if {@link Klarna::$pcStorage}
is set as 'xml' or 'json'.<br>
Use a HTTP-auth similar URL if {@link Klarna::$pcStorage} is set as
mysql', e.g. user:passwd@addr:port/dbName.dbTable.
Or an associative array (recommended) {@see MySQLStorage}
<b>Note</b>:<br>
This disables the config file storage.<br>
@param int $eid Merchant ID/EID
@param string $secret Secret key/Shared key
@param int $country {@link KlarnaCountry}
@param int $language {@link KlarnaLanguage}
@param int $currency {@link KlarnaCurrency}
@param int $mode {@link Klarna::LIVE} or {@link Klarna::BETA}
@param string $pcStorage PClass storage module.
@param string $pcURI PClass URI.
@param bool $ssl Whether HTTPS (HTTP over SSL) or HTTP is used.
@see Klarna::setConfig()
@see KlarnaConfig
@throws KlarnaException
@return void
|
[
"Method",
"of",
"ease",
"for",
"setting",
"common",
"config",
"fields",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L580-L607
|
24,702
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setConfig
|
public function setConfig(&$config)
{
$this->_checkConfig($config);
$this->config = $config;
$this->init();
}
|
php
|
public function setConfig(&$config)
{
$this->_checkConfig($config);
$this->config = $config;
$this->init();
}
|
[
"public",
"function",
"setConfig",
"(",
"&",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"_checkConfig",
"(",
"$",
"config",
")",
";",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"$",
"this",
"->",
"init",
"(",
")",
";",
"}"
] |
Sets and initializes this Klarna object using the supplied config object.
@param KlarnaConfig &$config Config object.
@see KlarnaConfig
@throws KlarnaException
@return void
|
[
"Sets",
"and",
"initializes",
"this",
"Klarna",
"object",
"using",
"the",
"supplied",
"config",
"object",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L618-L624
|
24,703
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setCountry
|
public function setCountry($country)
{
if (!is_numeric($country)
&& (strlen($country) == 2 || strlen($country) == 3)
) {
$country = KlarnaCountry::fromCode($country);
}
$this->_checkCountry($country);
$this->_country = $country;
}
|
php
|
public function setCountry($country)
{
if (!is_numeric($country)
&& (strlen($country) == 2 || strlen($country) == 3)
) {
$country = KlarnaCountry::fromCode($country);
}
$this->_checkCountry($country);
$this->_country = $country;
}
|
[
"public",
"function",
"setCountry",
"(",
"$",
"country",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"country",
")",
"&&",
"(",
"strlen",
"(",
"$",
"country",
")",
"==",
"2",
"||",
"strlen",
"(",
"$",
"country",
")",
"==",
"3",
")",
")",
"{",
"$",
"country",
"=",
"KlarnaCountry",
"::",
"fromCode",
"(",
"$",
"country",
")",
";",
"}",
"$",
"this",
"->",
"_checkCountry",
"(",
"$",
"country",
")",
";",
"$",
"this",
"->",
"_country",
"=",
"$",
"country",
";",
"}"
] |
Sets the country used.
<b>Note</b>:<br>
If you input 'dk', 'fi', 'de', 'nl', 'no' or 'se', <br>
then currency and language will be set to mirror that country.<br>
@param string|int $country {@link KlarnaCountry}
@see KlarnaCountry
@throws KlarnaException
@return void
|
[
"Sets",
"the",
"country",
"used",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L712-L721
|
24,704
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getCountryCode
|
public function getCountryCode($country = null)
{
if ($country === null) {
$country = $this->_country;
}
$code = KlarnaCountry::getCode($country);
return (string) $code;
}
|
php
|
public function getCountryCode($country = null)
{
if ($country === null) {
$country = $this->_country;
}
$code = KlarnaCountry::getCode($country);
return (string) $code;
}
|
[
"public",
"function",
"getCountryCode",
"(",
"$",
"country",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"country",
"===",
"null",
")",
"{",
"$",
"country",
"=",
"$",
"this",
"->",
"_country",
";",
"}",
"$",
"code",
"=",
"KlarnaCountry",
"::",
"getCode",
"(",
"$",
"country",
")",
";",
"return",
"(",
"string",
")",
"$",
"code",
";",
"}"
] |
Returns the country code for the set country constant.
@param int $country {@link KlarnaCountry Country} constant.
@return string Two letter code, e.g. "se", "no", etc.
|
[
"Returns",
"the",
"country",
"code",
"for",
"the",
"set",
"country",
"constant",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L730-L738
|
24,705
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setLanguage
|
public function setLanguage($language)
{
if (!is_numeric($language) && strlen($language) == 2) {
$this->setLanguage(self::getLanguageForCode($language));
} else {
$this->_checkLanguage($language);
$this->_language = $language;
}
}
|
php
|
public function setLanguage($language)
{
if (!is_numeric($language) && strlen($language) == 2) {
$this->setLanguage(self::getLanguageForCode($language));
} else {
$this->_checkLanguage($language);
$this->_language = $language;
}
}
|
[
"public",
"function",
"setLanguage",
"(",
"$",
"language",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"language",
")",
"&&",
"strlen",
"(",
"$",
"language",
")",
"==",
"2",
")",
"{",
"$",
"this",
"->",
"setLanguage",
"(",
"self",
"::",
"getLanguageForCode",
"(",
"$",
"language",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_checkLanguage",
"(",
"$",
"language",
")",
";",
"$",
"this",
"->",
"_language",
"=",
"$",
"language",
";",
"}",
"}"
] |
Sets the language used.
<b>Note</b>:<br>
You can use the two letter language code instead of the constant.<br>
E.g. 'da' instead of using {@link KlarnaLanguage::DA}.<br>
@param string|int $language {@link KlarnaLanguage}
@see KlarnaLanguage
@throws KlarnaException
@return void
|
[
"Sets",
"the",
"language",
"used",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L781-L789
|
24,706
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getLanguageCode
|
public function getLanguageCode($language = null)
{
if ($language === null) {
$language = $this->_language;
}
$code = KlarnaLanguage::getCode($language);
return (string) $code;
}
|
php
|
public function getLanguageCode($language = null)
{
if ($language === null) {
$language = $this->_language;
}
$code = KlarnaLanguage::getCode($language);
return (string) $code;
}
|
[
"public",
"function",
"getLanguageCode",
"(",
"$",
"language",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"language",
"===",
"null",
")",
"{",
"$",
"language",
"=",
"$",
"this",
"->",
"_language",
";",
"}",
"$",
"code",
"=",
"KlarnaLanguage",
"::",
"getCode",
"(",
"$",
"language",
")",
";",
"return",
"(",
"string",
")",
"$",
"code",
";",
"}"
] |
Returns the language code for the set language constant.
@param int $language {@link KlarnaLanguage Language} constant.
@return string Two letter code, e.g. "da", "de", etc.
|
[
"Returns",
"the",
"language",
"code",
"for",
"the",
"set",
"language",
"constant",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L798-L806
|
24,707
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setCurrency
|
public function setCurrency($currency)
{
if (!is_numeric($currency) && strlen($currency) == 3) {
$this->setCurrency(self::getCurrencyForCode($currency));
} else {
$this->_checkCurrency($currency);
$this->_currency = $currency;
}
}
|
php
|
public function setCurrency($currency)
{
if (!is_numeric($currency) && strlen($currency) == 3) {
$this->setCurrency(self::getCurrencyForCode($currency));
} else {
$this->_checkCurrency($currency);
$this->_currency = $currency;
}
}
|
[
"public",
"function",
"setCurrency",
"(",
"$",
"currency",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"currency",
")",
"&&",
"strlen",
"(",
"$",
"currency",
")",
"==",
"3",
")",
"{",
"$",
"this",
"->",
"setCurrency",
"(",
"self",
"::",
"getCurrencyForCode",
"(",
"$",
"currency",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_checkCurrency",
"(",
"$",
"currency",
")",
";",
"$",
"this",
"->",
"_currency",
"=",
"$",
"currency",
";",
"}",
"}"
] |
Sets the currency used.
<b>Note</b>:<br>
You can use the three letter shortening of the currency.<br>
E.g. "dkk", "eur", "nok" or "sek" instead of the constant.<br>
@param string|int $currency {@link KlarnaCurrency}
@see KlarnaCurrency
@throws KlarnaException
@return void
|
[
"Sets",
"the",
"currency",
"used",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L850-L858
|
24,708
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getCurrencyCode
|
public function getCurrencyCode($currency = null)
{
if ($currency === null) {
$currency = $this->_currency;
}
$code = KlarnaCurrency::getCode($currency);
return (string) $code;
}
|
php
|
public function getCurrencyCode($currency = null)
{
if ($currency === null) {
$currency = $this->_currency;
}
$code = KlarnaCurrency::getCode($currency);
return (string) $code;
}
|
[
"public",
"function",
"getCurrencyCode",
"(",
"$",
"currency",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"currency",
"===",
"null",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"_currency",
";",
"}",
"$",
"code",
"=",
"KlarnaCurrency",
"::",
"getCode",
"(",
"$",
"currency",
")",
";",
"return",
"(",
"string",
")",
"$",
"code",
";",
"}"
] |
Returns the the currency code for the set currency constant.
@param int $currency {@link KlarnaCurrency Currency} constant.
@return string Three letter currency code.
|
[
"Returns",
"the",
"the",
"currency",
"code",
"for",
"the",
"set",
"currency",
"constant",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L885-L893
|
24,709
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setSessionID
|
public function setSessionID($name, $sid)
{
$this->_checkArgument($name, "name");
$this->_checkArgument($sid, "sid");
$this->sid[$name] = $sid;
}
|
php
|
public function setSessionID($name, $sid)
{
$this->_checkArgument($name, "name");
$this->_checkArgument($sid, "sid");
$this->sid[$name] = $sid;
}
|
[
"public",
"function",
"setSessionID",
"(",
"$",
"name",
",",
"$",
"sid",
")",
"{",
"$",
"this",
"->",
"_checkArgument",
"(",
"$",
"name",
",",
"\"name\"",
")",
";",
"$",
"this",
"->",
"_checkArgument",
"(",
"$",
"sid",
",",
"\"sid\"",
")",
";",
"$",
"this",
"->",
"sid",
"[",
"$",
"name",
"]",
"=",
"$",
"sid",
";",
"}"
] |
Sets the session id's for various device identification,
behaviour identification software.
<b>Available named session id's</b>:<br>
string - dev_id_1<br>
string - dev_id_2<br>
string - dev_id_3<br>
string - beh_id_1<br>
string - beh_id_2<br>
string - beh_id_3<br>
@param string $name Session ID identifier, e.g. 'dev_id_1'.
@param string $sid Session ID.
@throws KlarnaException
@return void
|
[
"Sets",
"the",
"session",
"id",
"s",
"for",
"various",
"device",
"identification",
"behaviour",
"identification",
"software",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L964-L970
|
24,710
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getClientIP
|
public function getClientIP()
{
if (isset($this->clientIP)) {
return $this->clientIP;
}
$tmp_ip = '';
$x_fwd = null;
//Proxy handling.
if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
$tmp_ip = $_SERVER['REMOTE_ADDR'];
}
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$x_fwd = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
if (self::$x_forwarded_for && ($x_fwd !== null)) {
$forwarded = explode(",", $x_fwd);
return trim($forwarded[0]);
}
return $tmp_ip;
}
|
php
|
public function getClientIP()
{
if (isset($this->clientIP)) {
return $this->clientIP;
}
$tmp_ip = '';
$x_fwd = null;
//Proxy handling.
if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
$tmp_ip = $_SERVER['REMOTE_ADDR'];
}
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$x_fwd = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
if (self::$x_forwarded_for && ($x_fwd !== null)) {
$forwarded = explode(",", $x_fwd);
return trim($forwarded[0]);
}
return $tmp_ip;
}
|
[
"public",
"function",
"getClientIP",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"clientIP",
")",
")",
"{",
"return",
"$",
"this",
"->",
"clientIP",
";",
"}",
"$",
"tmp_ip",
"=",
"''",
";",
"$",
"x_fwd",
"=",
"null",
";",
"//Proxy handling.",
"if",
"(",
"array_key_exists",
"(",
"'REMOTE_ADDR'",
",",
"$",
"_SERVER",
")",
")",
"{",
"$",
"tmp_ip",
"=",
"$",
"_SERVER",
"[",
"'REMOTE_ADDR'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
")",
")",
"{",
"$",
"x_fwd",
"=",
"$",
"_SERVER",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
";",
"}",
"if",
"(",
"self",
"::",
"$",
"x_forwarded_for",
"&&",
"(",
"$",
"x_fwd",
"!==",
"null",
")",
")",
"{",
"$",
"forwarded",
"=",
"explode",
"(",
"\",\"",
",",
"$",
"x_fwd",
")",
";",
"return",
"trim",
"(",
"$",
"forwarded",
"[",
"0",
"]",
")",
";",
"}",
"return",
"$",
"tmp_ip",
";",
"}"
] |
Returns the clients IP address.
@return string
|
[
"Returns",
"the",
"clients",
"IP",
"address",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L1141-L1165
|
24,711
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setAddress
|
public function setAddress($type, $addr)
{
if (!($addr instanceof KlarnaAddr)) {
throw new Klarna_InvalidKlarnaAddrException;
}
if ($addr->isCompany === null) {
$addr->isCompany = false;
}
if ($type === KlarnaFlags::IS_SHIPPING) {
$this->shipping = $addr;
self::printDebug("shipping address array", $this->shipping);
return;
}
if ($type === KlarnaFlags::IS_BILLING) {
$this->billing = $addr;
self::printDebug("billing address array", $this->billing);
return;
}
throw new Klarna_UnknownAddressTypeException($type);
}
|
php
|
public function setAddress($type, $addr)
{
if (!($addr instanceof KlarnaAddr)) {
throw new Klarna_InvalidKlarnaAddrException;
}
if ($addr->isCompany === null) {
$addr->isCompany = false;
}
if ($type === KlarnaFlags::IS_SHIPPING) {
$this->shipping = $addr;
self::printDebug("shipping address array", $this->shipping);
return;
}
if ($type === KlarnaFlags::IS_BILLING) {
$this->billing = $addr;
self::printDebug("billing address array", $this->billing);
return;
}
throw new Klarna_UnknownAddressTypeException($type);
}
|
[
"public",
"function",
"setAddress",
"(",
"$",
"type",
",",
"$",
"addr",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"addr",
"instanceof",
"KlarnaAddr",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidKlarnaAddrException",
";",
"}",
"if",
"(",
"$",
"addr",
"->",
"isCompany",
"===",
"null",
")",
"{",
"$",
"addr",
"->",
"isCompany",
"=",
"false",
";",
"}",
"if",
"(",
"$",
"type",
"===",
"KlarnaFlags",
"::",
"IS_SHIPPING",
")",
"{",
"$",
"this",
"->",
"shipping",
"=",
"$",
"addr",
";",
"self",
"::",
"printDebug",
"(",
"\"shipping address array\"",
",",
"$",
"this",
"->",
"shipping",
")",
";",
"return",
";",
"}",
"if",
"(",
"$",
"type",
"===",
"KlarnaFlags",
"::",
"IS_BILLING",
")",
"{",
"$",
"this",
"->",
"billing",
"=",
"$",
"addr",
";",
"self",
"::",
"printDebug",
"(",
"\"billing address array\"",
",",
"$",
"this",
"->",
"billing",
")",
";",
"return",
";",
"}",
"throw",
"new",
"Klarna_UnknownAddressTypeException",
"(",
"$",
"type",
")",
";",
"}"
] |
Sets the specified address for the current order.
<b>Address type can be</b>:<br>
{@link KlarnaFlags::IS_SHIPPING}<br>
{@link KlarnaFlags::IS_BILLING}<br>
@param int $type Address type.
@param KlarnaAddr $addr Specified address.
@throws KlarnaException
@return void
|
[
"Sets",
"the",
"specified",
"address",
"for",
"the",
"current",
"order",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L1180-L1202
|
24,712
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.addArticle
|
public function addArticle(
$qty, $artNo, $title, $price, $vat, $discount = 0,
$flags = KlarnaFlags::INC_VAT
) {
$this->_checkQty($qty);
// Either artno or title has to be set
if ((($artNo === null ) || ($artNo == ""))
&& (($title === null ) || ($title == ""))
) {
throw new Klarna_ArgumentNotSetException('Title and ArtNo', 50026);
}
$this->_checkPrice($price);
$this->_checkVAT($vat);
$this->_checkDiscount($discount);
$this->_checkInt($flags, 'flags');
//Create goodsList array if not set.
if (!$this->goodsList || !is_array($this->goodsList)) {
$this->goodsList = array();
}
//Populate a temp array with the article details.
$tmpArr = array(
"artno" => $artNo,
"title" => $title,
"price" => $price,
"vat" => $vat,
"discount" => $discount,
"flags" => $flags
);
//Add the temp array and quantity field to the internal goods list.
$this->goodsList[] = array(
"goods" => $tmpArr,
"qty" => $qty
);
if (count($this->goodsList) > 0) {
self::printDebug(
"article added",
$this->goodsList[count($this->goodsList)-1]
);
}
}
|
php
|
public function addArticle(
$qty, $artNo, $title, $price, $vat, $discount = 0,
$flags = KlarnaFlags::INC_VAT
) {
$this->_checkQty($qty);
// Either artno or title has to be set
if ((($artNo === null ) || ($artNo == ""))
&& (($title === null ) || ($title == ""))
) {
throw new Klarna_ArgumentNotSetException('Title and ArtNo', 50026);
}
$this->_checkPrice($price);
$this->_checkVAT($vat);
$this->_checkDiscount($discount);
$this->_checkInt($flags, 'flags');
//Create goodsList array if not set.
if (!$this->goodsList || !is_array($this->goodsList)) {
$this->goodsList = array();
}
//Populate a temp array with the article details.
$tmpArr = array(
"artno" => $artNo,
"title" => $title,
"price" => $price,
"vat" => $vat,
"discount" => $discount,
"flags" => $flags
);
//Add the temp array and quantity field to the internal goods list.
$this->goodsList[] = array(
"goods" => $tmpArr,
"qty" => $qty
);
if (count($this->goodsList) > 0) {
self::printDebug(
"article added",
$this->goodsList[count($this->goodsList)-1]
);
}
}
|
[
"public",
"function",
"addArticle",
"(",
"$",
"qty",
",",
"$",
"artNo",
",",
"$",
"title",
",",
"$",
"price",
",",
"$",
"vat",
",",
"$",
"discount",
"=",
"0",
",",
"$",
"flags",
"=",
"KlarnaFlags",
"::",
"INC_VAT",
")",
"{",
"$",
"this",
"->",
"_checkQty",
"(",
"$",
"qty",
")",
";",
"// Either artno or title has to be set",
"if",
"(",
"(",
"(",
"$",
"artNo",
"===",
"null",
")",
"||",
"(",
"$",
"artNo",
"==",
"\"\"",
")",
")",
"&&",
"(",
"(",
"$",
"title",
"===",
"null",
")",
"||",
"(",
"$",
"title",
"==",
"\"\"",
")",
")",
")",
"{",
"throw",
"new",
"Klarna_ArgumentNotSetException",
"(",
"'Title and ArtNo'",
",",
"50026",
")",
";",
"}",
"$",
"this",
"->",
"_checkPrice",
"(",
"$",
"price",
")",
";",
"$",
"this",
"->",
"_checkVAT",
"(",
"$",
"vat",
")",
";",
"$",
"this",
"->",
"_checkDiscount",
"(",
"$",
"discount",
")",
";",
"$",
"this",
"->",
"_checkInt",
"(",
"$",
"flags",
",",
"'flags'",
")",
";",
"//Create goodsList array if not set.",
"if",
"(",
"!",
"$",
"this",
"->",
"goodsList",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"goodsList",
")",
")",
"{",
"$",
"this",
"->",
"goodsList",
"=",
"array",
"(",
")",
";",
"}",
"//Populate a temp array with the article details.",
"$",
"tmpArr",
"=",
"array",
"(",
"\"artno\"",
"=>",
"$",
"artNo",
",",
"\"title\"",
"=>",
"$",
"title",
",",
"\"price\"",
"=>",
"$",
"price",
",",
"\"vat\"",
"=>",
"$",
"vat",
",",
"\"discount\"",
"=>",
"$",
"discount",
",",
"\"flags\"",
"=>",
"$",
"flags",
")",
";",
"//Add the temp array and quantity field to the internal goods list.",
"$",
"this",
"->",
"goodsList",
"[",
"]",
"=",
"array",
"(",
"\"goods\"",
"=>",
"$",
"tmpArr",
",",
"\"qty\"",
"=>",
"$",
"qty",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"goodsList",
")",
">",
"0",
")",
"{",
"self",
"::",
"printDebug",
"(",
"\"article added\"",
",",
"$",
"this",
"->",
"goodsList",
"[",
"count",
"(",
"$",
"this",
"->",
"goodsList",
")",
"-",
"1",
"]",
")",
";",
"}",
"}"
] |
Adds an article to the current goods list for the current order.
<b>Note</b>:<br>
It is recommended that you use {@link KlarnaFlags::INC_VAT}.<br>
<b>Flags can be</b>:<br>
{@link KlarnaFlags::INC_VAT}<br>
{@link KlarnaFlags::IS_SHIPMENT}<br>
{@link KlarnaFlags::IS_HANDLING}<br>
{@link KlarnaFlags::PRINT_1000}<br>
{@link KlarnaFlags::PRINT_100}<br>
{@link KlarnaFlags::PRINT_10}<br>
{@link KlarnaFlags::NO_FLAG}<br>
Some flags can be added to each other for multiple options.
@param int $qty Quantity.
@param string $artNo Article number.
@param string $title Article title.
@param int $price Article price.
@param float $vat VAT in percent, e.g. 25% is inputted as 25.
@param float $discount Possible discount on article.
@param int $flags Options which specify the article
({@link KlarnaFlags::IS_HANDLING}) and it's price
({@link KlarnaFlags::INC_VAT})
@see Klarna::addTransaction()
@see Klarna::reserveAmount()
@see Klarna::activateReservation()
@throws KlarnaException
@return void
|
[
"Adds",
"an",
"article",
"to",
"the",
"current",
"goods",
"list",
"for",
"the",
"current",
"order",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L1491-L1536
|
24,713
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.summarizeGoodsList
|
public function summarizeGoodsList()
{
$amount = 0;
if (!is_array($this->goodsList)) {
return $amount;
}
foreach ($this->goodsList as $goods) {
$price = $goods['goods']['price'];
// Add VAT if price is Excluding VAT
if (($goods['goods']['flags'] & KlarnaFlags::INC_VAT) === 0) {
$vat = $goods['goods']['vat'] / 100.0;
$price *= (1.0 + $vat);
}
// Reduce discounts
if ($goods['goods']['discount'] > 0) {
$discount = $goods['goods']['discount'] / 100.0;
$price *= (1.0 - $discount);
}
$amount += $price * (int)$goods['qty'];
}
return $amount;
}
|
php
|
public function summarizeGoodsList()
{
$amount = 0;
if (!is_array($this->goodsList)) {
return $amount;
}
foreach ($this->goodsList as $goods) {
$price = $goods['goods']['price'];
// Add VAT if price is Excluding VAT
if (($goods['goods']['flags'] & KlarnaFlags::INC_VAT) === 0) {
$vat = $goods['goods']['vat'] / 100.0;
$price *= (1.0 + $vat);
}
// Reduce discounts
if ($goods['goods']['discount'] > 0) {
$discount = $goods['goods']['discount'] / 100.0;
$price *= (1.0 - $discount);
}
$amount += $price * (int)$goods['qty'];
}
return $amount;
}
|
[
"public",
"function",
"summarizeGoodsList",
"(",
")",
"{",
"$",
"amount",
"=",
"0",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"goodsList",
")",
")",
"{",
"return",
"$",
"amount",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"goodsList",
"as",
"$",
"goods",
")",
"{",
"$",
"price",
"=",
"$",
"goods",
"[",
"'goods'",
"]",
"[",
"'price'",
"]",
";",
"// Add VAT if price is Excluding VAT",
"if",
"(",
"(",
"$",
"goods",
"[",
"'goods'",
"]",
"[",
"'flags'",
"]",
"&",
"KlarnaFlags",
"::",
"INC_VAT",
")",
"===",
"0",
")",
"{",
"$",
"vat",
"=",
"$",
"goods",
"[",
"'goods'",
"]",
"[",
"'vat'",
"]",
"/",
"100.0",
";",
"$",
"price",
"*=",
"(",
"1.0",
"+",
"$",
"vat",
")",
";",
"}",
"// Reduce discounts",
"if",
"(",
"$",
"goods",
"[",
"'goods'",
"]",
"[",
"'discount'",
"]",
">",
"0",
")",
"{",
"$",
"discount",
"=",
"$",
"goods",
"[",
"'goods'",
"]",
"[",
"'discount'",
"]",
"/",
"100.0",
";",
"$",
"price",
"*=",
"(",
"1.0",
"-",
"$",
"discount",
")",
";",
"}",
"$",
"amount",
"+=",
"$",
"price",
"*",
"(",
"int",
")",
"$",
"goods",
"[",
"'qty'",
"]",
";",
"}",
"return",
"$",
"amount",
";",
"}"
] |
Summarizes the prices of the held goods list
@return int total amount
|
[
"Summarizes",
"the",
"prices",
"of",
"the",
"held",
"goods",
"list"
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L1800-L1824
|
24,714
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.cancelReservation
|
public function cancelReservation($rno)
{
$this->_checkRNO($rno);
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $this->_secret)
);
$paramList = array(
$rno,
$this->_eid,
$digestSecret
);
self::printDebug('cancel_reservation', $paramList);
$result = $this->xmlrpc_call('cancel_reservation', $paramList);
return ($result == 'ok');
}
|
php
|
public function cancelReservation($rno)
{
$this->_checkRNO($rno);
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $this->_secret)
);
$paramList = array(
$rno,
$this->_eid,
$digestSecret
);
self::printDebug('cancel_reservation', $paramList);
$result = $this->xmlrpc_call('cancel_reservation', $paramList);
return ($result == 'ok');
}
|
[
"public",
"function",
"cancelReservation",
"(",
"$",
"rno",
")",
"{",
"$",
"this",
"->",
"_checkRNO",
"(",
"$",
"rno",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"rno",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"rno",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'cancel_reservation'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'cancel_reservation'",
",",
"$",
"paramList",
")",
";",
"return",
"(",
"$",
"result",
"==",
"'ok'",
")",
";",
"}"
] |
Cancels a reservation.
@param string $rno Reservation number.
@throws KlarnaException
@return bool True, if the cancellation was successful.
|
[
"Cancels",
"a",
"reservation",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L1996-L2014
|
24,715
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.changeReservation
|
public function changeReservation(
$rno, $amount, $flags = KlarnaFlags::NEW_AMOUNT
) {
$this->_checkRNO($rno);
$this->_checkAmount($amount);
$this->_checkInt($flags, 'flags');
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $amount, $this->_secret)
);
$paramList = array(
$rno,
$amount,
$this->_eid,
$digestSecret,
$flags
);
self::printDebug('change_reservation', $paramList);
$result = $this->xmlrpc_call('change_reservation', $paramList);
return ($result == 'ok') ? true : false;
}
|
php
|
public function changeReservation(
$rno, $amount, $flags = KlarnaFlags::NEW_AMOUNT
) {
$this->_checkRNO($rno);
$this->_checkAmount($amount);
$this->_checkInt($flags, 'flags');
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $amount, $this->_secret)
);
$paramList = array(
$rno,
$amount,
$this->_eid,
$digestSecret,
$flags
);
self::printDebug('change_reservation', $paramList);
$result = $this->xmlrpc_call('change_reservation', $paramList);
return ($result == 'ok') ? true : false;
}
|
[
"public",
"function",
"changeReservation",
"(",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"flags",
"=",
"KlarnaFlags",
"::",
"NEW_AMOUNT",
")",
"{",
"$",
"this",
"->",
"_checkRNO",
"(",
"$",
"rno",
")",
";",
"$",
"this",
"->",
"_checkAmount",
"(",
"$",
"amount",
")",
";",
"$",
"this",
"->",
"_checkInt",
"(",
"$",
"flags",
",",
"'flags'",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"flags",
")",
";",
"self",
"::",
"printDebug",
"(",
"'change_reservation'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'change_reservation'",
",",
"$",
"paramList",
")",
";",
"return",
"(",
"$",
"result",
"==",
"'ok'",
")",
"?",
"true",
":",
"false",
";",
"}"
] |
Changes specified reservation to a new amount.
<b>Flags can be either of these</b>:<br>
{@link KlarnaFlags::NEW_AMOUNT}<br>
{@link KlarnaFlags::ADD_AMOUNT}<br>
@param string $rno Reservation number.
@param int $amount Amount including VAT.
@param int $flags Options which affect the behaviour.
@throws KlarnaException
@return bool True, if the change was successful.
|
[
"Changes",
"specified",
"reservation",
"to",
"a",
"new",
"amount",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2031-L2054
|
24,716
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.update
|
public function update($rno, $clear = true)
{
$rno = strval($rno);
// All info that is sent in is part of the digest secret, in this order:
// [
// proto_vsn, client_vsn, eid, rno, careof, street, zip, city,
// country, fname, lname, careof, street, zip, city, country,
// fname, lname, artno, qty, orderid1, orderid2
// ].
// The address part appears twice, that is one per address that
// changes. If no value is sent in for an optional field, there
// is no entry for this field in the digest secret. Shared secret
// is added at the end of the digest secret.
$digestArray = array(
str_replace('.', ':', $this->PROTO),
$this->VERSION,
$this->_eid,
$rno
);
$digestArray = array_merge(
$digestArray, $this->_addressDigestPart($this->shipping)
);
$digestArray = array_merge(
$digestArray, $this->_addressDigestPart($this->billing)
);
if (is_array($this->goodsList) && $this->goodsList !== array()) {
foreach ($this->goodsList as $goods) {
if (strlen($goods["goods"]["artno"]) > 0) {
$digestArray[] = $goods["goods"]["artno"];
} else {
$digestArray[] = $goods["goods"]["title"];
}
$digestArray[] = $goods["qty"];
}
}
foreach ($this->orderid as $orderid) {
$digestArray[] = $orderid;
}
$digestArray[] = $this->_secret;
$digestSecret = $this->digest(
call_user_func_array(
array('self', 'colon'), $digestArray
)
);
$shipping = array();
$billing = array();
if ($this->shipping !== null && $this->shipping instanceof KlarnaAddr) {
$shipping = $this->shipping->toArray();
}
if ($this->billing !== null && $this->billing instanceof KlarnaAddr) {
$billing = $this->billing->toArray();
}
$paramList = array(
$this->_eid,
$digestSecret,
$rno,
array(
'goods_list' => $this->goodsList,
'dlv_addr' => $shipping,
'bill_addr' => $billing,
'orderid1' => $this->orderid[0],
'orderid2' => $this->orderid[1]
)
);
self::printDebug('update array', $paramList);
$result = $this->xmlrpc_call('update', $paramList);
self::printDebug('update result', $result);
return ($result === 'ok');
}
|
php
|
public function update($rno, $clear = true)
{
$rno = strval($rno);
// All info that is sent in is part of the digest secret, in this order:
// [
// proto_vsn, client_vsn, eid, rno, careof, street, zip, city,
// country, fname, lname, careof, street, zip, city, country,
// fname, lname, artno, qty, orderid1, orderid2
// ].
// The address part appears twice, that is one per address that
// changes. If no value is sent in for an optional field, there
// is no entry for this field in the digest secret. Shared secret
// is added at the end of the digest secret.
$digestArray = array(
str_replace('.', ':', $this->PROTO),
$this->VERSION,
$this->_eid,
$rno
);
$digestArray = array_merge(
$digestArray, $this->_addressDigestPart($this->shipping)
);
$digestArray = array_merge(
$digestArray, $this->_addressDigestPart($this->billing)
);
if (is_array($this->goodsList) && $this->goodsList !== array()) {
foreach ($this->goodsList as $goods) {
if (strlen($goods["goods"]["artno"]) > 0) {
$digestArray[] = $goods["goods"]["artno"];
} else {
$digestArray[] = $goods["goods"]["title"];
}
$digestArray[] = $goods["qty"];
}
}
foreach ($this->orderid as $orderid) {
$digestArray[] = $orderid;
}
$digestArray[] = $this->_secret;
$digestSecret = $this->digest(
call_user_func_array(
array('self', 'colon'), $digestArray
)
);
$shipping = array();
$billing = array();
if ($this->shipping !== null && $this->shipping instanceof KlarnaAddr) {
$shipping = $this->shipping->toArray();
}
if ($this->billing !== null && $this->billing instanceof KlarnaAddr) {
$billing = $this->billing->toArray();
}
$paramList = array(
$this->_eid,
$digestSecret,
$rno,
array(
'goods_list' => $this->goodsList,
'dlv_addr' => $shipping,
'bill_addr' => $billing,
'orderid1' => $this->orderid[0],
'orderid2' => $this->orderid[1]
)
);
self::printDebug('update array', $paramList);
$result = $this->xmlrpc_call('update', $paramList);
self::printDebug('update result', $result);
return ($result === 'ok');
}
|
[
"public",
"function",
"update",
"(",
"$",
"rno",
",",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"rno",
"=",
"strval",
"(",
"$",
"rno",
")",
";",
"// All info that is sent in is part of the digest secret, in this order:",
"// [",
"// proto_vsn, client_vsn, eid, rno, careof, street, zip, city,",
"// country, fname, lname, careof, street, zip, city, country,",
"// fname, lname, artno, qty, orderid1, orderid2",
"// ].",
"// The address part appears twice, that is one per address that",
"// changes. If no value is sent in for an optional field, there",
"// is no entry for this field in the digest secret. Shared secret",
"// is added at the end of the digest secret.",
"$",
"digestArray",
"=",
"array",
"(",
"str_replace",
"(",
"'.'",
",",
"':'",
",",
"$",
"this",
"->",
"PROTO",
")",
",",
"$",
"this",
"->",
"VERSION",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"rno",
")",
";",
"$",
"digestArray",
"=",
"array_merge",
"(",
"$",
"digestArray",
",",
"$",
"this",
"->",
"_addressDigestPart",
"(",
"$",
"this",
"->",
"shipping",
")",
")",
";",
"$",
"digestArray",
"=",
"array_merge",
"(",
"$",
"digestArray",
",",
"$",
"this",
"->",
"_addressDigestPart",
"(",
"$",
"this",
"->",
"billing",
")",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"goodsList",
")",
"&&",
"$",
"this",
"->",
"goodsList",
"!==",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"goodsList",
"as",
"$",
"goods",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"goods",
"[",
"\"goods\"",
"]",
"[",
"\"artno\"",
"]",
")",
">",
"0",
")",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"goods",
"[",
"\"goods\"",
"]",
"[",
"\"artno\"",
"]",
";",
"}",
"else",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"goods",
"[",
"\"goods\"",
"]",
"[",
"\"title\"",
"]",
";",
"}",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"goods",
"[",
"\"qty\"",
"]",
";",
"}",
"}",
"foreach",
"(",
"$",
"this",
"->",
"orderid",
"as",
"$",
"orderid",
")",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"orderid",
";",
"}",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"this",
"->",
"_secret",
";",
"$",
"digestSecret",
"=",
"$",
"this",
"->",
"digest",
"(",
"call_user_func_array",
"(",
"array",
"(",
"'self'",
",",
"'colon'",
")",
",",
"$",
"digestArray",
")",
")",
";",
"$",
"shipping",
"=",
"array",
"(",
")",
";",
"$",
"billing",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"shipping",
"!==",
"null",
"&&",
"$",
"this",
"->",
"shipping",
"instanceof",
"KlarnaAddr",
")",
"{",
"$",
"shipping",
"=",
"$",
"this",
"->",
"shipping",
"->",
"toArray",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"billing",
"!==",
"null",
"&&",
"$",
"this",
"->",
"billing",
"instanceof",
"KlarnaAddr",
")",
"{",
"$",
"billing",
"=",
"$",
"this",
"->",
"billing",
"->",
"toArray",
"(",
")",
";",
"}",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"rno",
",",
"array",
"(",
"'goods_list'",
"=>",
"$",
"this",
"->",
"goodsList",
",",
"'dlv_addr'",
"=>",
"$",
"shipping",
",",
"'bill_addr'",
"=>",
"$",
"billing",
",",
"'orderid1'",
"=>",
"$",
"this",
"->",
"orderid",
"[",
"0",
"]",
",",
"'orderid2'",
"=>",
"$",
"this",
"->",
"orderid",
"[",
"1",
"]",
")",
")",
";",
"self",
"::",
"printDebug",
"(",
"'update array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'update'",
",",
"$",
"paramList",
")",
";",
"self",
"::",
"printDebug",
"(",
"'update result'",
",",
"$",
"result",
")",
";",
"return",
"(",
"$",
"result",
"===",
"'ok'",
")",
";",
"}"
] |
Update the reservation matching the given reservation number.
@param string $rno Reservation number
@param boolean $clear clear set data aftre updating. Defaulted to true.
@throws KlarnaException if no RNO is given, or if an error is recieved
from Klarna Online.
@return true if the update was successful
|
[
"Update",
"the",
"reservation",
"matching",
"the",
"given",
"reservation",
"number",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2067-L2142
|
24,717
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna._addressDigestPart
|
private function _addressDigestPart(KlarnaAddr $address = null)
{
if ($address === null) {
return array();
}
$keyOrder = array(
'careof', 'street', 'zip', 'city', 'country', 'fname', 'lname'
);
$holder = $address->toArray();
$digest = array();
foreach ($keyOrder as $key) {
if ($holder[$key] != "") {
$digest[] = $holder[$key];
}
}
return $digest;
}
|
php
|
private function _addressDigestPart(KlarnaAddr $address = null)
{
if ($address === null) {
return array();
}
$keyOrder = array(
'careof', 'street', 'zip', 'city', 'country', 'fname', 'lname'
);
$holder = $address->toArray();
$digest = array();
foreach ($keyOrder as $key) {
if ($holder[$key] != "") {
$digest[] = $holder[$key];
}
}
return $digest;
}
|
[
"private",
"function",
"_addressDigestPart",
"(",
"KlarnaAddr",
"$",
"address",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"address",
"===",
"null",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"keyOrder",
"=",
"array",
"(",
"'careof'",
",",
"'street'",
",",
"'zip'",
",",
"'city'",
",",
"'country'",
",",
"'fname'",
",",
"'lname'",
")",
";",
"$",
"holder",
"=",
"$",
"address",
"->",
"toArray",
"(",
")",
";",
"$",
"digest",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"keyOrder",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"holder",
"[",
"$",
"key",
"]",
"!=",
"\"\"",
")",
"{",
"$",
"digest",
"[",
"]",
"=",
"$",
"holder",
"[",
"$",
"key",
"]",
";",
"}",
"}",
"return",
"$",
"digest",
";",
"}"
] |
Help function to sort the address for update digest.
@param KlarnaAddr|null $address KlarnaAddr object or null
@return array
|
[
"Help",
"function",
"to",
"sort",
"the",
"address",
"for",
"update",
"digest",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2151-L2171
|
24,718
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.activate
|
public function activate(
$rno, $ocr = null, $flags = null, $clear = true
) {
$this->_checkRNO($rno);
// Overwrite any OCR set on activateInfo if supplied here since this
// method call is more specific.
if ($ocr !== null) {
$this->setActivateInfo('ocr', $ocr);
}
// If flags is specified set the flag supplied here to activateInfo.
if ($flags !== null) {
$this->setActivateInfo('flags', $flags);
}
//Assume normal shipment unless otherwise specified.
if (!array_key_exists('delay_adjust', $this->shipInfo)) {
$this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
}
// Append shipment info to activateInfo
$this->activateInfo['shipment_info'] = $this->shipInfo;
// Unlike other calls, if NO_FLAG is specified it should not be sent in
// at all.
if (array_key_exists('flags', $this->activateInfo)
&& $this->activateInfo['flags'] === KlarnaFlags::NO_FLAG
) {
unset($this->activateInfo['flags']);
}
// Build digest. Any field in activateInfo that is set is included in
// the digest.
$digestArray = array(
str_replace('.', ':', $this->PROTO),
$this->VERSION,
$this->_eid,
$rno
);
$optionalDigestKeys = array(
'bclass',
'cust_no',
'flags',
'ocr',
'orderid1',
'orderid2',
'reference',
'reference_code'
);
foreach ($optionalDigestKeys as $key) {
if (array_key_exists($key, $this->activateInfo)) {
$digestArray[] = $this->activateInfo[$key];
}
}
if (array_key_exists('delay_adjust', $this->activateInfo['shipment_info'])) {
$digestArray[] = $this->activateInfo['shipment_info']['delay_adjust'];
}
// If there are any artnos added with addArtNo, add them to the digest
// and to the activateInfo
if (is_array($this->artNos)) {
foreach ($this->artNos as $artNo) {
$digestArray[] = $artNo['artno'];
$digestArray[] = $artNo['qty'];
}
$this->setActivateInfo('artnos', $this->artNos);
}
$digestArray[] = $this->_secret;
$digestSecret = self::digest(
call_user_func_array(
array('self', 'colon'), $digestArray
)
);
// Create the parameter list.
$paramList = array(
$this->_eid,
$digestSecret,
$rno,
$this->activateInfo
);
self::printDebug('activate array', $paramList);
$result = $this->xmlrpc_call('activate', $paramList);
self::printDebug('activate result', $result);
// Clear the state if specified.
if ($clear) {
$this->clear();
}
return $result;
}
|
php
|
public function activate(
$rno, $ocr = null, $flags = null, $clear = true
) {
$this->_checkRNO($rno);
// Overwrite any OCR set on activateInfo if supplied here since this
// method call is more specific.
if ($ocr !== null) {
$this->setActivateInfo('ocr', $ocr);
}
// If flags is specified set the flag supplied here to activateInfo.
if ($flags !== null) {
$this->setActivateInfo('flags', $flags);
}
//Assume normal shipment unless otherwise specified.
if (!array_key_exists('delay_adjust', $this->shipInfo)) {
$this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
}
// Append shipment info to activateInfo
$this->activateInfo['shipment_info'] = $this->shipInfo;
// Unlike other calls, if NO_FLAG is specified it should not be sent in
// at all.
if (array_key_exists('flags', $this->activateInfo)
&& $this->activateInfo['flags'] === KlarnaFlags::NO_FLAG
) {
unset($this->activateInfo['flags']);
}
// Build digest. Any field in activateInfo that is set is included in
// the digest.
$digestArray = array(
str_replace('.', ':', $this->PROTO),
$this->VERSION,
$this->_eid,
$rno
);
$optionalDigestKeys = array(
'bclass',
'cust_no',
'flags',
'ocr',
'orderid1',
'orderid2',
'reference',
'reference_code'
);
foreach ($optionalDigestKeys as $key) {
if (array_key_exists($key, $this->activateInfo)) {
$digestArray[] = $this->activateInfo[$key];
}
}
if (array_key_exists('delay_adjust', $this->activateInfo['shipment_info'])) {
$digestArray[] = $this->activateInfo['shipment_info']['delay_adjust'];
}
// If there are any artnos added with addArtNo, add them to the digest
// and to the activateInfo
if (is_array($this->artNos)) {
foreach ($this->artNos as $artNo) {
$digestArray[] = $artNo['artno'];
$digestArray[] = $artNo['qty'];
}
$this->setActivateInfo('artnos', $this->artNos);
}
$digestArray[] = $this->_secret;
$digestSecret = self::digest(
call_user_func_array(
array('self', 'colon'), $digestArray
)
);
// Create the parameter list.
$paramList = array(
$this->_eid,
$digestSecret,
$rno,
$this->activateInfo
);
self::printDebug('activate array', $paramList);
$result = $this->xmlrpc_call('activate', $paramList);
self::printDebug('activate result', $result);
// Clear the state if specified.
if ($clear) {
$this->clear();
}
return $result;
}
|
[
"public",
"function",
"activate",
"(",
"$",
"rno",
",",
"$",
"ocr",
"=",
"null",
",",
"$",
"flags",
"=",
"null",
",",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_checkRNO",
"(",
"$",
"rno",
")",
";",
"// Overwrite any OCR set on activateInfo if supplied here since this",
"// method call is more specific.",
"if",
"(",
"$",
"ocr",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"setActivateInfo",
"(",
"'ocr'",
",",
"$",
"ocr",
")",
";",
"}",
"// If flags is specified set the flag supplied here to activateInfo.",
"if",
"(",
"$",
"flags",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"setActivateInfo",
"(",
"'flags'",
",",
"$",
"flags",
")",
";",
"}",
"//Assume normal shipment unless otherwise specified.",
"if",
"(",
"!",
"array_key_exists",
"(",
"'delay_adjust'",
",",
"$",
"this",
"->",
"shipInfo",
")",
")",
"{",
"$",
"this",
"->",
"setShipmentInfo",
"(",
"'delay_adjust'",
",",
"KlarnaFlags",
"::",
"NORMAL_SHIPMENT",
")",
";",
"}",
"// Append shipment info to activateInfo",
"$",
"this",
"->",
"activateInfo",
"[",
"'shipment_info'",
"]",
"=",
"$",
"this",
"->",
"shipInfo",
";",
"// Unlike other calls, if NO_FLAG is specified it should not be sent in",
"// at all.",
"if",
"(",
"array_key_exists",
"(",
"'flags'",
",",
"$",
"this",
"->",
"activateInfo",
")",
"&&",
"$",
"this",
"->",
"activateInfo",
"[",
"'flags'",
"]",
"===",
"KlarnaFlags",
"::",
"NO_FLAG",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"activateInfo",
"[",
"'flags'",
"]",
")",
";",
"}",
"// Build digest. Any field in activateInfo that is set is included in",
"// the digest.",
"$",
"digestArray",
"=",
"array",
"(",
"str_replace",
"(",
"'.'",
",",
"':'",
",",
"$",
"this",
"->",
"PROTO",
")",
",",
"$",
"this",
"->",
"VERSION",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"rno",
")",
";",
"$",
"optionalDigestKeys",
"=",
"array",
"(",
"'bclass'",
",",
"'cust_no'",
",",
"'flags'",
",",
"'ocr'",
",",
"'orderid1'",
",",
"'orderid2'",
",",
"'reference'",
",",
"'reference_code'",
")",
";",
"foreach",
"(",
"$",
"optionalDigestKeys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"activateInfo",
")",
")",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"this",
"->",
"activateInfo",
"[",
"$",
"key",
"]",
";",
"}",
"}",
"if",
"(",
"array_key_exists",
"(",
"'delay_adjust'",
",",
"$",
"this",
"->",
"activateInfo",
"[",
"'shipment_info'",
"]",
")",
")",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"this",
"->",
"activateInfo",
"[",
"'shipment_info'",
"]",
"[",
"'delay_adjust'",
"]",
";",
"}",
"// If there are any artnos added with addArtNo, add them to the digest",
"// and to the activateInfo",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"artNos",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"artNos",
"as",
"$",
"artNo",
")",
"{",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"artNo",
"[",
"'artno'",
"]",
";",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"artNo",
"[",
"'qty'",
"]",
";",
"}",
"$",
"this",
"->",
"setActivateInfo",
"(",
"'artnos'",
",",
"$",
"this",
"->",
"artNos",
")",
";",
"}",
"$",
"digestArray",
"[",
"]",
"=",
"$",
"this",
"->",
"_secret",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"call_user_func_array",
"(",
"array",
"(",
"'self'",
",",
"'colon'",
")",
",",
"$",
"digestArray",
")",
")",
";",
"// Create the parameter list.",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"rno",
",",
"$",
"this",
"->",
"activateInfo",
")",
";",
"self",
"::",
"printDebug",
"(",
"'activate array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'activate'",
",",
"$",
"paramList",
")",
";",
"self",
"::",
"printDebug",
"(",
"'activate result'",
",",
"$",
"result",
")",
";",
"// Clear the state if specified.",
"if",
"(",
"$",
"clear",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] |
Activate the reservation matching the given reservation number.
Optional information should be set in ActivateInfo.
To perform a partial activation, use the addArtNo function to specify
which items in the reservation to include in the activation.
@param string $rno Reservation number
@param string $ocr optional OCR number to attach to the reservation when
activating. Overrides OCR specified in activateInfo.
@param string $flags optional flags to affect behavior. If specified it
will overwrite any flag set in activateInfo.
@param boolean $clear clear set data after activating. Defaulted to true.
@throws KlarnaException when the RNO is not specified, or if an error
is recieved from Klarna Online.
@return A string array with risk status and reservation number.
|
[
"Activate",
"the",
"reservation",
"matching",
"the",
"given",
"reservation",
"number",
".",
"Optional",
"information",
"should",
"be",
"set",
"in",
"ActivateInfo",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2191-L2290
|
24,719
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.activateReservation
|
public function activateReservation(
$pno, $rno, $gender, $ocr = "", $flags = KlarnaFlags::NO_FLAG,
$pclass = KlarnaPClass::INVOICE, $encoding = null, $clear = true
) {
$this->_checkLocale();
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
// Only check PNO if it is not explicitly null.
if ($pno !== null) {
$this->_checkPNO($pno, $encoding);
}
$this->_checkRNO($rno);
if ($gender !== null && strlen($gender) > 0) {
$this->_checkInt($gender, 'gender');
}
$this->_checkOCR($ocr);
$this->_checkRef($this->reference, $this->reference_code);
$this->_checkGoodslist();
//No addresses used for phone transactions
$billing = $shipping = '';
if ( !($flags & KlarnaFlags::RSRV_PHONE_TRANSACTION) ) {
$billing = $this->assembleAddr($this->billing);
$shipping = $this->assembleAddr($this->shipping);
if (strlen($shipping['country']) > 0
&& ($shipping['country'] !== $this->_country)
) {
throw new Klarna_ShippingCountryException;
}
}
//activate digest
$string = $this->_eid . ":" . $pno . ":";
foreach ($this->goodsList as $goods) {
$string .= $goods["goods"]["artno"] . ":" . $goods["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end digest
//Assume normal shipment unless otherwise specified.
if (!isset($this->shipInfo['delay_adjust'])) {
$this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
}
$paramList = array(
$rno,
$ocr,
$pno,
$gender,
$this->reference,
$this->reference_code,
$this->orderid[0],
$this->orderid[1],
$shipping,
$billing,
"0.0.0.0",
$flags,
$this->_currency,
$this->_country,
$this->_language,
$this->_eid,
$digestSecret,
$encoding,
$pclass,
$this->goodsList,
$this->comment,
$this->shipInfo,
$this->travelInfo,
$this->incomeInfo,
$this->bankInfo,
$this->extraInfo
);
self::printDebug('activate_reservation', $paramList);
$result = $this->xmlrpc_call('activate_reservation', $paramList);
if ($clear === true) {
$this->clear();
}
self::printDebug('activate_reservation result', $result);
return $result;
}
|
php
|
public function activateReservation(
$pno, $rno, $gender, $ocr = "", $flags = KlarnaFlags::NO_FLAG,
$pclass = KlarnaPClass::INVOICE, $encoding = null, $clear = true
) {
$this->_checkLocale();
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
// Only check PNO if it is not explicitly null.
if ($pno !== null) {
$this->_checkPNO($pno, $encoding);
}
$this->_checkRNO($rno);
if ($gender !== null && strlen($gender) > 0) {
$this->_checkInt($gender, 'gender');
}
$this->_checkOCR($ocr);
$this->_checkRef($this->reference, $this->reference_code);
$this->_checkGoodslist();
//No addresses used for phone transactions
$billing = $shipping = '';
if ( !($flags & KlarnaFlags::RSRV_PHONE_TRANSACTION) ) {
$billing = $this->assembleAddr($this->billing);
$shipping = $this->assembleAddr($this->shipping);
if (strlen($shipping['country']) > 0
&& ($shipping['country'] !== $this->_country)
) {
throw new Klarna_ShippingCountryException;
}
}
//activate digest
$string = $this->_eid . ":" . $pno . ":";
foreach ($this->goodsList as $goods) {
$string .= $goods["goods"]["artno"] . ":" . $goods["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end digest
//Assume normal shipment unless otherwise specified.
if (!isset($this->shipInfo['delay_adjust'])) {
$this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
}
$paramList = array(
$rno,
$ocr,
$pno,
$gender,
$this->reference,
$this->reference_code,
$this->orderid[0],
$this->orderid[1],
$shipping,
$billing,
"0.0.0.0",
$flags,
$this->_currency,
$this->_country,
$this->_language,
$this->_eid,
$digestSecret,
$encoding,
$pclass,
$this->goodsList,
$this->comment,
$this->shipInfo,
$this->travelInfo,
$this->incomeInfo,
$this->bankInfo,
$this->extraInfo
);
self::printDebug('activate_reservation', $paramList);
$result = $this->xmlrpc_call('activate_reservation', $paramList);
if ($clear === true) {
$this->clear();
}
self::printDebug('activate_reservation result', $result);
return $result;
}
|
[
"public",
"function",
"activateReservation",
"(",
"$",
"pno",
",",
"$",
"rno",
",",
"$",
"gender",
",",
"$",
"ocr",
"=",
"\"\"",
",",
"$",
"flags",
"=",
"KlarnaFlags",
"::",
"NO_FLAG",
",",
"$",
"pclass",
"=",
"KlarnaPClass",
"::",
"INVOICE",
",",
"$",
"encoding",
"=",
"null",
",",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_checkLocale",
"(",
")",
";",
"//Get the PNO/SSN encoding constant.",
"if",
"(",
"$",
"encoding",
"===",
"null",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"getPNOEncoding",
"(",
")",
";",
"}",
"// Only check PNO if it is not explicitly null.",
"if",
"(",
"$",
"pno",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_checkPNO",
"(",
"$",
"pno",
",",
"$",
"encoding",
")",
";",
"}",
"$",
"this",
"->",
"_checkRNO",
"(",
"$",
"rno",
")",
";",
"if",
"(",
"$",
"gender",
"!==",
"null",
"&&",
"strlen",
"(",
"$",
"gender",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"_checkInt",
"(",
"$",
"gender",
",",
"'gender'",
")",
";",
"}",
"$",
"this",
"->",
"_checkOCR",
"(",
"$",
"ocr",
")",
";",
"$",
"this",
"->",
"_checkRef",
"(",
"$",
"this",
"->",
"reference",
",",
"$",
"this",
"->",
"reference_code",
")",
";",
"$",
"this",
"->",
"_checkGoodslist",
"(",
")",
";",
"//No addresses used for phone transactions",
"$",
"billing",
"=",
"$",
"shipping",
"=",
"''",
";",
"if",
"(",
"!",
"(",
"$",
"flags",
"&",
"KlarnaFlags",
"::",
"RSRV_PHONE_TRANSACTION",
")",
")",
"{",
"$",
"billing",
"=",
"$",
"this",
"->",
"assembleAddr",
"(",
"$",
"this",
"->",
"billing",
")",
";",
"$",
"shipping",
"=",
"$",
"this",
"->",
"assembleAddr",
"(",
"$",
"this",
"->",
"shipping",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"shipping",
"[",
"'country'",
"]",
")",
">",
"0",
"&&",
"(",
"$",
"shipping",
"[",
"'country'",
"]",
"!==",
"$",
"this",
"->",
"_country",
")",
")",
"{",
"throw",
"new",
"Klarna_ShippingCountryException",
";",
"}",
"}",
"//activate digest",
"$",
"string",
"=",
"$",
"this",
"->",
"_eid",
".",
"\":\"",
".",
"$",
"pno",
".",
"\":\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"goodsList",
"as",
"$",
"goods",
")",
"{",
"$",
"string",
".=",
"$",
"goods",
"[",
"\"goods\"",
"]",
"[",
"\"artno\"",
"]",
".",
"\":\"",
".",
"$",
"goods",
"[",
"\"qty\"",
"]",
".",
"\":\"",
";",
"}",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"string",
".",
"$",
"this",
"->",
"_secret",
")",
";",
"//end digest",
"//Assume normal shipment unless otherwise specified.",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipInfo",
"[",
"'delay_adjust'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"setShipmentInfo",
"(",
"'delay_adjust'",
",",
"KlarnaFlags",
"::",
"NORMAL_SHIPMENT",
")",
";",
"}",
"$",
"paramList",
"=",
"array",
"(",
"$",
"rno",
",",
"$",
"ocr",
",",
"$",
"pno",
",",
"$",
"gender",
",",
"$",
"this",
"->",
"reference",
",",
"$",
"this",
"->",
"reference_code",
",",
"$",
"this",
"->",
"orderid",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"orderid",
"[",
"1",
"]",
",",
"$",
"shipping",
",",
"$",
"billing",
",",
"\"0.0.0.0\"",
",",
"$",
"flags",
",",
"$",
"this",
"->",
"_currency",
",",
"$",
"this",
"->",
"_country",
",",
"$",
"this",
"->",
"_language",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"encoding",
",",
"$",
"pclass",
",",
"$",
"this",
"->",
"goodsList",
",",
"$",
"this",
"->",
"comment",
",",
"$",
"this",
"->",
"shipInfo",
",",
"$",
"this",
"->",
"travelInfo",
",",
"$",
"this",
"->",
"incomeInfo",
",",
"$",
"this",
"->",
"bankInfo",
",",
"$",
"this",
"->",
"extraInfo",
")",
";",
"self",
"::",
"printDebug",
"(",
"'activate_reservation'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'activate_reservation'",
",",
"$",
"paramList",
")",
";",
"if",
"(",
"$",
"clear",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"}",
"self",
"::",
"printDebug",
"(",
"'activate_reservation result'",
",",
"$",
"result",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Activates a previously created reservation.
<b>This method returns an array with</b>:<br>
Risk status ("no_risk", "ok")<br>
Invoice number<br>
Gender is only required for Germany and Netherlands.<br>
Use of the OCR parameter is optional.
An OCR number can be retrieved by using: {@link Klarna::reserveOCR()}.
<b>Flags can be set to</b>:<br>
{@link KlarnaFlags::NO_FLAG}<br>
{@link KlarnaFlags::TEST_MODE}<br>
{@link KlarnaFlags::RSRV_SEND_BY_MAIL}<br>
{@link KlarnaFlags::RSRV_SEND_BY_EMAIL}<br>
{@link KlarnaFlags::RSRV_PRESERVE_RESERVATION}<br>
{@link KlarnaFlags::RSRV_SENSITIVE_ORDER}<br>
Some flags can be added to each other for multiple options.
<b>Note</b>:<br>
Normal shipment type is assumed unless otherwise specified, you can
do this by calling:
{@link Klarna::setShipmentInfo() setShipmentInfo('delay_adjust', ...)}
with either: {@link KlarnaFlags::NORMAL_SHIPMENT NORMAL_SHIPMENT} or
{@link KlarnaFlags::EXPRESS_SHIPMENT EXPRESS_SHIPMENT}<br>
@param string $pno Personal number, SSN, date of birth, etc.
@param string $rno Reservation number.
@param int $gender {@link KlarnaFlags::FEMALE} or
{@link KlarnaFlags::MALE}, null for unspecified.
@param string $ocr A OCR number.
@param int $flags Options which affect the behaviour.
@param int $pclass {@link KlarnaPClass::getId() PClass ID}.
@param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
@param bool $clear Whether customer info should be cleared after
this call.
@see Klarna::reserveAmount()
@throws KlarnaException
@return array An array with risk status and invoice number [string, string].
|
[
"Activates",
"a",
"previously",
"created",
"reservation",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2337-L2430
|
24,720
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.splitReservation
|
public function splitReservation(
$rno, $amount, $flags = KlarnaFlags::NO_FLAG
) {
//Check so required information is set.
$this->_checkRNO($rno);
$this->_checkAmount($amount);
if ($amount <= 0) {
throw new Klarna_InvalidPriceException($amount);
}
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $amount, $this->_secret)
);
$paramList = array(
$rno,
$amount,
$this->orderid[0],
$this->orderid[1],
$flags,
$this->_eid,
$digestSecret
);
self::printDebug('split_reservation array', $paramList);
$result = $this->xmlrpc_call('split_reservation', $paramList);
self::printDebug('split_reservation result', $result);
return $result;
}
|
php
|
public function splitReservation(
$rno, $amount, $flags = KlarnaFlags::NO_FLAG
) {
//Check so required information is set.
$this->_checkRNO($rno);
$this->_checkAmount($amount);
if ($amount <= 0) {
throw new Klarna_InvalidPriceException($amount);
}
$digestSecret = self::digest(
$this->colon($this->_eid, $rno, $amount, $this->_secret)
);
$paramList = array(
$rno,
$amount,
$this->orderid[0],
$this->orderid[1],
$flags,
$this->_eid,
$digestSecret
);
self::printDebug('split_reservation array', $paramList);
$result = $this->xmlrpc_call('split_reservation', $paramList);
self::printDebug('split_reservation result', $result);
return $result;
}
|
[
"public",
"function",
"splitReservation",
"(",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"flags",
"=",
"KlarnaFlags",
"::",
"NO_FLAG",
")",
"{",
"//Check so required information is set.",
"$",
"this",
"->",
"_checkRNO",
"(",
"$",
"rno",
")",
";",
"$",
"this",
"->",
"_checkAmount",
"(",
"$",
"amount",
")",
";",
"if",
"(",
"$",
"amount",
"<=",
"0",
")",
"{",
"throw",
"new",
"Klarna_InvalidPriceException",
"(",
"$",
"amount",
")",
";",
"}",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"rno",
",",
"$",
"amount",
",",
"$",
"this",
"->",
"orderid",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"orderid",
"[",
"1",
"]",
",",
"$",
"flags",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'split_reservation array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'split_reservation'",
",",
"$",
"paramList",
")",
";",
"self",
"::",
"printDebug",
"(",
"'split_reservation result'",
",",
"$",
"result",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Splits a reservation due to for example outstanding articles.
<b>For flags usage see</b>:<br>
{@link Klarna::reserveAmount()}<br>
@param string $rno Reservation number.
@param int $amount The amount to be subtracted from the reservation.
@param int $flags Options which affect the behaviour.
@throws KlarnaException
@return string A new reservation number.
|
[
"Splits",
"a",
"reservation",
"due",
"to",
"for",
"example",
"outstanding",
"articles",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2447-L2478
|
24,721
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.activatePart
|
public function activatePart(
$invNo, $pclass = KlarnaPClass::INVOICE, $clear = true
) {
$this->_checkInvNo($invNo);
$this->_checkArtNos($this->artNos);
self::printDebug('activate_part artNos array', $this->artNos);
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$digestSecret,
$pclass,
$this->shipInfo
);
self::printDebug('activate_part array', $paramList);
$result = $this->xmlrpc_call('activate_part', $paramList);
if ($clear === true) {
$this->clear();
}
self::printDebug('activate_part result', $result);
return $result;
}
|
php
|
public function activatePart(
$invNo, $pclass = KlarnaPClass::INVOICE, $clear = true
) {
$this->_checkInvNo($invNo);
$this->_checkArtNos($this->artNos);
self::printDebug('activate_part artNos array', $this->artNos);
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$digestSecret,
$pclass,
$this->shipInfo
);
self::printDebug('activate_part array', $paramList);
$result = $this->xmlrpc_call('activate_part', $paramList);
if ($clear === true) {
$this->clear();
}
self::printDebug('activate_part result', $result);
return $result;
}
|
[
"public",
"function",
"activatePart",
"(",
"$",
"invNo",
",",
"$",
"pclass",
"=",
"KlarnaPClass",
"::",
"INVOICE",
",",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkArtNos",
"(",
"$",
"this",
"->",
"artNos",
")",
";",
"self",
"::",
"printDebug",
"(",
"'activate_part artNos array'",
",",
"$",
"this",
"->",
"artNos",
")",
";",
"//function activate_part_digest",
"$",
"string",
"=",
"$",
"this",
"->",
"_eid",
".",
"\":\"",
".",
"$",
"invNo",
".",
"\":\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"artNos",
"as",
"$",
"artNo",
")",
"{",
"$",
"string",
".=",
"$",
"artNo",
"[",
"\"artno\"",
"]",
".",
"\":\"",
".",
"$",
"artNo",
"[",
"\"qty\"",
"]",
".",
"\":\"",
";",
"}",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"string",
".",
"$",
"this",
"->",
"_secret",
")",
";",
"//end activate_part_digest",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"artNos",
",",
"$",
"digestSecret",
",",
"$",
"pclass",
",",
"$",
"this",
"->",
"shipInfo",
")",
";",
"self",
"::",
"printDebug",
"(",
"'activate_part array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'activate_part'",
",",
"$",
"paramList",
")",
";",
"if",
"(",
"$",
"clear",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"}",
"self",
"::",
"printDebug",
"(",
"'activate_part result'",
",",
"$",
"result",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Partially activates a passive invoice.
Returned array contains index "url" and "invno".<br>
The value of "url" is a URL pointing to a temporary PDF-version of the
activated invoice.<br>
The value of "invno" is either 0 if the entire invoice was activated or
the number on the new passive invoice.<br>
<b>Note</b>:<br>
You need to call {@link Klarna::addArtNo()} first, to specify which
articles and how many you want to partially activate.<br>
If you want to change the shipment type, you can specify it using:
{@link Klarna::setShipmentInfo() setShipmentInfo('delay_adjust', ...)}
with either: {@link KlarnaFlags::NORMAL_SHIPMENT NORMAL_SHIPMENT}
or {@link KlarnaFlags::EXPRESS_SHIPMENT EXPRESS_SHIPMENT}
@param string $invNo Invoice numbers.
@param int $pclass PClass id used for this invoice.
@param bool $clear Whether customer info should be cleared after
this call.
@see Klarna::addArtNo()
@see Klarna::activateInvoice()
@throws KlarnaException
@return array An array with invoice URL and invoice number.
['url' => val, 'invno' => val]
|
[
"Partially",
"activates",
"a",
"passive",
"invoice",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2607-L2643
|
24,722
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.invoiceAmount
|
public function invoiceAmount($invNo)
{
$this->_checkInvNo($invNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$digestSecret
);
self::printDebug('invoice_amount array', $paramList);
$result = $this->xmlrpc_call('invoice_amount', $paramList);
//Result is in cents, fix it.
return ($result / 100);
}
|
php
|
public function invoiceAmount($invNo)
{
$this->_checkInvNo($invNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$digestSecret
);
self::printDebug('invoice_amount array', $paramList);
$result = $this->xmlrpc_call('invoice_amount', $paramList);
//Result is in cents, fix it.
return ($result / 100);
}
|
[
"public",
"function",
"invoiceAmount",
"(",
"$",
"invNo",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'invoice_amount array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'invoice_amount'",
",",
"$",
"paramList",
")",
";",
"//Result is in cents, fix it.",
"return",
"(",
"$",
"result",
"/",
"100",
")",
";",
"}"
] |
Retrieves the total amount for an active invoice.
@param string $invNo Invoice number.
@throws KlarnaException
@return float The total amount.
|
[
"Retrieves",
"the",
"total",
"amount",
"for",
"an",
"active",
"invoice",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2654-L2674
|
24,723
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.updateOrderNo
|
public function updateOrderNo($invNo, $orderid)
{
$this->_checkInvNo($invNo);
$this->_checkEstoreOrderNo($orderid);
$digestSecret = self::digest(
$this->colon($invNo, $orderid, $this->_secret)
);
$paramList = array(
$this->_eid,
$digestSecret,
$invNo,
$orderid
);
self::printDebug('update_orderno array', $paramList);
$result = $this->xmlrpc_call('update_orderno', $paramList);
return $result;
}
|
php
|
public function updateOrderNo($invNo, $orderid)
{
$this->_checkInvNo($invNo);
$this->_checkEstoreOrderNo($orderid);
$digestSecret = self::digest(
$this->colon($invNo, $orderid, $this->_secret)
);
$paramList = array(
$this->_eid,
$digestSecret,
$invNo,
$orderid
);
self::printDebug('update_orderno array', $paramList);
$result = $this->xmlrpc_call('update_orderno', $paramList);
return $result;
}
|
[
"public",
"function",
"updateOrderNo",
"(",
"$",
"invNo",
",",
"$",
"orderid",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkEstoreOrderNo",
"(",
"$",
"orderid",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"invNo",
",",
"$",
"orderid",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"invNo",
",",
"$",
"orderid",
")",
";",
"self",
"::",
"printDebug",
"(",
"'update_orderno array'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'update_orderno'",
",",
"$",
"paramList",
")",
";",
"return",
"$",
"result",
";",
"}"
] |
Changes the order number of a purchase that was set when the order was
made online.
@param string $invNo Invoice number.
@param string $orderid Estores order number.
@throws KlarnaException
@return string Invoice number.
|
[
"Changes",
"the",
"order",
"number",
"of",
"a",
"purchase",
"that",
"was",
"set",
"when",
"the",
"order",
"was",
"made",
"online",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2687-L2708
|
24,724
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.creditInvoice
|
public function creditInvoice($invNo, $credNo = "")
{
$this->_checkInvNo($invNo);
$this->_checkCredNo($credNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$credNo,
$digestSecret
);
self::printDebug('credit_invoice', $paramList);
return $this->xmlrpc_call('credit_invoice', $paramList);
}
|
php
|
public function creditInvoice($invNo, $credNo = "")
{
$this->_checkInvNo($invNo);
$this->_checkCredNo($credNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$credNo,
$digestSecret
);
self::printDebug('credit_invoice', $paramList);
return $this->xmlrpc_call('credit_invoice', $paramList);
}
|
[
"public",
"function",
"creditInvoice",
"(",
"$",
"invNo",
",",
"$",
"credNo",
"=",
"\"\"",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkCredNo",
"(",
"$",
"credNo",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"credNo",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'credit_invoice'",
",",
"$",
"paramList",
")",
";",
"return",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'credit_invoice'",
",",
"$",
"paramList",
")",
";",
"}"
] |
Performs a complete refund on an invoice, part payment and mobile
purchase.
@param string $invNo Invoice number.
@param string $credNo Credit number.
@throws KlarnaException
@return string Invoice number.
|
[
"Performs",
"a",
"complete",
"refund",
"on",
"an",
"invoice",
"part",
"payment",
"and",
"mobile",
"purchase",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2831-L2849
|
24,725
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.creditPart
|
public function creditPart($invNo, $credNo = "")
{
$this->_checkInvNo($invNo);
$this->_checkCredNo($credNo);
if ($this->goodsList === null || empty($this->goodsList)) {
$this->_checkArtNos($this->artNos);
}
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
if ($this->artNos !== null && !empty($this->artNos)) {
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$credNo,
$digestSecret
);
if ($this->goodsList !== null && !empty($this->goodsList)) {
$paramList[] = 0;
$paramList[] = $this->goodsList;
}
$this->artNos = array();
self::printDebug('credit_part', $paramList);
return $this->xmlrpc_call('credit_part', $paramList);
}
|
php
|
public function creditPart($invNo, $credNo = "")
{
$this->_checkInvNo($invNo);
$this->_checkCredNo($credNo);
if ($this->goodsList === null || empty($this->goodsList)) {
$this->_checkArtNos($this->artNos);
}
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
if ($this->artNos !== null && !empty($this->artNos)) {
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$credNo,
$digestSecret
);
if ($this->goodsList !== null && !empty($this->goodsList)) {
$paramList[] = 0;
$paramList[] = $this->goodsList;
}
$this->artNos = array();
self::printDebug('credit_part', $paramList);
return $this->xmlrpc_call('credit_part', $paramList);
}
|
[
"public",
"function",
"creditPart",
"(",
"$",
"invNo",
",",
"$",
"credNo",
"=",
"\"\"",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkCredNo",
"(",
"$",
"credNo",
")",
";",
"if",
"(",
"$",
"this",
"->",
"goodsList",
"===",
"null",
"||",
"empty",
"(",
"$",
"this",
"->",
"goodsList",
")",
")",
"{",
"$",
"this",
"->",
"_checkArtNos",
"(",
"$",
"this",
"->",
"artNos",
")",
";",
"}",
"//function activate_part_digest",
"$",
"string",
"=",
"$",
"this",
"->",
"_eid",
".",
"\":\"",
".",
"$",
"invNo",
".",
"\":\"",
";",
"if",
"(",
"$",
"this",
"->",
"artNos",
"!==",
"null",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"artNos",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"artNos",
"as",
"$",
"artNo",
")",
"{",
"$",
"string",
".=",
"$",
"artNo",
"[",
"\"artno\"",
"]",
".",
"\":\"",
".",
"$",
"artNo",
"[",
"\"qty\"",
"]",
".",
"\":\"",
";",
"}",
"}",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"string",
".",
"$",
"this",
"->",
"_secret",
")",
";",
"//end activate_part_digest",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"artNos",
",",
"$",
"credNo",
",",
"$",
"digestSecret",
")",
";",
"if",
"(",
"$",
"this",
"->",
"goodsList",
"!==",
"null",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"goodsList",
")",
")",
"{",
"$",
"paramList",
"[",
"]",
"=",
"0",
";",
"$",
"paramList",
"[",
"]",
"=",
"$",
"this",
"->",
"goodsList",
";",
"}",
"$",
"this",
"->",
"artNos",
"=",
"array",
"(",
")",
";",
"self",
"::",
"printDebug",
"(",
"'credit_part'",
",",
"$",
"paramList",
")",
";",
"return",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'credit_part'",
",",
"$",
"paramList",
")",
";",
"}"
] |
Performs a partial refund on an invoice, part payment or mobile purchase.
<b>Note</b>:<br>
You need to call {@link Klarna::addArtNo()} first.<br>
@param string $invNo Invoice number.
@param string $credNo Credit number.
@see Klarna::addArtNo()
@throws KlarnaException
@return string Invoice number.
|
[
"Performs",
"a",
"partial",
"refund",
"on",
"an",
"invoice",
"part",
"payment",
"or",
"mobile",
"purchase",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2865-L2904
|
24,726
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.updateGoodsQty
|
public function updateGoodsQty($invNo, $artNo, $qty)
{
$this->_checkInvNo($invNo);
$this->_checkQty($qty);
$this->_checkArtNo($artNo);
$digestSecret = self::digest(
$this->colon($invNo, $artNo, $qty, $this->_secret)
);
$paramList = array(
$this->_eid,
$digestSecret,
$invNo,
$artNo,
$qty
);
self::printDebug('update_goods_qty', $paramList);
return $this->xmlrpc_call('update_goods_qty', $paramList);
}
|
php
|
public function updateGoodsQty($invNo, $artNo, $qty)
{
$this->_checkInvNo($invNo);
$this->_checkQty($qty);
$this->_checkArtNo($artNo);
$digestSecret = self::digest(
$this->colon($invNo, $artNo, $qty, $this->_secret)
);
$paramList = array(
$this->_eid,
$digestSecret,
$invNo,
$artNo,
$qty
);
self::printDebug('update_goods_qty', $paramList);
return $this->xmlrpc_call('update_goods_qty', $paramList);
}
|
[
"public",
"function",
"updateGoodsQty",
"(",
"$",
"invNo",
",",
"$",
"artNo",
",",
"$",
"qty",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkQty",
"(",
"$",
"qty",
")",
";",
"$",
"this",
"->",
"_checkArtNo",
"(",
"$",
"artNo",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"invNo",
",",
"$",
"artNo",
",",
"$",
"qty",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"invNo",
",",
"$",
"artNo",
",",
"$",
"qty",
")",
";",
"self",
"::",
"printDebug",
"(",
"'update_goods_qty'",
",",
"$",
"paramList",
")",
";",
"return",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'update_goods_qty'",
",",
"$",
"paramList",
")",
";",
"}"
] |
Changes the quantity of a specific item in a passive invoice.
@param string $invNo Invoice number.
@param string $artNo Article number.
@param int $qty Quantity of specified article.
@throws KlarnaException
@return string Invoice number.
|
[
"Changes",
"the",
"quantity",
"of",
"a",
"specific",
"item",
"in",
"a",
"passive",
"invoice",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2917-L2938
|
24,727
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.invoiceAddress
|
public function invoiceAddress($invNo)
{
$this->_checkInvNo($invNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$digestSecret
);
self::printDebug('invoice_address', $paramList);
$result = $this->xmlrpc_call('invoice_address', $paramList);
$addr = new KlarnaAddr();
if (strlen($result[0]) > 0) {
$addr->isCompany = false;
$addr->setFirstName($result[0]);
$addr->setLastName($result[1]);
} else {
$addr->isCompany = true;
$addr->setCompanyName($result[1]);
}
$addr->setStreet($result[2]);
$addr->setZipCode($result[3]);
$addr->setCity($result[4]);
$addr->setCountry($result[5]);
return $addr;
}
|
php
|
public function invoiceAddress($invNo)
{
$this->_checkInvNo($invNo);
$digestSecret = self::digest(
$this->colon($this->_eid, $invNo, $this->_secret)
);
$paramList = array(
$this->_eid,
$invNo,
$digestSecret
);
self::printDebug('invoice_address', $paramList);
$result = $this->xmlrpc_call('invoice_address', $paramList);
$addr = new KlarnaAddr();
if (strlen($result[0]) > 0) {
$addr->isCompany = false;
$addr->setFirstName($result[0]);
$addr->setLastName($result[1]);
} else {
$addr->isCompany = true;
$addr->setCompanyName($result[1]);
}
$addr->setStreet($result[2]);
$addr->setZipCode($result[3]);
$addr->setCity($result[4]);
$addr->setCountry($result[5]);
return $addr;
}
|
[
"public",
"function",
"invoiceAddress",
"(",
"$",
"invNo",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'invoice_address'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'invoice_address'",
",",
"$",
"paramList",
")",
";",
"$",
"addr",
"=",
"new",
"KlarnaAddr",
"(",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"result",
"[",
"0",
"]",
")",
">",
"0",
")",
"{",
"$",
"addr",
"->",
"isCompany",
"=",
"false",
";",
"$",
"addr",
"->",
"setFirstName",
"(",
"$",
"result",
"[",
"0",
"]",
")",
";",
"$",
"addr",
"->",
"setLastName",
"(",
"$",
"result",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"$",
"addr",
"->",
"isCompany",
"=",
"true",
";",
"$",
"addr",
"->",
"setCompanyName",
"(",
"$",
"result",
"[",
"1",
"]",
")",
";",
"}",
"$",
"addr",
"->",
"setStreet",
"(",
"$",
"result",
"[",
"2",
"]",
")",
";",
"$",
"addr",
"->",
"setZipCode",
"(",
"$",
"result",
"[",
"3",
"]",
")",
";",
"$",
"addr",
"->",
"setCity",
"(",
"$",
"result",
"[",
"4",
"]",
")",
";",
"$",
"addr",
"->",
"setCountry",
"(",
"$",
"result",
"[",
"5",
"]",
")",
";",
"return",
"$",
"addr",
";",
"}"
] |
The invoice_address function is used to retrieve the address of a
purchase.
@param string $invNo Invoice number.
@throws KlarnaException
@return KlarnaAddr
|
[
"The",
"invoice_address",
"function",
"is",
"used",
"to",
"retrieve",
"the",
"address",
"of",
"a",
"purchase",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L2993-L3025
|
24,728
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.invoicePartAmount
|
public function invoicePartAmount($invNo)
{
$this->_checkInvNo($invNo);
$this->_checkArtNos($this->artNos);
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$digestSecret
);
$this->artNos = array();
self::printDebug('invoice_part_amount', $paramList);
$result = $this->xmlrpc_call('invoice_part_amount', $paramList);
return ($result / 100);
}
|
php
|
public function invoicePartAmount($invNo)
{
$this->_checkInvNo($invNo);
$this->_checkArtNos($this->artNos);
//function activate_part_digest
$string = $this->_eid . ":" . $invNo . ":";
foreach ($this->artNos as $artNo) {
$string .= $artNo["artno"] . ":". $artNo["qty"] . ":";
}
$digestSecret = self::digest($string . $this->_secret);
//end activate_part_digest
$paramList = array(
$this->_eid,
$invNo,
$this->artNos,
$digestSecret
);
$this->artNos = array();
self::printDebug('invoice_part_amount', $paramList);
$result = $this->xmlrpc_call('invoice_part_amount', $paramList);
return ($result / 100);
}
|
[
"public",
"function",
"invoicePartAmount",
"(",
"$",
"invNo",
")",
"{",
"$",
"this",
"->",
"_checkInvNo",
"(",
"$",
"invNo",
")",
";",
"$",
"this",
"->",
"_checkArtNos",
"(",
"$",
"this",
"->",
"artNos",
")",
";",
"//function activate_part_digest",
"$",
"string",
"=",
"$",
"this",
"->",
"_eid",
".",
"\":\"",
".",
"$",
"invNo",
".",
"\":\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"artNos",
"as",
"$",
"artNo",
")",
"{",
"$",
"string",
".=",
"$",
"artNo",
"[",
"\"artno\"",
"]",
".",
"\":\"",
".",
"$",
"artNo",
"[",
"\"qty\"",
"]",
".",
"\":\"",
";",
"}",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"string",
".",
"$",
"this",
"->",
"_secret",
")",
";",
"//end activate_part_digest",
"$",
"paramList",
"=",
"array",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"invNo",
",",
"$",
"this",
"->",
"artNos",
",",
"$",
"digestSecret",
")",
";",
"$",
"this",
"->",
"artNos",
"=",
"array",
"(",
")",
";",
"self",
"::",
"printDebug",
"(",
"'invoice_part_amount'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'invoice_part_amount'",
",",
"$",
"paramList",
")",
";",
"return",
"(",
"$",
"result",
"/",
"100",
")",
";",
"}"
] |
Retrieves the amount of a specific goods from a purchase.
<b>Note</b>:<br>
You need to call {@link Klarna::addArtNo()} first.<br>
@param string $invNo Invoice number.
@see Klarna::addArtNo()
@throws KlarnaException
@return float The amount of the goods.
|
[
"Retrieves",
"the",
"amount",
"of",
"a",
"specific",
"goods",
"from",
"a",
"purchase",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3040-L3066
|
24,729
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getCustomerNo
|
public function getCustomerNo($pno, $encoding = null)
{
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
$this->_checkPNO($pno, $encoding);
$digestSecret = self::digest(
$this->colon($this->_eid, $pno, $this->_secret)
);
$paramList = array(
$pno,
$this->_eid,
$digestSecret,
$encoding
);
self::printDebug('get_customer_no', $paramList);
return $this->xmlrpc_call('get_customer_no', $paramList);
}
|
php
|
public function getCustomerNo($pno, $encoding = null)
{
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
$this->_checkPNO($pno, $encoding);
$digestSecret = self::digest(
$this->colon($this->_eid, $pno, $this->_secret)
);
$paramList = array(
$pno,
$this->_eid,
$digestSecret,
$encoding
);
self::printDebug('get_customer_no', $paramList);
return $this->xmlrpc_call('get_customer_no', $paramList);
}
|
[
"public",
"function",
"getCustomerNo",
"(",
"$",
"pno",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"//Get the PNO/SSN encoding constant.",
"if",
"(",
"$",
"encoding",
"===",
"null",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"getPNOEncoding",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_checkPNO",
"(",
"$",
"pno",
",",
"$",
"encoding",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"pno",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"pno",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"encoding",
")",
";",
"self",
"::",
"printDebug",
"(",
"'get_customer_no'",
",",
"$",
"paramList",
")",
";",
"return",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'get_customer_no'",
",",
"$",
"paramList",
")",
";",
"}"
] |
Retrieves a list of all the customer numbers associated with the
specified pno.
@param string $pno Social security number, Personal number, ...
@param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
@throws KlarnaException
@return array An array containing all customer numbers associated
with that pno.
|
[
"Retrieves",
"a",
"list",
"of",
"all",
"the",
"customer",
"numbers",
"associated",
"with",
"the",
"specified",
"pno",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3123-L3144
|
24,730
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setCustomerNo
|
public function setCustomerNo($pno, $custNo, $encoding = null)
{
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
$this->_checkPNO($pno, $encoding);
$this->_checkArgument($custNo, 'custNo');
$digestSecret = self::digest(
$this->colon($this->_eid, $pno, $custNo, $this->_secret)
);
$paramList = array(
$pno,
$custNo,
$this->_eid,
$digestSecret,
$encoding
);
self::printDebug('set_customer_no', $paramList);
$result = $this->xmlrpc_call('set_customer_no', $paramList);
return ($result == 'ok');
}
|
php
|
public function setCustomerNo($pno, $custNo, $encoding = null)
{
//Get the PNO/SSN encoding constant.
if ($encoding === null) {
$encoding = $this->getPNOEncoding();
}
$this->_checkPNO($pno, $encoding);
$this->_checkArgument($custNo, 'custNo');
$digestSecret = self::digest(
$this->colon($this->_eid, $pno, $custNo, $this->_secret)
);
$paramList = array(
$pno,
$custNo,
$this->_eid,
$digestSecret,
$encoding
);
self::printDebug('set_customer_no', $paramList);
$result = $this->xmlrpc_call('set_customer_no', $paramList);
return ($result == 'ok');
}
|
[
"public",
"function",
"setCustomerNo",
"(",
"$",
"pno",
",",
"$",
"custNo",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"//Get the PNO/SSN encoding constant.",
"if",
"(",
"$",
"encoding",
"===",
"null",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"getPNOEncoding",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_checkPNO",
"(",
"$",
"pno",
",",
"$",
"encoding",
")",
";",
"$",
"this",
"->",
"_checkArgument",
"(",
"$",
"custNo",
",",
"'custNo'",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"pno",
",",
"$",
"custNo",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"pno",
",",
"$",
"custNo",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
",",
"$",
"encoding",
")",
";",
"self",
"::",
"printDebug",
"(",
"'set_customer_no'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'set_customer_no'",
",",
"$",
"paramList",
")",
";",
"return",
"(",
"$",
"result",
"==",
"'ok'",
")",
";",
"}"
] |
Associates a pno with a customer number when you want to make future
purchases without a pno.
@param string $pno Social security number, Personal number, ...
@param string $custNo The customer number.
@param int $encoding {@link KlarnaEncoding PNO Encoding} constant.
@throws KlarnaException
@return bool True, if the customer number was associated with the pno.
|
[
"Associates",
"a",
"pno",
"with",
"a",
"customer",
"number",
"when",
"you",
"want",
"to",
"make",
"future",
"purchases",
"without",
"a",
"pno",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3157-L3183
|
24,731
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.removeCustomerNo
|
public function removeCustomerNo($custNo)
{
$this->_checkArgument($custNo, 'custNo');
$digestSecret = self::digest(
$this->colon($this->_eid, $custNo, $this->_secret)
);
$paramList = array(
$custNo,
$this->_eid,
$digestSecret
);
self::printDebug('remove_customer_no', $paramList);
$result = $this->xmlrpc_call('remove_customer_no', $paramList);
return ($result == 'ok');
}
|
php
|
public function removeCustomerNo($custNo)
{
$this->_checkArgument($custNo, 'custNo');
$digestSecret = self::digest(
$this->colon($this->_eid, $custNo, $this->_secret)
);
$paramList = array(
$custNo,
$this->_eid,
$digestSecret
);
self::printDebug('remove_customer_no', $paramList);
$result = $this->xmlrpc_call('remove_customer_no', $paramList);
return ($result == 'ok');
}
|
[
"public",
"function",
"removeCustomerNo",
"(",
"$",
"custNo",
")",
"{",
"$",
"this",
"->",
"_checkArgument",
"(",
"$",
"custNo",
",",
"'custNo'",
")",
";",
"$",
"digestSecret",
"=",
"self",
"::",
"digest",
"(",
"$",
"this",
"->",
"colon",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"custNo",
",",
"$",
"this",
"->",
"_secret",
")",
")",
";",
"$",
"paramList",
"=",
"array",
"(",
"$",
"custNo",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"digestSecret",
")",
";",
"self",
"::",
"printDebug",
"(",
"'remove_customer_no'",
",",
"$",
"paramList",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"xmlrpc_call",
"(",
"'remove_customer_no'",
",",
"$",
"paramList",
")",
";",
"return",
"(",
"$",
"result",
"==",
"'ok'",
")",
";",
"}"
] |
Removes a customer number from association with a pno.
@param string $custNo The customer number.
@throws KlarnaException
@return bool True, if the customer number association was removed.
|
[
"Removes",
"a",
"customer",
"number",
"from",
"association",
"with",
"a",
"pno",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3193-L3212
|
24,732
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getPCStorage
|
public function getPCStorage()
{
if (isset($this->pclasses)) {
return $this->pclasses;
}
include_once 'pclasses/storage.intf.php';
$className = $this->pcStorage.'storage';
$pclassStorage = dirname(__FILE__) . "/pclasses/{$className}.class.php";
include_once $pclassStorage;
$storage = new $className;
if (!($storage instanceof PCStorage)) {
throw new Klarna_PCStorageInvalidException(
$className, $pclassStorage
);
}
return $storage;
}
|
php
|
public function getPCStorage()
{
if (isset($this->pclasses)) {
return $this->pclasses;
}
include_once 'pclasses/storage.intf.php';
$className = $this->pcStorage.'storage';
$pclassStorage = dirname(__FILE__) . "/pclasses/{$className}.class.php";
include_once $pclassStorage;
$storage = new $className;
if (!($storage instanceof PCStorage)) {
throw new Klarna_PCStorageInvalidException(
$className, $pclassStorage
);
}
return $storage;
}
|
[
"public",
"function",
"getPCStorage",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"pclasses",
")",
")",
"{",
"return",
"$",
"this",
"->",
"pclasses",
";",
"}",
"include_once",
"'pclasses/storage.intf.php'",
";",
"$",
"className",
"=",
"$",
"this",
"->",
"pcStorage",
".",
"'storage'",
";",
"$",
"pclassStorage",
"=",
"dirname",
"(",
"__FILE__",
")",
".",
"\"/pclasses/{$className}.class.php\"",
";",
"include_once",
"$",
"pclassStorage",
";",
"$",
"storage",
"=",
"new",
"$",
"className",
";",
"if",
"(",
"!",
"(",
"$",
"storage",
"instanceof",
"PCStorage",
")",
")",
"{",
"throw",
"new",
"Klarna_PCStorageInvalidException",
"(",
"$",
"className",
",",
"$",
"pclassStorage",
")",
";",
"}",
"return",
"$",
"storage",
";",
"}"
] |
Returns the configured PCStorage object.
@throws Exception|KlarnaException
@return PCStorage
|
[
"Returns",
"the",
"configured",
"PCStorage",
"object",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3220-L3239
|
24,733
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.clearPClasses
|
public function clearPClasses()
{
$this->_checkConfig();
$pclasses = $this->getPCStorage();
$pclasses->clear($this->pcURI);
}
|
php
|
public function clearPClasses()
{
$this->_checkConfig();
$pclasses = $this->getPCStorage();
$pclasses->clear($this->pcURI);
}
|
[
"public",
"function",
"clearPClasses",
"(",
")",
"{",
"$",
"this",
"->",
"_checkConfig",
"(",
")",
";",
"$",
"pclasses",
"=",
"$",
"this",
"->",
"getPCStorage",
"(",
")",
";",
"$",
"pclasses",
"->",
"clear",
"(",
"$",
"this",
"->",
"pcURI",
")",
";",
"}"
] |
Removes the stored PClasses, if you need to update them.
@throws KlarnaException
@return void
|
[
"Removes",
"the",
"stored",
"PClasses",
"if",
"you",
"need",
"to",
"update",
"them",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3345-L3351
|
24,734
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getPClasses
|
public function getPClasses($type = null)
{
$this->_checkConfig();
if (!$this->pclasses) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
$tmp = $this->pclasses->getPClasses(
$this->_eid, $this->_country, $type
);
$this->sortPClasses($tmp[$this->_eid]);
return $tmp[$this->_eid];
}
|
php
|
public function getPClasses($type = null)
{
$this->_checkConfig();
if (!$this->pclasses) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
$tmp = $this->pclasses->getPClasses(
$this->_eid, $this->_country, $type
);
$this->sortPClasses($tmp[$this->_eid]);
return $tmp[$this->_eid];
}
|
[
"public",
"function",
"getPClasses",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_checkConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"pclasses",
")",
"{",
"$",
"this",
"->",
"pclasses",
"=",
"$",
"this",
"->",
"getPCStorage",
"(",
")",
";",
"$",
"this",
"->",
"pclasses",
"->",
"load",
"(",
"$",
"this",
"->",
"pcURI",
")",
";",
"}",
"$",
"tmp",
"=",
"$",
"this",
"->",
"pclasses",
"->",
"getPClasses",
"(",
"$",
"this",
"->",
"_eid",
",",
"$",
"this",
"->",
"_country",
",",
"$",
"type",
")",
";",
"$",
"this",
"->",
"sortPClasses",
"(",
"$",
"tmp",
"[",
"$",
"this",
"->",
"_eid",
"]",
")",
";",
"return",
"$",
"tmp",
"[",
"$",
"this",
"->",
"_eid",
"]",
";",
"}"
] |
Retrieves the specified PClasses.
<b>Type can be</b>:<br>
{@link KlarnaPClass::CAMPAIGN}<br>
{@link KlarnaPClass::ACCOUNT}<br>
{@link KlarnaPClass::SPECIAL}<br>
{@link KlarnaPClass::FIXED}<br>
{@link KlarnaPClass::DELAY}<br>
{@link KlarnaPClass::MOBILE}<br>
@param int $type PClass type identifier.
@throws KlarnaException
@return array An array of PClasses. [KlarnaPClass]
|
[
"Retrieves",
"the",
"specified",
"PClasses",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3369-L3382
|
24,735
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getAllPClasses
|
public function getAllPClasses()
{
if (!$this->pclasses) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
return $this->pclasses->getAllPClasses();
}
|
php
|
public function getAllPClasses()
{
if (!$this->pclasses) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
return $this->pclasses->getAllPClasses();
}
|
[
"public",
"function",
"getAllPClasses",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pclasses",
")",
"{",
"$",
"this",
"->",
"pclasses",
"=",
"$",
"this",
"->",
"getPCStorage",
"(",
")",
";",
"$",
"this",
"->",
"pclasses",
"->",
"load",
"(",
"$",
"this",
"->",
"pcURI",
")",
";",
"}",
"return",
"$",
"this",
"->",
"pclasses",
"->",
"getAllPClasses",
"(",
")",
";",
"}"
] |
Retrieve a flattened array of all pclasses stored in the configured
pclass storage.
@return array
|
[
"Retrieve",
"a",
"flattened",
"array",
"of",
"all",
"pclasses",
"stored",
"in",
"the",
"configured",
"pclass",
"storage",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3390-L3397
|
24,736
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getPClass
|
public function getPClass($id)
{
if (!is_numeric($id)) {
throw new Klarna_InvalidTypeException('id', 'integer');
}
$this->_checkConfig();
if (!$this->pclasses || !($this->pclasses instanceof PCStorage)) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
return $this->pclasses->getPClass(
intval($id), $this->_eid, $this->_country
);
}
|
php
|
public function getPClass($id)
{
if (!is_numeric($id)) {
throw new Klarna_InvalidTypeException('id', 'integer');
}
$this->_checkConfig();
if (!$this->pclasses || !($this->pclasses instanceof PCStorage)) {
$this->pclasses = $this->getPCStorage();
$this->pclasses->load($this->pcURI);
}
return $this->pclasses->getPClass(
intval($id), $this->_eid, $this->_country
);
}
|
[
"public",
"function",
"getPClass",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidTypeException",
"(",
"'id'",
",",
"'integer'",
")",
";",
"}",
"$",
"this",
"->",
"_checkConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"pclasses",
"||",
"!",
"(",
"$",
"this",
"->",
"pclasses",
"instanceof",
"PCStorage",
")",
")",
"{",
"$",
"this",
"->",
"pclasses",
"=",
"$",
"this",
"->",
"getPCStorage",
"(",
")",
";",
"$",
"this",
"->",
"pclasses",
"->",
"load",
"(",
"$",
"this",
"->",
"pcURI",
")",
";",
"}",
"return",
"$",
"this",
"->",
"pclasses",
"->",
"getPClass",
"(",
"intval",
"(",
"$",
"id",
")",
",",
"$",
"this",
"->",
"_eid",
",",
"$",
"this",
"->",
"_country",
")",
";",
"}"
] |
Returns the specified PClass.
@param int $id The PClass ID.
@return KlarnaPClass
|
[
"Returns",
"the",
"specified",
"PClass",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3406-L3421
|
24,737
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.sortPClasses
|
public function sortPClasses(&$array)
{
if (!is_array($array)) {
//Input is not an array!
$array = array();
return;
}
//Sort pclasses array after natural sort (natcmp)
if (!function_exists('pcCmp')) {
/**
* Comparison function
*
* @param KlarnaPClass $a object 1
* @param KlarnaPClass $b object 2
*
* @return int
*/
function pcCmp($a, $b)
{
if ($a->getDescription() == null
&& $b->getDescription() == null
) {
return 0;
} else if ($a->getDescription() == null) {
return 1;
} else if ($b->getDescription() == null) {
return -1;
} else if ($b->getType() === 2 && $a->getType() !== 2) {
return 1;
} else if ($b->getType() !== 2 && $a->getType() === 2) {
return -1;
}
return strnatcmp($a->getDescription(), $b->getDescription())*-1;
}
}
usort($array, "pcCmp");
}
|
php
|
public function sortPClasses(&$array)
{
if (!is_array($array)) {
//Input is not an array!
$array = array();
return;
}
//Sort pclasses array after natural sort (natcmp)
if (!function_exists('pcCmp')) {
/**
* Comparison function
*
* @param KlarnaPClass $a object 1
* @param KlarnaPClass $b object 2
*
* @return int
*/
function pcCmp($a, $b)
{
if ($a->getDescription() == null
&& $b->getDescription() == null
) {
return 0;
} else if ($a->getDescription() == null) {
return 1;
} else if ($b->getDescription() == null) {
return -1;
} else if ($b->getType() === 2 && $a->getType() !== 2) {
return 1;
} else if ($b->getType() !== 2 && $a->getType() === 2) {
return -1;
}
return strnatcmp($a->getDescription(), $b->getDescription())*-1;
}
}
usort($array, "pcCmp");
}
|
[
"public",
"function",
"sortPClasses",
"(",
"&",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"//Input is not an array!",
"$",
"array",
"=",
"array",
"(",
")",
";",
"return",
";",
"}",
"//Sort pclasses array after natural sort (natcmp)",
"if",
"(",
"!",
"function_exists",
"(",
"'pcCmp'",
")",
")",
"{",
"/**\n * Comparison function\n *\n * @param KlarnaPClass $a object 1\n * @param KlarnaPClass $b object 2\n *\n * @return int\n */",
"function",
"pcCmp",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getDescription",
"(",
")",
"==",
"null",
"&&",
"$",
"b",
"->",
"getDescription",
"(",
")",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"$",
"a",
"->",
"getDescription",
"(",
")",
"==",
"null",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"$",
"b",
"->",
"getDescription",
"(",
")",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"$",
"b",
"->",
"getType",
"(",
")",
"===",
"2",
"&&",
"$",
"a",
"->",
"getType",
"(",
")",
"!==",
"2",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"$",
"b",
"->",
"getType",
"(",
")",
"!==",
"2",
"&&",
"$",
"a",
"->",
"getType",
"(",
")",
"===",
"2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"strnatcmp",
"(",
"$",
"a",
"->",
"getDescription",
"(",
")",
",",
"$",
"b",
"->",
"getDescription",
"(",
")",
")",
"*",
"-",
"1",
";",
"}",
"}",
"usort",
"(",
"$",
"array",
",",
"\"pcCmp\"",
")",
";",
"}"
] |
Sorts the specified array of KlarnaPClasses.
@param array &$array An array of {@link KlarnaPClass PClasses}.
@return void
|
[
"Sorts",
"the",
"specified",
"array",
"of",
"KlarnaPClasses",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3430-L3467
|
24,738
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.getCheapestPClass
|
public function getCheapestPClass($sum, $flags)
{
if (!is_numeric($sum)) {
throw new Klarna_InvalidPriceException($sum);
}
if (!is_numeric($flags)
|| !in_array(
$flags, array(
KlarnaFlags::CHECKOUT_PAGE, KlarnaFlags::PRODUCT_PAGE)
)
) {
throw new Klarna_InvalidTypeException(
'flags',
KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
);
}
$lowest_pp = $lowest = false;
foreach ($this->getPClasses() as $pclass) {
$lowest_payment = KlarnaCalc::get_lowest_payment_for_account(
$pclass->getCountry()
);
if ($pclass->getType() < 2 && $sum >= $pclass->getMinAmount()) {
$minpay = KlarnaCalc::calc_monthly_cost(
$sum, $pclass, $flags
);
if ($minpay < $lowest_pp || $lowest_pp === false) {
if ($pclass->getType() == KlarnaPClass::ACCOUNT
|| $minpay >= $lowest_payment
) {
$lowest_pp = $minpay;
$lowest = $pclass;
}
}
}
}
return $lowest;
}
|
php
|
public function getCheapestPClass($sum, $flags)
{
if (!is_numeric($sum)) {
throw new Klarna_InvalidPriceException($sum);
}
if (!is_numeric($flags)
|| !in_array(
$flags, array(
KlarnaFlags::CHECKOUT_PAGE, KlarnaFlags::PRODUCT_PAGE)
)
) {
throw new Klarna_InvalidTypeException(
'flags',
KlarnaFlags::CHECKOUT_PAGE . ' or ' . KlarnaFlags::PRODUCT_PAGE
);
}
$lowest_pp = $lowest = false;
foreach ($this->getPClasses() as $pclass) {
$lowest_payment = KlarnaCalc::get_lowest_payment_for_account(
$pclass->getCountry()
);
if ($pclass->getType() < 2 && $sum >= $pclass->getMinAmount()) {
$minpay = KlarnaCalc::calc_monthly_cost(
$sum, $pclass, $flags
);
if ($minpay < $lowest_pp || $lowest_pp === false) {
if ($pclass->getType() == KlarnaPClass::ACCOUNT
|| $minpay >= $lowest_payment
) {
$lowest_pp = $minpay;
$lowest = $pclass;
}
}
}
}
return $lowest;
}
|
[
"public",
"function",
"getCheapestPClass",
"(",
"$",
"sum",
",",
"$",
"flags",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"sum",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidPriceException",
"(",
"$",
"sum",
")",
";",
"}",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"flags",
")",
"||",
"!",
"in_array",
"(",
"$",
"flags",
",",
"array",
"(",
"KlarnaFlags",
"::",
"CHECKOUT_PAGE",
",",
"KlarnaFlags",
"::",
"PRODUCT_PAGE",
")",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidTypeException",
"(",
"'flags'",
",",
"KlarnaFlags",
"::",
"CHECKOUT_PAGE",
".",
"' or '",
".",
"KlarnaFlags",
"::",
"PRODUCT_PAGE",
")",
";",
"}",
"$",
"lowest_pp",
"=",
"$",
"lowest",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"getPClasses",
"(",
")",
"as",
"$",
"pclass",
")",
"{",
"$",
"lowest_payment",
"=",
"KlarnaCalc",
"::",
"get_lowest_payment_for_account",
"(",
"$",
"pclass",
"->",
"getCountry",
"(",
")",
")",
";",
"if",
"(",
"$",
"pclass",
"->",
"getType",
"(",
")",
"<",
"2",
"&&",
"$",
"sum",
">=",
"$",
"pclass",
"->",
"getMinAmount",
"(",
")",
")",
"{",
"$",
"minpay",
"=",
"KlarnaCalc",
"::",
"calc_monthly_cost",
"(",
"$",
"sum",
",",
"$",
"pclass",
",",
"$",
"flags",
")",
";",
"if",
"(",
"$",
"minpay",
"<",
"$",
"lowest_pp",
"||",
"$",
"lowest_pp",
"===",
"false",
")",
"{",
"if",
"(",
"$",
"pclass",
"->",
"getType",
"(",
")",
"==",
"KlarnaPClass",
"::",
"ACCOUNT",
"||",
"$",
"minpay",
">=",
"$",
"lowest_payment",
")",
"{",
"$",
"lowest_pp",
"=",
"$",
"minpay",
";",
"$",
"lowest",
"=",
"$",
"pclass",
";",
"}",
"}",
"}",
"}",
"return",
"$",
"lowest",
";",
"}"
] |
Returns the cheapest, per month, PClass related to the specified sum.
<b>Note</b>: This choose the cheapest PClass for the current country.<br>
{@link Klarna::setCountry()}
<b>Flags can be</b>:<br>
{@link KlarnaFlags::CHECKOUT_PAGE}<br>
{@link KlarnaFlags::PRODUCT_PAGE}<br>
@param float $sum The product cost, or total sum of the cart.
@param int $flags Which type of page the info will be displayed on.
@throws KlarnaException
@return KlarnaPClass or false if none was found.
|
[
"Returns",
"the",
"cheapest",
"per",
"month",
"PClass",
"related",
"to",
"the",
"specified",
"sum",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3485-L3526
|
24,739
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.initCheckout
|
protected function initCheckout()
{
$dir = dirname(__FILE__);
//Require the CheckoutHTML interface/abstract class
include_once $dir.'/checkout/checkouthtml.intf.php';
//Iterate over all .class.php files in checkout/
foreach (glob($dir.'/checkout/*.class.php') as $checkout) {
if (!self::$debug) {
ob_start();
}
include_once $checkout;
$className = basename($checkout, '.class.php');
$cObj = new $className;
if ($cObj instanceof CheckoutHTML) {
$cObj->init($this, $this->_eid);
$this->coObjects[$className] = $cObj;
}
if (!self::$debug) {
ob_end_clean();
}
}
}
|
php
|
protected function initCheckout()
{
$dir = dirname(__FILE__);
//Require the CheckoutHTML interface/abstract class
include_once $dir.'/checkout/checkouthtml.intf.php';
//Iterate over all .class.php files in checkout/
foreach (glob($dir.'/checkout/*.class.php') as $checkout) {
if (!self::$debug) {
ob_start();
}
include_once $checkout;
$className = basename($checkout, '.class.php');
$cObj = new $className;
if ($cObj instanceof CheckoutHTML) {
$cObj->init($this, $this->_eid);
$this->coObjects[$className] = $cObj;
}
if (!self::$debug) {
ob_end_clean();
}
}
}
|
[
"protected",
"function",
"initCheckout",
"(",
")",
"{",
"$",
"dir",
"=",
"dirname",
"(",
"__FILE__",
")",
";",
"//Require the CheckoutHTML interface/abstract class",
"include_once",
"$",
"dir",
".",
"'/checkout/checkouthtml.intf.php'",
";",
"//Iterate over all .class.php files in checkout/",
"foreach",
"(",
"glob",
"(",
"$",
"dir",
".",
"'/checkout/*.class.php'",
")",
"as",
"$",
"checkout",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"debug",
")",
"{",
"ob_start",
"(",
")",
";",
"}",
"include_once",
"$",
"checkout",
";",
"$",
"className",
"=",
"basename",
"(",
"$",
"checkout",
",",
"'.class.php'",
")",
";",
"$",
"cObj",
"=",
"new",
"$",
"className",
";",
"if",
"(",
"$",
"cObj",
"instanceof",
"CheckoutHTML",
")",
"{",
"$",
"cObj",
"->",
"init",
"(",
"$",
"this",
",",
"$",
"this",
"->",
"_eid",
")",
";",
"$",
"this",
"->",
"coObjects",
"[",
"$",
"className",
"]",
"=",
"$",
"cObj",
";",
"}",
"if",
"(",
"!",
"self",
"::",
"$",
"debug",
")",
"{",
"ob_end_clean",
"(",
")",
";",
"}",
"}",
"}"
] |
Initializes the checkoutHTML objects.
@see Klarna::checkoutHTML()
@return void
|
[
"Initializes",
"the",
"checkoutHTML",
"objects",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3534-L3560
|
24,740
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.checkoutHTML
|
public function checkoutHTML()
{
if (empty($this->coObjects)) {
$this->initCheckout();
}
$dir = dirname(__FILE__);
//Require the CheckoutHTML interface/abstract class
include_once $dir.'/checkout/checkouthtml.intf.php';
//Iterate over all .class.php files in
$html = "\n";
foreach ($this->coObjects as $cObj) {
if (!self::$debug) {
ob_start();
}
if ($cObj instanceof CheckoutHTML) {
$html .= $cObj->toHTML() . "\n";
}
if (!self::$debug) {
ob_end_clean();
}
}
return $html;
}
|
php
|
public function checkoutHTML()
{
if (empty($this->coObjects)) {
$this->initCheckout();
}
$dir = dirname(__FILE__);
//Require the CheckoutHTML interface/abstract class
include_once $dir.'/checkout/checkouthtml.intf.php';
//Iterate over all .class.php files in
$html = "\n";
foreach ($this->coObjects as $cObj) {
if (!self::$debug) {
ob_start();
}
if ($cObj instanceof CheckoutHTML) {
$html .= $cObj->toHTML() . "\n";
}
if (!self::$debug) {
ob_end_clean();
}
}
return $html;
}
|
[
"public",
"function",
"checkoutHTML",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"coObjects",
")",
")",
"{",
"$",
"this",
"->",
"initCheckout",
"(",
")",
";",
"}",
"$",
"dir",
"=",
"dirname",
"(",
"__FILE__",
")",
";",
"//Require the CheckoutHTML interface/abstract class",
"include_once",
"$",
"dir",
".",
"'/checkout/checkouthtml.intf.php'",
";",
"//Iterate over all .class.php files in",
"$",
"html",
"=",
"\"\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"coObjects",
"as",
"$",
"cObj",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"debug",
")",
"{",
"ob_start",
"(",
")",
";",
"}",
"if",
"(",
"$",
"cObj",
"instanceof",
"CheckoutHTML",
")",
"{",
"$",
"html",
".=",
"$",
"cObj",
"->",
"toHTML",
"(",
")",
".",
"\"\\n\"",
";",
"}",
"if",
"(",
"!",
"self",
"::",
"$",
"debug",
")",
"{",
"ob_end_clean",
"(",
")",
";",
"}",
"}",
"return",
"$",
"html",
";",
"}"
] |
Returns the checkout page HTML from the checkout classes.
<b>Note</b>:<br>
This method uses output buffering to silence unwanted echoes.<br>
@see CheckoutHTML
@return string A HTML string.
|
[
"Returns",
"the",
"checkout",
"page",
"HTML",
"from",
"the",
"checkout",
"classes",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3572-L3597
|
24,741
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.xmlrpc_call
|
protected function xmlrpc_call($method, $array)
{
$this->_checkConfig();
if (!isset($method) || !is_string($method)) {
throw new Klarna_InvalidTypeException('method', 'string');
}
if ($array === null || count($array) === 0) {
throw new KlarnaException("Parameterlist is empty or null!", 50067);
}
if (self::$disableXMLRPC) {
return true;
}
try {
/*
* Disable verifypeer for CURL, so below error is avoided.
* CURL error: SSL certificate problem, verify that the CA
* cert is OK.
* Details: error:14090086:SSL
* routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (#8)
*/
$this->xmlrpc->verifypeer = false;
$timestart = microtime(true);
//Create the XMLRPC message.
$msg = new xmlrpcmsg($method);
$params = array_merge(
array(
$this->PROTO, $this->VERSION
), $array
);
$msg = new xmlrpcmsg($method);
foreach ($params as $p) {
if (!$msg->addParam(
php_xmlrpc_encode($p, array('extension_api'))
)
) {
throw new KlarnaException(
"Failed to add parameters to XMLRPC message.",
50068
);
}
}
$selectDateTime = microtime(true);
if (self::$xmlrpcDebug) {
$this->xmlrpc->setDebug(2);
}
//Save previous XML RPC client encoding settings.
$tmp_xmlrpc_defencoding = $GLOBALS['xmlrpc_defencoding'];
$tmp_xmlrpc_internalencoding = $GLOBALS['xmlrpc_internalencoding'];
//Set XML RPC client encoding settings.
$GLOBALS['xmlrpc_defencoding'] = 'ISO-8859-1';
$GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
//Send the message.
$xmlrpcresp = $this->xmlrpc->send($msg);
//Restore previous XML RPC client encoding settings.
$GLOBALS['xmlrpc_defencoding'] = $tmp_xmlrpc_defencoding;
$GLOBALS['xmlrpc_internalencoding'] = $tmp_xmlrpc_internalencoding;
//Calculate time and selectTime.
$timeend = microtime(true);
$time = (int) (($selectDateTime - $timestart) * 1000);
$selectTime = (int) (($timeend - $timestart) * 1000);
$status = $xmlrpcresp->faultCode();
if ($status !== 0) {
throw new KlarnaException($xmlrpcresp->faultString(), $status);
}
return php_xmlrpc_decode($xmlrpcresp->value());
}
catch(KlarnaException $e) {
//Otherwise it is caught below, and rethrown.
throw $e;
}
catch(Exception $e) {
throw new KlarnaException($e->getMessage(), $e->getCode());
}
}
|
php
|
protected function xmlrpc_call($method, $array)
{
$this->_checkConfig();
if (!isset($method) || !is_string($method)) {
throw new Klarna_InvalidTypeException('method', 'string');
}
if ($array === null || count($array) === 0) {
throw new KlarnaException("Parameterlist is empty or null!", 50067);
}
if (self::$disableXMLRPC) {
return true;
}
try {
/*
* Disable verifypeer for CURL, so below error is avoided.
* CURL error: SSL certificate problem, verify that the CA
* cert is OK.
* Details: error:14090086:SSL
* routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (#8)
*/
$this->xmlrpc->verifypeer = false;
$timestart = microtime(true);
//Create the XMLRPC message.
$msg = new xmlrpcmsg($method);
$params = array_merge(
array(
$this->PROTO, $this->VERSION
), $array
);
$msg = new xmlrpcmsg($method);
foreach ($params as $p) {
if (!$msg->addParam(
php_xmlrpc_encode($p, array('extension_api'))
)
) {
throw new KlarnaException(
"Failed to add parameters to XMLRPC message.",
50068
);
}
}
$selectDateTime = microtime(true);
if (self::$xmlrpcDebug) {
$this->xmlrpc->setDebug(2);
}
//Save previous XML RPC client encoding settings.
$tmp_xmlrpc_defencoding = $GLOBALS['xmlrpc_defencoding'];
$tmp_xmlrpc_internalencoding = $GLOBALS['xmlrpc_internalencoding'];
//Set XML RPC client encoding settings.
$GLOBALS['xmlrpc_defencoding'] = 'ISO-8859-1';
$GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
//Send the message.
$xmlrpcresp = $this->xmlrpc->send($msg);
//Restore previous XML RPC client encoding settings.
$GLOBALS['xmlrpc_defencoding'] = $tmp_xmlrpc_defencoding;
$GLOBALS['xmlrpc_internalencoding'] = $tmp_xmlrpc_internalencoding;
//Calculate time and selectTime.
$timeend = microtime(true);
$time = (int) (($selectDateTime - $timestart) * 1000);
$selectTime = (int) (($timeend - $timestart) * 1000);
$status = $xmlrpcresp->faultCode();
if ($status !== 0) {
throw new KlarnaException($xmlrpcresp->faultString(), $status);
}
return php_xmlrpc_decode($xmlrpcresp->value());
}
catch(KlarnaException $e) {
//Otherwise it is caught below, and rethrown.
throw $e;
}
catch(Exception $e) {
throw new KlarnaException($e->getMessage(), $e->getCode());
}
}
|
[
"protected",
"function",
"xmlrpc_call",
"(",
"$",
"method",
",",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"_checkConfig",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"method",
")",
"||",
"!",
"is_string",
"(",
"$",
"method",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidTypeException",
"(",
"'method'",
",",
"'string'",
")",
";",
"}",
"if",
"(",
"$",
"array",
"===",
"null",
"||",
"count",
"(",
"$",
"array",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"KlarnaException",
"(",
"\"Parameterlist is empty or null!\"",
",",
"50067",
")",
";",
"}",
"if",
"(",
"self",
"::",
"$",
"disableXMLRPC",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"/*\n * Disable verifypeer for CURL, so below error is avoided.\n * CURL error: SSL certificate problem, verify that the CA\n * cert is OK.\n * Details: error:14090086:SSL\n * routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (#8)\n */",
"$",
"this",
"->",
"xmlrpc",
"->",
"verifypeer",
"=",
"false",
";",
"$",
"timestart",
"=",
"microtime",
"(",
"true",
")",
";",
"//Create the XMLRPC message.",
"$",
"msg",
"=",
"new",
"xmlrpcmsg",
"(",
"$",
"method",
")",
";",
"$",
"params",
"=",
"array_merge",
"(",
"array",
"(",
"$",
"this",
"->",
"PROTO",
",",
"$",
"this",
"->",
"VERSION",
")",
",",
"$",
"array",
")",
";",
"$",
"msg",
"=",
"new",
"xmlrpcmsg",
"(",
"$",
"method",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"p",
")",
"{",
"if",
"(",
"!",
"$",
"msg",
"->",
"addParam",
"(",
"php_xmlrpc_encode",
"(",
"$",
"p",
",",
"array",
"(",
"'extension_api'",
")",
")",
")",
")",
"{",
"throw",
"new",
"KlarnaException",
"(",
"\"Failed to add parameters to XMLRPC message.\"",
",",
"50068",
")",
";",
"}",
"}",
"$",
"selectDateTime",
"=",
"microtime",
"(",
"true",
")",
";",
"if",
"(",
"self",
"::",
"$",
"xmlrpcDebug",
")",
"{",
"$",
"this",
"->",
"xmlrpc",
"->",
"setDebug",
"(",
"2",
")",
";",
"}",
"//Save previous XML RPC client encoding settings.",
"$",
"tmp_xmlrpc_defencoding",
"=",
"$",
"GLOBALS",
"[",
"'xmlrpc_defencoding'",
"]",
";",
"$",
"tmp_xmlrpc_internalencoding",
"=",
"$",
"GLOBALS",
"[",
"'xmlrpc_internalencoding'",
"]",
";",
"//Set XML RPC client encoding settings.",
"$",
"GLOBALS",
"[",
"'xmlrpc_defencoding'",
"]",
"=",
"'ISO-8859-1'",
";",
"$",
"GLOBALS",
"[",
"'xmlrpc_internalencoding'",
"]",
"=",
"'UTF-8'",
";",
"//Send the message.",
"$",
"xmlrpcresp",
"=",
"$",
"this",
"->",
"xmlrpc",
"->",
"send",
"(",
"$",
"msg",
")",
";",
"//Restore previous XML RPC client encoding settings.",
"$",
"GLOBALS",
"[",
"'xmlrpc_defencoding'",
"]",
"=",
"$",
"tmp_xmlrpc_defencoding",
";",
"$",
"GLOBALS",
"[",
"'xmlrpc_internalencoding'",
"]",
"=",
"$",
"tmp_xmlrpc_internalencoding",
";",
"//Calculate time and selectTime.",
"$",
"timeend",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"time",
"=",
"(",
"int",
")",
"(",
"(",
"$",
"selectDateTime",
"-",
"$",
"timestart",
")",
"*",
"1000",
")",
";",
"$",
"selectTime",
"=",
"(",
"int",
")",
"(",
"(",
"$",
"timeend",
"-",
"$",
"timestart",
")",
"*",
"1000",
")",
";",
"$",
"status",
"=",
"$",
"xmlrpcresp",
"->",
"faultCode",
"(",
")",
";",
"if",
"(",
"$",
"status",
"!==",
"0",
")",
"{",
"throw",
"new",
"KlarnaException",
"(",
"$",
"xmlrpcresp",
"->",
"faultString",
"(",
")",
",",
"$",
"status",
")",
";",
"}",
"return",
"php_xmlrpc_decode",
"(",
"$",
"xmlrpcresp",
"->",
"value",
"(",
")",
")",
";",
"}",
"catch",
"(",
"KlarnaException",
"$",
"e",
")",
"{",
"//Otherwise it is caught below, and rethrown.",
"throw",
"$",
"e",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"KlarnaException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
",",
"$",
"e",
"->",
"getCode",
"(",
")",
")",
";",
"}",
"}"
] |
Creates a XMLRPC call with specified XMLRPC method and parameters from array.
@param string $method XMLRPC method.
@param array $array XMLRPC parameters.
@throws KlarnaException
@return mixed
|
[
"Creates",
"a",
"XMLRPC",
"call",
"with",
"specified",
"XMLRPC",
"method",
"and",
"parameters",
"from",
"array",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3608-L3692
|
24,742
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.checkoutService
|
public function checkoutService($price, $currency, $locale, $country = null)
{
$this->_checkAmount($price);
$params = array(
'merchant_id' => $this->config['eid'],
'total_price' => $price,
'currency' => strtoupper($currency),
'locale' => strtolower($locale)
);
if ($country !== null) {
$params['country'] = $country;
}
return $this->createTransport()->send(
new CheckoutServiceRequest($this->config, $params)
);
}
|
php
|
public function checkoutService($price, $currency, $locale, $country = null)
{
$this->_checkAmount($price);
$params = array(
'merchant_id' => $this->config['eid'],
'total_price' => $price,
'currency' => strtoupper($currency),
'locale' => strtolower($locale)
);
if ($country !== null) {
$params['country'] = $country;
}
return $this->createTransport()->send(
new CheckoutServiceRequest($this->config, $params)
);
}
|
[
"public",
"function",
"checkoutService",
"(",
"$",
"price",
",",
"$",
"currency",
",",
"$",
"locale",
",",
"$",
"country",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_checkAmount",
"(",
"$",
"price",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'merchant_id'",
"=>",
"$",
"this",
"->",
"config",
"[",
"'eid'",
"]",
",",
"'total_price'",
"=>",
"$",
"price",
",",
"'currency'",
"=>",
"strtoupper",
"(",
"$",
"currency",
")",
",",
"'locale'",
"=>",
"strtolower",
"(",
"$",
"locale",
")",
")",
";",
"if",
"(",
"$",
"country",
"!==",
"null",
")",
"{",
"$",
"params",
"[",
"'country'",
"]",
"=",
"$",
"country",
";",
"}",
"return",
"$",
"this",
"->",
"createTransport",
"(",
")",
"->",
"send",
"(",
"new",
"CheckoutServiceRequest",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"params",
")",
")",
";",
"}"
] |
Perform a checkout service request.
@param int|float $price The total price for the checkout including VAT.
@param string $currency ISO 4217 Currency Code
@param string $locale Specify what locale is used by the checkout.
ISO 639 language and ISO 3166-1 country separated
by underscore. Example: sv_SE
@param string $country (Optional) Specify what ISO 3166-1 country to use
for fetching payment methods. If not specified
the locale country will be used.
@throws RuntimeException If the curl extension is not loaded
@return CheckoutServiceResponse Response with payment methods
|
[
"Perform",
"a",
"checkout",
"service",
"request",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3723-L3741
|
24,743
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.digest
|
public static function digest($data, $hash = null)
{
if ($hash===null) {
$preferred = array(
'sha512',
'sha384',
'sha256',
'sha224',
'md5'
);
$hashes = array_intersect($preferred, hash_algos());
if (count($hashes) == 0) {
throw new KlarnaException(
"No available hash algorithm supported!"
);
}
$hash = array_shift($hashes);
}
self::printDebug('digest() using hash', $hash);
return base64_encode(pack("H*", hash($hash, $data)));
}
|
php
|
public static function digest($data, $hash = null)
{
if ($hash===null) {
$preferred = array(
'sha512',
'sha384',
'sha256',
'sha224',
'md5'
);
$hashes = array_intersect($preferred, hash_algos());
if (count($hashes) == 0) {
throw new KlarnaException(
"No available hash algorithm supported!"
);
}
$hash = array_shift($hashes);
}
self::printDebug('digest() using hash', $hash);
return base64_encode(pack("H*", hash($hash, $data)));
}
|
[
"public",
"static",
"function",
"digest",
"(",
"$",
"data",
",",
"$",
"hash",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"hash",
"===",
"null",
")",
"{",
"$",
"preferred",
"=",
"array",
"(",
"'sha512'",
",",
"'sha384'",
",",
"'sha256'",
",",
"'sha224'",
",",
"'md5'",
")",
";",
"$",
"hashes",
"=",
"array_intersect",
"(",
"$",
"preferred",
",",
"hash_algos",
"(",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"hashes",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"KlarnaException",
"(",
"\"No available hash algorithm supported!\"",
")",
";",
"}",
"$",
"hash",
"=",
"array_shift",
"(",
"$",
"hashes",
")",
";",
"}",
"self",
"::",
"printDebug",
"(",
"'digest() using hash'",
",",
"$",
"hash",
")",
";",
"return",
"base64_encode",
"(",
"pack",
"(",
"\"H*\"",
",",
"hash",
"(",
"$",
"hash",
",",
"$",
"data",
")",
")",
")",
";",
"}"
] |
Creates a digest hash from the inputted string,
and the specified or the preferred hash algorithm.
@param string $data Data to be hashed.
@param string $hash hash algoritm to use
@throws KlarnaException
@return string Base64 encoded hash.
|
[
"Creates",
"a",
"digest",
"hash",
"from",
"the",
"inputted",
"string",
"and",
"the",
"specified",
"or",
"the",
"preferred",
"hash",
"algorithm",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3824-L3847
|
24,744
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.num_htmlentities
|
public static function num_htmlentities($str)
{
$charset = 'ISO-8859-1';
if (!self::$htmlentities) {
self::$htmlentities = array();
$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, $charset);
foreach ($table as $char => $entity) {
self::$htmlentities[$entity] = '&#' . ord($char) . ';';
}
}
return str_replace(
array_keys(
self::$htmlentities
), self::$htmlentities, htmlentities($str, ENT_COMPAT | ENT_HTML401, $charset)
);
}
|
php
|
public static function num_htmlentities($str)
{
$charset = 'ISO-8859-1';
if (!self::$htmlentities) {
self::$htmlentities = array();
$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, $charset);
foreach ($table as $char => $entity) {
self::$htmlentities[$entity] = '&#' . ord($char) . ';';
}
}
return str_replace(
array_keys(
self::$htmlentities
), self::$htmlentities, htmlentities($str, ENT_COMPAT | ENT_HTML401, $charset)
);
}
|
[
"public",
"static",
"function",
"num_htmlentities",
"(",
"$",
"str",
")",
"{",
"$",
"charset",
"=",
"'ISO-8859-1'",
";",
"if",
"(",
"!",
"self",
"::",
"$",
"htmlentities",
")",
"{",
"self",
"::",
"$",
"htmlentities",
"=",
"array",
"(",
")",
";",
"$",
"table",
"=",
"get_html_translation_table",
"(",
"HTML_ENTITIES",
",",
"ENT_QUOTES",
",",
"$",
"charset",
")",
";",
"foreach",
"(",
"$",
"table",
"as",
"$",
"char",
"=>",
"$",
"entity",
")",
"{",
"self",
"::",
"$",
"htmlentities",
"[",
"$",
"entity",
"]",
"=",
"'&#'",
".",
"ord",
"(",
"$",
"char",
")",
".",
"';'",
";",
"}",
"}",
"return",
"str_replace",
"(",
"array_keys",
"(",
"self",
"::",
"$",
"htmlentities",
")",
",",
"self",
"::",
"$",
"htmlentities",
",",
"htmlentities",
"(",
"$",
"str",
",",
"ENT_COMPAT",
"|",
"ENT_HTML401",
",",
"$",
"charset",
")",
")",
";",
"}"
] |
Converts special characters to numeric htmlentities.
<b>Note</b>:<br>
If supplied string is encoded with UTF-8, o umlaut ("ö") will become two
HTML entities instead of one.
@param string $str String to be converted.
@return string String converted to numeric HTML entities.
|
[
"Converts",
"special",
"characters",
"to",
"numeric",
"htmlentities",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L3860-L3877
|
24,745
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna._checkArgument
|
private function _checkArgument($argument, $name)
{
if (!is_string($argument)) {
$argument = strval($argument);
}
if (strlen($argument) == 0) {
throw new Klarna_ArgumentNotSetException($name);
}
}
|
php
|
private function _checkArgument($argument, $name)
{
if (!is_string($argument)) {
$argument = strval($argument);
}
if (strlen($argument) == 0) {
throw new Klarna_ArgumentNotSetException($name);
}
}
|
[
"private",
"function",
"_checkArgument",
"(",
"$",
"argument",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"argument",
")",
")",
"{",
"$",
"argument",
"=",
"strval",
"(",
"$",
"argument",
")",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"argument",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"Klarna_ArgumentNotSetException",
"(",
"$",
"name",
")",
";",
"}",
"}"
] |
Check so required argument is supplied.
@param string $argument argument to check
@param string $name name of argument
@throws Klarna_ArgumentNotSetException
@return void
|
[
"Check",
"so",
"required",
"argument",
"is",
"supplied",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L4356-L4365
|
24,746
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna.setPCStorage
|
public function setPCStorage($pcStorage)
{
if (!($pcStorage instanceof PCStorage)) {
throw new Klarna_InvalidTypeException('pcStorage', 'PCStorage');
}
$this->pcStorage = $pcStorage->getName();
$this->pclasses = $pcStorage;
}
|
php
|
public function setPCStorage($pcStorage)
{
if (!($pcStorage instanceof PCStorage)) {
throw new Klarna_InvalidTypeException('pcStorage', 'PCStorage');
}
$this->pcStorage = $pcStorage->getName();
$this->pclasses = $pcStorage;
}
|
[
"public",
"function",
"setPCStorage",
"(",
"$",
"pcStorage",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"pcStorage",
"instanceof",
"PCStorage",
")",
")",
"{",
"throw",
"new",
"Klarna_InvalidTypeException",
"(",
"'pcStorage'",
",",
"'PCStorage'",
")",
";",
"}",
"$",
"this",
"->",
"pcStorage",
"=",
"$",
"pcStorage",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"pclasses",
"=",
"$",
"pcStorage",
";",
"}"
] |
Set the pcStorage method used for this instance
@param PCStorage $pcStorage PCStorage implementation
@return void
|
[
"Set",
"the",
"pcStorage",
"method",
"used",
"for",
"this",
"instance"
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L4403-L4410
|
24,747
|
Subscribo/klarna-invoice-sdk-wrapped
|
src/Klarna.php
|
Klarna._checkConfig
|
private function _checkConfig($config = null)
{
if ($config === null) {
$config = $this->config;
}
if (!($config instanceof ArrayAccess)
&& !is_array($config)
) {
throw new Klarna_IncompleteConfigurationException;
}
}
|
php
|
private function _checkConfig($config = null)
{
if ($config === null) {
$config = $this->config;
}
if (!($config instanceof ArrayAccess)
&& !is_array($config)
) {
throw new Klarna_IncompleteConfigurationException;
}
}
|
[
"private",
"function",
"_checkConfig",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"config",
"===",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"config",
"instanceof",
"ArrayAccess",
")",
"&&",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"throw",
"new",
"Klarna_IncompleteConfigurationException",
";",
"}",
"}"
] |
Ensure the configuration is of the correct type.
@param array|ArrayAccess|null $config an optional config to validate
@return void
|
[
"Ensure",
"the",
"configuration",
"is",
"of",
"the",
"correct",
"type",
"."
] |
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
|
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Klarna.php#L4419-L4429
|
24,748
|
Talesoft/tale-framework
|
src/Tale/Event.php
|
Event.removeHandler
|
public function removeHandler($handler)
{
if(!is_callable($handler))
throw new \InvalidArgumentException("Argument 1 of Event->addHandler needs to be a valid callback");
$i = array_search($handler, $this->_handlers, true);
if ($i !== false)
unset($this->_handlers[$i]);
return $this;
}
|
php
|
public function removeHandler($handler)
{
if(!is_callable($handler))
throw new \InvalidArgumentException("Argument 1 of Event->addHandler needs to be a valid callback");
$i = array_search($handler, $this->_handlers, true);
if ($i !== false)
unset($this->_handlers[$i]);
return $this;
}
|
[
"public",
"function",
"removeHandler",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"handler",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Argument 1 of Event->addHandler needs to be a valid callback\"",
")",
";",
"$",
"i",
"=",
"array_search",
"(",
"$",
"handler",
",",
"$",
"this",
"->",
"_handlers",
",",
"true",
")",
";",
"if",
"(",
"$",
"i",
"!==",
"false",
")",
"unset",
"(",
"$",
"this",
"->",
"_handlers",
"[",
"$",
"i",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] |
Removes an assigned handler
This uses array_search to find the handler
@param callable $handler The handler to remove
@return $this
|
[
"Removes",
"an",
"assigned",
"handler"
] |
739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49
|
https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Event.php#L89-L100
|
24,749
|
Talesoft/tale-framework
|
src/Tale/Event.php
|
Event.trigger
|
public function trigger(Event\Args $args = null, $reverse = false)
{
$args = $args ? $args : new Event\Args();
if ($reverse) {
for ($i = count($this->_handlers); --$i >= 0;) {
if (call_user_func_array($this->_handlers[$i], func_get_args()) === false)
break;
}
} else {
foreach ($this->_handlers as $handler) {
if (call_user_func_array($handler, func_get_args()) === false)
break;
}
}
return !$args->isDefaultPrevented();
}
|
php
|
public function trigger(Event\Args $args = null, $reverse = false)
{
$args = $args ? $args : new Event\Args();
if ($reverse) {
for ($i = count($this->_handlers); --$i >= 0;) {
if (call_user_func_array($this->_handlers[$i], func_get_args()) === false)
break;
}
} else {
foreach ($this->_handlers as $handler) {
if (call_user_func_array($handler, func_get_args()) === false)
break;
}
}
return !$args->isDefaultPrevented();
}
|
[
"public",
"function",
"trigger",
"(",
"Event",
"\\",
"Args",
"$",
"args",
"=",
"null",
",",
"$",
"reverse",
"=",
"false",
")",
"{",
"$",
"args",
"=",
"$",
"args",
"?",
"$",
"args",
":",
"new",
"Event",
"\\",
"Args",
"(",
")",
";",
"if",
"(",
"$",
"reverse",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"_handlers",
")",
";",
"--",
"$",
"i",
">=",
"0",
";",
")",
"{",
"if",
"(",
"call_user_func_array",
"(",
"$",
"this",
"->",
"_handlers",
"[",
"$",
"i",
"]",
",",
"func_get_args",
"(",
")",
")",
"===",
"false",
")",
"break",
";",
"}",
"}",
"else",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_handlers",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"call_user_func_array",
"(",
"$",
"handler",
",",
"func_get_args",
"(",
")",
")",
"===",
"false",
")",
"break",
";",
"}",
"}",
"return",
"!",
"$",
"args",
"->",
"isDefaultPrevented",
"(",
")",
";",
"}"
] |
Triggers the event
The return value is the the negation of
isDefaultPrevented() result of the event args
If null is passed, new event args are created automatically
@param \Tale\Event\Args|null $args An argument object to pass
@param bool $reverse
@return bool
|
[
"Triggers",
"the",
"event"
] |
739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49
|
https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Event.php#L114-L136
|
24,750
|
bandama-framework/bandama-framework
|
src/foundation/controller/Controller.php
|
Controller.render
|
public function render($view, $params = array()) {
$viewPath = $this->viewPath;
$viewPath = rtrim($viewPath, '/').'/';
extract($params);
if (is_file($view)) {
require_once($view);
} else if (is_file($viewPath.str_replace(':', '/', $view))) {
require_once($viewPath.str_replace(':', '/', $view));
} else {
echo $view;
}
}
|
php
|
public function render($view, $params = array()) {
$viewPath = $this->viewPath;
$viewPath = rtrim($viewPath, '/').'/';
extract($params);
if (is_file($view)) {
require_once($view);
} else if (is_file($viewPath.str_replace(':', '/', $view))) {
require_once($viewPath.str_replace(':', '/', $view));
} else {
echo $view;
}
}
|
[
"public",
"function",
"render",
"(",
"$",
"view",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"viewPath",
"=",
"$",
"this",
"->",
"viewPath",
";",
"$",
"viewPath",
"=",
"rtrim",
"(",
"$",
"viewPath",
",",
"'/'",
")",
".",
"'/'",
";",
"extract",
"(",
"$",
"params",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"view",
")",
")",
"{",
"require_once",
"(",
"$",
"view",
")",
";",
"}",
"else",
"if",
"(",
"is_file",
"(",
"$",
"viewPath",
".",
"str_replace",
"(",
"':'",
",",
"'/'",
",",
"$",
"view",
")",
")",
")",
"{",
"require_once",
"(",
"$",
"viewPath",
".",
"str_replace",
"(",
"':'",
",",
"'/'",
",",
"$",
"view",
")",
")",
";",
"}",
"else",
"{",
"echo",
"$",
"view",
";",
"}",
"}"
] |
Render the content of view file or text
@param string View path of view file or text
@param array View parameters
@return string
|
[
"Render",
"the",
"content",
"of",
"view",
"file",
"or",
"text"
] |
234ed703baf9e31268941c9d5f6d5e004cc53066
|
https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/foundation/controller/Controller.php#L39-L50
|
24,751
|
PenoaksDev/Milky-Framework
|
src/Milky/Config/ConfigurationLoader.php
|
ConfigurationLoader.create
|
public static function create( ConfigurationBuilder $builder )
{
// TODO Currently only supports PHP files, need to add optional json and yaml support.
$configPath = Framework::fw()->buildPath( '__config' );
$configFile = $configPath . __ . $builder->key() . ".php";
if ( file_put_contents( $configFile, $builder->toPhp( true ) ) === false || !is_array( $data = include( $configFile ) ) )
{
@unlink( $configFile );
throw new FrameworkException( "Configuration error, either failed to write config file to [" . $configFile . "] or returned data is not an array." );
}
Framework::config()->set( $builder->key(), $data );
}
|
php
|
public static function create( ConfigurationBuilder $builder )
{
// TODO Currently only supports PHP files, need to add optional json and yaml support.
$configPath = Framework::fw()->buildPath( '__config' );
$configFile = $configPath . __ . $builder->key() . ".php";
if ( file_put_contents( $configFile, $builder->toPhp( true ) ) === false || !is_array( $data = include( $configFile ) ) )
{
@unlink( $configFile );
throw new FrameworkException( "Configuration error, either failed to write config file to [" . $configFile . "] or returned data is not an array." );
}
Framework::config()->set( $builder->key(), $data );
}
|
[
"public",
"static",
"function",
"create",
"(",
"ConfigurationBuilder",
"$",
"builder",
")",
"{",
"// TODO Currently only supports PHP files, need to add optional json and yaml support.",
"$",
"configPath",
"=",
"Framework",
"::",
"fw",
"(",
")",
"->",
"buildPath",
"(",
"'__config'",
")",
";",
"$",
"configFile",
"=",
"$",
"configPath",
".",
"__",
".",
"$",
"builder",
"->",
"key",
"(",
")",
".",
"\".php\"",
";",
"if",
"(",
"file_put_contents",
"(",
"$",
"configFile",
",",
"$",
"builder",
"->",
"toPhp",
"(",
"true",
")",
")",
"===",
"false",
"||",
"!",
"is_array",
"(",
"$",
"data",
"=",
"include",
"(",
"$",
"configFile",
")",
")",
")",
"{",
"@",
"unlink",
"(",
"$",
"configFile",
")",
";",
"throw",
"new",
"FrameworkException",
"(",
"\"Configuration error, either failed to write config file to [\"",
".",
"$",
"configFile",
".",
"\"] or returned data is not an array.\"",
")",
";",
"}",
"Framework",
"::",
"config",
"(",
")",
"->",
"set",
"(",
"$",
"builder",
"->",
"key",
"(",
")",
",",
"$",
"data",
")",
";",
"}"
] |
Saves a builder to the filesystem
@param ConfigurationBuilder $builder
@throws FrameworkException
|
[
"Saves",
"a",
"builder",
"to",
"the",
"filesystem"
] |
8afd7156610a70371aa5b1df50b8a212bf7b142c
|
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Config/ConfigurationLoader.php#L108-L123
|
24,752
|
theomessin/ts-framework
|
src/Adapter/ServerQuery/Reply.php
|
Reply.fetchError
|
protected function fetchError($err)
{
$cells = $err->section(Teamspeak::SEPARATOR_CELL, 1, 3);
foreach ($cells->split(Teamspeak::SEPARATOR_CELL) as $pair) {
list($ident, $value) = $pair->split(Teamspeak::SEPARATOR_PAIR);
$this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
}
Signal::getInstance()->emit("notifyError", $this);
if ($this->getErrorProperty("id", 0x00) != 0x00 && $this->exp) {
if ($permid = $this->getErrorProperty("failed_permid")) {
if ($permsid = key($this->con->request("permget permid=" . $permid, false)->toAssocArray("permsid"))) {
$suffix = " (failed on " . $permsid . ")";
} else {
$suffix = " (failed on " . $this->cmd->section(
Teamspeak::SEPARATOR_CELL
) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
}
} elseif ($details = $this->getErrorProperty("extra_msg")) {
$suffix = " (" . trim($details) . ")";
} else {
$suffix = "";
}
throw new Ts3Exception(
$this->getErrorProperty("msg") . $suffix,
$this->getErrorProperty("id")
);
}
}
|
php
|
protected function fetchError($err)
{
$cells = $err->section(Teamspeak::SEPARATOR_CELL, 1, 3);
foreach ($cells->split(Teamspeak::SEPARATOR_CELL) as $pair) {
list($ident, $value) = $pair->split(Teamspeak::SEPARATOR_PAIR);
$this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
}
Signal::getInstance()->emit("notifyError", $this);
if ($this->getErrorProperty("id", 0x00) != 0x00 && $this->exp) {
if ($permid = $this->getErrorProperty("failed_permid")) {
if ($permsid = key($this->con->request("permget permid=" . $permid, false)->toAssocArray("permsid"))) {
$suffix = " (failed on " . $permsid . ")";
} else {
$suffix = " (failed on " . $this->cmd->section(
Teamspeak::SEPARATOR_CELL
) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
}
} elseif ($details = $this->getErrorProperty("extra_msg")) {
$suffix = " (" . trim($details) . ")";
} else {
$suffix = "";
}
throw new Ts3Exception(
$this->getErrorProperty("msg") . $suffix,
$this->getErrorProperty("id")
);
}
}
|
[
"protected",
"function",
"fetchError",
"(",
"$",
"err",
")",
"{",
"$",
"cells",
"=",
"$",
"err",
"->",
"section",
"(",
"Teamspeak",
"::",
"SEPARATOR_CELL",
",",
"1",
",",
"3",
")",
";",
"foreach",
"(",
"$",
"cells",
"->",
"split",
"(",
"Teamspeak",
"::",
"SEPARATOR_CELL",
")",
"as",
"$",
"pair",
")",
"{",
"list",
"(",
"$",
"ident",
",",
"$",
"value",
")",
"=",
"$",
"pair",
"->",
"split",
"(",
"Teamspeak",
"::",
"SEPARATOR_PAIR",
")",
";",
"$",
"this",
"->",
"err",
"[",
"$",
"ident",
"->",
"toString",
"(",
")",
"]",
"=",
"$",
"value",
"->",
"isInt",
"(",
")",
"?",
"$",
"value",
"->",
"toInt",
"(",
")",
":",
"$",
"value",
"->",
"unescape",
"(",
")",
";",
"}",
"Signal",
"::",
"getInstance",
"(",
")",
"->",
"emit",
"(",
"\"notifyError\"",
",",
"$",
"this",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getErrorProperty",
"(",
"\"id\"",
",",
"0x00",
")",
"!=",
"0x00",
"&&",
"$",
"this",
"->",
"exp",
")",
"{",
"if",
"(",
"$",
"permid",
"=",
"$",
"this",
"->",
"getErrorProperty",
"(",
"\"failed_permid\"",
")",
")",
"{",
"if",
"(",
"$",
"permsid",
"=",
"key",
"(",
"$",
"this",
"->",
"con",
"->",
"request",
"(",
"\"permget permid=\"",
".",
"$",
"permid",
",",
"false",
")",
"->",
"toAssocArray",
"(",
"\"permsid\"",
")",
")",
")",
"{",
"$",
"suffix",
"=",
"\" (failed on \"",
".",
"$",
"permsid",
".",
"\")\"",
";",
"}",
"else",
"{",
"$",
"suffix",
"=",
"\" (failed on \"",
".",
"$",
"this",
"->",
"cmd",
"->",
"section",
"(",
"Teamspeak",
"::",
"SEPARATOR_CELL",
")",
".",
"\" \"",
".",
"$",
"permid",
".",
"\"/0x\"",
".",
"strtoupper",
"(",
"dechex",
"(",
"$",
"permid",
")",
")",
".",
"\")\"",
";",
"}",
"}",
"elseif",
"(",
"$",
"details",
"=",
"$",
"this",
"->",
"getErrorProperty",
"(",
"\"extra_msg\"",
")",
")",
"{",
"$",
"suffix",
"=",
"\" (\"",
".",
"trim",
"(",
"$",
"details",
")",
".",
"\")\"",
";",
"}",
"else",
"{",
"$",
"suffix",
"=",
"\"\"",
";",
"}",
"throw",
"new",
"Ts3Exception",
"(",
"$",
"this",
"->",
"getErrorProperty",
"(",
"\"msg\"",
")",
".",
"$",
"suffix",
",",
"$",
"this",
"->",
"getErrorProperty",
"(",
"\"id\"",
")",
")",
";",
"}",
"}"
] |
Parses a ServerQuery error and throws a Ts3Exception object if
there's an error.
@param StringHelper|string $err
@throws Ts3Exception
@return void
|
[
"Parses",
"a",
"ServerQuery",
"error",
"and",
"throws",
"a",
"Ts3Exception",
"object",
"if",
"there",
"s",
"an",
"error",
"."
] |
d60e36553241db05cb05ef19e749866cc977437c
|
https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Adapter/ServerQuery/Reply.php#L287-L319
|
24,753
|
theomessin/ts-framework
|
src/Adapter/ServerQuery/Reply.php
|
Reply.fetchReply
|
protected function fetchReply($rpl)
{
foreach ($rpl as $key => $val) {
if ($val->startsWith(Teamspeak::GREET)) {
unset($rpl[$key]);
} elseif ($val->startsWith(Teamspeak::EVENT)) {
$this->evt[] = new Event($rpl[$key], $this->con);
unset($rpl[$key]);
}
}
$this->rpl = new StringHelper(implode(Teamspeak::SEPARATOR_LIST, $rpl));
}
|
php
|
protected function fetchReply($rpl)
{
foreach ($rpl as $key => $val) {
if ($val->startsWith(Teamspeak::GREET)) {
unset($rpl[$key]);
} elseif ($val->startsWith(Teamspeak::EVENT)) {
$this->evt[] = new Event($rpl[$key], $this->con);
unset($rpl[$key]);
}
}
$this->rpl = new StringHelper(implode(Teamspeak::SEPARATOR_LIST, $rpl));
}
|
[
"protected",
"function",
"fetchReply",
"(",
"$",
"rpl",
")",
"{",
"foreach",
"(",
"$",
"rpl",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"val",
"->",
"startsWith",
"(",
"Teamspeak",
"::",
"GREET",
")",
")",
"{",
"unset",
"(",
"$",
"rpl",
"[",
"$",
"key",
"]",
")",
";",
"}",
"elseif",
"(",
"$",
"val",
"->",
"startsWith",
"(",
"Teamspeak",
"::",
"EVENT",
")",
")",
"{",
"$",
"this",
"->",
"evt",
"[",
"]",
"=",
"new",
"Event",
"(",
"$",
"rpl",
"[",
"$",
"key",
"]",
",",
"$",
"this",
"->",
"con",
")",
";",
"unset",
"(",
"$",
"rpl",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"$",
"this",
"->",
"rpl",
"=",
"new",
"StringHelper",
"(",
"implode",
"(",
"Teamspeak",
"::",
"SEPARATOR_LIST",
",",
"$",
"rpl",
")",
")",
";",
"}"
] |
Parses a ServerQuery reply and creates a String object.
@param array $rpl
@return void
|
[
"Parses",
"a",
"ServerQuery",
"reply",
"and",
"creates",
"a",
"String",
"object",
"."
] |
d60e36553241db05cb05ef19e749866cc977437c
|
https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Adapter/ServerQuery/Reply.php#L327-L339
|
24,754
|
MasterkeyInformatica/browser-kit
|
Response.php
|
Response.getHeader
|
public function getHeader($header, $first = true)
{
$normalizedHeader = str_replace('-', '_', strtolower($header));
foreach ($this->headers as $key => $value) {
if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) {
if ($first) {
return is_array($value) ? (count($value) ? $value[0] : '') : $value;
}
return is_array($value) ? $value : array($value);
}
}
return $first ? null : array();
}
|
php
|
public function getHeader($header, $first = true)
{
$normalizedHeader = str_replace('-', '_', strtolower($header));
foreach ($this->headers as $key => $value) {
if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) {
if ($first) {
return is_array($value) ? (count($value) ? $value[0] : '') : $value;
}
return is_array($value) ? $value : array($value);
}
}
return $first ? null : array();
}
|
[
"public",
"function",
"getHeader",
"(",
"$",
"header",
",",
"$",
"first",
"=",
"true",
")",
"{",
"$",
"normalizedHeader",
"=",
"str_replace",
"(",
"'-'",
",",
"'_'",
",",
"strtolower",
"(",
"$",
"header",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"str_replace",
"(",
"'-'",
",",
"'_'",
",",
"strtolower",
"(",
"$",
"key",
")",
")",
"===",
"$",
"normalizedHeader",
")",
"{",
"if",
"(",
"$",
"first",
")",
"{",
"return",
"is_array",
"(",
"$",
"value",
")",
"?",
"(",
"count",
"(",
"$",
"value",
")",
"?",
"$",
"value",
"[",
"0",
"]",
":",
"''",
")",
":",
"$",
"value",
";",
"}",
"return",
"is_array",
"(",
"$",
"value",
")",
"?",
"$",
"value",
":",
"array",
"(",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"first",
"?",
"null",
":",
"array",
"(",
")",
";",
"}"
] |
Gets a response header.
@param string $header The header name
@param bool $first Whether to return the first value or all header values
@return string|array The first header value if $first is true, an array of values otherwise
|
[
"Gets",
"a",
"response",
"header",
"."
] |
fd735ad31c00af54d5c060d01218aa48308557f7
|
https://github.com/MasterkeyInformatica/browser-kit/blob/fd735ad31c00af54d5c060d01218aa48308557f7/Response.php#L114-L128
|
24,755
|
eliasis-framework/complement
|
src/Traits/ComplementAction.php
|
ComplementAction.getAction
|
public function getAction($state)
{
$type = self::getType('strtolower', false);
$action = self::$defaultAction[$type];
if (isset($this->states['action'])) {
$action = $this->states['action'];
}
return ($state === 'uninstalled') ? '' : $action;
}
|
php
|
public function getAction($state)
{
$type = self::getType('strtolower', false);
$action = self::$defaultAction[$type];
if (isset($this->states['action'])) {
$action = $this->states['action'];
}
return ($state === 'uninstalled') ? '' : $action;
}
|
[
"public",
"function",
"getAction",
"(",
"$",
"state",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"getType",
"(",
"'strtolower'",
",",
"false",
")",
";",
"$",
"action",
"=",
"self",
"::",
"$",
"defaultAction",
"[",
"$",
"type",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"states",
"[",
"'action'",
"]",
")",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"states",
"[",
"'action'",
"]",
";",
"}",
"return",
"(",
"$",
"state",
"===",
"'uninstalled'",
")",
"?",
"''",
":",
"$",
"action",
";",
"}"
] |
Get complement action.
@param string $state → complement state
@uses \Eliasis\Complement\ComplementState->$states
@uses \Eliasis\Complement\Traits\ComplementHandler::getType()
@return string → complement action
|
[
"Get",
"complement",
"action",
"."
] |
d50e92cf01600ff4573bf1761c312069044748c3
|
https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementAction.php#L55-L65
|
24,756
|
eliasis-framework/complement
|
src/Traits/ComplementAction.php
|
ComplementAction.doAction
|
public function doAction($action)
{
$controller = $this->getOption('hooks-controller');
$instance = $this->getControllerInstance($controller);
if (is_object($instance) && method_exists($instance, $action)) {
$response = call_user_func([$instance, $action]);
}
$this->setAction('');
return isset($response);
}
|
php
|
public function doAction($action)
{
$controller = $this->getOption('hooks-controller');
$instance = $this->getControllerInstance($controller);
if (is_object($instance) && method_exists($instance, $action)) {
$response = call_user_func([$instance, $action]);
}
$this->setAction('');
return isset($response);
}
|
[
"public",
"function",
"doAction",
"(",
"$",
"action",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'hooks-controller'",
")",
";",
"$",
"instance",
"=",
"$",
"this",
"->",
"getControllerInstance",
"(",
"$",
"controller",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"instance",
")",
"&&",
"method_exists",
"(",
"$",
"instance",
",",
"$",
"action",
")",
")",
"{",
"$",
"response",
"=",
"call_user_func",
"(",
"[",
"$",
"instance",
",",
"$",
"action",
"]",
")",
";",
"}",
"$",
"this",
"->",
"setAction",
"(",
"''",
")",
";",
"return",
"isset",
"(",
"$",
"response",
")",
";",
"}"
] |
Execute action hook.
@param string $action → action hook to execute
@uses \Eliasis\Complement\Traits\ComplementAction::setAction()
@uses \Eliasis\Complement\Traits\ComplementHandler::getOption()
@return bool
|
[
"Execute",
"action",
"hook",
"."
] |
d50e92cf01600ff4573bf1761c312069044748c3
|
https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementAction.php#L96-L108
|
24,757
|
eliasis-framework/complement
|
src/Traits/ComplementAction.php
|
ComplementAction.addActions
|
private function addActions()
{
if (isset($this->complement['hooks'])) {
Hook::getInstance(App::getCurrentID());
return Hook::addActions($this->complement['hooks']);
}
return false;
}
|
php
|
private function addActions()
{
if (isset($this->complement['hooks'])) {
Hook::getInstance(App::getCurrentID());
return Hook::addActions($this->complement['hooks']);
}
return false;
}
|
[
"private",
"function",
"addActions",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"complement",
"[",
"'hooks'",
"]",
")",
")",
"{",
"Hook",
"::",
"getInstance",
"(",
"App",
"::",
"getCurrentID",
"(",
")",
")",
";",
"return",
"Hook",
"::",
"addActions",
"(",
"$",
"this",
"->",
"complement",
"[",
"'hooks'",
"]",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Add complement action hooks.
@uses \Eliasis\Framework\App::getCurrentID()
@uses \Eliasis\Complement\Complement->$complement
@uses \Josantonius\Hook\Hook::getInstance
@uses \Josantonius\Hook\Hook::addActions
|
[
"Add",
"complement",
"action",
"hooks",
"."
] |
d50e92cf01600ff4573bf1761c312069044748c3
|
https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementAction.php#L118-L127
|
24,758
|
eliasis-framework/complement
|
src/Traits/ComplementAction.php
|
ComplementAction.doActions
|
private function doActions($action)
{
$type = self::getType('strtolower', false);
Hook::getInstance(App::getCurrentID());
Hook::doAction($type . '-load');
Hook::doAction('after-loading-' . $this->complement['slug'] . '-' . $type);
if (in_array($action, self::$hooks, true)) {
$this->doAction($action);
}
}
|
php
|
private function doActions($action)
{
$type = self::getType('strtolower', false);
Hook::getInstance(App::getCurrentID());
Hook::doAction($type . '-load');
Hook::doAction('after-loading-' . $this->complement['slug'] . '-' . $type);
if (in_array($action, self::$hooks, true)) {
$this->doAction($action);
}
}
|
[
"private",
"function",
"doActions",
"(",
"$",
"action",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"getType",
"(",
"'strtolower'",
",",
"false",
")",
";",
"Hook",
"::",
"getInstance",
"(",
"App",
"::",
"getCurrentID",
"(",
")",
")",
";",
"Hook",
"::",
"doAction",
"(",
"$",
"type",
".",
"'-load'",
")",
";",
"Hook",
"::",
"doAction",
"(",
"'after-loading-'",
".",
"$",
"this",
"->",
"complement",
"[",
"'slug'",
"]",
".",
"'-'",
".",
"$",
"type",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"action",
",",
"self",
"::",
"$",
"hooks",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"doAction",
"(",
"$",
"action",
")",
";",
"}",
"}"
] |
Execute action hooks.
@param string $action → action hook to execute
@uses \Eliasis\Framework\App::getCurrentID()
@uses \Josantonius\Hook\Hook::getInstance
@uses \Josantonius\Hook\Hook::doAction
@uses \Eliasis\Complement\Traits\ComplementHandler::getType()
|
[
"Execute",
"action",
"hooks",
"."
] |
d50e92cf01600ff4573bf1761c312069044748c3
|
https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementAction.php#L139-L150
|
24,759
|
MichaelJ2324/PHP-REST-Client
|
src/Auth/Abstracts/AbstractBasicController.php
|
AbstractBasicController.getAuthHeaderValue
|
protected function getAuthHeaderValue()
{
$value = "";
if (isset($this->credentials['username']) && isset($this->credentials['password'])){
$value = $this->credentials['username'].":".$this->credentials['password'];
$value = base64_encode($value);
}
return static::$_AUTH_TYPE." ".$value;
}
|
php
|
protected function getAuthHeaderValue()
{
$value = "";
if (isset($this->credentials['username']) && isset($this->credentials['password'])){
$value = $this->credentials['username'].":".$this->credentials['password'];
$value = base64_encode($value);
}
return static::$_AUTH_TYPE." ".$value;
}
|
[
"protected",
"function",
"getAuthHeaderValue",
"(",
")",
"{",
"$",
"value",
"=",
"\"\"",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"credentials",
"[",
"'username'",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"credentials",
"[",
"'password'",
"]",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"credentials",
"[",
"'username'",
"]",
".",
"\":\"",
".",
"$",
"this",
"->",
"credentials",
"[",
"'password'",
"]",
";",
"$",
"value",
"=",
"base64_encode",
"(",
"$",
"value",
")",
";",
"}",
"return",
"static",
"::",
"$",
"_AUTH_TYPE",
".",
"\" \"",
".",
"$",
"value",
";",
"}"
] |
Parse the Credentials or Token to build out the Auth Header Value
@return string
|
[
"Parse",
"the",
"Credentials",
"or",
"Token",
"to",
"build",
"out",
"the",
"Auth",
"Header",
"Value"
] |
b8a2caaf6456eccaa845ba5c5098608aa9645c92
|
https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Auth/Abstracts/AbstractBasicController.php#L34-L42
|
24,760
|
randomhost/image
|
src/php/Text/Decorator/Generic.php
|
Generic.providesMethod
|
public function providesMethod($name)
{
if (method_exists($this, $name)) {
return true;
}
if ($this->text instanceof Generic) {
return $this->text->providesMethod($name);
}
return false;
}
|
php
|
public function providesMethod($name)
{
if (method_exists($this, $name)) {
return true;
}
if ($this->text instanceof Generic) {
return $this->text->providesMethod($name);
}
return false;
}
|
[
"public",
"function",
"providesMethod",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"text",
"instanceof",
"Generic",
")",
"{",
"return",
"$",
"this",
"->",
"text",
"->",
"providesMethod",
"(",
"$",
"name",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns if the given method is implemented by one of the decorators.
@param string $name Method name.
@return bool
|
[
"Returns",
"if",
"the",
"given",
"method",
"is",
"implemented",
"by",
"one",
"of",
"the",
"decorators",
"."
] |
bd669ba6b50fd2bbbe50c4ef06235b111a8a30b0
|
https://github.com/randomhost/image/blob/bd669ba6b50fd2bbbe50c4ef06235b111a8a30b0/src/php/Text/Decorator/Generic.php#L149-L158
|
24,761
|
netbull/CoreBundle
|
Twig/CoreExtension.php
|
CoreExtension.buildQueryInputs
|
public function buildQueryInputs($currentField)
{
$request = $this->requestStack->getCurrentRequest();
$fields = '';
foreach ($request->query->all() as $field => $value) {
// Exclude the current field and the PAGE parameter
if($field !== $currentField && $field !== 'page'){
$fields .= sprintf('<input type="hidden" name="%s" value="%s">', $field, $value);
}
}
return $fields;
}
|
php
|
public function buildQueryInputs($currentField)
{
$request = $this->requestStack->getCurrentRequest();
$fields = '';
foreach ($request->query->all() as $field => $value) {
// Exclude the current field and the PAGE parameter
if($field !== $currentField && $field !== 'page'){
$fields .= sprintf('<input type="hidden" name="%s" value="%s">', $field, $value);
}
}
return $fields;
}
|
[
"public",
"function",
"buildQueryInputs",
"(",
"$",
"currentField",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"fields",
"=",
"''",
";",
"foreach",
"(",
"$",
"request",
"->",
"query",
"->",
"all",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"// Exclude the current field and the PAGE parameter",
"if",
"(",
"$",
"field",
"!==",
"$",
"currentField",
"&&",
"$",
"field",
"!==",
"'page'",
")",
"{",
"$",
"fields",
".=",
"sprintf",
"(",
"'<input type=\"hidden\" name=\"%s\" value=\"%s\">'",
",",
"$",
"field",
",",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"fields",
";",
"}"
] |
Build Hidden fields based on the URL parameters
@param $currentField
@return string
|
[
"Build",
"Hidden",
"fields",
"based",
"on",
"the",
"URL",
"parameters"
] |
0bacc1d9e4733b6da613027400c48421e5a14645
|
https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Twig/CoreExtension.php#L130-L142
|
24,762
|
netbull/CoreBundle
|
Twig/CoreExtension.php
|
CoreExtension.inflect
|
public function inflect(string $string, $pluralize = 0) : string
{
return ($pluralize) ? Inflect::pluralize($string) : Inflect::singularize($string);
}
|
php
|
public function inflect(string $string, $pluralize = 0) : string
{
return ($pluralize) ? Inflect::pluralize($string) : Inflect::singularize($string);
}
|
[
"public",
"function",
"inflect",
"(",
"string",
"$",
"string",
",",
"$",
"pluralize",
"=",
"0",
")",
":",
"string",
"{",
"return",
"(",
"$",
"pluralize",
")",
"?",
"Inflect",
"::",
"pluralize",
"(",
"$",
"string",
")",
":",
"Inflect",
"::",
"singularize",
"(",
"$",
"string",
")",
";",
"}"
] |
Pluralize or Singularize a string
@param string $string
@param int $pluralize
@return string
|
[
"Pluralize",
"or",
"Singularize",
"a",
"string"
] |
0bacc1d9e4733b6da613027400c48421e5a14645
|
https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Twig/CoreExtension.php#L205-L208
|
24,763
|
romm/configuration_object
|
Classes/ConfigurationObjectFactory.php
|
ConfigurationObjectFactory.get
|
public function get($className, array $objectData)
{
$this->runningProcesses++;
try {
$result = $this->convertToObject($className, $objectData);
$this->runningProcesses--;
return $result;
} catch (\Exception $exception) {
$this->runningProcesses--;
throw $exception;
}
}
|
php
|
public function get($className, array $objectData)
{
$this->runningProcesses++;
try {
$result = $this->convertToObject($className, $objectData);
$this->runningProcesses--;
return $result;
} catch (\Exception $exception) {
$this->runningProcesses--;
throw $exception;
}
}
|
[
"public",
"function",
"get",
"(",
"$",
"className",
",",
"array",
"$",
"objectData",
")",
"{",
"$",
"this",
"->",
"runningProcesses",
"++",
";",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"convertToObject",
"(",
"$",
"className",
",",
"$",
"objectData",
")",
";",
"$",
"this",
"->",
"runningProcesses",
"--",
";",
"return",
"$",
"result",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"runningProcesses",
"--",
";",
"throw",
"$",
"exception",
";",
"}",
"}"
] |
Returns an instance of the given configuration object name. The object is
recursively filled with the given array data.
@param string $className Name of the configuration object class. The class must implement `\Romm\ConfigurationObject\ConfigurationObjectInterface`.
@param array $objectData Data used to fill the object.
@return ConfigurationObjectInstance
@throws \Exception
|
[
"Returns",
"an",
"instance",
"of",
"the",
"given",
"configuration",
"object",
"name",
".",
"The",
"object",
"is",
"recursively",
"filled",
"with",
"the",
"given",
"array",
"data",
"."
] |
d3a40903386c2e0766bd8279337fe6da45cf5ce3
|
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/ConfigurationObjectFactory.php#L99-L114
|
24,764
|
romm/configuration_object
|
Classes/ConfigurationObjectFactory.php
|
ConfigurationObjectFactory.register
|
protected function register($className)
{
if (false === isset($this->configurationObjectServiceFactory[$className])) {
if (false === Core::get()->classExists($className)) {
throw new ClassNotFoundException(
'Trying to get a non-existing configuration object: "' . $className . '".',
1448886437
);
}
if (false === in_array(ConfigurationObjectInterface::class, class_implements($className))) {
throw new WrongInheritanceException(
'The configuration object class: "' . $className . '" must implement "' . ConfigurationObjectInterface::class . '".',
1448886449
);
}
/** @var ConfigurationObjectInterface $configurationObjectClassName */
$configurationObjectClassName = $className;
$serviceFactory = $configurationObjectClassName::getConfigurationObjectServices();
if (false === $serviceFactory instanceof ServiceFactory) {
throw new WrongServiceException(
'Service factory for configuration object class: "' . $className . '" must be an instance of "' . ServiceFactory::class . '".',
1448886479
);
}
/** @var ServiceFactory $serviceFactory */
$serviceFactory->initialize();
$this->configurationObjectServiceFactory[$className] = $serviceFactory;
}
return $this->configurationObjectServiceFactory[$className];
}
|
php
|
protected function register($className)
{
if (false === isset($this->configurationObjectServiceFactory[$className])) {
if (false === Core::get()->classExists($className)) {
throw new ClassNotFoundException(
'Trying to get a non-existing configuration object: "' . $className . '".',
1448886437
);
}
if (false === in_array(ConfigurationObjectInterface::class, class_implements($className))) {
throw new WrongInheritanceException(
'The configuration object class: "' . $className . '" must implement "' . ConfigurationObjectInterface::class . '".',
1448886449
);
}
/** @var ConfigurationObjectInterface $configurationObjectClassName */
$configurationObjectClassName = $className;
$serviceFactory = $configurationObjectClassName::getConfigurationObjectServices();
if (false === $serviceFactory instanceof ServiceFactory) {
throw new WrongServiceException(
'Service factory for configuration object class: "' . $className . '" must be an instance of "' . ServiceFactory::class . '".',
1448886479
);
}
/** @var ServiceFactory $serviceFactory */
$serviceFactory->initialize();
$this->configurationObjectServiceFactory[$className] = $serviceFactory;
}
return $this->configurationObjectServiceFactory[$className];
}
|
[
"protected",
"function",
"register",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"this",
"->",
"configurationObjectServiceFactory",
"[",
"$",
"className",
"]",
")",
")",
"{",
"if",
"(",
"false",
"===",
"Core",
"::",
"get",
"(",
")",
"->",
"classExists",
"(",
"$",
"className",
")",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"'Trying to get a non-existing configuration object: \"'",
".",
"$",
"className",
".",
"'\".'",
",",
"1448886437",
")",
";",
"}",
"if",
"(",
"false",
"===",
"in_array",
"(",
"ConfigurationObjectInterface",
"::",
"class",
",",
"class_implements",
"(",
"$",
"className",
")",
")",
")",
"{",
"throw",
"new",
"WrongInheritanceException",
"(",
"'The configuration object class: \"'",
".",
"$",
"className",
".",
"'\" must implement \"'",
".",
"ConfigurationObjectInterface",
"::",
"class",
".",
"'\".'",
",",
"1448886449",
")",
";",
"}",
"/** @var ConfigurationObjectInterface $configurationObjectClassName */",
"$",
"configurationObjectClassName",
"=",
"$",
"className",
";",
"$",
"serviceFactory",
"=",
"$",
"configurationObjectClassName",
"::",
"getConfigurationObjectServices",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"serviceFactory",
"instanceof",
"ServiceFactory",
")",
"{",
"throw",
"new",
"WrongServiceException",
"(",
"'Service factory for configuration object class: \"'",
".",
"$",
"className",
".",
"'\" must be an instance of \"'",
".",
"ServiceFactory",
"::",
"class",
".",
"'\".'",
",",
"1448886479",
")",
";",
"}",
"/** @var ServiceFactory $serviceFactory */",
"$",
"serviceFactory",
"->",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"configurationObjectServiceFactory",
"[",
"$",
"className",
"]",
"=",
"$",
"serviceFactory",
";",
"}",
"return",
"$",
"this",
"->",
"configurationObjectServiceFactory",
"[",
"$",
"className",
"]",
";",
"}"
] |
Any configuration object needs to be registered before it can be used.
@param string $className Class name of the wanted configuration object.
@return ServiceFactory
@throws ClassNotFoundException
@throws WrongInheritanceException
@throws WrongServiceException
|
[
"Any",
"configuration",
"object",
"needs",
"to",
"be",
"registered",
"before",
"it",
"can",
"be",
"used",
"."
] |
d3a40903386c2e0766bd8279337fe6da45cf5ce3
|
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/ConfigurationObjectFactory.php#L165-L199
|
24,765
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/Schema/SchemaManager.php
|
SchemaManager.createAllDocumentTables
|
public function createAllDocumentTables()
{
/**
* @var ClassMetadata $class
*/
foreach ($this->metadataFactory->getAllMetadata() as $class) {
if ($class->isMappedSuperclass || $class->isEmbeddedDocument || (count($class->parentClassNames) && $class->inheritanceType == ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE)) {
continue;
}
$this->createDocumentTableFor($class->name);
}
}
|
php
|
public function createAllDocumentTables()
{
/**
* @var ClassMetadata $class
*/
foreach ($this->metadataFactory->getAllMetadata() as $class) {
if ($class->isMappedSuperclass || $class->isEmbeddedDocument || (count($class->parentClassNames) && $class->inheritanceType == ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE)) {
continue;
}
$this->createDocumentTableFor($class->name);
}
}
|
[
"public",
"function",
"createAllDocumentTables",
"(",
")",
"{",
"/**\n * @var ClassMetadata $class\n */",
"foreach",
"(",
"$",
"this",
"->",
"metadataFactory",
"->",
"getAllMetadata",
"(",
")",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"->",
"isMappedSuperclass",
"||",
"$",
"class",
"->",
"isEmbeddedDocument",
"||",
"(",
"count",
"(",
"$",
"class",
"->",
"parentClassNames",
")",
"&&",
"$",
"class",
"->",
"inheritanceType",
"==",
"ClassMetadata",
"::",
"INHERITANCE_TYPE_SINGLE_TABLE",
")",
")",
"{",
"continue",
";",
"}",
"$",
"this",
"->",
"createDocumentTableFor",
"(",
"$",
"class",
"->",
"name",
")",
";",
"}",
"}"
] |
Create all the mapped document tables in the metadata factory.
@return void
|
[
"Create",
"all",
"the",
"mapped",
"document",
"tables",
"in",
"the",
"metadata",
"factory",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/SchemaManager.php#L83-L95
|
24,766
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/Schema/SchemaManager.php
|
SchemaManager.createDocumentTableFor
|
public function createDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
throw ODMException::cannotCreateMappedSuperclassTable($documentName);
}
$this->doCreateTable($class->getTableName(), $class->getDefinitionTable());
}
|
php
|
public function createDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
throw ODMException::cannotCreateMappedSuperclassTable($documentName);
}
$this->doCreateTable($class->getTableName(), $class->getDefinitionTable());
}
|
[
"public",
"function",
"createDocumentTableFor",
"(",
"$",
"documentName",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"$",
"documentName",
")",
";",
"if",
"(",
"$",
"class",
"->",
"isMappedSuperclass",
"||",
"$",
"class",
"->",
"isEmbeddedDocument",
")",
"{",
"throw",
"ODMException",
"::",
"cannotCreateMappedSuperclassTable",
"(",
"$",
"documentName",
")",
";",
"}",
"$",
"this",
"->",
"doCreateTable",
"(",
"$",
"class",
"->",
"getTableName",
"(",
")",
",",
"$",
"class",
"->",
"getDefinitionTable",
"(",
")",
")",
";",
"}"
] |
Checks if the DynamoDB table for a mapped class exists, and if not creates
it.
@param string $documentName
@return void
@throws ODMException
|
[
"Checks",
"if",
"the",
"DynamoDB",
"table",
"for",
"a",
"mapped",
"class",
"exists",
"and",
"if",
"not",
"creates",
"it",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/SchemaManager.php#L143-L152
|
24,767
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/Schema/SchemaManager.php
|
SchemaManager.deleteAllDocumentTables
|
public function deleteAllDocumentTables()
{
foreach ($this->metadataFactory->getAllMetadata() as $class) {
if ($class->isMappedSuperclass || $class->isEmbeddedDocument || (count($class->parentClassNames) && $class->inheritanceType == ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE)) {
continue;
}
$this->deleteDocumentTableFor($class->name);
}
}
|
php
|
public function deleteAllDocumentTables()
{
foreach ($this->metadataFactory->getAllMetadata() as $class) {
if ($class->isMappedSuperclass || $class->isEmbeddedDocument || (count($class->parentClassNames) && $class->inheritanceType == ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE)) {
continue;
}
$this->deleteDocumentTableFor($class->name);
}
}
|
[
"public",
"function",
"deleteAllDocumentTables",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"metadataFactory",
"->",
"getAllMetadata",
"(",
")",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"->",
"isMappedSuperclass",
"||",
"$",
"class",
"->",
"isEmbeddedDocument",
"||",
"(",
"count",
"(",
"$",
"class",
"->",
"parentClassNames",
")",
"&&",
"$",
"class",
"->",
"inheritanceType",
"==",
"ClassMetadata",
"::",
"INHERITANCE_TYPE_SINGLE_TABLE",
")",
")",
"{",
"continue",
";",
"}",
"$",
"this",
"->",
"deleteDocumentTableFor",
"(",
"$",
"class",
"->",
"name",
")",
";",
"}",
"}"
] |
Delete all tables for document classes known to DynamoDM.
@return void
|
[
"Delete",
"all",
"tables",
"for",
"document",
"classes",
"known",
"to",
"DynamoDM",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/SchemaManager.php#L175-L184
|
24,768
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/Schema/SchemaManager.php
|
SchemaManager.deleteDocumentTableFor
|
public function deleteDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
throw ODMException::cannotDeleteMappedSuperclassTable($documentName);
}
$this->doDeleteTable($class->getTableName(), $class->getDefinitionTable());
}
|
php
|
public function deleteDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
throw ODMException::cannotDeleteMappedSuperclassTable($documentName);
}
$this->doDeleteTable($class->getTableName(), $class->getDefinitionTable());
}
|
[
"public",
"function",
"deleteDocumentTableFor",
"(",
"$",
"documentName",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"$",
"documentName",
")",
";",
"if",
"(",
"$",
"class",
"->",
"isMappedSuperclass",
"||",
"$",
"class",
"->",
"isEmbeddedDocument",
")",
"{",
"throw",
"ODMException",
"::",
"cannotDeleteMappedSuperclassTable",
"(",
"$",
"documentName",
")",
";",
"}",
"$",
"this",
"->",
"doDeleteTable",
"(",
"$",
"class",
"->",
"getTableName",
"(",
")",
",",
"$",
"class",
"->",
"getDefinitionTable",
"(",
")",
")",
";",
"}"
] |
Checks if the DynamoDB table for a mapped class exists, and deletes it if
it does.
@param string $documentName
@return void
@throws ODMException
|
[
"Checks",
"if",
"the",
"DynamoDB",
"table",
"for",
"a",
"mapped",
"class",
"exists",
"and",
"deletes",
"it",
"if",
"it",
"does",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/SchemaManager.php#L232-L241
|
24,769
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/Schema/SchemaManager.php
|
SchemaManager.rebuildDocumentTableFor
|
public function rebuildDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
$table = $class->getTableName();
$defintiion = $class->getDefinitionTable();
$this->doDeleteTable($table, $defintiion);
$this->doCreateTable($table, $defintiion);
}
|
php
|
public function rebuildDocumentTableFor($documentName)
{
$class = $this->dm->getClassMetadata($documentName);
$table = $class->getTableName();
$defintiion = $class->getDefinitionTable();
$this->doDeleteTable($table, $defintiion);
$this->doCreateTable($table, $defintiion);
}
|
[
"public",
"function",
"rebuildDocumentTableFor",
"(",
"$",
"documentName",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"$",
"documentName",
")",
";",
"$",
"table",
"=",
"$",
"class",
"->",
"getTableName",
"(",
")",
";",
"$",
"defintiion",
"=",
"$",
"class",
"->",
"getDefinitionTable",
"(",
")",
";",
"$",
"this",
"->",
"doDeleteTable",
"(",
"$",
"table",
",",
"$",
"defintiion",
")",
";",
"$",
"this",
"->",
"doCreateTable",
"(",
"$",
"table",
",",
"$",
"defintiion",
")",
";",
"}"
] |
Deletes and rebuilds the DynamoDB table for a mapped class.
@param string $documentName
@return void
|
[
"Deletes",
"and",
"rebuilds",
"the",
"DynamoDB",
"table",
"for",
"a",
"mapped",
"class",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/SchemaManager.php#L328-L336
|
24,770
|
agentmedia/phine-core
|
src/Core/Modules/Backend/AreaForm.php
|
AreaForm.LayoutCondition
|
private function LayoutCondition()
{
$sql = Access::SqlBuilder();
$tbl = Area::Schema()->Table();
return $sql->Equals($tbl->Field('Layout'), $sql->Value($this->layout->GetID()));
}
|
php
|
private function LayoutCondition()
{
$sql = Access::SqlBuilder();
$tbl = Area::Schema()->Table();
return $sql->Equals($tbl->Field('Layout'), $sql->Value($this->layout->GetID()));
}
|
[
"private",
"function",
"LayoutCondition",
"(",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tbl",
"=",
"Area",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"return",
"$",
"sql",
"->",
"Equals",
"(",
"$",
"tbl",
"->",
"Field",
"(",
"'Layout'",
")",
",",
"$",
"sql",
"->",
"Value",
"(",
"$",
"this",
"->",
"layout",
"->",
"GetID",
"(",
")",
")",
")",
";",
"}"
] |
Gets the layout condition for the name validator
@return \Phine\Framework\Database\Sql\Condition
|
[
"Gets",
"the",
"layout",
"condition",
"for",
"the",
"name",
"validator"
] |
38c1be8d03ebffae950d00a96da3c612aff67832
|
https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/AreaForm.php#L89-L94
|
24,771
|
picturae/php-composition-utils
|
src/WithEvents.php
|
WithEvents.subscribe
|
public function subscribe($eventType, $callback)
{
$callback = $this->makeEventCallback($callback);
if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
$this->eventList[$eventType] = [];
}
array_push($this->eventList[$eventType], $callback);
return $callback['id'];
}
|
php
|
public function subscribe($eventType, $callback)
{
$callback = $this->makeEventCallback($callback);
if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
$this->eventList[$eventType] = [];
}
array_push($this->eventList[$eventType], $callback);
return $callback['id'];
}
|
[
"public",
"function",
"subscribe",
"(",
"$",
"eventType",
",",
"$",
"callback",
")",
"{",
"$",
"callback",
"=",
"$",
"this",
"->",
"makeEventCallback",
"(",
"$",
"callback",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
"=",
"[",
"]",
";",
"}",
"array_push",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
",",
"$",
"callback",
")",
";",
"return",
"$",
"callback",
"[",
"'id'",
"]",
";",
"}"
] |
Add a callback on a specific backend event.
@param string $eventType - Use constants(add your own if needed)
@param callable $callback - Execution callback.
@return string|null
|
[
"Add",
"a",
"callback",
"on",
"a",
"specific",
"backend",
"event",
"."
] |
59a8191066c27687daabc8c5b33addb3599826ab
|
https://github.com/picturae/php-composition-utils/blob/59a8191066c27687daabc8c5b33addb3599826ab/src/WithEvents.php#L29-L37
|
24,772
|
picturae/php-composition-utils
|
src/WithEvents.php
|
WithEvents.unsubscribe
|
public function unsubscribe($eventType, $callbackId)
{
$success = false;
if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
$this->eventList[$eventType] = array_filter(
$this->eventList[$eventType],
function ($cb) use ($callbackId) {
return $cb['id'] !== $callbackId;
}
);
$success = true;
}
return $success;
}
|
php
|
public function unsubscribe($eventType, $callbackId)
{
$success = false;
if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
$this->eventList[$eventType] = array_filter(
$this->eventList[$eventType],
function ($cb) use ($callbackId) {
return $cb['id'] !== $callbackId;
}
);
$success = true;
}
return $success;
}
|
[
"public",
"function",
"unsubscribe",
"(",
"$",
"eventType",
",",
"$",
"callbackId",
")",
"{",
"$",
"success",
"=",
"false",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
")",
")",
"{",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"eventList",
"[",
"$",
"eventType",
"]",
",",
"function",
"(",
"$",
"cb",
")",
"use",
"(",
"$",
"callbackId",
")",
"{",
"return",
"$",
"cb",
"[",
"'id'",
"]",
"!==",
"$",
"callbackId",
";",
"}",
")",
";",
"$",
"success",
"=",
"true",
";",
"}",
"return",
"$",
"success",
";",
"}"
] |
Remove callback by identifier.
@param string
@param string
|
[
"Remove",
"callback",
"by",
"identifier",
"."
] |
59a8191066c27687daabc8c5b33addb3599826ab
|
https://github.com/picturae/php-composition-utils/blob/59a8191066c27687daabc8c5b33addb3599826ab/src/WithEvents.php#L44-L57
|
24,773
|
dann95/ts3-php
|
TeamSpeak3/Node/Servergroup.php
|
Servergroup.permAssign
|
public function permAssign($permid, $permvalue, $permnegated = false, $permskip = false)
{
return $this->getParent()->serverGroupPermAssign($this->getId(), $permid, $permvalue, $permnegated, $permskip);
}
|
php
|
public function permAssign($permid, $permvalue, $permnegated = false, $permskip = false)
{
return $this->getParent()->serverGroupPermAssign($this->getId(), $permid, $permvalue, $permnegated, $permskip);
}
|
[
"public",
"function",
"permAssign",
"(",
"$",
"permid",
",",
"$",
"permvalue",
",",
"$",
"permnegated",
"=",
"false",
",",
"$",
"permskip",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"getParent",
"(",
")",
"->",
"serverGroupPermAssign",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"$",
"permid",
",",
"$",
"permvalue",
",",
"$",
"permnegated",
",",
"$",
"permskip",
")",
";",
"}"
] |
Adds a set of specified permissions to the server group. Multiple permissions
can be added by providing the four parameters of each permission in separate arrays.
@param integer $permid
@param integer $permvalue
@param bool|int $permnegated
@param bool|int $permskip
@return void
|
[
"Adds",
"a",
"set",
"of",
"specified",
"permissions",
"to",
"the",
"server",
"group",
".",
"Multiple",
"permissions",
"can",
"be",
"added",
"by",
"providing",
"the",
"four",
"parameters",
"of",
"each",
"permission",
"in",
"separate",
"arrays",
"."
] |
d4693d78b54be0177a2b5fab316c0ff9d036238d
|
https://github.com/dann95/ts3-php/blob/d4693d78b54be0177a2b5fab316c0ff9d036238d/TeamSpeak3/Node/Servergroup.php#L120-L123
|
24,774
|
praxigento/mobi_mod_downline
|
Helper/Tree.php
|
Tree.getParentId
|
private function getParentId($item, $key)
{
if (is_array($item)) {
$result = $item[$key];
} elseif ($item instanceof \Praxigento\Core\Data) {
$result = $item->get($key);
} else {
$result = $item;
}
return $result;
}
|
php
|
private function getParentId($item, $key)
{
if (is_array($item)) {
$result = $item[$key];
} elseif ($item instanceof \Praxigento\Core\Data) {
$result = $item->get($key);
} else {
$result = $item;
}
return $result;
}
|
[
"private",
"function",
"getParentId",
"(",
"$",
"item",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"{",
"$",
"result",
"=",
"$",
"item",
"[",
"$",
"key",
"]",
";",
"}",
"elseif",
"(",
"$",
"item",
"instanceof",
"\\",
"Praxigento",
"\\",
"Core",
"\\",
"Data",
")",
"{",
"$",
"result",
"=",
"$",
"item",
"->",
"get",
"(",
"$",
"key",
")",
";",
"}",
"else",
"{",
"$",
"result",
"=",
"$",
"item",
";",
"}",
"return",
"$",
"result",
";",
"}"
] |
Get Parent ID from entry. Entry can be integer, array or Data Object.
@param int|array|\Praxigento\Core\Data $item
@param string $key
@return int
|
[
"Get",
"Parent",
"ID",
"from",
"entry",
".",
"Entry",
"can",
"be",
"integer",
"array",
"or",
"Data",
"Object",
"."
] |
0f3c276dfff1aa029f9fd205ccfc56f207a2e75b
|
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Helper/Tree.php#L102-L112
|
24,775
|
Wedeto/Log
|
src/Writer/AbstractWriter.php
|
AbstractWriter.isLevelEnabled
|
public function isLevelEnabled(string $level, int $level_num = null)
{
if ($level_num === null)
$level_num = Logger::getLevelNumeric($level);
return $level_num >= $this->min_level;
}
|
php
|
public function isLevelEnabled(string $level, int $level_num = null)
{
if ($level_num === null)
$level_num = Logger::getLevelNumeric($level);
return $level_num >= $this->min_level;
}
|
[
"public",
"function",
"isLevelEnabled",
"(",
"string",
"$",
"level",
",",
"int",
"$",
"level_num",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"level_num",
"===",
"null",
")",
"$",
"level_num",
"=",
"Logger",
"::",
"getLevelNumeric",
"(",
"$",
"level",
")",
";",
"return",
"$",
"level_num",
">=",
"$",
"this",
"->",
"min_level",
";",
"}"
] |
Return if a message of a specific level would be accepted
@param string $level The LogLevel
@param int $level_num The level as int, with 0 being DEBUG and 8 being EMERGENCY. When omitted,
it is obtained from Logger.
@return bool True if a message with this level would be accepted, false it it would be dropped.
|
[
"Return",
"if",
"a",
"message",
"of",
"a",
"specific",
"level",
"would",
"be",
"accepted"
] |
88252c5052089fdcc5dae466d1ad5889bb2b735f
|
https://github.com/Wedeto/Log/blob/88252c5052089fdcc5dae466d1ad5889bb2b735f/src/Writer/AbstractWriter.php#L71-L76
|
24,776
|
Stinger-Soft/DoctrineCommons
|
src/StingerSoft/DoctrineCommons/Utils/DoctrineFunctions.php
|
DoctrineFunctions.getAllMetadata
|
protected function getAllMetadata($managerName = null) {
if(!$this->allMetadata) {
$this->allMetadata = $this->registry->getManager($managerName)->getMetadataFactory()->getAllMetadata();
}
return $this->allMetadata;
}
|
php
|
protected function getAllMetadata($managerName = null) {
if(!$this->allMetadata) {
$this->allMetadata = $this->registry->getManager($managerName)->getMetadataFactory()->getAllMetadata();
}
return $this->allMetadata;
}
|
[
"protected",
"function",
"getAllMetadata",
"(",
"$",
"managerName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"allMetadata",
")",
"{",
"$",
"this",
"->",
"allMetadata",
"=",
"$",
"this",
"->",
"registry",
"->",
"getManager",
"(",
"$",
"managerName",
")",
"->",
"getMetadataFactory",
"(",
")",
"->",
"getAllMetadata",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"allMetadata",
";",
"}"
] |
Returns all management class metadata
@return ClassMetadata[]
|
[
"Returns",
"all",
"management",
"class",
"metadata"
] |
1f0dd56a94654c8de63927d7eec2175aab3cf809
|
https://github.com/Stinger-Soft/DoctrineCommons/blob/1f0dd56a94654c8de63927d7eec2175aab3cf809/src/StingerSoft/DoctrineCommons/Utils/DoctrineFunctions.php#L226-L231
|
24,777
|
KDF5000/EasyThink
|
src/ThinkPHP/Library/Think/Upload/Driver/Bcs/requestcore.php
|
BCS_RequestCore.isBaeEnv
|
private function isBaeEnv() {
if (isset ( $_SERVER ['HTTP_HOST'] )) {
$host = $_SERVER ['HTTP_HOST'];
$pos = strpos ( $host, '.' );
if ($pos !== false) {
$substr = substr ( $host, $pos + 1 );
if ($substr == 'duapp.com') {
return true;
}
}
}
if (isset ( $_SERVER ["HTTP_BAE_LOGID"] )) {
return true;
}
return false;
}
|
php
|
private function isBaeEnv() {
if (isset ( $_SERVER ['HTTP_HOST'] )) {
$host = $_SERVER ['HTTP_HOST'];
$pos = strpos ( $host, '.' );
if ($pos !== false) {
$substr = substr ( $host, $pos + 1 );
if ($substr == 'duapp.com') {
return true;
}
}
}
if (isset ( $_SERVER ["HTTP_BAE_LOGID"] )) {
return true;
}
return false;
}
|
[
"private",
"function",
"isBaeEnv",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_HOST'",
"]",
")",
")",
"{",
"$",
"host",
"=",
"$",
"_SERVER",
"[",
"'HTTP_HOST'",
"]",
";",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"host",
",",
"'.'",
")",
";",
"if",
"(",
"$",
"pos",
"!==",
"false",
")",
"{",
"$",
"substr",
"=",
"substr",
"(",
"$",
"host",
",",
"$",
"pos",
"+",
"1",
")",
";",
"if",
"(",
"$",
"substr",
"==",
"'duapp.com'",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"\"HTTP_BAE_LOGID\"",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
is the environment BAE?
@return boolean the result of the answer
|
[
"is",
"the",
"environment",
"BAE?"
] |
86efc9c8a0d504e01e2fea55868227fdc8928841
|
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Upload/Driver/Bcs/requestcore.php#L590-L606
|
24,778
|
werx/core
|
src/Config.php
|
Config.getEnvironment
|
public function getEnvironment()
{
$environment_file = $this->resolvePath('config/environment');
if (file_exists($environment_file)) {
$environment = trim(file_get_contents($environment_file));
} else {
$environment = 'local';
}
return $environment;
}
|
php
|
public function getEnvironment()
{
$environment_file = $this->resolvePath('config/environment');
if (file_exists($environment_file)) {
$environment = trim(file_get_contents($environment_file));
} else {
$environment = 'local';
}
return $environment;
}
|
[
"public",
"function",
"getEnvironment",
"(",
")",
"{",
"$",
"environment_file",
"=",
"$",
"this",
"->",
"resolvePath",
"(",
"'config/environment'",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"environment_file",
")",
")",
"{",
"$",
"environment",
"=",
"trim",
"(",
"file_get_contents",
"(",
"$",
"environment_file",
")",
")",
";",
"}",
"else",
"{",
"$",
"environment",
"=",
"'local'",
";",
"}",
"return",
"$",
"environment",
";",
"}"
] |
What environment are we running in? Local? Development? Production?
@return string
|
[
"What",
"environment",
"are",
"we",
"running",
"in?",
"Local?",
"Development?",
"Production?"
] |
9ab7a9f7a8c02e1d41ca40301afada8129ea0a79
|
https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Config.php#L58-L69
|
24,779
|
werx/core
|
src/Config.php
|
Config.getBaseUrl
|
public function getBaseUrl($include_script_name = false)
{
$this->config->load('config');
$base_url = $this->config->get('base_url');
if (empty($base_url)) {
// No base_url defined in the config. Work it out based on server name.
// This won't work if the app is running behind a proxied URL.
$protocol = 'http://';
if (array_key_exists('HTTPS', $_SERVER) && strtolower($_SERVER['HTTPS']) == 'on') {
$protocol = 'https://';
}
$base_url = $protocol . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']);
}
$base_url = rtrim($base_url, '/') . '/';
if ($include_script_name) {
# http://example.com/path/to/app/index.php
return $base_url . basename($_SERVER['SCRIPT_NAME']);
} else {
# http://example.com/path/to/app/
return $base_url;
}
}
|
php
|
public function getBaseUrl($include_script_name = false)
{
$this->config->load('config');
$base_url = $this->config->get('base_url');
if (empty($base_url)) {
// No base_url defined in the config. Work it out based on server name.
// This won't work if the app is running behind a proxied URL.
$protocol = 'http://';
if (array_key_exists('HTTPS', $_SERVER) && strtolower($_SERVER['HTTPS']) == 'on') {
$protocol = 'https://';
}
$base_url = $protocol . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']);
}
$base_url = rtrim($base_url, '/') . '/';
if ($include_script_name) {
# http://example.com/path/to/app/index.php
return $base_url . basename($_SERVER['SCRIPT_NAME']);
} else {
# http://example.com/path/to/app/
return $base_url;
}
}
|
[
"public",
"function",
"getBaseUrl",
"(",
"$",
"include_script_name",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"load",
"(",
"'config'",
")",
";",
"$",
"base_url",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'base_url'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"base_url",
")",
")",
"{",
"// No base_url defined in the config. Work it out based on server name.",
"// This won't work if the app is running behind a proxied URL.",
"$",
"protocol",
"=",
"'http://'",
";",
"if",
"(",
"array_key_exists",
"(",
"'HTTPS'",
",",
"$",
"_SERVER",
")",
"&&",
"strtolower",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
"==",
"'on'",
")",
"{",
"$",
"protocol",
"=",
"'https://'",
";",
"}",
"$",
"base_url",
"=",
"$",
"protocol",
".",
"$",
"_SERVER",
"[",
"'SERVER_NAME'",
"]",
".",
"dirname",
"(",
"$",
"_SERVER",
"[",
"'SCRIPT_NAME'",
"]",
")",
";",
"}",
"$",
"base_url",
"=",
"rtrim",
"(",
"$",
"base_url",
",",
"'/'",
")",
".",
"'/'",
";",
"if",
"(",
"$",
"include_script_name",
")",
"{",
"# http://example.com/path/to/app/index.php",
"return",
"$",
"base_url",
".",
"basename",
"(",
"$",
"_SERVER",
"[",
"'SCRIPT_NAME'",
"]",
")",
";",
"}",
"else",
"{",
"# http://example.com/path/to/app/",
"return",
"$",
"base_url",
";",
"}",
"}"
] |
Get the the base url of our app
@param bool $include_script_name Should we include the filename (index.php)?
@return null|string The full URL to our app.
|
[
"Get",
"the",
"the",
"base",
"url",
"of",
"our",
"app"
] |
9ab7a9f7a8c02e1d41ca40301afada8129ea0a79
|
https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Config.php#L77-L103
|
24,780
|
opensourcerefinery/vicus
|
src/Provider/EnvironmentServiceProvider.php
|
EnvironmentServiceProvider.determine
|
private function determine()
{
if (false !== $this->filepath && true === is_readable($this->filepath . '/' . $this->filename)) {
return strtolower(trim(file_get_contents($this->filepath . '/' . $this->filename)));
} elseif (null !== getenv($this->variable)) {
return getenv($this->variable);
} else {
return false;
}
}
|
php
|
private function determine()
{
if (false !== $this->filepath && true === is_readable($this->filepath . '/' . $this->filename)) {
return strtolower(trim(file_get_contents($this->filepath . '/' . $this->filename)));
} elseif (null !== getenv($this->variable)) {
return getenv($this->variable);
} else {
return false;
}
}
|
[
"private",
"function",
"determine",
"(",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"this",
"->",
"filepath",
"&&",
"true",
"===",
"is_readable",
"(",
"$",
"this",
"->",
"filepath",
".",
"'/'",
".",
"$",
"this",
"->",
"filename",
")",
")",
"{",
"return",
"strtolower",
"(",
"trim",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"filepath",
".",
"'/'",
".",
"$",
"this",
"->",
"filename",
")",
")",
")",
";",
"}",
"elseif",
"(",
"null",
"!==",
"getenv",
"(",
"$",
"this",
"->",
"variable",
")",
")",
"{",
"return",
"getenv",
"(",
"$",
"this",
"->",
"variable",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Dertermines the runtime environment by checking for a file or an
environment variable containing the applications runtime environment
name. If both checks fail it will return false.
@return string|bool
|
[
"Dertermines",
"the",
"runtime",
"environment",
"by",
"checking",
"for",
"a",
"file",
"or",
"an",
"environment",
"variable",
"containing",
"the",
"applications",
"runtime",
"environment",
"name",
".",
"If",
"both",
"checks",
"fail",
"it",
"will",
"return",
"false",
"."
] |
5be93d75bf6ab8009a299e9946c8333f0017fa3e
|
https://github.com/opensourcerefinery/vicus/blob/5be93d75bf6ab8009a299e9946c8333f0017fa3e/src/Provider/EnvironmentServiceProvider.php#L86-L96
|
24,781
|
netgen/site-legacy-bundle
|
bundle/Composer/ScriptHandler.php
|
ScriptHandler.installLegacySymlinks
|
public static function installLegacySymlinks(Event $event): void
{
$options = static::getOptions($event);
$consoleDir = static::getConsoleDir($event, 'install legacy symlinks');
static::executeCommand($event, $consoleDir, 'ngsite:symlink:legacy', $options['process-timeout']);
}
|
php
|
public static function installLegacySymlinks(Event $event): void
{
$options = static::getOptions($event);
$consoleDir = static::getConsoleDir($event, 'install legacy symlinks');
static::executeCommand($event, $consoleDir, 'ngsite:symlink:legacy', $options['process-timeout']);
}
|
[
"public",
"static",
"function",
"installLegacySymlinks",
"(",
"Event",
"$",
"event",
")",
":",
"void",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
"$",
"event",
")",
";",
"$",
"consoleDir",
"=",
"static",
"::",
"getConsoleDir",
"(",
"$",
"event",
",",
"'install legacy symlinks'",
")",
";",
"static",
"::",
"executeCommand",
"(",
"$",
"event",
",",
"$",
"consoleDir",
",",
"'ngsite:symlink:legacy'",
",",
"$",
"options",
"[",
"'process-timeout'",
"]",
")",
";",
"}"
] |
Symlinks legacy siteaccesses and various other legacy files to their proper locations.
|
[
"Symlinks",
"legacy",
"siteaccesses",
"and",
"various",
"other",
"legacy",
"files",
"to",
"their",
"proper",
"locations",
"."
] |
943224cdee28cfb9ef07854c11c91d060456b394
|
https://github.com/netgen/site-legacy-bundle/blob/943224cdee28cfb9ef07854c11c91d060456b394/bundle/Composer/ScriptHandler.php#L15-L21
|
24,782
|
Retentio/Boomgo
|
src/Boomgo/Mapper/MapperProvider.php
|
MapperProvider.createInstance
|
protected function createInstance(\ReflectionClass $reflectedClass)
{
$constructor = $reflectedClass->getConstructor();
if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) {
throw new \RuntimeException('Unable to hydrate an object requiring constructor param');
}
return $reflectedClass->newInstance();
}
|
php
|
protected function createInstance(\ReflectionClass $reflectedClass)
{
$constructor = $reflectedClass->getConstructor();
if ($constructor && $constructor->getNumberOfRequiredParameters() > 0) {
throw new \RuntimeException('Unable to hydrate an object requiring constructor param');
}
return $reflectedClass->newInstance();
}
|
[
"protected",
"function",
"createInstance",
"(",
"\\",
"ReflectionClass",
"$",
"reflectedClass",
")",
"{",
"$",
"constructor",
"=",
"$",
"reflectedClass",
"->",
"getConstructor",
"(",
")",
";",
"if",
"(",
"$",
"constructor",
"&&",
"$",
"constructor",
"->",
"getNumberOfRequiredParameters",
"(",
")",
">",
"0",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Unable to hydrate an object requiring constructor param'",
")",
";",
"}",
"return",
"$",
"reflectedClass",
"->",
"newInstance",
"(",
")",
";",
"}"
] |
Create an instance from a Reflected class
@param ReflectionClass $reflectedClass
@throws RuntimeException If constructor requires parameter
@return mixed
|
[
"Create",
"an",
"instance",
"from",
"a",
"Reflected",
"class"
] |
95cc53777425dd76cd0034046fa4f9e72c04d73a
|
https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Mapper/MapperProvider.php#L33-L42
|
24,783
|
Retentio/Boomgo
|
src/Boomgo/Mapper/MapperProvider.php
|
MapperProvider.normalize
|
protected function normalize($data)
{
if (null === $data || is_scalar($data)) {
return $data;
}
if (is_array($data)) {
foreach ($data as $key => $val) {
$data[$key] = $this->normalize($val);
}
return $data;
}
throw new \RuntimeException('An unexpected value could not be normalized: '.var_export($data, true));
}
|
php
|
protected function normalize($data)
{
if (null === $data || is_scalar($data)) {
return $data;
}
if (is_array($data)) {
foreach ($data as $key => $val) {
$data[$key] = $this->normalize($val);
}
return $data;
}
throw new \RuntimeException('An unexpected value could not be normalized: '.var_export($data, true));
}
|
[
"protected",
"function",
"normalize",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"data",
"||",
"is_scalar",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"normalize",
"(",
"$",
"val",
")",
";",
"}",
"return",
"$",
"data",
";",
"}",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'An unexpected value could not be normalized: '",
".",
"var_export",
"(",
"$",
"data",
",",
"true",
")",
")",
";",
"}"
] |
Normalize php data for mongo
This code chunk was inspired by the Symfony framework
and is subject to the MIT license. Please see the LICENCE
at https://github.com/symfony/symfony
(c) Fabien Potencier <fabien@symfony.com>
Author Nils Adermann <naderman@naderman.de>
@param mixed $data
@return mixed
|
[
"Normalize",
"php",
"data",
"for",
"mongo"
] |
95cc53777425dd76cd0034046fa4f9e72c04d73a
|
https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Mapper/MapperProvider.php#L58-L73
|
24,784
|
Retentio/Boomgo
|
src/Boomgo/Mapper/MapperProvider.php
|
MapperProvider.serializeEmbeddedCollection
|
protected function serializeEmbeddedCollection(MapperInterface $mapper, array $collection)
{
$data = array();
foreach ($collection as $object) {
$data[] = $mapper->serialize($object);
}
return $data;
}
|
php
|
protected function serializeEmbeddedCollection(MapperInterface $mapper, array $collection)
{
$data = array();
foreach ($collection as $object) {
$data[] = $mapper->serialize($object);
}
return $data;
}
|
[
"protected",
"function",
"serializeEmbeddedCollection",
"(",
"MapperInterface",
"$",
"mapper",
",",
"array",
"$",
"collection",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"object",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"$",
"mapper",
"->",
"serialize",
"(",
"$",
"object",
")",
";",
"}",
"return",
"$",
"data",
";",
"}"
] |
Serialize an embedded collection
Return a collection of hydrated objects
@param MapperInterface $mapper
@param array $collection
@return array
|
[
"Serialize",
"an",
"embedded",
"collection"
] |
95cc53777425dd76cd0034046fa4f9e72c04d73a
|
https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Mapper/MapperProvider.php#L85-L93
|
24,785
|
Retentio/Boomgo
|
src/Boomgo/Mapper/MapperProvider.php
|
MapperProvider.unserializeEmbeddedCollection
|
protected function unserializeEmbeddedCollection(MapperInterface $mapper, array $data)
{
$collection = array();
foreach ($data as $document) {
$collection[] = $mapper->unserialize($document);
}
return $collection;
}
|
php
|
protected function unserializeEmbeddedCollection(MapperInterface $mapper, array $data)
{
$collection = array();
foreach ($data as $document) {
$collection[] = $mapper->unserialize($document);
}
return $collection;
}
|
[
"protected",
"function",
"unserializeEmbeddedCollection",
"(",
"MapperInterface",
"$",
"mapper",
",",
"array",
"$",
"data",
")",
"{",
"$",
"collection",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"document",
")",
"{",
"$",
"collection",
"[",
"]",
"=",
"$",
"mapper",
"->",
"unserialize",
"(",
"$",
"document",
")",
";",
"}",
"return",
"$",
"collection",
";",
"}"
] |
Unserialize an embedded collection
Return a collection of serialized objects (arrays)
@param MapperInterface $mapper
@param array $data
@return array
|
[
"Unserialize",
"an",
"embedded",
"collection"
] |
95cc53777425dd76cd0034046fa4f9e72c04d73a
|
https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Mapper/MapperProvider.php#L105-L113
|
24,786
|
MBHFramework/mbh-rest
|
Mbh/DefaultServicesProvider.php
|
DefaultServicesProvider.register
|
public function register(ContainerInterface $container)
{
if (! isset($container['session'])) {
$container['session'] = function (ContainerInterface $container) {
return new Session;
};
}
if (! isset($container['router'])) {
/**
* This service MUST return a SHARED instance
* of Mbh\Interfaces\RouterInterface.
*
* @param Container $container
* @return RouterInterface
*/
$container['router'] = function (ContainerInterface $container) {
$routerCacheFile = false;
if (isset($container->get('settings')['routerCacheFile'])) {
$routerCacheFile = $container->get('settings')['routerCacheFile'];
}
$router = (new Router)->setCacheFile($routerCacheFile);
if (method_exists($router, 'setContainer')) {
$router->setContainer($container);
}
if (method_exists($router, 'setCallableResolver')) {
$router->setCallableResolver($container['callableResolver']);
}
return $router;
};
}
}
|
php
|
public function register(ContainerInterface $container)
{
if (! isset($container['session'])) {
$container['session'] = function (ContainerInterface $container) {
return new Session;
};
}
if (! isset($container['router'])) {
/**
* This service MUST return a SHARED instance
* of Mbh\Interfaces\RouterInterface.
*
* @param Container $container
* @return RouterInterface
*/
$container['router'] = function (ContainerInterface $container) {
$routerCacheFile = false;
if (isset($container->get('settings')['routerCacheFile'])) {
$routerCacheFile = $container->get('settings')['routerCacheFile'];
}
$router = (new Router)->setCacheFile($routerCacheFile);
if (method_exists($router, 'setContainer')) {
$router->setContainer($container);
}
if (method_exists($router, 'setCallableResolver')) {
$router->setCallableResolver($container['callableResolver']);
}
return $router;
};
}
}
|
[
"public",
"function",
"register",
"(",
"ContainerInterface",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"container",
"[",
"'session'",
"]",
")",
")",
"{",
"$",
"container",
"[",
"'session'",
"]",
"=",
"function",
"(",
"ContainerInterface",
"$",
"container",
")",
"{",
"return",
"new",
"Session",
";",
"}",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"container",
"[",
"'router'",
"]",
")",
")",
"{",
"/**\n * This service MUST return a SHARED instance\n * of Mbh\\Interfaces\\RouterInterface.\n *\n * @param Container $container\n * @return RouterInterface\n */",
"$",
"container",
"[",
"'router'",
"]",
"=",
"function",
"(",
"ContainerInterface",
"$",
"container",
")",
"{",
"$",
"routerCacheFile",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"container",
"->",
"get",
"(",
"'settings'",
")",
"[",
"'routerCacheFile'",
"]",
")",
")",
"{",
"$",
"routerCacheFile",
"=",
"$",
"container",
"->",
"get",
"(",
"'settings'",
")",
"[",
"'routerCacheFile'",
"]",
";",
"}",
"$",
"router",
"=",
"(",
"new",
"Router",
")",
"->",
"setCacheFile",
"(",
"$",
"routerCacheFile",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"router",
",",
"'setContainer'",
")",
")",
"{",
"$",
"router",
"->",
"setContainer",
"(",
"$",
"container",
")",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"router",
",",
"'setCallableResolver'",
")",
")",
"{",
"$",
"router",
"->",
"setCallableResolver",
"(",
"$",
"container",
"[",
"'callableResolver'",
"]",
")",
";",
"}",
"return",
"$",
"router",
";",
"}",
";",
"}",
"}"
] |
Register Mbh's default services.
@param Container $container A DI container implementing ArrayAccess and container-interop.
|
[
"Register",
"Mbh",
"s",
"default",
"services",
"."
] |
e23b4e66dc2b8da35e06312dcfdba41c4cfc2c83
|
https://github.com/MBHFramework/mbh-rest/blob/e23b4e66dc2b8da35e06312dcfdba41c4cfc2c83/Mbh/DefaultServicesProvider.php#L28-L62
|
24,787
|
agentmedia/phine-core
|
src/Core/Modules/Backend/ModuleForm.php
|
ModuleForm.AddModuleTypeOption
|
private function AddModuleTypeOption(Select $select, $type)
{
if ($type != 'BuiltIn-Container' ||
(!Request::GetData('container') && Container::Schema()->Count() > 0))
{
$select->AddOption($type, Trans($type));
}
}
|
php
|
private function AddModuleTypeOption(Select $select, $type)
{
if ($type != 'BuiltIn-Container' ||
(!Request::GetData('container') && Container::Schema()->Count() > 0))
{
$select->AddOption($type, Trans($type));
}
}
|
[
"private",
"function",
"AddModuleTypeOption",
"(",
"Select",
"$",
"select",
",",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"!=",
"'BuiltIn-Container'",
"||",
"(",
"!",
"Request",
"::",
"GetData",
"(",
"'container'",
")",
"&&",
"Container",
"::",
"Schema",
"(",
")",
"->",
"Count",
"(",
")",
">",
"0",
")",
")",
"{",
"$",
"select",
"->",
"AddOption",
"(",
"$",
"type",
",",
"Trans",
"(",
"$",
"type",
")",
")",
";",
"}",
"}"
] |
Adds the module type option, if allowed
@param Select $select The select box
@param string $type The module type
|
[
"Adds",
"the",
"module",
"type",
"option",
"if",
"allowed"
] |
38c1be8d03ebffae950d00a96da3c612aff67832
|
https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/ModuleForm.php#L52-L59
|
24,788
|
TiMESPLiNTER/tsFramework
|
src/ch/timesplinter/logger/Logger.php
|
Logger.warn
|
public function warn($msg) {
$this->mailMessage(self::LEVEL_WARN, $msg);
if($this->checkLevel($this->loglevels, self::LEVEL_WARN) !== true)
return;
$this->writeMessage(self::LEVEL_WARN, $msg);
}
|
php
|
public function warn($msg) {
$this->mailMessage(self::LEVEL_WARN, $msg);
if($this->checkLevel($this->loglevels, self::LEVEL_WARN) !== true)
return;
$this->writeMessage(self::LEVEL_WARN, $msg);
}
|
[
"public",
"function",
"warn",
"(",
"$",
"msg",
")",
"{",
"$",
"this",
"->",
"mailMessage",
"(",
"self",
"::",
"LEVEL_WARN",
",",
"$",
"msg",
")",
";",
"if",
"(",
"$",
"this",
"->",
"checkLevel",
"(",
"$",
"this",
"->",
"loglevels",
",",
"self",
"::",
"LEVEL_WARN",
")",
"!==",
"true",
")",
"return",
";",
"$",
"this",
"->",
"writeMessage",
"(",
"self",
"::",
"LEVEL_WARN",
",",
"$",
"msg",
")",
";",
"}"
] |
Logs a warning
@param type $msg
|
[
"Logs",
"a",
"warning"
] |
b3b9fd98f6d456a9e571015877ecca203786fd0c
|
https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/logger/Logger.php#L101-L108
|
24,789
|
TiMESPLiNTER/tsFramework
|
src/ch/timesplinter/logger/Logger.php
|
Logger.info
|
public function info($msg) {
$this->mailMessage(self::LEVEL_INFO, $msg);
if($this->checkLevel($this->loglevels, self::LEVEL_INFO) !== true)
return;
$this->writeMessage(self::LEVEL_INFO, $msg);
}
|
php
|
public function info($msg) {
$this->mailMessage(self::LEVEL_INFO, $msg);
if($this->checkLevel($this->loglevels, self::LEVEL_INFO) !== true)
return;
$this->writeMessage(self::LEVEL_INFO, $msg);
}
|
[
"public",
"function",
"info",
"(",
"$",
"msg",
")",
"{",
"$",
"this",
"->",
"mailMessage",
"(",
"self",
"::",
"LEVEL_INFO",
",",
"$",
"msg",
")",
";",
"if",
"(",
"$",
"this",
"->",
"checkLevel",
"(",
"$",
"this",
"->",
"loglevels",
",",
"self",
"::",
"LEVEL_INFO",
")",
"!==",
"true",
")",
"return",
";",
"$",
"this",
"->",
"writeMessage",
"(",
"self",
"::",
"LEVEL_INFO",
",",
"$",
"msg",
")",
";",
"}"
] |
Logs an information
@param string $msg
@return type
|
[
"Logs",
"an",
"information"
] |
b3b9fd98f6d456a9e571015877ecca203786fd0c
|
https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/logger/Logger.php#L115-L122
|
24,790
|
phpffcms/ffcms-core
|
src/Traits/ClassTools.php
|
ClassTools.createStringClassSnapshotHash
|
public function createStringClassSnapshotHash()
{
$hash = null;
foreach ($this as $property => $value) {
$hash = md5($hash . $property . '=' . $value);
}
return $hash;
}
|
php
|
public function createStringClassSnapshotHash()
{
$hash = null;
foreach ($this as $property => $value) {
$hash = md5($hash . $property . '=' . $value);
}
return $hash;
}
|
[
"public",
"function",
"createStringClassSnapshotHash",
"(",
")",
"{",
"$",
"hash",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"$",
"hash",
".",
"$",
"property",
".",
"'='",
".",
"$",
"value",
")",
";",
"}",
"return",
"$",
"hash",
";",
"}"
] |
Create hash string from current class properties and itself values.
This method is good stuff for caching dynamic instances
@return string|null
|
[
"Create",
"hash",
"string",
"from",
"current",
"class",
"properties",
"and",
"itself",
"values",
".",
"This",
"method",
"is",
"good",
"stuff",
"for",
"caching",
"dynamic",
"instances"
] |
44a309553ef9f115ccfcfd71f2ac6e381c612082
|
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Traits/ClassTools.php#L16-L23
|
24,791
|
phpffcms/ffcms-core
|
src/Traits/ClassTools.php
|
ClassTools.getMethodRequiredArgCount
|
public function getMethodRequiredArgCount($class, string $method): int
{
$instance = new \ReflectionMethod($class, $method);
$count = 0;
// calculate method defined arguments count
foreach ($instance->getParameters() as $arg) {
if (!$arg->isOptional()) {
$count++;
}
}
return $count;
}
|
php
|
public function getMethodRequiredArgCount($class, string $method): int
{
$instance = new \ReflectionMethod($class, $method);
$count = 0;
// calculate method defined arguments count
foreach ($instance->getParameters() as $arg) {
if (!$arg->isOptional()) {
$count++;
}
}
return $count;
}
|
[
"public",
"function",
"getMethodRequiredArgCount",
"(",
"$",
"class",
",",
"string",
"$",
"method",
")",
":",
"int",
"{",
"$",
"instance",
"=",
"new",
"\\",
"ReflectionMethod",
"(",
"$",
"class",
",",
"$",
"method",
")",
";",
"$",
"count",
"=",
"0",
";",
"// calculate method defined arguments count",
"foreach",
"(",
"$",
"instance",
"->",
"getParameters",
"(",
")",
"as",
"$",
"arg",
")",
"{",
"if",
"(",
"!",
"$",
"arg",
"->",
"isOptional",
"(",
")",
")",
"{",
"$",
"count",
"++",
";",
"}",
"}",
"return",
"$",
"count",
";",
"}"
] |
Get method required arguments count
@param $class
@param string $method
@return int
|
[
"Get",
"method",
"required",
"arguments",
"count"
] |
44a309553ef9f115ccfcfd71f2ac6e381c612082
|
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Traits/ClassTools.php#L31-L43
|
24,792
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/DocumentManager.php
|
DocumentManager.contains
|
public function contains($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
return $this->unitOfWork->isScheduledForInsert($document) ||
$this->unitOfWork->isInIdentityMap($document) &&
!$this->unitOfWork->isScheduledForDelete($document);
}
|
php
|
public function contains($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
return $this->unitOfWork->isScheduledForInsert($document) ||
$this->unitOfWork->isInIdentityMap($document) &&
!$this->unitOfWork->isScheduledForDelete($document);
}
|
[
"public",
"function",
"contains",
"(",
"$",
"document",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"document",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"gettype",
"(",
"$",
"document",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"unitOfWork",
"->",
"isScheduledForInsert",
"(",
"$",
"document",
")",
"||",
"$",
"this",
"->",
"unitOfWork",
"->",
"isInIdentityMap",
"(",
"$",
"document",
")",
"&&",
"!",
"$",
"this",
"->",
"unitOfWork",
"->",
"isScheduledForDelete",
"(",
"$",
"document",
")",
";",
"}"
] |
Determines whether a document instance is managed in this DocumentManager.
@param object $document
@throws \InvalidArgumentException When the $document param is not an object
@return bool TRUE if this DocumentManager currently manages the given document, FALSE otherwise.
|
[
"Determines",
"whether",
"a",
"document",
"instance",
"is",
"managed",
"in",
"this",
"DocumentManager",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/DocumentManager.php#L207-L216
|
24,793
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/DocumentManager.php
|
DocumentManager.getFilterCollection
|
public function getFilterCollection()
{
if (null === $this->filterCollection) {
$this->filterCollection = new Filter\FilterCollection($this);
}
return $this->filterCollection;
}
|
php
|
public function getFilterCollection()
{
if (null === $this->filterCollection) {
$this->filterCollection = new Filter\FilterCollection($this);
}
return $this->filterCollection;
}
|
[
"public",
"function",
"getFilterCollection",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"filterCollection",
")",
"{",
"$",
"this",
"->",
"filterCollection",
"=",
"new",
"Filter",
"\\",
"FilterCollection",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"filterCollection",
";",
"}"
] |
Gets the filter collection.
@return Filter\FilterCollection The active filter collection.
|
[
"Gets",
"the",
"filter",
"collection",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/DocumentManager.php#L356-L363
|
24,794
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/DocumentManager.php
|
DocumentManager.persist
|
public function persist($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->persist($document);
}
|
php
|
public function persist($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->persist($document);
}
|
[
"public",
"function",
"persist",
"(",
"$",
"document",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"document",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"gettype",
"(",
"$",
"document",
")",
")",
";",
"}",
"$",
"this",
"->",
"errorIfClosed",
"(",
")",
";",
"$",
"this",
"->",
"unitOfWork",
"->",
"persist",
"(",
"$",
"document",
")",
";",
"}"
] |
Tells the DocumentManager to make an instance managed and persistent.
The document will be entered into the database at or before transaction
commit or as a result of the flush operation.
NOTE: The persist operation always considers documents that are not yet known to
this DocumentManager as NEW. Do not pass detached documents to the persist operation.
@param object $document The instance to make managed and persistent.
@throws \InvalidArgumentException When the given $document param is not an object
|
[
"Tells",
"the",
"DocumentManager",
"to",
"make",
"an",
"instance",
"managed",
"and",
"persistent",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/DocumentManager.php#L500-L507
|
24,795
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/DocumentManager.php
|
DocumentManager.refresh
|
public function refresh($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->refresh($document);
}
|
php
|
public function refresh($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->refresh($document);
}
|
[
"public",
"function",
"refresh",
"(",
"$",
"document",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"document",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"gettype",
"(",
"$",
"document",
")",
")",
";",
"}",
"$",
"this",
"->",
"errorIfClosed",
"(",
")",
";",
"$",
"this",
"->",
"unitOfWork",
"->",
"refresh",
"(",
"$",
"document",
")",
";",
"}"
] |
Refreshes the persistent state of a document from the database,
overriding any local changes that have not yet been persisted.
@param object $document The document to refresh.
@throws \InvalidArgumentException When the given $document param is not an object
|
[
"Refreshes",
"the",
"persistent",
"state",
"of",
"a",
"document",
"from",
"the",
"database",
"overriding",
"any",
"local",
"changes",
"that",
"have",
"not",
"yet",
"been",
"persisted",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/DocumentManager.php#L517-L524
|
24,796
|
cloudtek/dynamodm
|
lib/Cloudtek/DynamoDM/DocumentManager.php
|
DocumentManager.remove
|
public function remove($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->remove($document);
}
|
php
|
public function remove($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->remove($document);
}
|
[
"public",
"function",
"remove",
"(",
"$",
"document",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"document",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"gettype",
"(",
"$",
"document",
")",
")",
";",
"}",
"$",
"this",
"->",
"errorIfClosed",
"(",
")",
";",
"$",
"this",
"->",
"unitOfWork",
"->",
"remove",
"(",
"$",
"document",
")",
";",
"}"
] |
Removes a document instance.
A removed document will be removed from the database at or before transaction commit
or as a result of the flush operation.
@param object $document The document instance to remove.
@throws \InvalidArgumentException when the $document param is not an object
|
[
"Removes",
"a",
"document",
"instance",
"."
] |
119d355e2c5cbaef1f867970349b4432f5704fcd
|
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/DocumentManager.php#L536-L543
|
24,797
|
jenskooij/cloudcontrol
|
src/storage/storage/BricksStorage.php
|
BricksStorage.addBrick
|
public function addBrick($postValues)
{
$brickObject = BrickFactory::createBrickFromPostValues($postValues);
$bricks = $this->repository->bricks;
$bricks[] = $brickObject;
$this->repository->bricks = $bricks;
$this->save();
}
|
php
|
public function addBrick($postValues)
{
$brickObject = BrickFactory::createBrickFromPostValues($postValues);
$bricks = $this->repository->bricks;
$bricks[] = $brickObject;
$this->repository->bricks = $bricks;
$this->save();
}
|
[
"public",
"function",
"addBrick",
"(",
"$",
"postValues",
")",
"{",
"$",
"brickObject",
"=",
"BrickFactory",
"::",
"createBrickFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"bricks",
"=",
"$",
"this",
"->",
"repository",
"->",
"bricks",
";",
"$",
"bricks",
"[",
"]",
"=",
"$",
"brickObject",
";",
"$",
"this",
"->",
"repository",
"->",
"bricks",
"=",
"$",
"bricks",
";",
"$",
"this",
"->",
"save",
"(",
")",
";",
"}"
] |
Add a brick
@param $postValues
@throws \Exception
|
[
"Add",
"a",
"brick"
] |
76e5d9ac8f9c50d06d39a995d13cc03742536548
|
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/BricksStorage.php#L28-L37
|
24,798
|
jenskooij/cloudcontrol
|
src/storage/storage/BricksStorage.php
|
BricksStorage.getBrickBySlug
|
public function getBrickBySlug($slug)
{
$bricks = $this->repository->bricks;
foreach ($bricks as $brick) {
if ($brick->slug == $slug) {
return $brick;
}
}
return null;
}
|
php
|
public function getBrickBySlug($slug)
{
$bricks = $this->repository->bricks;
foreach ($bricks as $brick) {
if ($brick->slug == $slug) {
return $brick;
}
}
return null;
}
|
[
"public",
"function",
"getBrickBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"bricks",
"=",
"$",
"this",
"->",
"repository",
"->",
"bricks",
";",
"foreach",
"(",
"$",
"bricks",
"as",
"$",
"brick",
")",
"{",
"if",
"(",
"$",
"brick",
"->",
"slug",
"==",
"$",
"slug",
")",
"{",
"return",
"$",
"brick",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get a brick by its slug
@param $slug
@return \stdClass
|
[
"Get",
"a",
"brick",
"by",
"its",
"slug"
] |
76e5d9ac8f9c50d06d39a995d13cc03742536548
|
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/BricksStorage.php#L46-L56
|
24,799
|
jenskooij/cloudcontrol
|
src/storage/storage/BricksStorage.php
|
BricksStorage.saveBrick
|
public function saveBrick($slug, $postValues)
{
$brickObject = BrickFactory::createBrickFromPostValues($postValues);
$bricks = $this->repository->bricks;
foreach ($bricks as $key => $brick) {
if ($brick->slug == $slug) {
$bricks[$key] = $brickObject;
}
}
$this->repository->bricks = $bricks;
$this->save();
}
|
php
|
public function saveBrick($slug, $postValues)
{
$brickObject = BrickFactory::createBrickFromPostValues($postValues);
$bricks = $this->repository->bricks;
foreach ($bricks as $key => $brick) {
if ($brick->slug == $slug) {
$bricks[$key] = $brickObject;
}
}
$this->repository->bricks = $bricks;
$this->save();
}
|
[
"public",
"function",
"saveBrick",
"(",
"$",
"slug",
",",
"$",
"postValues",
")",
"{",
"$",
"brickObject",
"=",
"BrickFactory",
"::",
"createBrickFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"bricks",
"=",
"$",
"this",
"->",
"repository",
"->",
"bricks",
";",
"foreach",
"(",
"$",
"bricks",
"as",
"$",
"key",
"=>",
"$",
"brick",
")",
"{",
"if",
"(",
"$",
"brick",
"->",
"slug",
"==",
"$",
"slug",
")",
"{",
"$",
"bricks",
"[",
"$",
"key",
"]",
"=",
"$",
"brickObject",
";",
"}",
"}",
"$",
"this",
"->",
"repository",
"->",
"bricks",
"=",
"$",
"bricks",
";",
"$",
"this",
"->",
"save",
"(",
")",
";",
"}"
] |
Save changes to a brick
@param $slug
@param $postValues
@throws \Exception
|
[
"Save",
"changes",
"to",
"a",
"brick"
] |
76e5d9ac8f9c50d06d39a995d13cc03742536548
|
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/BricksStorage.php#L66-L78
|
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.