repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getStringBetween | public static function getStringBetween($str, $start, $end)
{
$str = ' ' . $str;
$ini = strpos($str, $start);
if ($ini == 0) {
return '';
}
$ini += strlen($start);
$len = strpos($str, $end, $ini) - $ini;
return substr($str, $ini, $len);
} | php | public static function getStringBetween($str, $start, $end)
{
$str = ' ' . $str;
$ini = strpos($str, $start);
if ($ini == 0) {
return '';
}
$ini += strlen($start);
$len = strpos($str, $end, $ini) - $ini;
return substr($str, $ini, $len);
} | [
"public",
"static",
"function",
"getStringBetween",
"(",
"$",
"str",
",",
"$",
"start",
",",
"$",
"end",
")",
"{",
"$",
"str",
"=",
"' '",
".",
"$",
"str",
";",
"$",
"ini",
"=",
"strpos",
"(",
"$",
"str",
",",
"$",
"start",
")",
";",
"if",
"(",... | Extracts a substring between 2 marks
@param string $str The target string
@param string $start The initial mark
@param string $end The end mark
@return string A substring or an empty string if is not able to find the marks
or if there is no string between the marks | [
"Extracts",
"a",
"substring",
"between",
"2",
"marks"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L275-L287 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.redirect | public static function redirect($url, $parameters = array(), $stay = false)
{
assert('is_string($url)');
assert('is_array($parameters)');
if (substr($url, 0, 1) === '/') {
$url = self::getSelfURLhost() . $url;
}
/**
* Verify that the URL matches the reg... | php | public static function redirect($url, $parameters = array(), $stay = false)
{
assert('is_string($url)');
assert('is_array($parameters)');
if (substr($url, 0, 1) === '/') {
$url = self::getSelfURLhost() . $url;
}
/**
* Verify that the URL matches the reg... | [
"public",
"static",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"stay",
"=",
"false",
")",
"{",
"assert",
"(",
"'is_string($url)'",
")",
";",
"assert",
"(",
"'is_array($parameters)'",
")",
";",
"if",... | Executes a redirection to the provided url (or return the target url).
@param string $url The target url
@param array $parameters Extra parameters to be passed as part of the url
@param bool $stay True if we want to stay (returns the url string) False to redirect
@return string|null ... | [
"Executes",
"a",
"redirection",
"to",
"the",
"provided",
"url",
"(",
"or",
"return",
"the",
"target",
"url",
")",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L300-L358 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getSelfURLhost | public static function getSelfURLhost()
{
$currenthost = self::getSelfHost();
$port = '';
if (self::isHTTPS()) {
$protocol = 'https';
} else {
$protocol = 'http';
}
$portnumber = self::getSelfPort();
if (isset($portnumber) && ($port... | php | public static function getSelfURLhost()
{
$currenthost = self::getSelfHost();
$port = '';
if (self::isHTTPS()) {
$protocol = 'https';
} else {
$protocol = 'http';
}
$portnumber = self::getSelfPort();
if (isset($portnumber) && ($port... | [
"public",
"static",
"function",
"getSelfURLhost",
"(",
")",
"{",
"$",
"currenthost",
"=",
"self",
"::",
"getSelfHost",
"(",
")",
";",
"$",
"port",
"=",
"''",
";",
"if",
"(",
"self",
"::",
"isHTTPS",
"(",
")",
")",
"{",
"$",
"protocol",
"=",
"'https'"... | Returns the protocol + the current host + the port (if different than
common ports).
@return string $url | [
"Returns",
"the",
"protocol",
"+",
"the",
"current",
"host",
"+",
"the",
"port",
"(",
"if",
"different",
"than",
"common",
"ports",
")",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L432-L451 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getSelfHost | public static function getSelfHost()
{
$currentHost = self::getRawHost();
// strip the port
if (false !== strpos($currentHost, ':')) {
list($currentHost, $port) = explode(':', $currentHost, 2);
}
return $currentHost;
} | php | public static function getSelfHost()
{
$currentHost = self::getRawHost();
// strip the port
if (false !== strpos($currentHost, ':')) {
list($currentHost, $port) = explode(':', $currentHost, 2);
}
return $currentHost;
} | [
"public",
"static",
"function",
"getSelfHost",
"(",
")",
"{",
"$",
"currentHost",
"=",
"self",
"::",
"getRawHost",
"(",
")",
";",
"// strip the port",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"currentHost",
",",
"':'",
")",
")",
"{",
"list",
"(",
... | Returns the current host.
@return string $currentHost The current host | [
"Returns",
"the",
"current",
"host",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L545-L555 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getSelfURLNoQuery | public static function getSelfURLNoQuery()
{
$selfURLNoQuery = self::getSelfURLhost();
$infoWithBaseURLPath = self::buildWithBaseURLPath($_SERVER['SCRIPT_NAME']);
if (!empty($infoWithBaseURLPath)) {
$selfURLNoQuery .= $infoWithBaseURLPath;
} else {
$selfURLNo... | php | public static function getSelfURLNoQuery()
{
$selfURLNoQuery = self::getSelfURLhost();
$infoWithBaseURLPath = self::buildWithBaseURLPath($_SERVER['SCRIPT_NAME']);
if (!empty($infoWithBaseURLPath)) {
$selfURLNoQuery .= $infoWithBaseURLPath;
} else {
$selfURLNo... | [
"public",
"static",
"function",
"getSelfURLNoQuery",
"(",
")",
"{",
"$",
"selfURLNoQuery",
"=",
"self",
"::",
"getSelfURLhost",
"(",
")",
";",
"$",
"infoWithBaseURLPath",
"=",
"self",
"::",
"buildWithBaseURLPath",
"(",
"$",
"_SERVER",
"[",
"'SCRIPT_NAME'",
"]",
... | Returns the URL of the current host + current view.
@return string | [
"Returns",
"the",
"URL",
"of",
"the",
"current",
"host",
"+",
"current",
"view",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L598-L614 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getSelfRoutedURLNoQuery | public static function getSelfRoutedURLNoQuery()
{
$selfURLhost = self::getSelfURLhost();
$route = '';
if (!empty($_SERVER['REQUEST_URI'])) {
$route = $_SERVER['REQUEST_URI'];
if (!empty($_SERVER['QUERY_STRING'])) {
$route = str_replace($_SERVER['QUER... | php | public static function getSelfRoutedURLNoQuery()
{
$selfURLhost = self::getSelfURLhost();
$route = '';
if (!empty($_SERVER['REQUEST_URI'])) {
$route = $_SERVER['REQUEST_URI'];
if (!empty($_SERVER['QUERY_STRING'])) {
$route = str_replace($_SERVER['QUER... | [
"public",
"static",
"function",
"getSelfRoutedURLNoQuery",
"(",
")",
"{",
"$",
"selfURLhost",
"=",
"self",
"::",
"getSelfURLhost",
"(",
")",
";",
"$",
"route",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
... | Returns the routed URL of the current host + current view.
@return string | [
"Returns",
"the",
"routed",
"URL",
"of",
"the",
"current",
"host",
"+",
"current",
"view",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L621-L643 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.buildWithBaseURLPath | protected static function buildWithBaseURLPath($info)
{
$result = '';
$baseURLPath = self::getBaseURLPath();
if (!empty($baseURLPath)) {
$result = $baseURLPath;
if (!empty($info)) {
$path = explode('/', $info);
$extractedInfo = array_po... | php | protected static function buildWithBaseURLPath($info)
{
$result = '';
$baseURLPath = self::getBaseURLPath();
if (!empty($baseURLPath)) {
$result = $baseURLPath;
if (!empty($info)) {
$path = explode('/', $info);
$extractedInfo = array_po... | [
"protected",
"static",
"function",
"buildWithBaseURLPath",
"(",
"$",
"info",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"baseURLPath",
"=",
"self",
"::",
"getBaseURLPath",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"baseURLPath",
")",
")",
"{... | Returns the part of the URL with the BaseURLPath.
@param $info
@return string | [
"Returns",
"the",
"part",
"of",
"the",
"URL",
"with",
"the",
"BaseURLPath",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L677-L692 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.extractOriginalQueryParam | public static function extractOriginalQueryParam($name)
{
$index = strpos($_SERVER['QUERY_STRING'], $name.'=');
$substring = substr($_SERVER['QUERY_STRING'], $index + strlen($name) + 1);
$end = strpos($substring, '&');
return $end ? substr($substring, 0, strpos($substring, '&')) : $s... | php | public static function extractOriginalQueryParam($name)
{
$index = strpos($_SERVER['QUERY_STRING'], $name.'=');
$substring = substr($_SERVER['QUERY_STRING'], $index + strlen($name) + 1);
$end = strpos($substring, '&');
return $end ? substr($substring, 0, strpos($substring, '&')) : $s... | [
"public",
"static",
"function",
"extractOriginalQueryParam",
"(",
"$",
"name",
")",
"{",
"$",
"index",
"=",
"strpos",
"(",
"$",
"_SERVER",
"[",
"'QUERY_STRING'",
"]",
",",
"$",
"name",
".",
"'='",
")",
";",
"$",
"substring",
"=",
"substr",
"(",
"$",
"_... | Extract a query param - as it was sent - from $_SERVER[QUERY_STRING]
@param string $name The param to-be extracted
@return string | [
"Extract",
"a",
"query",
"param",
"-",
"as",
"it",
"was",
"sent",
"-",
"from",
"$_SERVER",
"[",
"QUERY_STRING",
"]"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L701-L707 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.parseSAML2Time | public static function parseSAML2Time($time)
{
$matches = array();
/* We use a very strict regex to parse the timestamp. */
$exp1 = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)';
$exp2 = 'T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D';
if (preg_match($exp1 . $exp2, $time, $matches) == ... | php | public static function parseSAML2Time($time)
{
$matches = array();
/* We use a very strict regex to parse the timestamp. */
$exp1 = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)';
$exp2 = 'T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D';
if (preg_match($exp1 . $exp2, $time, $matches) == ... | [
"public",
"static",
"function",
"parseSAML2Time",
"(",
"$",
"time",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"/* We use a very strict regex to parse the timestamp. */",
"$",
"exp1",
"=",
"'/^(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d)-(\\\\d\\\\d)'",
";",
"$",
"ex... | Converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(\.s+)?Z
to a UNIX timestamp. The sub-second part is ignored.
@param string $time The time we should convert (SAML Timestamp).
@return int $timestamp Converted to a unix timestamp.
@throws Exception | [
"Converts",
"a",
"SAML2",
"timestamp",
"on",
"the",
"form",
"yyyy",
"-",
"mm",
"-",
"ddThh",
":",
"mm",
":",
"ss",
"(",
"\\",
".",
"s",
"+",
")",
"?Z",
"to",
"a",
"UNIX",
"timestamp",
".",
"The",
"sub",
"-",
"second",
"part",
"is",
"ignored",
"."... | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L744-L775 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getExpireTime | public static function getExpireTime($cacheDuration = null, $validUntil = null)
{
$expireTime = null;
if ($cacheDuration !== null) {
$expireTime = self::parseDuration($cacheDuration, time());
}
if ($validUntil !== null) {
if (is_int($validUntil)) {
... | php | public static function getExpireTime($cacheDuration = null, $validUntil = null)
{
$expireTime = null;
if ($cacheDuration !== null) {
$expireTime = self::parseDuration($cacheDuration, time());
}
if ($validUntil !== null) {
if (is_int($validUntil)) {
... | [
"public",
"static",
"function",
"getExpireTime",
"(",
"$",
"cacheDuration",
"=",
"null",
",",
"$",
"validUntil",
"=",
"null",
")",
"{",
"$",
"expireTime",
"=",
"null",
";",
"if",
"(",
"$",
"cacheDuration",
"!==",
"null",
")",
"{",
"$",
"expireTime",
"=",... | Compares 2 dates and returns the earliest.
@param string|null $cacheDuration The duration, as a string.
@param string|int|null $validUntil The valid until date, as a string or as a timestamp
@return int|null $expireTime The expiration time.
@throws Exception | [
"Compares",
"2",
"dates",
"and",
"returns",
"the",
"earliest",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L876-L896 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.query | public static function query($dom, $query, $context = null)
{
$xpath = new DOMXPath($dom);
$xpath->registerNamespace('samlp', OneLogin_Saml2_Constants::NS_SAMLP);
$xpath->registerNamespace('saml', OneLogin_Saml2_Constants::NS_SAML);
$xpath->registerNamespace('ds', OneLogin_Saml2_Cons... | php | public static function query($dom, $query, $context = null)
{
$xpath = new DOMXPath($dom);
$xpath->registerNamespace('samlp', OneLogin_Saml2_Constants::NS_SAMLP);
$xpath->registerNamespace('saml', OneLogin_Saml2_Constants::NS_SAML);
$xpath->registerNamespace('ds', OneLogin_Saml2_Cons... | [
"public",
"static",
"function",
"query",
"(",
"$",
"dom",
",",
"$",
"query",
",",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"xpath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"$",
"xpath",
"->",
"registerNamespace",
"(",
"'samlp'",
",",
... | Extracts nodes from the DOMDocument.
@param DOMDocument $dom The DOMDocument
@param string $query Xpath Expresion
@param DomElement|null $context Context Node (DomElement)
@return DOMNodeList The queried nodes | [
"Extracts",
"nodes",
"from",
"the",
"DOMDocument",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L908-L925 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.calculateX509Fingerprint | public static function calculateX509Fingerprint($x509cert, $alg = 'sha1')
{
assert('is_string($x509cert)');
$arCert = explode("\n", $x509cert);
$data = '';
$inData = false;
foreach ($arCert as $curData) {
if (! $inData) {
if (strncmp($curData, '-... | php | public static function calculateX509Fingerprint($x509cert, $alg = 'sha1')
{
assert('is_string($x509cert)');
$arCert = explode("\n", $x509cert);
$data = '';
$inData = false;
foreach ($arCert as $curData) {
if (! $inData) {
if (strncmp($curData, '-... | [
"public",
"static",
"function",
"calculateX509Fingerprint",
"(",
"$",
"x509cert",
",",
"$",
"alg",
"=",
"'sha1'",
")",
"{",
"assert",
"(",
"'is_string($x509cert)'",
")",
";",
"$",
"arCert",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"x509cert",
")",
";",
"$... | Calculates the fingerprint of a x509cert.
@param string $x509cert x509 cert
@param string $alg
@return null|string Formatted fingerprint | [
"Calculates",
"the",
"fingerprint",
"of",
"a",
"x509cert",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L962-L1004 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.generateNameId | public static function generateNameId($value, $spnq, $format = null, $cert = null, $nq = null)
{
$doc = new DOMDocument();
$nameId = $doc->createElement('saml:NameID');
if (isset($spnq)) {
$nameId->setAttribute('SPNameQualifier', $spnq);
}
if (isset($nq)) {
... | php | public static function generateNameId($value, $spnq, $format = null, $cert = null, $nq = null)
{
$doc = new DOMDocument();
$nameId = $doc->createElement('saml:NameID');
if (isset($spnq)) {
$nameId->setAttribute('SPNameQualifier', $spnq);
}
if (isset($nq)) {
... | [
"public",
"static",
"function",
"generateNameId",
"(",
"$",
"value",
",",
"$",
"spnq",
",",
"$",
"format",
"=",
"null",
",",
"$",
"cert",
"=",
"null",
",",
"$",
"nq",
"=",
"null",
")",
"{",
"$",
"doc",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$... | Generates a nameID.
@param string $value fingerprint
@param string $spnq SP Name Qualifier
@param string|null $format SP Format
@param string|null $cert IdP Public cert to encrypt the nameID
@param string|null $nq IdP Name Qualifier
@return string $nameIDElement DOMElement | XMLSec nameID
@throws Exception | [
"Generates",
"a",
"nameID",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1033-L1078 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.getStatus | public static function getStatus($dom)
{
$status = array();
$statusEntry = self::query($dom, '/samlp:Response/samlp:Status');
if ($statusEntry->length != 1) {
throw new OneLogin_Saml2_ValidationError(
"Missing Status on response",
OneLogin_Saml2_V... | php | public static function getStatus($dom)
{
$status = array();
$statusEntry = self::query($dom, '/samlp:Response/samlp:Status');
if ($statusEntry->length != 1) {
throw new OneLogin_Saml2_ValidationError(
"Missing Status on response",
OneLogin_Saml2_V... | [
"public",
"static",
"function",
"getStatus",
"(",
"$",
"dom",
")",
"{",
"$",
"status",
"=",
"array",
"(",
")",
";",
"$",
"statusEntry",
"=",
"self",
"::",
"query",
"(",
"$",
"dom",
",",
"'/samlp:Response/samlp:Status'",
")",
";",
"if",
"(",
"$",
"statu... | Gets Status from a Response.
@param DOMDocument $dom The Response as XML
@return array $status The Status, an array with the code and a message.
@throws OneLogin_Saml2_ValidationError | [
"Gets",
"Status",
"from",
"a",
"Response",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1090-L1125 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.isSupportedSigningAlgorithm | public static function isSupportedSigningAlgorithm($algorithm)
{
return in_array(
$algorithm,
array(
XMLSecurityKey::RSA_1_5,
XMLSecurityKey::RSA_SHA1,
XMLSecurityKey::RSA_SHA256,
XMLSecurityKey::RSA_SHA384,
... | php | public static function isSupportedSigningAlgorithm($algorithm)
{
return in_array(
$algorithm,
array(
XMLSecurityKey::RSA_1_5,
XMLSecurityKey::RSA_SHA1,
XMLSecurityKey::RSA_SHA256,
XMLSecurityKey::RSA_SHA384,
... | [
"public",
"static",
"function",
"isSupportedSigningAlgorithm",
"(",
"$",
"algorithm",
")",
"{",
"return",
"in_array",
"(",
"$",
"algorithm",
",",
"array",
"(",
"XMLSecurityKey",
"::",
"RSA_1_5",
",",
"XMLSecurityKey",
"::",
"RSA_SHA1",
",",
"XMLSecurityKey",
"::",... | @param $algorithm
@return bool | [
"@param",
"$algorithm"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1287-L1299 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.addSign | public static function addSign($xml, $key, $cert, $signAlgorithm = XMLSecurityKey::RSA_SHA1, $digestAlgorithm = XMLSecurityDSig::SHA1)
{
if ($xml instanceof DOMDocument) {
$dom = $xml;
} else {
$dom = new DOMDocument();
$dom = self::loadXML($dom, $xml);
... | php | public static function addSign($xml, $key, $cert, $signAlgorithm = XMLSecurityKey::RSA_SHA1, $digestAlgorithm = XMLSecurityDSig::SHA1)
{
if ($xml instanceof DOMDocument) {
$dom = $xml;
} else {
$dom = new DOMDocument();
$dom = self::loadXML($dom, $xml);
... | [
"public",
"static",
"function",
"addSign",
"(",
"$",
"xml",
",",
"$",
"key",
",",
"$",
"cert",
",",
"$",
"signAlgorithm",
"=",
"XMLSecurityKey",
"::",
"RSA_SHA1",
",",
"$",
"digestAlgorithm",
"=",
"XMLSecurityDSig",
"::",
"SHA1",
")",
"{",
"if",
"(",
"$"... | Adds signature key and senders certificate to an element (Message or Assertion).
@param string|DomDocument $xml The element we should sign
@param string $key The private key
@param string $cert The public
@param string $signAlgorithm Signature algorithm ... | [
"Adds",
"signature",
"key",
"and",
"senders",
"certificate",
"to",
"an",
"element",
"(",
"Message",
"or",
"Assertion",
")",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1314-L1365 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.validateSign | public static function validateSign($xml, $cert = null, $fingerprint = null, $fingerprintalg = 'sha1', $xpath = null, $multiCerts = null)
{
if ($xml instanceof DOMDocument) {
$dom = clone $xml;
} else if ($xml instanceof DOMElement) {
$dom = clone $xml->ownerDocument;
... | php | public static function validateSign($xml, $cert = null, $fingerprint = null, $fingerprintalg = 'sha1', $xpath = null, $multiCerts = null)
{
if ($xml instanceof DOMDocument) {
$dom = clone $xml;
} else if ($xml instanceof DOMElement) {
$dom = clone $xml->ownerDocument;
... | [
"public",
"static",
"function",
"validateSign",
"(",
"$",
"xml",
",",
"$",
"cert",
"=",
"null",
",",
"$",
"fingerprint",
"=",
"null",
",",
"$",
"fingerprintalg",
"=",
"'sha1'",
",",
"$",
"xpath",
"=",
"null",
",",
"$",
"multiCerts",
"=",
"null",
")",
... | Validates a signature (Message or Assertion).
@param string|DomNode $xml The element we should validate
@param string|null $cert The pubic cert
@param string|null $fingerprint The fingerprint of the public cert
@param string|null $fingerprintalg The algorithm used to get the fingerprin... | [
"Validates",
"a",
"signature",
"(",
"Message",
"or",
"Assertion",
")",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1381-L1461 |
onelogin/php-saml | lib/Saml2/Utils.php | OneLogin_Saml2_Utils.validateBinarySign | public static function validateBinarySign($messageType, $getData, $idpData, $retrieveParametersFromServer = false)
{
if (!isset($getData['SigAlg'])) {
$signAlg = XMLSecurityKey::RSA_SHA1;
} else {
$signAlg = $getData['SigAlg'];
}
if ($retrieveParametersFromSe... | php | public static function validateBinarySign($messageType, $getData, $idpData, $retrieveParametersFromServer = false)
{
if (!isset($getData['SigAlg'])) {
$signAlg = XMLSecurityKey::RSA_SHA1;
} else {
$signAlg = $getData['SigAlg'];
}
if ($retrieveParametersFromSe... | [
"public",
"static",
"function",
"validateBinarySign",
"(",
"$",
"messageType",
",",
"$",
"getData",
",",
"$",
"idpData",
",",
"$",
"retrieveParametersFromServer",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"getData",
"[",
"'SigAlg'",
"]",
"... | Validates a binary signature
@param string $messageType Type of SAML Message
@param array $getData HTTP GET array
@param array $idpData IdP setting data
@param bool $retrieveParametersFromServer Indicates where to get the values in order to validat... | [
"Validates",
"a",
"binary",
"signature"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Utils.php#L1475-L1541 |
onelogin/php-saml | lib/Saml2/Metadata.php | OneLogin_Saml2_Metadata.builder | public static function builder($sp, $authnsign = false, $wsign = false, $validUntil = null, $cacheDuration = null, $contacts = array(), $organization = array(), $attributes = array())
{
if (!isset($validUntil)) {
$validUntil = time() + self::TIME_VALID;
}
$validUntilTime = gmd... | php | public static function builder($sp, $authnsign = false, $wsign = false, $validUntil = null, $cacheDuration = null, $contacts = array(), $organization = array(), $attributes = array())
{
if (!isset($validUntil)) {
$validUntil = time() + self::TIME_VALID;
}
$validUntilTime = gmd... | [
"public",
"static",
"function",
"builder",
"(",
"$",
"sp",
",",
"$",
"authnsign",
"=",
"false",
",",
"$",
"wsign",
"=",
"false",
",",
"$",
"validUntil",
"=",
"null",
",",
"$",
"cacheDuration",
"=",
"null",
",",
"$",
"contacts",
"=",
"array",
"(",
")"... | Generates the metadata of the SP based on the settings
@param array $sp The SP data
@param bool|string $authnsign authnRequestsSigned attribute
@param bool|string $wsign wantAssertionsSigned attribute
@param DateTime|null $validUntil Metadata's valid time
@param int|null $cac... | [
"Generates",
"the",
"metadata",
"of",
"the",
"SP",
"based",
"on",
"the",
"settings"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Metadata.php#L27-L172 |
onelogin/php-saml | lib/Saml2/Metadata.php | OneLogin_Saml2_Metadata.signMetadata | public static function signMetadata($metadata, $key, $cert, $signAlgorithm = XMLSecurityKey::RSA_SHA1, $digestAlgorithm = XMLSecurityDSig::SHA1)
{
return OneLogin_Saml2_Utils::addSign($metadata, $key, $cert, $signAlgorithm, $digestAlgorithm);
} | php | public static function signMetadata($metadata, $key, $cert, $signAlgorithm = XMLSecurityKey::RSA_SHA1, $digestAlgorithm = XMLSecurityDSig::SHA1)
{
return OneLogin_Saml2_Utils::addSign($metadata, $key, $cert, $signAlgorithm, $digestAlgorithm);
} | [
"public",
"static",
"function",
"signMetadata",
"(",
"$",
"metadata",
",",
"$",
"key",
",",
"$",
"cert",
",",
"$",
"signAlgorithm",
"=",
"XMLSecurityKey",
"::",
"RSA_SHA1",
",",
"$",
"digestAlgorithm",
"=",
"XMLSecurityDSig",
"::",
"SHA1",
")",
"{",
"return"... | Signs the metadata with the key/cert provided
@param string $metadata SAML Metadata XML
@param string $key x509 key
@param string $cert x509 cert
@param string $signAlgorithm Signature algorithm method
@param string $digestAlgorithm Digest algorithm method
@return string Signed Metadata
@throws Exception | [
"Signs",
"the",
"metadata",
"with",
"the",
"key",
"/",
"cert",
"provided"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Metadata.php#L187-L190 |
onelogin/php-saml | lib/Saml2/Metadata.php | OneLogin_Saml2_Metadata.addX509KeyDescriptors | public static function addX509KeyDescriptors($metadata, $cert, $wantsEncrypted = true)
{
$xml = new DOMDocument();
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
try {
$xml = OneLogin_Saml2_Utils::loadXML($xml, $metadata);
if (!$xml) {
... | php | public static function addX509KeyDescriptors($metadata, $cert, $wantsEncrypted = true)
{
$xml = new DOMDocument();
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
try {
$xml = OneLogin_Saml2_Utils::loadXML($xml, $metadata);
if (!$xml) {
... | [
"public",
"static",
"function",
"addX509KeyDescriptors",
"(",
"$",
"metadata",
",",
"$",
"cert",
",",
"$",
"wantsEncrypted",
"=",
"true",
")",
"{",
"$",
"xml",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"xml",
"->",
"preserveWhiteSpace",
"=",
"false",
... | Adds the x509 descriptors (sign/encriptation) to the metadata
The same cert will be used for sign/encrypt
@param string $metadata SAML Metadata XML
@param string $cert x509 cert
@param bool $wantsEncrypted Whether to include the KeyDescriptor for encryption
@return string Metadata with KeyDescriptors
@throws Excepti... | [
"Adds",
"the",
"x509",
"descriptors",
"(",
"sign",
"/",
"encriptation",
")",
"to",
"the",
"metadata",
"The",
"same",
"cert",
"will",
"be",
"used",
"for",
"sign",
"/",
"encrypt"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Metadata.php#L204-L247 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.setStrict | public function setStrict($value)
{
if (!is_bool($value)) {
throw new OneLogin_Saml2_Error(
'Invalid value passed to setStrict()',
OneLogin_Saml2_Error::SETTINGS_INVALID_SYNTAX
);
}
$this->_settings->setStrict($value);
} | php | public function setStrict($value)
{
if (!is_bool($value)) {
throw new OneLogin_Saml2_Error(
'Invalid value passed to setStrict()',
OneLogin_Saml2_Error::SETTINGS_INVALID_SYNTAX
);
}
$this->_settings->setStrict($value);
} | [
"public",
"function",
"setStrict",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"OneLogin_Saml2_Error",
"(",
"'Invalid value passed to setStrict()'",
",",
"OneLogin_Saml2_Error",
"::",
"SETTINGS_INVALID_... | Set the strict mode active/disable
@param bool $value Strict parameter
@throws OneLogin_Saml2_Error | [
"Set",
"the",
"strict",
"mode",
"active",
"/",
"disable"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L165-L175 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.redirectTo | public function redirectTo($url = '', $parameters = array(), $stay = false)
{
assert('is_string($url)');
assert('is_array($parameters)');
if (empty($url) && isset($_REQUEST['RelayState'])) {
$url = $_REQUEST['RelayState'];
}
return OneLogin_Saml2_Utils::redirect... | php | public function redirectTo($url = '', $parameters = array(), $stay = false)
{
assert('is_string($url)');
assert('is_array($parameters)');
if (empty($url) && isset($_REQUEST['RelayState'])) {
$url = $_REQUEST['RelayState'];
}
return OneLogin_Saml2_Utils::redirect... | [
"public",
"function",
"redirectTo",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"stay",
"=",
"false",
")",
"{",
"assert",
"(",
"'is_string($url)'",
")",
";",
"assert",
"(",
"'is_array($parameters)'",
")",
";",
... | Redirects the user to the url past by parameter
or to the url that we defined in our SSO Request.
@param string $url The target URL to redirect the user.
@param array $parameters Extra parameters to be passed as part of the url
@param bool $stay True if we want to stay (returns the url string) False to redirect
@retu... | [
"Redirects",
"the",
"user",
"to",
"the",
"url",
"past",
"by",
"parameter",
"or",
"to",
"the",
"url",
"that",
"we",
"defined",
"in",
"our",
"SSO",
"Request",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L311-L321 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.getAttribute | public function getAttribute($name)
{
assert('is_string($name)');
$value = null;
if (isset($this->_attributes[$name])) {
return $this->_attributes[$name];
}
return $value;
} | php | public function getAttribute($name)
{
assert('is_string($name)');
$value = null;
if (isset($this->_attributes[$name])) {
return $this->_attributes[$name];
}
return $value;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
")",
"{",
"assert",
"(",
"'is_string($name)'",
")",
";",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return"... | Returns the requested SAML attribute
@param string $name The requested attribute of the user.
@return array|null Requested SAML attribute ($name). | [
"Returns",
"the",
"requested",
"SAML",
"attribute"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L430-L439 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.getAttributeWithFriendlyName | public function getAttributeWithFriendlyName($friendlyName)
{
assert('is_string($friendlyName)');
$value = null;
if (isset($this->_attributesWithFriendlyName[$friendlyName])) {
return $this->_attributesWithFriendlyName[$friendlyName];
}
return $value;
} | php | public function getAttributeWithFriendlyName($friendlyName)
{
assert('is_string($friendlyName)');
$value = null;
if (isset($this->_attributesWithFriendlyName[$friendlyName])) {
return $this->_attributesWithFriendlyName[$friendlyName];
}
return $value;
} | [
"public",
"function",
"getAttributeWithFriendlyName",
"(",
"$",
"friendlyName",
")",
"{",
"assert",
"(",
"'is_string($friendlyName)'",
")",
";",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_attributesWithFriendlyName",
"[",
"$",
... | Returns the requested SAML attribute indexed by FriendlyName
@param string $friendlyName The requested attribute of the user.
@return array|null Requested SAML attribute ($friendlyName). | [
"Returns",
"the",
"requested",
"SAML",
"attribute",
"indexed",
"by",
"FriendlyName"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L448-L457 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.getSLOurl | public function getSLOurl()
{
$url = null;
$idpData = $this->_settings->getIdPData();
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['url'])) {
$url = $idpData['singleLogoutService']['url'];
}
return $url;
} | php | public function getSLOurl()
{
$url = null;
$idpData = $this->_settings->getIdPData();
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['url'])) {
$url = $idpData['singleLogoutService']['url'];
}
return $url;
} | [
"public",
"function",
"getSLOurl",
"(",
")",
"{",
"$",
"url",
"=",
"null",
";",
"$",
"idpData",
"=",
"$",
"this",
"->",
"_settings",
"->",
"getIdPData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"idpData",
"[",
"'singleLogoutService'",
"]",
")",
"... | Gets the SLO url.
@return string|null The url of the Single Logout Service | [
"Gets",
"the",
"SLO",
"url",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L575-L583 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.getSLOResponseUrl | public function getSLOResponseUrl()
{
$idpData = $this->_settings->getIdPData();
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['responseUrl'])) {
return $idpData['singleLogoutService']['responseUrl'];
}
return $this->getSLOurl();
... | php | public function getSLOResponseUrl()
{
$idpData = $this->_settings->getIdPData();
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['responseUrl'])) {
return $idpData['singleLogoutService']['responseUrl'];
}
return $this->getSLOurl();
... | [
"public",
"function",
"getSLOResponseUrl",
"(",
")",
"{",
"$",
"idpData",
"=",
"$",
"this",
"->",
"_settings",
"->",
"getIdPData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"idpData",
"[",
"'singleLogoutService'",
"]",
")",
"&&",
"isset",
"(",
"$",
... | Gets the SLO response url.
@return string|null The response url of the Single Logout Service | [
"Gets",
"the",
"SLO",
"response",
"url",
"."
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L590-L597 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.buildRequestSignature | public function buildRequestSignature($samlRequest, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA1)
{
return $this->buildMessageSignature($samlRequest, $relayState, $signAlgorithm, "SAMLRequest");
} | php | public function buildRequestSignature($samlRequest, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA1)
{
return $this->buildMessageSignature($samlRequest, $relayState, $signAlgorithm, "SAMLRequest");
} | [
"public",
"function",
"buildRequestSignature",
"(",
"$",
"samlRequest",
",",
"$",
"relayState",
",",
"$",
"signAlgorithm",
"=",
"XMLSecurityKey",
"::",
"RSA_SHA1",
")",
"{",
"return",
"$",
"this",
"->",
"buildMessageSignature",
"(",
"$",
"samlRequest",
",",
"$",... | Generates the Signature for a SAML Request
@param string $samlRequest The SAML Request
@param string $relayState The RelayState
@param string $signAlgorithm Signature algorithm method
@return string A base64 encoded signature
@throws OneLogin_Saml2_Error | [
"Generates",
"the",
"Signature",
"for",
"a",
"SAML",
"Request"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L620-L623 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.buildResponseSignature | public function buildResponseSignature($samlResponse, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA1)
{
return $this->buildMessageSignature($samlResponse, $relayState, $signAlgorithm, "SAMLResponse");
} | php | public function buildResponseSignature($samlResponse, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA1)
{
return $this->buildMessageSignature($samlResponse, $relayState, $signAlgorithm, "SAMLResponse");
} | [
"public",
"function",
"buildResponseSignature",
"(",
"$",
"samlResponse",
",",
"$",
"relayState",
",",
"$",
"signAlgorithm",
"=",
"XMLSecurityKey",
"::",
"RSA_SHA1",
")",
"{",
"return",
"$",
"this",
"->",
"buildMessageSignature",
"(",
"$",
"samlResponse",
",",
"... | Generates the Signature for a SAML Response
@param string $samlResponse The SAML Response
@param string $relayState The RelayState
@param string $signAlgorithm Signature algorithm method
@return string A base64 encoded signature
@throws OneLogin_Saml2_Error | [
"Generates",
"the",
"Signature",
"for",
"a",
"SAML",
"Response"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L636-L639 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.buildMessageSignature | private function buildMessageSignature($samlMessage, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256, $type="SAMLRequest")
{
$key = $this->_settings->getSPkey();
if (empty($key)) {
if ($type == "SAMLRequest") {
$errorMsg = "Trying to sign the SAML Request but can... | php | private function buildMessageSignature($samlMessage, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256, $type="SAMLRequest")
{
$key = $this->_settings->getSPkey();
if (empty($key)) {
if ($type == "SAMLRequest") {
$errorMsg = "Trying to sign the SAML Request but can... | [
"private",
"function",
"buildMessageSignature",
"(",
"$",
"samlMessage",
",",
"$",
"relayState",
",",
"$",
"signAlgorithm",
"=",
"XMLSecurityKey",
"::",
"RSA_SHA256",
",",
"$",
"type",
"=",
"\"SAMLRequest\"",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"_s... | Generates the Signature for a SAML Response
@param string $samlMessage The SAML Response
@param string $relayState The RelayState
@param string $signAlgorithm Signature algorithm method
@param string $type "SAMLRequest" or "SAMLResponse"
@return string A base64 encoded signature
@throws OneLogin_Saml2_... | [
"Generates",
"the",
"Signature",
"for",
"a",
"SAML",
"Response"
] | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L653-L685 |
onelogin/php-saml | lib/Saml2/Auth.php | OneLogin_Saml2_Auth.getLastResponseXML | public function getLastResponseXML()
{
$response = null;
if (isset($this->_lastResponse)) {
if (is_string($this->_lastResponse)) {
$response = $this->_lastResponse;
} else {
$response = $this->_lastResponse->saveXML();
}
}
... | php | public function getLastResponseXML()
{
$response = null;
if (isset($this->_lastResponse)) {
if (is_string($this->_lastResponse)) {
$response = $this->_lastResponse;
} else {
$response = $this->_lastResponse->saveXML();
}
}
... | [
"public",
"function",
"getLastResponseXML",
"(",
")",
"{",
"$",
"response",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_lastResponse",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"_lastResponse",
")",
")",
"{",
... | Returns the most recently-constructed/processed
XML SAML response (SAMLResponse, LogoutResponse).
If the SAMLResponse was encrypted, by default tries
to return the decrypted XML.
@return string|null The Response XML | [
"Returns",
"the",
"most",
"recently",
"-",
"constructed",
"/",
"processed",
"XML",
"SAML",
"response",
"(",
"SAMLResponse",
"LogoutResponse",
")",
".",
"If",
"the",
"SAMLResponse",
"was",
"encrypted",
"by",
"default",
"tries",
"to",
"return",
"the",
"decrypted",... | train | https://github.com/onelogin/php-saml/blob/fc9c87d40d16cee0116ac580c948b66a8fb404aa/lib/Saml2/Auth.php#L732-L744 |
srmklive/laravel-paypal | src/Traits/RecurringProfiles.php | RecurringProfiles.createCustomSubscription | public function createCustomSubscription($token, $amount, $description, $billingFrequency, $trialDays = null)
{
$data = [
'PROFILESTARTDATE' => Carbon::now()->toAtomString(),
'DESC' => $description,
'BILLINGPERIOD' => 'Month',
'BILLINGFREQUENCY'... | php | public function createCustomSubscription($token, $amount, $description, $billingFrequency, $trialDays = null)
{
$data = [
'PROFILESTARTDATE' => Carbon::now()->toAtomString(),
'DESC' => $description,
'BILLINGPERIOD' => 'Month',
'BILLINGFREQUENCY'... | [
"public",
"function",
"createCustomSubscription",
"(",
"$",
"token",
",",
"$",
"amount",
",",
"$",
"description",
",",
"$",
"billingFrequency",
",",
"$",
"trialDays",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"'PROFILESTARTDATE'",
"=>",
"Carbon",
"::",
... | Create recurring subscription on custom frequency basis.
The billing frequency is in months, i.e: if you want a monthly subscription, then your billing frequency would be 1.
@param string $token
@param float $amount
@param string $description
@param int $billingFrequency
@param int $trialDays
@return array | [
"Create",
"recurring",
"subscription",
"on",
"custom",
"frequency",
"basis",
".",
"The",
"billing",
"frequency",
"is",
"in",
"months",
"i",
".",
"e",
":",
"if",
"you",
"want",
"a",
"monthly",
"subscription",
"then",
"your",
"billing",
"frequency",
"would",
"... | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/RecurringProfiles.php#L21-L40 |
srmklive/laravel-paypal | src/Traits/RecurringProfiles.php | RecurringProfiles.createMonthlySubscription | public function createMonthlySubscription($token, $amount, $description)
{
$data = [
'PROFILESTARTDATE' => Carbon::now()->toAtomString(),
'DESC' => $description,
'BILLINGPERIOD' => 'Month',
'BILLINGFREQUENCY' => 1,
'AMT' ... | php | public function createMonthlySubscription($token, $amount, $description)
{
$data = [
'PROFILESTARTDATE' => Carbon::now()->toAtomString(),
'DESC' => $description,
'BILLINGPERIOD' => 'Month',
'BILLINGFREQUENCY' => 1,
'AMT' ... | [
"public",
"function",
"createMonthlySubscription",
"(",
"$",
"token",
",",
"$",
"amount",
",",
"$",
"description",
")",
"{",
"$",
"data",
"=",
"[",
"'PROFILESTARTDATE'",
"=>",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toAtomString",
"(",
")",
",",
"'DESC'",
... | Create recurring subscription on monthly basis.
@param string $token
@param float $amount
@param string $description
@return array | [
"Create",
"recurring",
"subscription",
"on",
"monthly",
"basis",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/RecurringProfiles.php#L51-L63 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setConfig | private function setConfig(array $config = [])
{
// Set Api Credentials
if (function_exists('config')) {
$this->setApiCredentials(
config('paypal')
);
} elseif (!empty($config)) {
$this->setApiCredentials($config);
}
$this-... | php | private function setConfig(array $config = [])
{
// Set Api Credentials
if (function_exists('config')) {
$this->setApiCredentials(
config('paypal')
);
} elseif (!empty($config)) {
$this->setApiCredentials($config);
}
$this-... | [
"private",
"function",
"setConfig",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"// Set Api Credentials",
"if",
"(",
"function_exists",
"(",
"'config'",
")",
")",
"{",
"$",
"this",
"->",
"setApiCredentials",
"(",
"config",
"(",
"'paypal'",
")",
"... | Function To Set PayPal API Configuration.
@param array $config
@throws \Exception | [
"Function",
"To",
"Set",
"PayPal",
"API",
"Configuration",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L130-L142 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setDefaultValues | private function setDefaultValues()
{
// Set default payment action.
if (empty($this->paymentAction)) {
$this->paymentAction = 'Sale';
}
// Set default locale.
if (empty($this->locale)) {
$this->locale = 'en_US';
}
// Set default valu... | php | private function setDefaultValues()
{
// Set default payment action.
if (empty($this->paymentAction)) {
$this->paymentAction = 'Sale';
}
// Set default locale.
if (empty($this->locale)) {
$this->locale = 'en_US';
}
// Set default valu... | [
"private",
"function",
"setDefaultValues",
"(",
")",
"{",
"// Set default payment action.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"paymentAction",
")",
")",
"{",
"$",
"this",
"->",
"paymentAction",
"=",
"'Sale'",
";",
"}",
"// Set default locale.",
"if",
... | Set default values for configuration.
@return void | [
"Set",
"default",
"values",
"for",
"configuration",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L149-L165 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setApiCredentials | public function setApiCredentials($credentials)
{
// Setting Default PayPal Mode If not set
$this->setApiEnvironment($credentials);
// Set API configuration for the PayPal provider
$this->setApiProviderConfiguration($credentials);
// Set default currency.
$this->set... | php | public function setApiCredentials($credentials)
{
// Setting Default PayPal Mode If not set
$this->setApiEnvironment($credentials);
// Set API configuration for the PayPal provider
$this->setApiProviderConfiguration($credentials);
// Set default currency.
$this->set... | [
"public",
"function",
"setApiCredentials",
"(",
"$",
"credentials",
")",
"{",
"// Setting Default PayPal Mode If not set",
"$",
"this",
"->",
"setApiEnvironment",
"(",
"$",
"credentials",
")",
";",
"// Set API configuration for the PayPal provider",
"$",
"this",
"->",
"se... | Set PayPal API Credentials.
@param array $credentials
@throws \Exception
@return void | [
"Set",
"PayPal",
"API",
"Credentials",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L176-L192 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setApiEnvironment | private function setApiEnvironment($credentials)
{
if (empty($credentials['mode']) || !in_array($credentials['mode'], ['sandbox', 'live'])) {
$this->mode = 'live';
} else {
$this->mode = $credentials['mode'];
}
} | php | private function setApiEnvironment($credentials)
{
if (empty($credentials['mode']) || !in_array($credentials['mode'], ['sandbox', 'live'])) {
$this->mode = 'live';
} else {
$this->mode = $credentials['mode'];
}
} | [
"private",
"function",
"setApiEnvironment",
"(",
"$",
"credentials",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"credentials",
"[",
"'mode'",
"]",
")",
"||",
"!",
"in_array",
"(",
"$",
"credentials",
"[",
"'mode'",
"]",
",",
"[",
"'sandbox'",
",",
"'live'",... | Set API environment to be used by PayPal.
@param array $credentials
@return void | [
"Set",
"API",
"environment",
"to",
"be",
"used",
"by",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L201-L208 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setApiProviderConfiguration | private function setApiProviderConfiguration($credentials)
{
// Setting PayPal API Credentials
collect($credentials[$this->mode])->map(function ($value, $key) {
$this->config[$key] = $value;
});
// Setup PayPal API Signature value to use.
$this->config['signature... | php | private function setApiProviderConfiguration($credentials)
{
// Setting PayPal API Credentials
collect($credentials[$this->mode])->map(function ($value, $key) {
$this->config[$key] = $value;
});
// Setup PayPal API Signature value to use.
$this->config['signature... | [
"private",
"function",
"setApiProviderConfiguration",
"(",
"$",
"credentials",
")",
"{",
"// Setting PayPal API Credentials",
"collect",
"(",
"$",
"credentials",
"[",
"$",
"this",
"->",
"mode",
"]",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"value",
",",
"$... | Set configuration details for the provider.
@param array $credentials
@throws \Exception
@return void | [
"Set",
"configuration",
"details",
"for",
"the",
"provider",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L219-L239 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setApiProvider | private function setApiProvider($credentials)
{
if ($this instanceof \Srmklive\PayPal\Services\AdaptivePayments) {
$this->setAdaptivePaymentsOptions();
} elseif ($this instanceof \Srmklive\PayPal\Services\ExpressCheckout) {
$this->setExpressCheckoutOptions($credentials);
... | php | private function setApiProvider($credentials)
{
if ($this instanceof \Srmklive\PayPal\Services\AdaptivePayments) {
$this->setAdaptivePaymentsOptions();
} elseif ($this instanceof \Srmklive\PayPal\Services\ExpressCheckout) {
$this->setExpressCheckoutOptions($credentials);
... | [
"private",
"function",
"setApiProvider",
"(",
"$",
"credentials",
")",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"\\",
"Srmklive",
"\\",
"PayPal",
"\\",
"Services",
"\\",
"AdaptivePayments",
")",
"{",
"$",
"this",
"->",
"setAdaptivePaymentsOptions",
"(",
")",... | Determines which API provider should be used.
@param array $credentials
@throws \Exception | [
"Determines",
"which",
"API",
"provider",
"should",
"be",
"used",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L248-L257 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setRequestData | protected function setRequestData(array $data = [])
{
if (($this->post instanceof Collection) && (!$this->post->isEmpty())) {
unset($this->post);
}
$this->post = new Collection($data);
return $this->post;
} | php | protected function setRequestData(array $data = [])
{
if (($this->post instanceof Collection) && (!$this->post->isEmpty())) {
unset($this->post);
}
$this->post = new Collection($data);
return $this->post;
} | [
"protected",
"function",
"setRequestData",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"post",
"instanceof",
"Collection",
")",
"&&",
"(",
"!",
"$",
"this",
"->",
"post",
"->",
"isEmpty",
"(",
")",
")",
")... | Setup request data to be sent to PayPal.
@param array $data
@return \Illuminate\Support\Collection | [
"Setup",
"request",
"data",
"to",
"be",
"sent",
"to",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L266-L275 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setCurrency | public function setCurrency($currency = 'USD')
{
$allowedCurrencies = ['AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'INR', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'USD', 'RUB'];
// Check if provided currency is valid.
if (... | php | public function setCurrency($currency = 'USD')
{
$allowedCurrencies = ['AUD', 'BRL', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'INR', 'JPY', 'MYR', 'MXN', 'NOK', 'NZD', 'PHP', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'TWD', 'THB', 'USD', 'RUB'];
// Check if provided currency is valid.
if (... | [
"public",
"function",
"setCurrency",
"(",
"$",
"currency",
"=",
"'USD'",
")",
"{",
"$",
"allowedCurrencies",
"=",
"[",
"'AUD'",
",",
"'BRL'",
",",
"'CAD'",
",",
"'CZK'",
",",
"'DKK'",
",",
"'EUR'",
",",
"'HKD'",
",",
"'HUF'",
",",
"'ILS'",
",",
"'INR'"... | Function to set currency.
@param string $currency
@throws \Exception
@return $this | [
"Function",
"to",
"set",
"currency",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L300-L312 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.setBillingType | public function setBillingType($billingType = 'MerchantInitiatedBilling')
{
$allowedBillingTypes = ['MerchantInitiatedBilling', 'MerchantInitiatedBillingSingleAgreement', 'RecurringPayments'];
if ($billingType != null && !in_array($billingType, $allowedBillingTypes)) {
throw new \Except... | php | public function setBillingType($billingType = 'MerchantInitiatedBilling')
{
$allowedBillingTypes = ['MerchantInitiatedBilling', 'MerchantInitiatedBillingSingleAgreement', 'RecurringPayments'];
if ($billingType != null && !in_array($billingType, $allowedBillingTypes)) {
throw new \Except... | [
"public",
"function",
"setBillingType",
"(",
"$",
"billingType",
"=",
"'MerchantInitiatedBilling'",
")",
"{",
"$",
"allowedBillingTypes",
"=",
"[",
"'MerchantInitiatedBilling'",
",",
"'MerchantInitiatedBillingSingleAgreement'",
",",
"'RecurringPayments'",
"]",
";",
"if",
... | Function to set billing type.
@param string $billingType
@throws \Exception
@return $this | [
"Function",
"to",
"set",
"billing",
"type",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L323-L334 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.verifyIPN | public function verifyIPN($post)
{
$this->setRequestData($post);
$this->apiUrl = $this->config['ipn_url'];
return $this->doPayPalRequest('verifyipn');
} | php | public function verifyIPN($post)
{
$this->setRequestData($post);
$this->apiUrl = $this->config['ipn_url'];
return $this->doPayPalRequest('verifyipn');
} | [
"public",
"function",
"verifyIPN",
"(",
"$",
"post",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"$",
"post",
")",
";",
"$",
"this",
"->",
"apiUrl",
"=",
"$",
"this",
"->",
"config",
"[",
"'ipn_url'",
"]",
";",
"return",
"$",
"this",
"->",
... | Retrieve PayPal IPN Response.
@param array $post
@return array | [
"Retrieve",
"PayPal",
"IPN",
"Response",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L343-L350 |
srmklive/laravel-paypal | src/Traits/PayPalRequest.php | PayPalRequest.createRequestPayload | private function createRequestPayload($method)
{
$config = array_merge([
'USER' => $this->config['username'],
'PWD' => $this->config['password'],
'SIGNATURE' => $this->config['signature'],
'VERSION' => 123,
'METHOD' => $method,
... | php | private function createRequestPayload($method)
{
$config = array_merge([
'USER' => $this->config['username'],
'PWD' => $this->config['password'],
'SIGNATURE' => $this->config['signature'],
'VERSION' => 123,
'METHOD' => $method,
... | [
"private",
"function",
"createRequestPayload",
"(",
"$",
"method",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"[",
"'USER'",
"=>",
"$",
"this",
"->",
"config",
"[",
"'username'",
"]",
",",
"'PWD'",
"=>",
"$",
"this",
"->",
"config",
"[",
"'passwor... | Create request payload to be sent to PayPal.
@param string $method | [
"Create",
"request",
"payload",
"to",
"be",
"sent",
"to",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalRequest.php#L357-L371 |
srmklive/laravel-paypal | src/Traits/PayPalTransactions.php | PayPalTransactions.doReferenceTransaction | public function doReferenceTransaction($transaction, $action, $amount = 0.00)
{
$this->setRequestData([
'REFERENCEID' => $transaction,
'PAYMENTACTION' => $action,
'AMT' => $amount,
]);
return $this->doPayPalRequest('DoReferenceTransaction');
... | php | public function doReferenceTransaction($transaction, $action, $amount = 0.00)
{
$this->setRequestData([
'REFERENCEID' => $transaction,
'PAYMENTACTION' => $action,
'AMT' => $amount,
]);
return $this->doPayPalRequest('DoReferenceTransaction');
... | [
"public",
"function",
"doReferenceTransaction",
"(",
"$",
"transaction",
",",
"$",
"action",
",",
"$",
"amount",
"=",
"0.00",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"[",
"'REFERENCEID'",
"=>",
"$",
"transaction",
",",
"'PAYMENTACTION'",
"=>",
"$... | Perform a DoReferenceTransaction API operation on PayPal.
@param string $transaction
@param string $action
@param float $amount
@return array | [
"Perform",
"a",
"DoReferenceTransaction",
"API",
"operation",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalTransactions.php#L32-L41 |
srmklive/laravel-paypal | src/Traits/PayPalTransactions.php | PayPalTransactions.refundTransaction | public function refundTransaction($transaction, $amount = 0.00)
{
$this->setRequestData([
'TRANSACTIONID' => $transaction,
]);
if ($amount > 0) {
$this->post = $this->post->merge([
'REFUNDTYPE' => 'Partial',
'AMT' => $amount,
... | php | public function refundTransaction($transaction, $amount = 0.00)
{
$this->setRequestData([
'TRANSACTIONID' => $transaction,
]);
if ($amount > 0) {
$this->post = $this->post->merge([
'REFUNDTYPE' => 'Partial',
'AMT' => $amount,
... | [
"public",
"function",
"refundTransaction",
"(",
"$",
"transaction",
",",
"$",
"amount",
"=",
"0.00",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"[",
"'TRANSACTIONID'",
"=>",
"$",
"transaction",
",",
"]",
")",
";",
"if",
"(",
"$",
"amount",
">",
... | Refund PayPal Transaction.
@param string $transaction
@param float $amount
@return array | [
"Refund",
"PayPal",
"Transaction",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalTransactions.php#L51-L65 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setExpressCheckoutOptions | public function setExpressCheckoutOptions($credentials)
{
// Setting API Endpoints
if ($this->mode === 'sandbox') {
$this->config['api_url'] = !empty($this->config['secret']) ?
'https://api-3t.sandbox.paypal.com/nvp' : 'https://api.sandbox.paypal.com/nvp';
$t... | php | public function setExpressCheckoutOptions($credentials)
{
// Setting API Endpoints
if ($this->mode === 'sandbox') {
$this->config['api_url'] = !empty($this->config['secret']) ?
'https://api-3t.sandbox.paypal.com/nvp' : 'https://api.sandbox.paypal.com/nvp';
$t... | [
"public",
"function",
"setExpressCheckoutOptions",
"(",
"$",
"credentials",
")",
"{",
"// Setting API Endpoints",
"if",
"(",
"$",
"this",
"->",
"mode",
"===",
"'sandbox'",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'api_url'",
"]",
"=",
"!",
"empty",
"(",
... | Set ExpressCheckout API endpoints & options.
@param array $credentials
@return void | [
"Set",
"ExpressCheckout",
"API",
"endpoints",
"&",
"options",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L39-L60 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setCartItems | protected function setCartItems($items)
{
return (new Collection($items))->map(function ($item, $num) {
return [
'L_PAYMENTREQUEST_0_NAME'.$num => $item['name'],
'L_PAYMENTREQUEST_0_AMT'.$num => $item['price'],
'L_PAYMENTREQUEST_0_QTY'.$num => is... | php | protected function setCartItems($items)
{
return (new Collection($items))->map(function ($item, $num) {
return [
'L_PAYMENTREQUEST_0_NAME'.$num => $item['name'],
'L_PAYMENTREQUEST_0_AMT'.$num => $item['price'],
'L_PAYMENTREQUEST_0_QTY'.$num => is... | [
"protected",
"function",
"setCartItems",
"(",
"$",
"items",
")",
"{",
"return",
"(",
"new",
"Collection",
"(",
"$",
"items",
")",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"item",
",",
"$",
"num",
")",
"{",
"return",
"[",
"'L_PAYMENTREQUEST_0_NAME'",
... | Set cart item details for PayPal.
@param array $items
@return \Illuminate\Support\Collection | [
"Set",
"cart",
"item",
"details",
"for",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L69-L80 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setExpressCheckoutRecurringPaymentConfig | protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false)
{
$billingType = $this->billingType;
// Overwrite billing type if $subscription flag is enabled
if ($subscription) {
$billingType = 'RecurringPayments';
}
// Send L_BILLING... | php | protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false)
{
$billingType = $this->billingType;
// Overwrite billing type if $subscription flag is enabled
if ($subscription) {
$billingType = 'RecurringPayments';
}
// Send L_BILLING... | [
"protected",
"function",
"setExpressCheckoutRecurringPaymentConfig",
"(",
"$",
"data",
",",
"$",
"subscription",
"=",
"false",
")",
"{",
"$",
"billingType",
"=",
"$",
"this",
"->",
"billingType",
";",
"// Overwrite billing type if $subscription flag is enabled",
"if",
"... | Set Recurring payments details for SetExpressCheckout API call.
@param array $data
@param bool $subscription | [
"Set",
"Recurring",
"payments",
"details",
"for",
"SetExpressCheckout",
"API",
"call",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L88-L105 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setShippingAmount | protected function setShippingAmount($data)
{
if (isset($data['shipping'])) {
$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPPINGAMT' => $data['shipping'],
]);
}
} | php | protected function setShippingAmount($data)
{
if (isset($data['shipping'])) {
$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPPINGAMT' => $data['shipping'],
]);
}
} | [
"protected",
"function",
"setShippingAmount",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'shipping'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"post",
"->",
"merge",
"(",
"[",
"'PAYMENTREQUES... | Set shipping amount if available.
@param array $data | [
"Set",
"shipping",
"amount",
"if",
"available",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L122-L129 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setShippingDiscount | protected function setShippingDiscount($data)
{
if (isset($data['shipping_discount'])) {
if ($data['shipping_discount'] > 0) {
$data['shipping_discount'] *= -1;
}
$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPDISCAMT' => $data['... | php | protected function setShippingDiscount($data)
{
if (isset($data['shipping_discount'])) {
if ($data['shipping_discount'] > 0) {
$data['shipping_discount'] *= -1;
}
$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPDISCAMT' => $data['... | [
"protected",
"function",
"setShippingDiscount",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'shipping_discount'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"'shipping_discount'",
"]",
">",
"0",
")",
"{",
"$",
"data",
... | Set shipping discount if available.
@param array $data | [
"Set",
"shipping",
"discount",
"if",
"available",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L136-L148 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.setExpressCheckout | public function setExpressCheckout($data, $subscription = false)
{
$this->setItemSubTotal($data);
$this->post = $this->setCartItems($data['items'])->merge([
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'... | php | public function setExpressCheckout($data, $subscription = false)
{
$this->setItemSubTotal($data);
$this->post = $this->setCartItems($data['items'])->merge([
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'... | [
"public",
"function",
"setExpressCheckout",
"(",
"$",
"data",
",",
"$",
"subscription",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"setItemSubTotal",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setCartItems",
"(",
"$... | Perform a SetExpressCheckout API call on PayPal.
@param array $data
@param bool $subscription
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"SetExpressCheckout",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L160-L188 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.doExpressCheckoutPayment | public function doExpressCheckoutPayment($data, $token, $payerid)
{
$this->setItemSubTotal($data);
$this->post = $this->setCartItems($data['items'])->merge([
'TOKEN' => $token,
'PAYERID' => $payerid,
'PAYMENTREQUEST... | php | public function doExpressCheckoutPayment($data, $token, $payerid)
{
$this->setItemSubTotal($data);
$this->post = $this->setCartItems($data['items'])->merge([
'TOKEN' => $token,
'PAYERID' => $payerid,
'PAYMENTREQUEST... | [
"public",
"function",
"doExpressCheckoutPayment",
"(",
"$",
"data",
",",
"$",
"token",
",",
"$",
"payerid",
")",
"{",
"$",
"this",
"->",
"setItemSubTotal",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setCartItems",
"... | Perform DoExpressCheckoutPayment API call on PayPal.
@param array $data
@param string $token
@param string $payerid
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"DoExpressCheckoutPayment",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L219-L238 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.doAuthorization | public function doAuthorization($authorization_id, $amount, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
])
);
return $this->doPayPalRequest('DoAuthoriz... | php | public function doAuthorization($authorization_id, $amount, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
])
);
return $this->doPayPalRequest('DoAuthoriz... | [
"public",
"function",
"doAuthorization",
"(",
"$",
"authorization_id",
",",
"$",
"amount",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"array_merge",
"(",
"$",
"data",
",",
"[",
"'AUTHORIZATIONID'",
"=>",
"$",
"au... | Perform a DoAuthorization API call on PayPal.
@param string $authorization_id Transaction ID
@param float $amount Amount to capture
@param array $data Optional request fields
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"DoAuthorization",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L251-L261 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.doCapture | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
'COMPLETETYPE' => $complete,
... | php | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
'COMPLETETYPE' => $complete,
... | [
"public",
"function",
"doCapture",
"(",
"$",
"authorization_id",
",",
"$",
"amount",
",",
"$",
"complete",
"=",
"'Complete'",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"array_merge",
"(",
"$",
"data",
",",
"["... | Perform a DoCapture API call on PayPal.
@param string $authorization_id Transaction ID
@param float $amount Amount to capture
@param string $complete Indicates whether or not this is the last capture.
@param array $data Optional request fields
@throws \Exception
@return array|\Psr\Htt... | [
"Perform",
"a",
"DoCapture",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L275-L287 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.doReAuthorization | public function doReAuthorization($authorization_id, $amount, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMOUNT' => $amount,
])
);
return $this->doPayPalRequest('DoReauth... | php | public function doReAuthorization($authorization_id, $amount, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMOUNT' => $amount,
])
);
return $this->doPayPalRequest('DoReauth... | [
"public",
"function",
"doReAuthorization",
"(",
"$",
"authorization_id",
",",
"$",
"amount",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"array_merge",
"(",
"$",
"data",
",",
"[",
"'AUTHORIZATIONID'",
"=>",
"$",
"... | Perform a DoReauthorization API call on PayPal to reauthorize an existing authorization transaction.
@param string $authorization_id
@param float $amount
@param array $data
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"DoReauthorization",
"API",
"call",
"on",
"PayPal",
"to",
"reauthorize",
"an",
"existing",
"authorization",
"transaction",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L300-L310 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.doVoid | public function doVoid($authorization_id, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
])
);
return $this->doPayPalRequest('DoVoid');
} | php | public function doVoid($authorization_id, $data = [])
{
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
])
);
return $this->doPayPalRequest('DoVoid');
} | [
"public",
"function",
"doVoid",
"(",
"$",
"authorization_id",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"setRequestData",
"(",
"array_merge",
"(",
"$",
"data",
",",
"[",
"'AUTHORIZATIONID'",
"=>",
"$",
"authorization_id",
",",
"]",
")... | Perform a DoVoid API call on PayPal.
@param string $authorization_id Transaction ID
@param array $data Optional request fields
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"DoVoid",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L322-L331 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.createRecurringPaymentsProfile | public function createRecurringPaymentsProfile($data, $token)
{
$this->post = $this->setRequestData($data)->merge([
'TOKEN' => $token,
]);
return $this->doPayPalRequest('CreateRecurringPaymentsProfile');
} | php | public function createRecurringPaymentsProfile($data, $token)
{
$this->post = $this->setRequestData($data)->merge([
'TOKEN' => $token,
]);
return $this->doPayPalRequest('CreateRecurringPaymentsProfile');
} | [
"public",
"function",
"createRecurringPaymentsProfile",
"(",
"$",
"data",
",",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setRequestData",
"(",
"$",
"data",
")",
"->",
"merge",
"(",
"[",
"'TOKEN'",
"=>",
"$",
"token",
"... | Perform a CreateRecurringPaymentsProfile API call on PayPal.
@param array $data
@param string $token
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"CreateRecurringPaymentsProfile",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L361-L368 |
srmklive/laravel-paypal | src/Services/ExpressCheckout.php | ExpressCheckout.updateRecurringPaymentsProfile | public function updateRecurringPaymentsProfile($data, $id)
{
$this->post = $this->setRequestData($data)->merge([
'PROFILEID' => $id,
]);
return $this->doPayPalRequest('UpdateRecurringPaymentsProfile');
} | php | public function updateRecurringPaymentsProfile($data, $id)
{
$this->post = $this->setRequestData($data)->merge([
'PROFILEID' => $id,
]);
return $this->doPayPalRequest('UpdateRecurringPaymentsProfile');
} | [
"public",
"function",
"updateRecurringPaymentsProfile",
"(",
"$",
"data",
",",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setRequestData",
"(",
"$",
"data",
")",
"->",
"merge",
"(",
"[",
"'PROFILEID'",
"=>",
"$",
"id",
","... | Perform a UpdateRecurringPaymentsProfile API call on PayPal.
@param array $data
@param string $id
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Perform",
"a",
"UpdateRecurringPaymentsProfile",
"API",
"call",
"on",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/ExpressCheckout.php#L398-L405 |
srmklive/laravel-paypal | src/PayPalFacadeAccessor.php | PayPalFacadeAccessor.setProvider | public static function setProvider($option = '')
{
// Set default provider.
if (empty($option) || ($option != 'adaptive_payments') || ($option == 'express_checkout')) {
self::$provider = new ExpressCheckout();
} else {
self::$provider = new AdaptivePayments();
... | php | public static function setProvider($option = '')
{
// Set default provider.
if (empty($option) || ($option != 'adaptive_payments') || ($option == 'express_checkout')) {
self::$provider = new ExpressCheckout();
} else {
self::$provider = new AdaptivePayments();
... | [
"public",
"static",
"function",
"setProvider",
"(",
"$",
"option",
"=",
"''",
")",
"{",
"// Set default provider.",
"if",
"(",
"empty",
"(",
"$",
"option",
")",
"||",
"(",
"$",
"option",
"!=",
"'adaptive_payments'",
")",
"||",
"(",
"$",
"option",
"==",
"... | Set specific PayPal API to use.
@param string $option
@return ExpressCheckout|AdaptivePayments | [
"Set",
"specific",
"PayPal",
"API",
"to",
"use",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/PayPalFacadeAccessor.php#L38-L48 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.setAdaptivePaymentsOptions | public function setAdaptivePaymentsOptions()
{
if ($this->mode == 'sandbox') {
$this->config['api_url'] = 'https://svcs.sandbox.paypal.com/AdaptivePayments';
$this->config['gateway_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
} else {
$this->config['ap... | php | public function setAdaptivePaymentsOptions()
{
if ($this->mode == 'sandbox') {
$this->config['api_url'] = 'https://svcs.sandbox.paypal.com/AdaptivePayments';
$this->config['gateway_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
} else {
$this->config['ap... | [
"public",
"function",
"setAdaptivePaymentsOptions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mode",
"==",
"'sandbox'",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'api_url'",
"]",
"=",
"'https://svcs.sandbox.paypal.com/AdaptivePayments'",
";",
"$",
"this",... | Set AdaptivePayments API endpoints & options.
@return void | [
"Set",
"AdaptivePayments",
"API",
"endpoints",
"&",
"options",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L25-L35 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.setHeaders | private function setHeaders()
{
$headers = [
'X-PAYPAL-SECURITY-USERID' => $this->config['username'],
'X-PAYPAL-SECURITY-PASSWORD' => $this->config['password'],
'X-PAYPAL-SECURITY-SIGNATURE' => $this->config['signature'],
'X-PAYPAL-REQUEST-DATA-FORMA... | php | private function setHeaders()
{
$headers = [
'X-PAYPAL-SECURITY-USERID' => $this->config['username'],
'X-PAYPAL-SECURITY-PASSWORD' => $this->config['password'],
'X-PAYPAL-SECURITY-SIGNATURE' => $this->config['signature'],
'X-PAYPAL-REQUEST-DATA-FORMA... | [
"private",
"function",
"setHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"'X-PAYPAL-SECURITY-USERID'",
"=>",
"$",
"this",
"->",
"config",
"[",
"'username'",
"]",
",",
"'X-PAYPAL-SECURITY-PASSWORD'",
"=>",
"$",
"this",
"->",
"config",
"[",
"'password'",
"]... | Set Adaptive Payments API request headers.
@return array | [
"Set",
"Adaptive",
"Payments",
"API",
"request",
"headers",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L42-L54 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.setPayRequestDetails | private function setPayRequestDetails($data)
{
$this->post = $this->setRequestData([
'actionType' => 'PAY',
'currencyCode' => $this->currency,
'receiverList' => [
'receiver' => $data['receivers'],
],
'returnUrl' => $data['re... | php | private function setPayRequestDetails($data)
{
$this->post = $this->setRequestData([
'actionType' => 'PAY',
'currencyCode' => $this->currency,
'receiverList' => [
'receiver' => $data['receivers'],
],
'returnUrl' => $data['re... | [
"private",
"function",
"setPayRequestDetails",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setRequestData",
"(",
"[",
"'actionType'",
"=>",
"'PAY'",
",",
"'currencyCode'",
"=>",
"$",
"this",
"->",
"currency",
",",
"'rece... | Set request details for Pay API operation.
@param array $data
@return void | [
"Set",
"request",
"details",
"for",
"Pay",
"API",
"operation",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L78-L93 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.createPayRequest | public function createPayRequest($data)
{
if (empty($data['return_url']) && empty($data['cancel_url'])) {
throw new \Exception('Return & Cancel URL should be specified');
}
$this->setPayRequestDetails($data);
return $this->doPayPalRequest('Pay');
} | php | public function createPayRequest($data)
{
if (empty($data['return_url']) && empty($data['cancel_url'])) {
throw new \Exception('Return & Cancel URL should be specified');
}
$this->setPayRequestDetails($data);
return $this->doPayPalRequest('Pay');
} | [
"public",
"function",
"createPayRequest",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"[",
"'return_url'",
"]",
")",
"&&",
"empty",
"(",
"$",
"data",
"[",
"'cancel_url'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(... | Function to perform Adaptive Payments API's PAY operation.
@param array $data
@throws \Exception
@return array | [
"Function",
"to",
"perform",
"Adaptive",
"Payments",
"API",
"s",
"PAY",
"operation",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L104-L113 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.setPaymentOptions | public function setPaymentOptions($payKey, $receivers)
{
$this->post = $this->setRequestData([
'requestEnvelope' => $this->setEnvelope(),
'payKey' => $payKey,
])->merge([
'receiverOptions' => $this->setPaymentOptionsReceiverDetails($receivers),
])... | php | public function setPaymentOptions($payKey, $receivers)
{
$this->post = $this->setRequestData([
'requestEnvelope' => $this->setEnvelope(),
'payKey' => $payKey,
])->merge([
'receiverOptions' => $this->setPaymentOptionsReceiverDetails($receivers),
])... | [
"public",
"function",
"setPaymentOptions",
"(",
"$",
"payKey",
",",
"$",
"receivers",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",
"setRequestData",
"(",
"[",
"'requestEnvelope'",
"=>",
"$",
"this",
"->",
"setEnvelope",
"(",
")",
",",
"'p... | Function to perform Adaptive Payments API's SetPaymentOptions operation.
@param string $payKey
@param array $receivers
@return array | [
"Function",
"to",
"perform",
"Adaptive",
"Payments",
"API",
"s",
"SetPaymentOptions",
"operation",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L123-L133 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.getPaymentOptions | public function getPaymentOptions($payKey, $details = false)
{
$operation = ($details) ? 'PaymentDetails' : 'GetPaymentOptions';
$this->setRequestData([
'requestEnvelope' => $this->setEnvelope(),
'payKey' => $payKey,
]);
return $this->doPayPalReques... | php | public function getPaymentOptions($payKey, $details = false)
{
$operation = ($details) ? 'PaymentDetails' : 'GetPaymentOptions';
$this->setRequestData([
'requestEnvelope' => $this->setEnvelope(),
'payKey' => $payKey,
]);
return $this->doPayPalReques... | [
"public",
"function",
"getPaymentOptions",
"(",
"$",
"payKey",
",",
"$",
"details",
"=",
"false",
")",
"{",
"$",
"operation",
"=",
"(",
"$",
"details",
")",
"?",
"'PaymentDetails'",
":",
"'GetPaymentOptions'",
";",
"$",
"this",
"->",
"setRequestData",
"(",
... | Function to perform Adaptive Payments API's GetPaymentOptions operation.
@param string $payKey
@param bool $details
@return array | [
"Function",
"to",
"perform",
"Adaptive",
"Payments",
"API",
"s",
"GetPaymentOptions",
"operation",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L143-L153 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.getRedirectUrl | public function getRedirectUrl($option, $payKey)
{
$url = $this->config['gateway_url'].'?cmd=';
if ($option == 'approved') {
$url .= '_ap-payment&paykey='.$payKey;
} elseif ($option == 'pre-approved') {
$url .= '_ap-preapproval&preapprovalkey='.$payKey;
}
... | php | public function getRedirectUrl($option, $payKey)
{
$url = $this->config['gateway_url'].'?cmd=';
if ($option == 'approved') {
$url .= '_ap-payment&paykey='.$payKey;
} elseif ($option == 'pre-approved') {
$url .= '_ap-preapproval&preapprovalkey='.$payKey;
}
... | [
"public",
"function",
"getRedirectUrl",
"(",
"$",
"option",
",",
"$",
"payKey",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"config",
"[",
"'gateway_url'",
"]",
".",
"'?cmd='",
";",
"if",
"(",
"$",
"option",
"==",
"'approved'",
")",
"{",
"$",
"url"... | Get PayPal redirect url for processing payment.
@param string $option
@param string $payKey
@return string | [
"Get",
"PayPal",
"redirect",
"url",
"for",
"processing",
"payment",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L175-L186 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.setPaymentOptionsReceiverDetails | private function setPaymentOptionsReceiverDetails($receivers)
{
return collect($receivers)->map(function ($receiver) {
$item = [];
$item['receiver'] = [
'email' => $receiver['email'],
];
$item['invoiceData']['item'] = collect($receiver['invoi... | php | private function setPaymentOptionsReceiverDetails($receivers)
{
return collect($receivers)->map(function ($receiver) {
$item = [];
$item['receiver'] = [
'email' => $receiver['email'],
];
$item['invoiceData']['item'] = collect($receiver['invoi... | [
"private",
"function",
"setPaymentOptionsReceiverDetails",
"(",
"$",
"receivers",
")",
"{",
"return",
"collect",
"(",
"$",
"receivers",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"receiver",
")",
"{",
"$",
"item",
"=",
"[",
"]",
";",
"$",
"item",
"[",
... | Set receiver details for SetPaymentOptions.
@param array $receivers
@return array | [
"Set",
"receiver",
"details",
"for",
"SetPaymentOptions",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L195-L212 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.createRequestPayload | private function createRequestPayload($method)
{
$this->apiUrl = $this->config['api_url'].'/'.$method;
$this->post = $this->post->merge($this->options);
} | php | private function createRequestPayload($method)
{
$this->apiUrl = $this->config['api_url'].'/'.$method;
$this->post = $this->post->merge($this->options);
} | [
"private",
"function",
"createRequestPayload",
"(",
"$",
"method",
")",
"{",
"$",
"this",
"->",
"apiUrl",
"=",
"$",
"this",
"->",
"config",
"[",
"'api_url'",
"]",
".",
"'/'",
".",
"$",
"method",
";",
"$",
"this",
"->",
"post",
"=",
"$",
"this",
"->",... | Create request payload to be sent to PayPal.
@param string $method | [
"Create",
"request",
"payload",
"to",
"be",
"sent",
"to",
"PayPal",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L219-L224 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.makeHttpRequest | private function makeHttpRequest()
{
try {
return $this->client->post($this->apiUrl, [
'json' => $this->post->toArray(),
'headers' => $this->setHeaders(),
])->getBody();
} catch (\GuzzleHttp\Exception\ClientException $e) {
throw ... | php | private function makeHttpRequest()
{
try {
return $this->client->post($this->apiUrl, [
'json' => $this->post->toArray(),
'headers' => $this->setHeaders(),
])->getBody();
} catch (\GuzzleHttp\Exception\ClientException $e) {
throw ... | [
"private",
"function",
"makeHttpRequest",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"apiUrl",
",",
"[",
"'json'",
"=>",
"$",
"this",
"->",
"post",
"->",
"toArray",
"(",
")",
",",
"'headers... | Perform PayPal API request & return response.
@throws \Exception
@return \Psr\Http\Message\StreamInterface | [
"Perform",
"PayPal",
"API",
"request",
"&",
"return",
"response",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L233-L247 |
srmklive/laravel-paypal | src/Services/AdaptivePayments.php | AdaptivePayments.doPayPalRequest | private function doPayPalRequest($method)
{
// Setup PayPal API Request Payload
$this->createRequestPayload($method);
try {
$response = $this->makeHttpRequest();
return \GuzzleHttp\json_decode($response, true);
} catch (\Exception $e) {
$message ... | php | private function doPayPalRequest($method)
{
// Setup PayPal API Request Payload
$this->createRequestPayload($method);
try {
$response = $this->makeHttpRequest();
return \GuzzleHttp\json_decode($response, true);
} catch (\Exception $e) {
$message ... | [
"private",
"function",
"doPayPalRequest",
"(",
"$",
"method",
")",
"{",
"// Setup PayPal API Request Payload",
"$",
"this",
"->",
"createRequestPayload",
"(",
"$",
"method",
")",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"makeHttpRequest",
"(",
... | Function To Perform PayPal API Request.
@param string $method
@throws \Exception
@return array|mixed|\Psr\Http\Message\StreamInterface | [
"Function",
"To",
"Perform",
"PayPal",
"API",
"Request",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Services/AdaptivePayments.php#L258-L275 |
srmklive/laravel-paypal | src/Traits/PayPalHttpClient.php | PayPalHttpClient.setHttpClientConfiguration | protected function setHttpClientConfiguration()
{
$this->setCurlConstants();
$this->httpClientConfig = [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
CURLOPT_SSL_VERIFYPEER => $this->validateSSL,
];
if (!empty($this->certificate)) {
$this->... | php | protected function setHttpClientConfiguration()
{
$this->setCurlConstants();
$this->httpClientConfig = [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
CURLOPT_SSL_VERIFYPEER => $this->validateSSL,
];
if (!empty($this->certificate)) {
$this->... | [
"protected",
"function",
"setHttpClientConfiguration",
"(",
")",
"{",
"$",
"this",
"->",
"setCurlConstants",
"(",
")",
";",
"$",
"this",
"->",
"httpClientConfig",
"=",
"[",
"CURLOPT_SSLVERSION",
"=>",
"CURL_SSLVERSION_TLSv1_2",
",",
"CURLOPT_SSL_VERIFYPEER",
"=>",
"... | Function to set Http Client configuration.
@return void | [
"Function",
"to",
"set",
"Http",
"Client",
"configuration",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalHttpClient.php#L53-L77 |
srmklive/laravel-paypal | src/Traits/PayPalHttpClient.php | PayPalHttpClient.makeHttpRequest | private function makeHttpRequest()
{
try {
return $this->client->post($this->apiUrl, [
$this->httpBodyParam => $this->post->toArray(),
])->getBody();
} catch (HttpClientException $e) {
throw new \Exception($e->getRequest().' '.$e->getResponse());
... | php | private function makeHttpRequest()
{
try {
return $this->client->post($this->apiUrl, [
$this->httpBodyParam => $this->post->toArray(),
])->getBody();
} catch (HttpClientException $e) {
throw new \Exception($e->getRequest().' '.$e->getResponse());
... | [
"private",
"function",
"makeHttpRequest",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"$",
"this",
"->",
"apiUrl",
",",
"[",
"$",
"this",
"->",
"httpBodyParam",
"=>",
"$",
"this",
"->",
"post",
"->",
"toArray",
... | Perform PayPal API request & return response.
@throws \Exception
@return \Psr\Http\Message\StreamInterface | [
"Perform",
"PayPal",
"API",
"request",
"&",
"return",
"response",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalHttpClient.php#L86-L99 |
srmklive/laravel-paypal | src/Traits/PayPalHttpClient.php | PayPalHttpClient.doPayPalRequest | private function doPayPalRequest($method)
{
// Setup PayPal API Request Payload
$this->createRequestPayload($method);
try {
// Perform PayPal HTTP API request.
$response = $this->makeHttpRequest();
return $this->retrieveData($method, $response);
... | php | private function doPayPalRequest($method)
{
// Setup PayPal API Request Payload
$this->createRequestPayload($method);
try {
// Perform PayPal HTTP API request.
$response = $this->makeHttpRequest();
return $this->retrieveData($method, $response);
... | [
"private",
"function",
"doPayPalRequest",
"(",
"$",
"method",
")",
"{",
"// Setup PayPal API Request Payload",
"$",
"this",
"->",
"createRequestPayload",
"(",
"$",
"method",
")",
";",
"try",
"{",
"// Perform PayPal HTTP API request.",
"$",
"response",
"=",
"$",
"thi... | Function To Perform PayPal API Request.
@param string $method
@throws \Exception
@return array|\Psr\Http\Message\StreamInterface | [
"Function",
"To",
"Perform",
"PayPal",
"API",
"Request",
"."
] | train | https://github.com/srmklive/laravel-paypal/blob/8ca37765c525408b0d4a3e9951fd535eee822011/src/Traits/PayPalHttpClient.php#L110-L128 |
top-think/think-swoole | src/websocket/Pusher.php | Pusher.isServerWebsocket | public function isServerWebsocket(int $fd): bool
{
return (bool) $this->server->connection_info($fd)['websocket_status'] ?? false;
} | php | public function isServerWebsocket(int $fd): bool
{
return (bool) $this->server->connection_info($fd)['websocket_status'] ?? false;
} | [
"public",
"function",
"isServerWebsocket",
"(",
"int",
"$",
"fd",
")",
":",
"bool",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"server",
"->",
"connection_info",
"(",
"$",
"fd",
")",
"[",
"'websocket_status'",
"]",
"??",
"false",
";",
"}"
] | Check if it's a websocket fd.
@param int $fd
@return bool | [
"Check",
"if",
"it",
"s",
"a",
"websocket",
"fd",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/Pusher.php#L222-L225 |
top-think/think-swoole | src/websocket/Pusher.php | Pusher.getWebsocketConnections | protected function getWebsocketConnections(): array
{
return array_filter(iterator_to_array($this->server->connections), function ($fd) {
return $this->isServerWebsocket($fd);
});
} | php | protected function getWebsocketConnections(): array
{
return array_filter(iterator_to_array($this->server->connections), function ($fd) {
return $this->isServerWebsocket($fd);
});
} | [
"protected",
"function",
"getWebsocketConnections",
"(",
")",
":",
"array",
"{",
"return",
"array_filter",
"(",
"iterator_to_array",
"(",
"$",
"this",
"->",
"server",
"->",
"connections",
")",
",",
"function",
"(",
"$",
"fd",
")",
"{",
"return",
"$",
"this",... | Returns all descriptors that are websocket
@return array | [
"Returns",
"all",
"descriptors",
"that",
"are",
"websocket"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/Pusher.php#L232-L237 |
top-think/think-swoole | src/websocket/Pusher.php | Pusher.shouldPushToDescriptor | public function shouldPushToDescriptor(int $fd): bool
{
if (!$this->server->exist($fd)) {
return false;
}
return $this->broadcast ? $this->sender !== (int) $fd : true;
} | php | public function shouldPushToDescriptor(int $fd): bool
{
if (!$this->server->exist($fd)) {
return false;
}
return $this->broadcast ? $this->sender !== (int) $fd : true;
} | [
"public",
"function",
"shouldPushToDescriptor",
"(",
"int",
"$",
"fd",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"server",
"->",
"exist",
"(",
"$",
"fd",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"broa... | @param int $fd
@return bool | [
"@param",
"int",
"$fd"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/Pusher.php#L244-L251 |
top-think/think-swoole | src/command/Server.php | Server.start | protected function start()
{
$pid = $this->getMasterPid();
if ($this->isRunning($pid)) {
$this->output->writeln('<error>swoole http server process is already running.</error>');
return;
}
$this->output->writeln('Starting swoole http server...');
/**... | php | protected function start()
{
$pid = $this->getMasterPid();
if ($this->isRunning($pid)) {
$this->output->writeln('<error>swoole http server process is already running.</error>');
return;
}
$this->output->writeln('Starting swoole http server...');
/**... | [
"protected",
"function",
"start",
"(",
")",
"{",
"$",
"pid",
"=",
"$",
"this",
"->",
"getMasterPid",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
"$",
"pid",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<e... | 启动server
@access protected
@return void | [
"启动server"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/command/Server.php#L63-L92 |
top-think/think-swoole | src/command/Server.php | Server.reload | protected function reload()
{
$pid = $this->getMasterPid();
if (!$this->isRunning($pid)) {
$this->output->writeln('<error>no swoole http server process running.</error>');
return;
}
$this->output->writeln('Reloading swoole http server...');
$isRunni... | php | protected function reload()
{
$pid = $this->getMasterPid();
if (!$this->isRunning($pid)) {
$this->output->writeln('<error>no swoole http server process running.</error>');
return;
}
$this->output->writeln('Reloading swoole http server...');
$isRunni... | [
"protected",
"function",
"reload",
"(",
")",
"{",
"$",
"pid",
"=",
"$",
"this",
"->",
"getMasterPid",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isRunning",
"(",
"$",
"pid",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"("... | 柔性重启server
@access protected
@return void | [
"柔性重启server"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/command/Server.php#L115-L135 |
top-think/think-swoole | src/command/Server.php | Server.stop | protected function stop()
{
$pid = $this->getMasterPid();
if (!$this->isRunning($pid)) {
$this->output->writeln('<error>no swoole http server process running.</error>');
return;
}
$this->output->writeln('Stopping swoole http server...');
$isRunning ... | php | protected function stop()
{
$pid = $this->getMasterPid();
if (!$this->isRunning($pid)) {
$this->output->writeln('<error>no swoole http server process running.</error>');
return;
}
$this->output->writeln('Stopping swoole http server...');
$isRunning ... | [
"protected",
"function",
"stop",
"(",
")",
"{",
"$",
"pid",
"=",
"$",
"this",
"->",
"getMasterPid",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isRunning",
"(",
"$",
"pid",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
... | 停止server
@access protected
@return void | [
"停止server"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/command/Server.php#L142-L163 |
top-think/think-swoole | src/command/Server.php | Server.restart | protected function restart()
{
$pid = $this->getMasterPid();
if ($this->isRunning($pid)) {
$this->stop();
}
$this->start();
} | php | protected function restart()
{
$pid = $this->getMasterPid();
if ($this->isRunning($pid)) {
$this->stop();
}
$this->start();
} | [
"protected",
"function",
"restart",
"(",
")",
"{",
"$",
"pid",
"=",
"$",
"this",
"->",
"getMasterPid",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
"$",
"pid",
")",
")",
"{",
"$",
"this",
"->",
"stop",
"(",
")",
";",
"}",
"$",... | 重启server
@access protected
@return void | [
"重启server"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/command/Server.php#L170-L179 |
top-think/think-swoole | src/command/Server.php | Server.getMasterPid | protected function getMasterPid()
{
$pidFile = $this->getPidPath();
if (is_file($pidFile)) {
$masterPid = (int) file_get_contents($pidFile);
} else {
$masterPid = 0;
}
return $masterPid;
} | php | protected function getMasterPid()
{
$pidFile = $this->getPidPath();
if (is_file($pidFile)) {
$masterPid = (int) file_get_contents($pidFile);
} else {
$masterPid = 0;
}
return $masterPid;
} | [
"protected",
"function",
"getMasterPid",
"(",
")",
"{",
"$",
"pidFile",
"=",
"$",
"this",
"->",
"getPidPath",
"(",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"pidFile",
")",
")",
"{",
"$",
"masterPid",
"=",
"(",
"int",
")",
"file_get_contents",
"(",
"... | 获取主进程PID
@access protected
@return int | [
"获取主进程PID"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/command/Server.php#L186-L197 |
top-think/think-swoole | src/websocket/Parser.php | Parser.execute | public function execute($server, $frame)
{
$skip = false;
foreach ($this->strategies as $strategy) {
$result = App::invokeMethod(
[$strategy, 'handle'],
[
'server' => $server,
'frame' => $frame,
]
... | php | public function execute($server, $frame)
{
$skip = false;
foreach ($this->strategies as $strategy) {
$result = App::invokeMethod(
[$strategy, 'handle'],
[
'server' => $server,
'frame' => $frame,
]
... | [
"public",
"function",
"execute",
"(",
"$",
"server",
",",
"$",
"frame",
")",
"{",
"$",
"skip",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"strategies",
"as",
"$",
"strategy",
")",
"{",
"$",
"result",
"=",
"App",
"::",
"invokeMethod",
"(",
... | Execute strategies before decoding payload.
If return value is true will skip decoding.
@param Server $server
@param Frame $frame
@return boolean | [
"Execute",
"strategies",
"before",
"decoding",
"payload",
".",
"If",
"return",
"value",
"is",
"true",
"will",
"skip",
"decoding",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/Parser.php#L25-L44 |
top-think/think-swoole | src/Websocket.php | Websocket.emit | public function emit(string $event, $data): bool
{
$fds = $this->getFds();
$assigned = !empty($this->to);
// if no fds are found, but rooms are assigned
// that means trying to emit to a non-existing room
// skip it directly instead of pushing to a task queue
if... | php | public function emit(string $event, $data): bool
{
$fds = $this->getFds();
$assigned = !empty($this->to);
// if no fds are found, but rooms are assigned
// that means trying to emit to a non-existing room
// skip it directly instead of pushing to a task queue
if... | [
"public",
"function",
"emit",
"(",
"string",
"$",
"event",
",",
"$",
"data",
")",
":",
"bool",
"{",
"$",
"fds",
"=",
"$",
"this",
"->",
"getFds",
"(",
")",
";",
"$",
"assigned",
"=",
"!",
"empty",
"(",
"$",
"this",
"->",
"to",
")",
";",
"// if ... | Emit data and reset some status.
@param string
@param mixed
@return boolean | [
"Emit",
"data",
"and",
"reset",
"some",
"status",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Websocket.php#L143-L170 |
top-think/think-swoole | src/Websocket.php | Websocket.call | public function call(string $event, $data = null)
{
if (!$this->eventExists($event)) {
return;
}
// inject request param on connect event
$isConnect = $event === static::EVENT_CONNECT;
$dataKey = $isConnect ? 'request' : 'data';
return $this->app->invo... | php | public function call(string $event, $data = null)
{
if (!$this->eventExists($event)) {
return;
}
// inject request param on connect event
$isConnect = $event === static::EVENT_CONNECT;
$dataKey = $isConnect ? 'request' : 'data';
return $this->app->invo... | [
"public",
"function",
"call",
"(",
"string",
"$",
"event",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"eventExists",
"(",
"$",
"event",
")",
")",
"{",
"return",
";",
"}",
"// inject request param on connect event",
"$",
... | Execute callback function by its event name.
@param string
@param mixed
@return mixed | [
"Execute",
"callback",
"function",
"by",
"its",
"event",
"name",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Websocket.php#L227-L241 |
top-think/think-swoole | src/websocket/room/RedisRoom.php | RedisRoom.prepare | public function prepare(Redis $redis = null): RoomContract
{
$this->setRedis($redis);
$this->setPrefix();
$this->cleanRooms();
return $this;
} | php | public function prepare(Redis $redis = null): RoomContract
{
$this->setRedis($redis);
$this->setPrefix();
$this->cleanRooms();
return $this;
} | [
"public",
"function",
"prepare",
"(",
"Redis",
"$",
"redis",
"=",
"null",
")",
":",
"RoomContract",
"{",
"$",
"this",
"->",
"setRedis",
"(",
"$",
"redis",
")",
";",
"$",
"this",
"->",
"setPrefix",
"(",
")",
";",
"$",
"this",
"->",
"cleanRooms",
"(",
... | @param \Redis|null $redis
@return RoomContract | [
"@param",
"\\",
"Redis|null",
"$redis"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/room/RedisRoom.php#L44-L51 |
top-think/think-swoole | src/websocket/room/RedisRoom.php | RedisRoom.checkTable | protected function checkTable(string $table)
{
if (!in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) {
throw new InvalidArgumentException("Invalid table name: `{$table}`.");
}
} | php | protected function checkTable(string $table)
{
if (!in_array($table, [RoomContract::ROOMS_KEY, RoomContract::DESCRIPTORS_KEY])) {
throw new InvalidArgumentException("Invalid table name: `{$table}`.");
}
} | [
"protected",
"function",
"checkTable",
"(",
"string",
"$",
"table",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"table",
",",
"[",
"RoomContract",
"::",
"ROOMS_KEY",
",",
"RoomContract",
"::",
"DESCRIPTORS_KEY",
"]",
")",
")",
"{",
"throw",
"new",
"I... | Check table for rooms and descriptors.
@param string $table | [
"Check",
"table",
"for",
"rooms",
"and",
"descriptors",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/room/RedisRoom.php#L203-L208 |
top-think/think-swoole | src/coroutine/PDO.php | PDO.connect | protected function connect(array $options = [])
{
$this->client->connect($options);
if (!$this->client->connected) {
$message = $this->client->connect_error ?: $this->client->error;
$errorCode = $this->client->connect_errno ?: $this->client->errno;
throw new P... | php | protected function connect(array $options = [])
{
$this->client->connect($options);
if (!$this->client->connected) {
$message = $this->client->connect_error ?: $this->client->error;
$errorCode = $this->client->connect_errno ?: $this->client->errno;
throw new P... | [
"protected",
"function",
"connect",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"connect",
"(",
"$",
"options",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"client",
"->",
"connected",
")",
"{",
"$",
... | @param array $options
@return $this | [
"@param",
"array",
"$options"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/coroutine/PDO.php#L59-L71 |
top-think/think-swoole | src/coroutine/PDO.php | PDO.query | public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = [])
{
$result = $this->client->query($statement, self::$options['timeout']);
if ($result === false) {
throw new PDOException($this->client->error, $this->client->errno);
}
... | php | public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = [])
{
$result = $this->client->query($statement, self::$options['timeout']);
if ($result === false) {
throw new PDOException($this->client->error, $this->client->errno);
}
... | [
"public",
"function",
"query",
"(",
"$",
"statement",
",",
"$",
"mode",
"=",
"PDO",
"::",
"ATTR_DEFAULT_FETCH_MODE",
",",
"$",
"arg3",
"=",
"null",
",",
"array",
"$",
"ctorargs",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"client... | @param string $statement
@param int $mode
@param mixed $arg3
@param array $ctorargs
@return array|bool|false|\PDOStatement | [
"@param",
"string",
"$statement",
"@param",
"int",
"$mode",
"@param",
"mixed",
"$arg3",
"@param",
"array",
"$ctorargs"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/coroutine/PDO.php#L217-L226 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.onOpen | public function onOpen($server, $req)
{
$request = $this->prepareRequest($req);
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
/** @var Sandbox $sandbox */
$sandbox = $this->app->make(Sandbox::class);
try {
$websocket->r... | php | public function onOpen($server, $req)
{
$request = $this->prepareRequest($req);
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
/** @var Sandbox $sandbox */
$sandbox = $this->app->make(Sandbox::class);
try {
$websocket->r... | [
"public",
"function",
"onOpen",
"(",
"$",
"server",
",",
"$",
"req",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"prepareRequest",
"(",
"$",
"req",
")",
";",
"/** @var Websocket $websocket */",
"$",
"websocket",
"=",
"$",
"this",
"->",
"app",
"->",... | "onOpen" listener.
@param Server $server
@param Request $req | [
"onOpen",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L61-L91 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.onMessage | public function onMessage($server, $frame)
{
// execute parser strategies and skip non-message packet
if ($this->payloadParser->execute($server, $frame)) {
return;
}
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
/** @va... | php | public function onMessage($server, $frame)
{
// execute parser strategies and skip non-message packet
if ($this->payloadParser->execute($server, $frame)) {
return;
}
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
/** @va... | [
"public",
"function",
"onMessage",
"(",
"$",
"server",
",",
"$",
"frame",
")",
"{",
"// execute parser strategies and skip non-message packet",
"if",
"(",
"$",
"this",
"->",
"payloadParser",
"->",
"execute",
"(",
"$",
"server",
",",
"$",
"frame",
")",
")",
"{"... | "onMessage" listener.
@param Server $server
@param Frame $frame | [
"onMessage",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L99-L131 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.onClose | public function onClose($server, $fd, $reactorId)
{
if (!$this->isServerWebsocket($fd) || !$server instanceof Server) {
return;
}
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
try {
$websocket->reset(true)->setSend... | php | public function onClose($server, $fd, $reactorId)
{
if (!$this->isServerWebsocket($fd) || !$server instanceof Server) {
return;
}
/** @var Websocket $websocket */
$websocket = $this->app->make(Websocket::class);
try {
$websocket->reset(true)->setSend... | [
"public",
"function",
"onClose",
"(",
"$",
"server",
",",
"$",
"fd",
",",
"$",
"reactorId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isServerWebsocket",
"(",
"$",
"fd",
")",
"||",
"!",
"$",
"server",
"instanceof",
"Server",
")",
"{",
"return",
... | "onClose" listener.
@param Server $server
@param int $fd
@param int $reactorId | [
"onClose",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L140-L162 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.prepareWebsocketHandler | protected function prepareWebsocketHandler()
{
$handlerClass = $this->container->make('config')->get('swoole.websocket.handler', Handler::class);
if (!$handlerClass) {
throw new RuntimeException('Websocket handler is not set in swoole.websocket config');
}
$this->setWeb... | php | protected function prepareWebsocketHandler()
{
$handlerClass = $this->container->make('config')->get('swoole.websocket.handler', Handler::class);
if (!$handlerClass) {
throw new RuntimeException('Websocket handler is not set in swoole.websocket config');
}
$this->setWeb... | [
"protected",
"function",
"prepareWebsocketHandler",
"(",
")",
"{",
"$",
"handlerClass",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'config'",
")",
"->",
"get",
"(",
"'swoole.websocket.handler'",
",",
"Handler",
"::",
"class",
")",
";",
"if",
"(... | Prepare websocket handler for onOpen and onClose callback.
@throws \Exception | [
"Prepare",
"websocket",
"handler",
"for",
"onOpen",
"and",
"onClose",
"callback",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L235-L244 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.bindRoom | protected function bindRoom(): void
{
$this->app->bind(RoomContract::class, function (App $app) {
$config = $app->make('config');
$room = $config->get('swoole.websocket.room', []);
$className = Arr::pull($room, 'type', TableRoom::class);
// create room ins... | php | protected function bindRoom(): void
{
$this->app->bind(RoomContract::class, function (App $app) {
$config = $app->make('config');
$room = $config->get('swoole.websocket.room', []);
$className = Arr::pull($room, 'type', TableRoom::class);
// create room ins... | [
"protected",
"function",
"bindRoom",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"RoomContract",
"::",
"class",
",",
"function",
"(",
"App",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"->",
"make",
"(",
"'con... | Bind room instance to Laravel app container. | [
"Bind",
"room",
"instance",
"to",
"Laravel",
"app",
"container",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L284-L300 |
top-think/think-swoole | src/concerns/InteractsWithWebsocket.php | InteractsWithWebsocket.bindWebsocket | protected function bindWebsocket()
{
$this->app->bind(Websocket::class, function (App $app) {
return new Websocket($app, $app->make(RoomContract::class));
});
$this->app->bind('swoole.websocket', Websocket::class);
} | php | protected function bindWebsocket()
{
$this->app->bind(Websocket::class, function (App $app) {
return new Websocket($app, $app->make(RoomContract::class));
});
$this->app->bind('swoole.websocket', Websocket::class);
} | [
"protected",
"function",
"bindWebsocket",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"Websocket",
"::",
"class",
",",
"function",
"(",
"App",
"$",
"app",
")",
"{",
"return",
"new",
"Websocket",
"(",
"$",
"app",
",",
"$",
"app",
"->",... | Bind websocket instance to Laravel app container. | [
"Bind",
"websocket",
"instance",
"to",
"Laravel",
"app",
"container",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithWebsocket.php#L305-L312 |
top-think/think-swoole | src/Sandbox.php | Sandbox.setInitialResetters | protected function setInitialResetters()
{
$app = $this->getBaseApp();
$resetters = [
ClearInstances::class,
RebindHttpContainer::class,
RebindRouterContainer::class,
BindRequest::class,
ResetConfig::class,
ResetEvent::class,
... | php | protected function setInitialResetters()
{
$app = $this->getBaseApp();
$resetters = [
ClearInstances::class,
RebindHttpContainer::class,
RebindRouterContainer::class,
BindRequest::class,
ResetConfig::class,
ResetEvent::class,
... | [
"protected",
"function",
"setInitialResetters",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"getBaseApp",
"(",
")",
";",
"$",
"resetters",
"=",
"[",
"ClearInstances",
"::",
"class",
",",
"RebindHttpContainer",
"::",
"class",
",",
"RebindRouterContainer"... | Initialize resetters. | [
"Initialize",
"resetters",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Sandbox.php#L194-L216 |
top-think/think-swoole | src/coroutine/connector/Mysql.php | Mysql.isBreak | protected function isBreak($e): bool
{
if (!$this->config['break_reconnect']) {
return false;
}
return parent::isBreak($e) || Str::contains($e->getMessage(), 'is closed');
} | php | protected function isBreak($e): bool
{
if (!$this->config['break_reconnect']) {
return false;
}
return parent::isBreak($e) || Str::contains($e->getMessage(), 'is closed');
} | [
"protected",
"function",
"isBreak",
"(",
"$",
"e",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"config",
"[",
"'break_reconnect'",
"]",
")",
"{",
"return",
"false",
";",
"}",
"return",
"parent",
"::",
"isBreak",
"(",
"$",
"e",
")",
"|... | 是否断线
@access protected
@param PDOException|Exception $e 异常对象
@return bool | [
"是否断线"
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/coroutine/connector/Mysql.php#L25-L32 |
top-think/think-swoole | src/concerns/InteractsWithSwooleTable.php | InteractsWithSwooleTable.registerTables | protected function registerTables()
{
$tables = $this->container->make('config')->get('swoole.tables', []);
foreach ($tables as $key => $value) {
$table = new SwooleTable($value['size']);
$columns = $value['columns'] ?? [];
foreach ($columns as $column) {
... | php | protected function registerTables()
{
$tables = $this->container->make('config')->get('swoole.tables', []);
foreach ($tables as $key => $value) {
$table = new SwooleTable($value['size']);
$columns = $value['columns'] ?? [];
foreach ($columns as $column) {
... | [
"protected",
"function",
"registerTables",
"(",
")",
"{",
"$",
"tables",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'config'",
")",
"->",
"get",
"(",
"'swoole.tables'",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"tables",
"as",
"$",
... | Register user-defined swoole tables. | [
"Register",
"user",
"-",
"defined",
"swoole",
"tables",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithSwooleTable.php#L45-L63 |
top-think/think-swoole | src/concerns/InteractsWithSwooleTable.php | InteractsWithSwooleTable.bindSwooleTable | protected function bindSwooleTable()
{
$this->app->bind(Table::class, function () {
return $this->currentTable;
});
$this->app->bind('swoole.table', Table::class);
} | php | protected function bindSwooleTable()
{
$this->app->bind(Table::class, function () {
return $this->currentTable;
});
$this->app->bind('swoole.table', Table::class);
} | [
"protected",
"function",
"bindSwooleTable",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"Table",
"::",
"class",
",",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"currentTable",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",... | Bind swoole table to Laravel app container. | [
"Bind",
"swoole",
"table",
"to",
"Laravel",
"app",
"container",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/concerns/InteractsWithSwooleTable.php#L68-L75 |
top-think/think-swoole | src/Service.php | Service.createSwooleServer | protected function createSwooleServer()
{
$server = $this->isWebsocket ? WebsocketServer::class : HttpServer::class;
$config = $this->app->config;
$host = $config->get('swoole.server.host');
$port = $config->get('swoole.server.port');
$socketType = $config... | php | protected function createSwooleServer()
{
$server = $this->isWebsocket ? WebsocketServer::class : HttpServer::class;
$config = $this->app->config;
$host = $config->get('swoole.server.host');
$port = $config->get('swoole.server.port');
$socketType = $config... | [
"protected",
"function",
"createSwooleServer",
"(",
")",
"{",
"$",
"server",
"=",
"$",
"this",
"->",
"isWebsocket",
"?",
"WebsocketServer",
"::",
"class",
":",
"HttpServer",
"::",
"class",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"->",
"config",
... | Create swoole server. | [
"Create",
"swoole",
"server",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Service.php#L67-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.