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 |
|---|---|---|---|---|---|---|---|---|---|---|
simplesamlphp/saml2 | src/SAML2/Signature/PublicKeyValidator.php | PublicKeyValidator.canValidate | public function canValidate(
SignedElement $signedElement,
CertificateProvider $configuration
) : bool {
$this->configuredKeys = $this->keyLoader->extractPublicKeys($configuration);
return !!count($this->configuredKeys);
} | php | public function canValidate(
SignedElement $signedElement,
CertificateProvider $configuration
) : bool {
$this->configuredKeys = $this->keyLoader->extractPublicKeys($configuration);
return !!count($this->configuredKeys);
} | [
"public",
"function",
"canValidate",
"(",
"SignedElement",
"$",
"signedElement",
",",
"CertificateProvider",
"$",
"configuration",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"configuredKeys",
"=",
"$",
"this",
"->",
"keyLoader",
"->",
"extractPublicKeys",
"(",
"$... | @param \SAML2\SignedElement $signedElement
@param \SAML2\Configuration\CertificateProvider $configuration
@return bool | [
"@param",
"\\",
"SAML2",
"\\",
"SignedElement",
"$signedElement",
"@param",
"\\",
"SAML2",
"\\",
"Configuration",
"\\",
"CertificateProvider",
"$configuration"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Signature/PublicKeyValidator.php#L48-L55 |
simplesamlphp/saml2 | src/SAML2/Signature/PublicKeyValidator.php | PublicKeyValidator.hasValidSignature | public function hasValidSignature(
SignedElement $signedElement,
CertificateProvider $configuration
) : bool {
$logger = $this->logger;
$pemCandidates = $this->configuredKeys->filter(function (Key $key) use ($logger) {
if (!$key instanceof X509) {
$logger-... | php | public function hasValidSignature(
SignedElement $signedElement,
CertificateProvider $configuration
) : bool {
$logger = $this->logger;
$pemCandidates = $this->configuredKeys->filter(function (Key $key) use ($logger) {
if (!$key instanceof X509) {
$logger-... | [
"public",
"function",
"hasValidSignature",
"(",
"SignedElement",
"$",
"signedElement",
",",
"CertificateProvider",
"$",
"configuration",
")",
":",
"bool",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"logger",
";",
"$",
"pemCandidates",
"=",
"$",
"this",
"->",
... | @param \SAML2\SignedElement $signedElement
@param \SAML2\Configuration\CertificateProvider $configuration
@return bool | [
"@param",
"\\",
"SAML2",
"\\",
"SignedElement",
"$signedElement",
"@param",
"\\",
"SAML2",
"\\",
"Configuration",
"\\",
"CertificateProvider",
"$configuration"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Signature/PublicKeyValidator.php#L64-L84 |
simplesamlphp/saml2 | src/SAML2/DOMDocumentFactory.php | DOMDocumentFactory.fromString | public static function fromString(string $xml) : DOMDocument
{
if (trim($xml) === '') {
throw InvalidArgumentException::invalidType('non-empty string', $xml);
}
$entityLoader = libxml_disable_entity_loader(true);
$internalErrors = libxml_use_internal_errors(true);
... | php | public static function fromString(string $xml) : DOMDocument
{
if (trim($xml) === '') {
throw InvalidArgumentException::invalidType('non-empty string', $xml);
}
$entityLoader = libxml_disable_entity_loader(true);
$internalErrors = libxml_use_internal_errors(true);
... | [
"public",
"static",
"function",
"fromString",
"(",
"string",
"$",
"xml",
")",
":",
"DOMDocument",
"{",
"if",
"(",
"trim",
"(",
"$",
"xml",
")",
"===",
"''",
")",
"{",
"throw",
"InvalidArgumentException",
"::",
"invalidType",
"(",
"'non-empty string'",
",",
... | @param string $xml
@return \DOMDocument | [
"@param",
"string",
"$xml"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/DOMDocumentFactory.php#L29-L68 |
simplesamlphp/saml2 | src/SAML2/DOMDocumentFactory.php | DOMDocumentFactory.fromFile | public static function fromFile(string $file) : DOMDocument
{
if (!is_file($file)) {
throw new InvalidArgumentException(sprintf('Path "%s" is not a file', $file));
}
if (!is_readable($file)) {
throw new InvalidArgumentException(sprintf('File "%s" is not readable', $f... | php | public static function fromFile(string $file) : DOMDocument
{
if (!is_file($file)) {
throw new InvalidArgumentException(sprintf('Path "%s" is not a file', $file));
}
if (!is_readable($file)) {
throw new InvalidArgumentException(sprintf('File "%s" is not readable', $f... | [
"public",
"static",
"function",
"fromFile",
"(",
"string",
"$",
"file",
")",
":",
"DOMDocument",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Path \"%s\" is not a file'",
... | @param string $file
@return \DOMDocument | [
"@param",
"string",
"$file"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/DOMDocumentFactory.php#L76-L101 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.validateElement | public static function validateElement(DOMElement $root)
{
/* Create an XML security object. */
$objXMLSecDSig = new XMLSecurityDSig();
/* Both SAML messages and SAML assertions use the 'ID' attribute. */
$objXMLSecDSig->idKeys[] = 'ID';
/* Locate the XMLDSig Signature elem... | php | public static function validateElement(DOMElement $root)
{
/* Create an XML security object. */
$objXMLSecDSig = new XMLSecurityDSig();
/* Both SAML messages and SAML assertions use the 'ID' attribute. */
$objXMLSecDSig->idKeys[] = 'ID';
/* Locate the XMLDSig Signature elem... | [
"public",
"static",
"function",
"validateElement",
"(",
"DOMElement",
"$",
"root",
")",
"{",
"/* Create an XML security object. */",
"$",
"objXMLSecDSig",
"=",
"new",
"XMLSecurityDSig",
"(",
")",
";",
"/* Both SAML messages and SAML assertions use the 'ID' attribute. */",
"$"... | Check the Signature in a XML element.
This function expects the XML element to contain a Signature element
which contains a reference to the XML-element. This is common for both
messages and assertions.
Note that this function only validates the element itself. It does not
check this against any local keys.
If no Si... | [
"Check",
"the",
"Signature",
"in",
"a",
"XML",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L51-L111 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.castKey | public static function castKey(XMLSecurityKey $key, string $algorithm, string $type = null) : XMLSecurityKey
{
$type = $type ?: 'public';
Assert::oneOf($type, ["private", "public"]);
// do nothing if algorithm is already the type of the key
if ($key->type === $algorithm) {
... | php | public static function castKey(XMLSecurityKey $key, string $algorithm, string $type = null) : XMLSecurityKey
{
$type = $type ?: 'public';
Assert::oneOf($type, ["private", "public"]);
// do nothing if algorithm is already the type of the key
if ($key->type === $algorithm) {
... | [
"public",
"static",
"function",
"castKey",
"(",
"XMLSecurityKey",
"$",
"key",
",",
"string",
"$",
"algorithm",
",",
"string",
"$",
"type",
"=",
"null",
")",
":",
"XMLSecurityKey",
"{",
"$",
"type",
"=",
"$",
"type",
"?",
":",
"'public'",
";",
"Assert",
... | Helper function to convert a XMLSecurityKey to the correct algorithm.
@param XMLSecurityKey $key The key.
@param string $algorithm The desired algorithm.
@param string $type Public or private key, defaults to public.
@return XMLSecurityKey The new key. | [
"Helper",
"function",
"to",
"convert",
"a",
"XMLSecurityKey",
"to",
"the",
"correct",
"algorithm",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L122-L154 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.validateSignature | public static function validateSignature(array $info, XMLSecurityKey $key) : void
{
Assert::keyExists($info, "Signature");
/** @var XMLSecurityDSig $objXMLSecDSig */
$objXMLSecDSig = $info['Signature'];
/**
* @var \DOMElement[] $sigMethod
* @var \DOMElemen... | php | public static function validateSignature(array $info, XMLSecurityKey $key) : void
{
Assert::keyExists($info, "Signature");
/** @var XMLSecurityDSig $objXMLSecDSig */
$objXMLSecDSig = $info['Signature'];
/**
* @var \DOMElement[] $sigMethod
* @var \DOMElemen... | [
"public",
"static",
"function",
"validateSignature",
"(",
"array",
"$",
"info",
",",
"XMLSecurityKey",
"$",
"key",
")",
":",
"void",
"{",
"Assert",
"::",
"keyExists",
"(",
"$",
"info",
",",
"\"Signature\"",
")",
";",
"/** @var XMLSecurityDSig $objXMLSecDSig */",
... | Check a signature against a key.
An exception is thrown if we are unable to validate the signature.
@param array $info The information returned by the validateElement() function.
@param XMLSecurityKey $key The publickey that should validate the Signature object.
@throws \Exception
@return void | [
"Check",
"a",
"signature",
"against",
"a",
"key",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L167-L196 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.xpQuery | public static function xpQuery(DOMNode $node, string $query) : array
{
static $xpCache = null;
if ($node instanceof DOMDocument) {
$doc = $node;
} else {
$doc = $node->ownerDocument;
}
if ($xpCache === null || !$xpCache->document->isSameNode($doc)) {... | php | public static function xpQuery(DOMNode $node, string $query) : array
{
static $xpCache = null;
if ($node instanceof DOMDocument) {
$doc = $node;
} else {
$doc = $node->ownerDocument;
}
if ($xpCache === null || !$xpCache->document->isSameNode($doc)) {... | [
"public",
"static",
"function",
"xpQuery",
"(",
"DOMNode",
"$",
"node",
",",
"string",
"$",
"query",
")",
":",
"array",
"{",
"static",
"$",
"xpCache",
"=",
"null",
";",
"if",
"(",
"$",
"node",
"instanceof",
"DOMDocument",
")",
"{",
"$",
"doc",
"=",
"... | Do an XPath query on an XML node.
@param \DOMNode $node The XML node.
@param string $query The query.
@return \DOMNode[] Array with matching DOM nodes. | [
"Do",
"an",
"XPath",
"query",
"on",
"an",
"XML",
"node",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L206-L233 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.copyElement | public static function copyElement(DOMElement $element, DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$document = DOMDocumentFactory::create();
} else {
$document = $parent->ownerDocument;
}
$namespaces = [];
for ($e = $element; $e... | php | public static function copyElement(DOMElement $element, DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$document = DOMDocumentFactory::create();
} else {
$document = $parent->ownerDocument;
}
$namespaces = [];
for ($e = $element; $e... | [
"public",
"static",
"function",
"copyElement",
"(",
"DOMElement",
"$",
"element",
",",
"DOMElement",
"$",
"parent",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"$",
"parent",
"===",
"null",
")",
"{",
"$",
"document",
"=",
"DOMDocumentFactory",
"::... | Make an exact copy the specific \DOMElement.
@param \DOMElement $element The element we should copy.
@param \DOMElement|null $parent The target parent element.
@return \DOMElement The copied element. | [
"Make",
"an",
"exact",
"copy",
"the",
"specific",
"\\",
"DOMElement",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L243-L278 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.parseBoolean | public static function parseBoolean(DOMElement $node, string $attributeName, $default = null)
{
if (!$node->hasAttribute($attributeName)) {
return $default;
}
$value = $node->getAttribute($attributeName);
switch (strtolower($value)) {
case '0':
cas... | php | public static function parseBoolean(DOMElement $node, string $attributeName, $default = null)
{
if (!$node->hasAttribute($attributeName)) {
return $default;
}
$value = $node->getAttribute($attributeName);
switch (strtolower($value)) {
case '0':
cas... | [
"public",
"static",
"function",
"parseBoolean",
"(",
"DOMElement",
"$",
"node",
",",
"string",
"$",
"attributeName",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"->",
"hasAttribute",
"(",
"$",
"attributeName",
")",
")",
"{",
... | Parse a boolean attribute.
@param \DOMElement $node The element we should fetch the attribute from.
@param string $attributeName The name of the attribute.
@param mixed|null $default The value that should be returned if the attribute doesn't exist.
@return bool|mixed The value of the attribute, or $default if the attr... | [
"Parse",
"a",
"boolean",
"attribute",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L289-L306 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.insertSignature | public static function insertSignature(
XMLSecurityKey $key,
array $certificates,
DOMElement $root,
DOMNode $insertBefore = null
) : void {
$objXMLSecDSig = new XMLSecurityDSig();
$objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
switch ($key->ty... | php | public static function insertSignature(
XMLSecurityKey $key,
array $certificates,
DOMElement $root,
DOMNode $insertBefore = null
) : void {
$objXMLSecDSig = new XMLSecurityDSig();
$objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
switch ($key->ty... | [
"public",
"static",
"function",
"insertSignature",
"(",
"XMLSecurityKey",
"$",
"key",
",",
"array",
"$",
"certificates",
",",
"DOMElement",
"$",
"root",
",",
"DOMNode",
"$",
"insertBefore",
"=",
"null",
")",
":",
"void",
"{",
"$",
"objXMLSecDSig",
"=",
"new"... | Insert a Signature node.
@param XMLSecurityKey $key The key we should use to sign the message.
@param array $certificates The certificates we should add to the signature node.
@param \DOMElement $root The XML node we should sign.
@param \DOMNode $insertBefore The XML element we should insert the signature element bef... | [
"Insert",
"a",
"Signature",
"node",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L318-L355 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.doDecryptElement | private static function doDecryptElement(DOMElement $encryptedData, XMLSecurityKey $inputKey, array &$blacklist) : DOMElement
{
$enc = new XMLSecEnc();
$enc->setNode($encryptedData);
$enc->type = $encryptedData->getAttribute("Type");
$symmetricKey = $enc->locateKey($encryptedData);... | php | private static function doDecryptElement(DOMElement $encryptedData, XMLSecurityKey $inputKey, array &$blacklist) : DOMElement
{
$enc = new XMLSecEnc();
$enc->setNode($encryptedData);
$enc->type = $encryptedData->getAttribute("Type");
$symmetricKey = $enc->locateKey($encryptedData);... | [
"private",
"static",
"function",
"doDecryptElement",
"(",
"DOMElement",
"$",
"encryptedData",
",",
"XMLSecurityKey",
"$",
"inputKey",
",",
"array",
"&",
"$",
"blacklist",
")",
":",
"DOMElement",
"{",
"$",
"enc",
"=",
"new",
"XMLSecEnc",
"(",
")",
";",
"$",
... | Decrypt an encrypted element.
This is an internal helper function.
@param \DOMElement $encryptedData The encrypted data.
@param XMLSecurityKey $inputKey The decryption key.
@param array &$blacklist Blacklisted decryption algorithms.
@throws \Exception
@return \DOMElement The decrypted element. | [
"Decrypt",
"an",
"encrypted",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L369-L511 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.decryptElement | public static function decryptElement(DOMElement $encryptedData, XMLSecurityKey $inputKey, array $blacklist = []) : DOMElement
{
try {
return self::doDecryptElement($encryptedData, $inputKey, $blacklist);
} catch (\Exception $e) {
/*
* Something went wrong during... | php | public static function decryptElement(DOMElement $encryptedData, XMLSecurityKey $inputKey, array $blacklist = []) : DOMElement
{
try {
return self::doDecryptElement($encryptedData, $inputKey, $blacklist);
} catch (\Exception $e) {
/*
* Something went wrong during... | [
"public",
"static",
"function",
"decryptElement",
"(",
"DOMElement",
"$",
"encryptedData",
",",
"XMLSecurityKey",
"$",
"inputKey",
",",
"array",
"$",
"blacklist",
"=",
"[",
"]",
")",
":",
"DOMElement",
"{",
"try",
"{",
"return",
"self",
"::",
"doDecryptElement... | Decrypt an encrypted element.
@param \DOMElement $encryptedData The encrypted data.
@param XMLSecurityKey $inputKey The decryption key.
@param array $blacklist Blacklisted decryption algorithms.
@throws \Exception
@return \DOMElement The decrypted element. | [
"Decrypt",
"an",
"encrypted",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L523-L535 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.extractLocalizedStrings | public static function extractLocalizedStrings(\DOMElement $parent, string $namespaceURI, string $localName) : array
{
$ret = [];
foreach ($parent->childNodes as $node) {
if ($node->namespaceURI !== $namespaceURI || $node->localName !== $localName) {
continue;
... | php | public static function extractLocalizedStrings(\DOMElement $parent, string $namespaceURI, string $localName) : array
{
$ret = [];
foreach ($parent->childNodes as $node) {
if ($node->namespaceURI !== $namespaceURI || $node->localName !== $localName) {
continue;
... | [
"public",
"static",
"function",
"extractLocalizedStrings",
"(",
"\\",
"DOMElement",
"$",
"parent",
",",
"string",
"$",
"namespaceURI",
",",
"string",
"$",
"localName",
")",
":",
"array",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parent",
... | Extract localized strings from a set of nodes.
@param \DOMElement $parent The element that contains the localized strings.
@param string $namespaceURI The namespace URI the localized strings should have.
@param string $localName The localName of the localized strings.
@return array Localized strings. | [
"Extract",
"localized",
"strings",
"from",
"a",
"set",
"of",
"nodes",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L546-L565 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.extractStrings | public static function extractStrings(DOMElement $parent, string $namespaceURI, string $localName) : array
{
$ret = [];
foreach ($parent->childNodes as $node) {
if ($node->namespaceURI !== $namespaceURI || $node->localName !== $localName) {
continue;
}
... | php | public static function extractStrings(DOMElement $parent, string $namespaceURI, string $localName) : array
{
$ret = [];
foreach ($parent->childNodes as $node) {
if ($node->namespaceURI !== $namespaceURI || $node->localName !== $localName) {
continue;
}
... | [
"public",
"static",
"function",
"extractStrings",
"(",
"DOMElement",
"$",
"parent",
",",
"string",
"$",
"namespaceURI",
",",
"string",
"$",
"localName",
")",
":",
"array",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parent",
"->",
"childNo... | Extract strings from a set of nodes.
@param \DOMElement $parent The element that contains the localized strings.
@param string $namespaceURI The namespace URI the string elements should have.
@param string $localName The localName of the string elements.
@return array The string values of the various nodes. | [
"Extract",
"strings",
"from",
"a",
"set",
"of",
"nodes",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L576-L587 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.addString | public static function addString(
DOMElement $parent,
string $namespace,
string $name,
string $value
) : DOMElement {
$doc = $parent->ownerDocument;
$n = $doc->createElementNS($namespace, $name);
$n->appendChild($doc->createTextNode($value));
$parent-... | php | public static function addString(
DOMElement $parent,
string $namespace,
string $name,
string $value
) : DOMElement {
$doc = $parent->ownerDocument;
$n = $doc->createElementNS($namespace, $name);
$n->appendChild($doc->createTextNode($value));
$parent-... | [
"public",
"static",
"function",
"addString",
"(",
"DOMElement",
"$",
"parent",
",",
"string",
"$",
"namespace",
",",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
":",
"DOMElement",
"{",
"$",
"doc",
"=",
"$",
"parent",
"->",
"ownerDocument",
"... | Append string element.
@param \DOMElement $parent The parent element we should append the new nodes to.
@param string $namespace The namespace of the created element.
@param string $name The name of the created element.
@param string $value The value of the element.
@return \DOMElement The generated element. | [
"Append",
"string",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L599-L612 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.addStrings | public static function addStrings(
DOMElement $parent,
string $namespace,
string $name,
bool $localized,
array $values
) : void {
$doc = $parent->ownerDocument;
foreach ($values as $index => $value) {
$n = $doc->createElementNS($namespace, $name);... | php | public static function addStrings(
DOMElement $parent,
string $namespace,
string $name,
bool $localized,
array $values
) : void {
$doc = $parent->ownerDocument;
foreach ($values as $index => $value) {
$n = $doc->createElementNS($namespace, $name);... | [
"public",
"static",
"function",
"addStrings",
"(",
"DOMElement",
"$",
"parent",
",",
"string",
"$",
"namespace",
",",
"string",
"$",
"name",
",",
"bool",
"$",
"localized",
",",
"array",
"$",
"values",
")",
":",
"void",
"{",
"$",
"doc",
"=",
"$",
"paren... | Append string elements.
@param \DOMElement $parent The parent element we should append the new nodes to.
@param string $namespace The namespace of the created elements
@param string $name The name of the created elements
@param bool $localized Whether the strings are localized, and should include the xml:lang attribut... | [
"Append",
"string",
"elements",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L625-L642 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.createKeyDescriptor | public static function createKeyDescriptor(string $x509Data) : KeyDescriptor
{
$x509Certificate = new X509Certificate();
$x509Certificate->setCertificate($x509Data);
$x509Data = new X509Data();
$x509Data->addData($x509Certificate);
$keyInfo = new KeyInfo();
$keyInfo... | php | public static function createKeyDescriptor(string $x509Data) : KeyDescriptor
{
$x509Certificate = new X509Certificate();
$x509Certificate->setCertificate($x509Data);
$x509Data = new X509Data();
$x509Data->addData($x509Certificate);
$keyInfo = new KeyInfo();
$keyInfo... | [
"public",
"static",
"function",
"createKeyDescriptor",
"(",
"string",
"$",
"x509Data",
")",
":",
"KeyDescriptor",
"{",
"$",
"x509Certificate",
"=",
"new",
"X509Certificate",
"(",
")",
";",
"$",
"x509Certificate",
"->",
"setCertificate",
"(",
"$",
"x509Data",
")"... | Create a KeyDescriptor with the given certificate.
@param string $x509Data The certificate, as a base64-encoded DER data.
@return \SAML2\XML\md\KeyDescriptor The keydescriptor. | [
"Create",
"a",
"KeyDescriptor",
"with",
"the",
"given",
"certificate",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L651-L666 |
simplesamlphp/saml2 | src/SAML2/Utils.php | Utils.xsDateTimeToTimestamp | public static function xsDateTimeToTimestamp(string $time) : int
{
$matches = [];
// We use a very strict regex to parse the timestamp.
$regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d{1,9})?Z$/D';
if (preg_match($regex, $time, $matches) == 0) {
... | php | public static function xsDateTimeToTimestamp(string $time) : int
{
$matches = [];
// We use a very strict regex to parse the timestamp.
$regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d{1,9})?Z$/D';
if (preg_match($regex, $time, $matches) == 0) {
... | [
"public",
"static",
"function",
"xsDateTimeToTimestamp",
"(",
"string",
"$",
"time",
")",
":",
"int",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"// We use a very strict regex to parse the timestamp.",
"$",
"regex",
"=",
"'/^(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d)-(\\\\d\\\\d)T... | This function converts a SAML2 timestamp on the form
yyyy-mm-ddThh:mm:ss(\.s+)?Z to a UNIX timestamp. The sub-second
part is ignored.
Andreas comments:
I got this timestamp from Shibboleth 1.3 IdP: 2008-01-17T11:28:03.577Z
Therefore I added to possibility to have microseconds to the format.
Added: (\.\\d{1,3})? to the... | [
"This",
"function",
"converts",
"a",
"SAML2",
"timestamp",
"on",
"the",
"form",
"yyyy",
"-",
"mm",
"-",
"ddThh",
":",
"mm",
":",
"ss",
"(",
"\\",
".",
"s",
"+",
")",
"?Z",
"to",
"a",
"UNIX",
"timestamp",
".",
"The",
"sub",
"-",
"second",
"part",
... | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Utils.php#L688-L714 |
simplesamlphp/saml2 | src/SAML2/XML/mdui/Keywords.php | Keywords.toXML | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->lang, "Cannot convert Keywords to XML without a language set.");
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Common::NS, 'mdui:Keywords');
$e->setAttribute('xml:lang', $this->lang);
... | php | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->lang, "Cannot convert Keywords to XML without a language set.");
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Common::NS, 'mdui:Keywords');
$e->setAttribute('xml:lang', $this->lang);
... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"Assert",
"::",
"notEmpty",
"(",
"$",
"this",
"->",
"lang",
",",
"\"Cannot convert Keywords to XML without a language set.\"",
")",
";",
"$",
"doc",
"=",
"$",
"parent",... | Convert this Keywords to XML.
@param \DOMElement $parent The element we should append this Keywords to.
@throws \Exception
@return \DOMElement | [
"Convert",
"this",
"Keywords",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/mdui/Keywords.php#L125-L145 |
simplesamlphp/saml2 | src/SAML2/XML/mdui/UIInfo.php | UIInfo.toXML | public function toXML(DOMElement $parent) : ?DOMElement
{
$e = null;
if (!empty($this->DisplayName)
|| !empty($this->Description)
|| !empty($this->InformationURL)
|| !empty($this->PrivacyStatementURL)
|| !empty($this->Keywords)
|| !empty($this->Logo)
... | php | public function toXML(DOMElement $parent) : ?DOMElement
{
$e = null;
if (!empty($this->DisplayName)
|| !empty($this->Description)
|| !empty($this->InformationURL)
|| !empty($this->PrivacyStatementURL)
|| !empty($this->Keywords)
|| !empty($this->Logo)
... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"?",
"DOMElement",
"{",
"$",
"e",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"DisplayName",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"Descrip... | Convert this UIInfo to XML.
@param \DOMElement $parent The element we should append to.
@return \DOMElement|null | [
"Convert",
"this",
"UIInfo",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/mdui/UIInfo.php#L308-L343 |
simplesamlphp/saml2 | src/SAML2/Compat/MockContainer.php | MockContainer.redirect | public function redirect(string $url, array $data = []) : void
{
$this->redirectUrl = $url;
$this->redirectData = $data;
} | php | public function redirect(string $url, array $data = []) : void
{
$this->redirectUrl = $url;
$this->redirectData = $data;
} | [
"public",
"function",
"redirect",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
":",
"void",
"{",
"$",
"this",
"->",
"redirectUrl",
"=",
"$",
"url",
";",
"$",
"this",
"->",
"redirectData",
"=",
"$",
"data",
";",
"}"
] | Trigger the user to perform a GET to the given URL with the given data.
@param string $url
@param array $data
@return void | [
"Trigger",
"the",
"user",
"to",
"perform",
"a",
"GET",
"to",
"the",
"given",
"URL",
"with",
"the",
"given",
"data",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Compat/MockContainer.php#L92-L96 |
simplesamlphp/saml2 | src/SAML2/Compat/MockContainer.php | MockContainer.postRedirect | public function postRedirect(string $url = null, array $data = []) : void
{
$this->postRedirectUrl = $url;
$this->postRedirectData = $data;
} | php | public function postRedirect(string $url = null, array $data = []) : void
{
$this->postRedirectUrl = $url;
$this->postRedirectData = $data;
} | [
"public",
"function",
"postRedirect",
"(",
"string",
"$",
"url",
"=",
"null",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
":",
"void",
"{",
"$",
"this",
"->",
"postRedirectUrl",
"=",
"$",
"url",
";",
"$",
"this",
"->",
"postRedirectData",
"=",
"$"... | Trigger the user to perform a POST to the given URL with the given data.
@param string|null $url
@param array $data
@return void | [
"Trigger",
"the",
"user",
"to",
"perform",
"a",
"POST",
"to",
"the",
"given",
"URL",
"with",
"the",
"given",
"data",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Compat/MockContainer.php#L106-L110 |
simplesamlphp/saml2 | src/SAML2/XML/md/RoleDescriptor.php | RoleDescriptor.setErrorURL | public function setErrorURL(string $errorURL = null) : void
{
if (!is_null($errorURL) && !filter_var($errorURL, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException('RoleDescriptor errorURL is not a valid URL.');
}
$this->errorURL = $errorURL;
} | php | public function setErrorURL(string $errorURL = null) : void
{
if (!is_null($errorURL) && !filter_var($errorURL, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException('RoleDescriptor errorURL is not a valid URL.');
}
$this->errorURL = $errorURL;
} | [
"public",
"function",
"setErrorURL",
"(",
"string",
"$",
"errorURL",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"errorURL",
")",
"&&",
"!",
"filter_var",
"(",
"$",
"errorURL",
",",
"FILTER_VALIDATE_URL",
")",
")",
"{",
"th... | Set the value of the errorURL property.
@param string|null $errorURL
@return void | [
"Set",
"the",
"value",
"of",
"the",
"errorURL",
"property",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/RoleDescriptor.php#L247-L253 |
simplesamlphp/saml2 | src/SAML2/XML/md/RoleDescriptor.php | RoleDescriptor.toXML | protected function toXML(DOMElement $parent) : DOMElement
{
$e = $parent->ownerDocument->createElementNS(Constants::NS_MD, $this->elementName);
$parent->appendChild($e);
if ($this->ID !== null) {
$e->setAttribute('ID', $this->ID);
}
if ($this->validUntil !== nul... | php | protected function toXML(DOMElement $parent) : DOMElement
{
$e = $parent->ownerDocument->createElementNS(Constants::NS_MD, $this->elementName);
$parent->appendChild($e);
if ($this->ID !== null) {
$e->setAttribute('ID', $this->ID);
}
if ($this->validUntil !== nul... | [
"protected",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"$",
"e",
"=",
"$",
"parent",
"->",
"ownerDocument",
"->",
"createElementNS",
"(",
"Constants",
"::",
"NS_MD",
",",
"$",
"this",
"->",
"elementName",
")",
";",... | Add this RoleDescriptor to an EntityDescriptor.
@param \DOMElement $parent The EntityDescriptor we should append this endpoint to.
@return \DOMElement | [
"Add",
"this",
"RoleDescriptor",
"to",
"an",
"EntityDescriptor",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/RoleDescriptor.php#L401-L439 |
simplesamlphp/saml2 | src/SAML2/XML/md/AffiliationDescriptor.php | AffiliationDescriptor.toXML | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->AffiliateMember);
$e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:AffiliationDescriptor');
$parent->appendChild($e);
$e->setAttribute('affiliationOwnerID', $this->affiliationOwnerID)... | php | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->AffiliateMember);
$e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:AffiliationDescriptor');
$parent->appendChild($e);
$e->setAttribute('affiliationOwnerID', $this->affiliationOwnerID)... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"Assert",
"::",
"notEmpty",
"(",
"$",
"this",
"->",
"AffiliateMember",
")",
";",
"$",
"e",
"=",
"$",
"parent",
"->",
"ownerDocument",
"->",
"createElementNS",
"("... | Add this AffiliationDescriptor to an EntityDescriptor.
@param \DOMElement $parent The EntityDescriptor we should append this endpoint to.
@return \DOMElement | [
"Add",
"this",
"AffiliationDescriptor",
"to",
"an",
"EntityDescriptor",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/md/AffiliationDescriptor.php#L253-L285 |
simplesamlphp/saml2 | src/SAML2/XML/shibmd/Scope.php | Scope.toXML | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->scope);
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Scope::NS, 'shibmd:Scope');
$parent->appendChild($e);
$e->appendChild($doc->createTextNode($this->scope));
if ($this-... | php | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->scope);
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Scope::NS, 'shibmd:Scope');
$parent->appendChild($e);
$e->appendChild($doc->createTextNode($this->scope));
if ($this-... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"Assert",
"::",
"notEmpty",
"(",
"$",
"this",
"->",
"scope",
")",
";",
"$",
"doc",
"=",
"$",
"parent",
"->",
"ownerDocument",
";",
"$",
"e",
"=",
"$",
"doc"... | Convert this Scope to XML.
@param \DOMElement $parent The element we should append this Scope to.
@return \DOMElement | [
"Convert",
"this",
"Scope",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/shibmd/Scope.php#L108-L126 |
simplesamlphp/saml2 | src/SAML2/SOAPClient.php | SOAPClient.send | public function send(Message $msg, Configuration $srcMetadata, Configuration $dstMetadata = null) : Message
{
$issuer = $msg->getIssuer();
$ctxOpts = [
'ssl' => [
'capture_peer_cert' => true,
'allow_self_signed' => true
],
];
... | php | public function send(Message $msg, Configuration $srcMetadata, Configuration $dstMetadata = null) : Message
{
$issuer = $msg->getIssuer();
$ctxOpts = [
'ssl' => [
'capture_peer_cert' => true,
'allow_self_signed' => true
],
];
... | [
"public",
"function",
"send",
"(",
"Message",
"$",
"msg",
",",
"Configuration",
"$",
"srcMetadata",
",",
"Configuration",
"$",
"dstMetadata",
"=",
"null",
")",
":",
"Message",
"{",
"$",
"issuer",
"=",
"$",
"msg",
"->",
"getIssuer",
"(",
")",
";",
"$",
... | This function sends the SOAP message to the service location and returns SOAP response
@param \SAML2\Message $msg The request that should be sent.
@param \SimpleSAML\Configuration $srcMetadata The metadata of the issuer of the message.
@param \SimpleSAML\Configuration $dstMetadata The metadata of the destination of th... | [
"This",
"function",
"sends",
"the",
"SOAP",
"message",
"to",
"the",
"service",
"location",
"and",
"returns",
"SOAP",
"response"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SOAPClient.php#L41-L170 |
simplesamlphp/saml2 | src/SAML2/SOAPClient.php | SOAPClient.addSSLValidator | private static function addSSLValidator(Message $msg, $context) : void
{
$options = stream_context_get_options($context);
if (!isset($options['ssl']['peer_certificate'])) {
return;
}
$container = ContainerSingleton::getInstance();
$key = openssl_pkey_get_public($... | php | private static function addSSLValidator(Message $msg, $context) : void
{
$options = stream_context_get_options($context);
if (!isset($options['ssl']['peer_certificate'])) {
return;
}
$container = ContainerSingleton::getInstance();
$key = openssl_pkey_get_public($... | [
"private",
"static",
"function",
"addSSLValidator",
"(",
"Message",
"$",
"msg",
",",
"$",
"context",
")",
":",
"void",
"{",
"$",
"options",
"=",
"stream_context_get_options",
"(",
"$",
"context",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[... | Add a signature validator based on a SSL context.
@param \SAML2\Message $msg The message we should add a validator to.
@param resource $context The stream context.
@return void | [
"Add",
"a",
"signature",
"validator",
"based",
"on",
"a",
"SSL",
"context",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SOAPClient.php#L180-L209 |
simplesamlphp/saml2 | src/SAML2/SOAPClient.php | SOAPClient.validateSSL | public static function validateSSL(string $data, XMLSecurityKey $key) : void
{
$container = ContainerSingleton::getInstance();
$keyInfo = openssl_pkey_get_details($key->key);
if ($keyInfo === false) {
throw new \Exception('Unable to get key details from XMLSecurityKey.');
... | php | public static function validateSSL(string $data, XMLSecurityKey $key) : void
{
$container = ContainerSingleton::getInstance();
$keyInfo = openssl_pkey_get_details($key->key);
if ($keyInfo === false) {
throw new \Exception('Unable to get key details from XMLSecurityKey.');
... | [
"public",
"static",
"function",
"validateSSL",
"(",
"string",
"$",
"data",
",",
"XMLSecurityKey",
"$",
"key",
")",
":",
"void",
"{",
"$",
"container",
"=",
"ContainerSingleton",
"::",
"getInstance",
"(",
")",
";",
"$",
"keyInfo",
"=",
"openssl_pkey_get_details... | Validate a SOAP message against the certificate on the SSL connection.
@param string $data The public key that was used on the connection.
@param XMLSecurityKey $key The key we should validate the certificate against.
@throws \Exception
@return void | [
"Validate",
"a",
"SOAP",
"message",
"against",
"the",
"certificate",
"on",
"the",
"SSL",
"connection",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SOAPClient.php#L220-L239 |
simplesamlphp/saml2 | src/SAML2/SOAPClient.php | SOAPClient.getSOAPFault | private function getSOAPFault(DOMDocument $soapMessage) : ?string
{
$soapFault = Utils::xpQuery($soapMessage->firstChild, '/soap-env:Envelope/soap-env:Body/soap-env:Fault');
if (empty($soapFault)) {
/* No fault. */
return null;
}
$soapFaultElement = $soapFau... | php | private function getSOAPFault(DOMDocument $soapMessage) : ?string
{
$soapFault = Utils::xpQuery($soapMessage->firstChild, '/soap-env:Envelope/soap-env:Body/soap-env:Fault');
if (empty($soapFault)) {
/* No fault. */
return null;
}
$soapFaultElement = $soapFau... | [
"private",
"function",
"getSOAPFault",
"(",
"DOMDocument",
"$",
"soapMessage",
")",
":",
"?",
"string",
"{",
"$",
"soapFault",
"=",
"Utils",
"::",
"xpQuery",
"(",
"$",
"soapMessage",
"->",
"firstChild",
",",
"'/soap-env:Envelope/soap-env:Body/soap-env:Fault'",
")",
... | Extracts the SOAP Fault from SOAP message
@param \DOMDocument $soapMessage Soap response needs to be type DOMDocument
@return string|null $soapfaultstring | [
"Extracts",
"the",
"SOAP",
"Fault",
"from",
"SOAP",
"message"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SOAPClient.php#L248-L267 |
simplesamlphp/saml2 | src/SAML2/Configuration/SimpleSAMLConverter.php | SimpleSAMLConverter.convertToIdentityProvider | public static function convertToIdentityProvider(
Configuration $configuration,
string $certificatePrefix = ''
) : IdentityProvider {
$pluckedConfiguration = static::pluckConfiguration($configuration, $certificatePrefix);
static::enrichForDecryptionProvider($configuration, $pluckedCo... | php | public static function convertToIdentityProvider(
Configuration $configuration,
string $certificatePrefix = ''
) : IdentityProvider {
$pluckedConfiguration = static::pluckConfiguration($configuration, $certificatePrefix);
static::enrichForDecryptionProvider($configuration, $pluckedCo... | [
"public",
"static",
"function",
"convertToIdentityProvider",
"(",
"Configuration",
"$",
"configuration",
",",
"string",
"$",
"certificatePrefix",
"=",
"''",
")",
":",
"IdentityProvider",
"{",
"$",
"pluckedConfiguration",
"=",
"static",
"::",
"pluckConfiguration",
"(",... | @param \SimpleSAML\Configuration $configuration
@param string $certificatePrefix
@return \SAML2\Configuration\IdentityProvider
@psalm-suppress UndefinedClass | [
"@param",
"\\",
"SimpleSAML",
"\\",
"Configuration",
"$configuration",
"@param",
"string",
"$certificatePrefix"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Configuration/SimpleSAMLConverter.php#L22-L31 |
simplesamlphp/saml2 | src/SAML2/Configuration/SimpleSAMLConverter.php | SimpleSAMLConverter.convertToServiceProvider | public static function convertToServiceProvider(
Configuration $configuration,
string $certificatePrefix = ''
) : ServiceProvider {
$pluckedConfiguration = static::pluckConfiguration($configuration, $certificatePrefix);
static::enrichForServiceProvider($configuration, $pluckedConfigu... | php | public static function convertToServiceProvider(
Configuration $configuration,
string $certificatePrefix = ''
) : ServiceProvider {
$pluckedConfiguration = static::pluckConfiguration($configuration, $certificatePrefix);
static::enrichForServiceProvider($configuration, $pluckedConfigu... | [
"public",
"static",
"function",
"convertToServiceProvider",
"(",
"Configuration",
"$",
"configuration",
",",
"string",
"$",
"certificatePrefix",
"=",
"''",
")",
":",
"ServiceProvider",
"{",
"$",
"pluckedConfiguration",
"=",
"static",
"::",
"pluckConfiguration",
"(",
... | @param \SimpleSAML\Configuration $configuration
@param string $certificatePrefix
@return \SAML2\Configuration\ServiceProvider
@psalm-suppress UndefinedClass | [
"@param",
"\\",
"SimpleSAML",
"\\",
"Configuration",
"$configuration",
"@param",
"string",
"$certificatePrefix"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Configuration/SimpleSAMLConverter.php#L42-L51 |
simplesamlphp/saml2 | src/SAML2/Configuration/SimpleSAMLConverter.php | SimpleSAMLConverter.pluckConfiguration | protected static function pluckConfiguration(Configuration $configuration, string $prefix = '') : array
{
$extracted = [];
// ported from
// https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1092
if ($confi... | php | protected static function pluckConfiguration(Configuration $configuration, string $prefix = '') : array
{
$extracted = [];
// ported from
// https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1092
if ($confi... | [
"protected",
"static",
"function",
"pluckConfiguration",
"(",
"Configuration",
"$",
"configuration",
",",
"string",
"$",
"prefix",
"=",
"''",
")",
":",
"array",
"{",
"$",
"extracted",
"=",
"[",
"]",
";",
"// ported from",
"// https://github.com/simplesamlphp/simples... | @param \SimpleSAML\Configuration $configuration
@param string $prefix
@return array
@psalm-suppress UndefinedClass | [
"@param",
"\\",
"SimpleSAML",
"\\",
"Configuration",
"$configuration",
"@param",
"string",
"$prefix"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Configuration/SimpleSAMLConverter.php#L62-L91 |
simplesamlphp/saml2 | src/SAML2/Configuration/SimpleSAMLConverter.php | SimpleSAMLConverter.enrichForIdentityProvider | protected static function enrichForIdentityProvider(Configuration $configuration, array &$baseConfiguration) : void
{
$baseConfiguration['base64EncodedAttributes'] = $configuration->getBoolean('base64attributes', false);
$baseConfiguration['entityId'] = $configuration->getString('entityid');
} | php | protected static function enrichForIdentityProvider(Configuration $configuration, array &$baseConfiguration) : void
{
$baseConfiguration['base64EncodedAttributes'] = $configuration->getBoolean('base64attributes', false);
$baseConfiguration['entityId'] = $configuration->getString('entityid');
} | [
"protected",
"static",
"function",
"enrichForIdentityProvider",
"(",
"Configuration",
"$",
"configuration",
",",
"array",
"&",
"$",
"baseConfiguration",
")",
":",
"void",
"{",
"$",
"baseConfiguration",
"[",
"'base64EncodedAttributes'",
"]",
"=",
"$",
"configuration",
... | @param \SimpleSAML\Configuration $configuration
@param array $baseConfiguration
@return void
@psalm-suppress UndefinedClass | [
"@param",
"\\",
"SimpleSAML",
"\\",
"Configuration",
"$configuration",
"@param",
"array",
"$baseConfiguration"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Configuration/SimpleSAMLConverter.php#L102-L106 |
simplesamlphp/saml2 | src/SAML2/Configuration/SimpleSAMLConverter.php | SimpleSAMLConverter.enrichForDecryptionProvider | protected static function enrichForDecryptionProvider(
Configuration $configuration,
array &$baseConfiguration
) : void {
if ($configuration->hasValue('sharedKey')) {
$baseConfiguration['sharedKey'] = $configuration->getString('sharedKey', null);
}
if ($configura... | php | protected static function enrichForDecryptionProvider(
Configuration $configuration,
array &$baseConfiguration
) : void {
if ($configuration->hasValue('sharedKey')) {
$baseConfiguration['sharedKey'] = $configuration->getString('sharedKey', null);
}
if ($configura... | [
"protected",
"static",
"function",
"enrichForDecryptionProvider",
"(",
"Configuration",
"$",
"configuration",
",",
"array",
"&",
"$",
"baseConfiguration",
")",
":",
"void",
"{",
"if",
"(",
"$",
"configuration",
"->",
"hasValue",
"(",
"'sharedKey'",
")",
")",
"{"... | @param \SimpleSAML\Configuration $configuration
@param array $baseConfiguration
@return void
@psalm-suppress UndefinedClass | [
"@param",
"\\",
"SimpleSAML",
"\\",
"Configuration",
"$configuration",
"@param",
"array",
"$baseConfiguration"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/Configuration/SimpleSAMLConverter.php#L131-L159 |
simplesamlphp/saml2 | src/SAML2/EncryptedAssertion.php | EncryptedAssertion.setAssertion | public function setAssertion(Assertion $assertion, XMLSecurityKey $key) : void
{
$xml = $assertion->toXML();
Utils::getContainer()->debugMessage($xml, 'encrypt');
$enc = new XMLSecEnc();
$enc->setNode($xml);
$enc->type = XMLSecEnc::Element;
switch ($key->type) {
... | php | public function setAssertion(Assertion $assertion, XMLSecurityKey $key) : void
{
$xml = $assertion->toXML();
Utils::getContainer()->debugMessage($xml, 'encrypt');
$enc = new XMLSecEnc();
$enc->setNode($xml);
$enc->type = XMLSecEnc::Element;
switch ($key->type) {
... | [
"public",
"function",
"setAssertion",
"(",
"Assertion",
"$",
"assertion",
",",
"XMLSecurityKey",
"$",
"key",
")",
":",
"void",
"{",
"$",
"xml",
"=",
"$",
"assertion",
"->",
"toXML",
"(",
")",
";",
"Utils",
"::",
"getContainer",
"(",
")",
"->",
"debugMess... | Set the assertion.
@param \SAML2\Assertion $assertion The assertion.
@param XMLSecurityKey $key The key we should use to encrypt the assertion.
@throws \Exception
@return void | [
"Set",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/EncryptedAssertion.php#L71-L107 |
simplesamlphp/saml2 | src/SAML2/EncryptedAssertion.php | EncryptedAssertion.getAssertion | public function getAssertion(XMLSecurityKey $inputKey, array $blacklist = []) : Assertion
{
$assertionXML = Utils::decryptElement($this->encryptedData, $inputKey, $blacklist);
Utils::getContainer()->debugMessage($assertionXML, 'decrypt');
return new Assertion($assertionXML);
} | php | public function getAssertion(XMLSecurityKey $inputKey, array $blacklist = []) : Assertion
{
$assertionXML = Utils::decryptElement($this->encryptedData, $inputKey, $blacklist);
Utils::getContainer()->debugMessage($assertionXML, 'decrypt');
return new Assertion($assertionXML);
} | [
"public",
"function",
"getAssertion",
"(",
"XMLSecurityKey",
"$",
"inputKey",
",",
"array",
"$",
"blacklist",
"=",
"[",
"]",
")",
":",
"Assertion",
"{",
"$",
"assertionXML",
"=",
"Utils",
"::",
"decryptElement",
"(",
"$",
"this",
"->",
"encryptedData",
",",
... | Retrieve the assertion.
@param XMLSecurityKey $inputKey The key we should use to decrypt the assertion.
@param array $blacklist Blacklisted decryption algorithms.
@return \SAML2\Assertion The decrypted assertion. | [
"Retrieve",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/EncryptedAssertion.php#L117-L124 |
simplesamlphp/saml2 | src/SAML2/EncryptedAssertion.php | EncryptedAssertion.toXML | public function toXML(DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
$parentElement = $document;
} else {
$document = $parentElement->ownerDocument;
}
$root = $document->creat... | php | public function toXML(DOMNode $parentElement = null) : DOMElement
{
if ($parentElement === null) {
$document = DOMDocumentFactory::create();
$parentElement = $document;
} else {
$document = $parentElement->ownerDocument;
}
$root = $document->creat... | [
"public",
"function",
"toXML",
"(",
"DOMNode",
"$",
"parentElement",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"$",
"parentElement",
"===",
"null",
")",
"{",
"$",
"document",
"=",
"DOMDocumentFactory",
"::",
"create",
"(",
")",
";",
"$",
"pare... | Convert this encrypted assertion to an XML element.
@param \DOMNode|null $parentElement The DOM node the assertion should be created in.
@return \DOMElement This encrypted assertion. | [
"Convert",
"this",
"encrypted",
"assertion",
"to",
"an",
"XML",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/EncryptedAssertion.php#L133-L148 |
simplesamlphp/saml2 | src/SAML2/XML/saml/BaseIDType.php | BaseIDType.toXML | public function toXML(DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$parent = DOMDocumentFactory::create();
$doc = $parent;
} else {
$doc = $parent->ownerDocument;
}
$element = $doc->createElementNS(Constants::NS_SAML, $this->no... | php | public function toXML(DOMElement $parent = null) : DOMElement
{
if ($parent === null) {
$parent = DOMDocumentFactory::create();
$doc = $parent;
} else {
$doc = $parent->ownerDocument;
}
$element = $doc->createElementNS(Constants::NS_SAML, $this->no... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
"=",
"null",
")",
":",
"DOMElement",
"{",
"if",
"(",
"$",
"parent",
"===",
"null",
")",
"{",
"$",
"parent",
"=",
"DOMDocumentFactory",
"::",
"create",
"(",
")",
";",
"$",
"doc",
"=",
"$... | Convert this BaseID to XML.
@param \DOMElement $parent The element we are converting to XML.
@return \DOMElement The XML element after adding the data corresponding to this BaseID. | [
"Convert",
"this",
"BaseID",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/saml/BaseIDType.php#L131-L151 |
simplesamlphp/saml2 | src/SAML2/SignedElementHelper.php | SignedElementHelper.getValidatingCertificates | public function getValidatingCertificates() : array
{
$ret = [];
foreach ($this->certificates as $cert) {
/* Construct a PEM formatted certificate */
$pemCert = "-----BEGIN CERTIFICATE-----\n".
chunk_split($cert, 64).
"-----END CERTIFICATE-----... | php | public function getValidatingCertificates() : array
{
$ret = [];
foreach ($this->certificates as $cert) {
/* Construct a PEM formatted certificate */
$pemCert = "-----BEGIN CERTIFICATE-----\n".
chunk_split($cert, 64).
"-----END CERTIFICATE-----... | [
"public",
"function",
"getValidatingCertificates",
"(",
")",
":",
"array",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"certificates",
"as",
"$",
"cert",
")",
"{",
"/* Construct a PEM formatted certificate */",
"$",
"pemCert",
"=",
... | Retrieve certificates that sign this element.
@return array Array with certificates. | [
"Retrieve",
"certificates",
"that",
"sign",
"this",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SignedElementHelper.php#L185-L209 |
simplesamlphp/saml2 | src/SAML2/SignedElementHelper.php | SignedElementHelper.signElement | protected function signElement(DOMElement $root, DOMNode $insertBefore = null) : ?DOMElement
{
if ($this->signatureKey === null) {
/* We cannot sign this element. */
return null;
}
Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore)... | php | protected function signElement(DOMElement $root, DOMNode $insertBefore = null) : ?DOMElement
{
if ($this->signatureKey === null) {
/* We cannot sign this element. */
return null;
}
Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore)... | [
"protected",
"function",
"signElement",
"(",
"DOMElement",
"$",
"root",
",",
"DOMNode",
"$",
"insertBefore",
"=",
"null",
")",
":",
"?",
"DOMElement",
"{",
"if",
"(",
"$",
"this",
"->",
"signatureKey",
"===",
"null",
")",
"{",
"/* We cannot sign this element. ... | Sign the given XML element.
@param \DOMElement $root The element we should sign.
@param \DOMNode|null $insertBefore The element we should insert the signature node before.
@return \DOMElement|null | [
"Sign",
"the",
"given",
"XML",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/SignedElementHelper.php#L264-L274 |
simplesamlphp/saml2 | src/SAML2/XML/ds/KeyInfo.php | KeyInfo.addInfo | public function addInfo($info) : void
{
Assert::isInstanceOfAny(
$info,
[Chunk::class, KeyName::class, X509Data::class],
'KeyInfo can only contain instances of KeyName, X509Data or Chunk.'
);
$this->info[] = $info;
} | php | public function addInfo($info) : void
{
Assert::isInstanceOfAny(
$info,
[Chunk::class, KeyName::class, X509Data::class],
'KeyInfo can only contain instances of KeyName, X509Data or Chunk.'
);
$this->info[] = $info;
} | [
"public",
"function",
"addInfo",
"(",
"$",
"info",
")",
":",
"void",
"{",
"Assert",
"::",
"isInstanceOfAny",
"(",
"$",
"info",
",",
"[",
"Chunk",
"::",
"class",
",",
"KeyName",
"::",
"class",
",",
"X509Data",
"::",
"class",
"]",
",",
"'KeyInfo can only c... | Add the value to the info-property
@param \SAML2\XML\Chunk|\SAML2\XML\ds\KeyName|\SAML2\XML\ds\X509Data $info
@throws \Exception
@return void | [
"Add",
"the",
"value",
"to",
"the",
"info",
"-",
"property"
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/ds/KeyInfo.php#L130-L138 |
simplesamlphp/saml2 | src/SAML2/XML/ds/KeyInfo.php | KeyInfo.toXML | public function toXML(DOMElement $parent) : DOMElement
{
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:KeyInfo');
$parent->appendChild($e);
if ($this->Id !== null) {
$e->setAttribute('Id', $this->Id);
}
foreac... | php | public function toXML(DOMElement $parent) : DOMElement
{
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:KeyInfo');
$parent->appendChild($e);
if ($this->Id !== null) {
$e->setAttribute('Id', $this->Id);
}
foreac... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"$",
"doc",
"=",
"$",
"parent",
"->",
"ownerDocument",
";",
"$",
"e",
"=",
"$",
"doc",
"->",
"createElementNS",
"(",
"XMLSecurityDSig",
"::",
"XMLDSIGNS",
",",
... | Convert this KeyInfo to XML.
@param \DOMElement $parent The element we should append this KeyInfo to.
@return \DOMElement | [
"Convert",
"this",
"KeyInfo",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/ds/KeyInfo.php#L147-L163 |
simplesamlphp/saml2 | src/SAML2/AuthnRequest.php | AuthnRequest.setNameIdPolicy | public function setNameIdPolicy(array $nameIdPolicy) : void
{
if (isset($nameIdPolicy['Format']) && !is_string($nameIdPolicy['Format'])) {
throw InvalidArgumentException::invalidType('string', $nameIdPolicy['Format']);
}
if (isset($nameIdPolicy['SPNameQualifier']) && !is_string($... | php | public function setNameIdPolicy(array $nameIdPolicy) : void
{
if (isset($nameIdPolicy['Format']) && !is_string($nameIdPolicy['Format'])) {
throw InvalidArgumentException::invalidType('string', $nameIdPolicy['Format']);
}
if (isset($nameIdPolicy['SPNameQualifier']) && !is_string($... | [
"public",
"function",
"setNameIdPolicy",
"(",
"array",
"$",
"nameIdPolicy",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"nameIdPolicy",
"[",
"'Format'",
"]",
")",
"&&",
"!",
"is_string",
"(",
"$",
"nameIdPolicy",
"[",
"'Format'",
"]",
")",
")",
... | Set the NameIDPolicy.
This function accepts an array with the following options:
- 'Format' (string)
- 'SPNameQualifier' (string)
- 'AllowCreate' (bool)
@param array $nameIdPolicy The NameIDPolicy.
@return void | [
"Set",
"the",
"NameIDPolicy",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/AuthnRequest.php#L371-L384 |
simplesamlphp/saml2 | src/SAML2/AuthnRequest.php | AuthnRequest.toUnsignedXML | public function toUnsignedXML() : DOMElement
{
$root = parent::toUnsignedXML();
if ($this->forceAuthn) {
$root->setAttribute('ForceAuthn', 'true');
}
if (!empty($this->ProviderName)) {
$root->setAttribute('ProviderName', $this->ProviderName);
}
... | php | public function toUnsignedXML() : DOMElement
{
$root = parent::toUnsignedXML();
if ($this->forceAuthn) {
$root->setAttribute('ForceAuthn', 'true');
}
if (!empty($this->ProviderName)) {
$root->setAttribute('ProviderName', $this->ProviderName);
}
... | [
"public",
"function",
"toUnsignedXML",
"(",
")",
":",
"DOMElement",
"{",
"$",
"root",
"=",
"parent",
"::",
"toUnsignedXML",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"forceAuthn",
")",
"{",
"$",
"root",
"->",
"setAttribute",
"(",
"'ForceAuthn'",
",",
... | Convert this authentication request to an XML element.
@return \DOMElement This authentication request. | [
"Convert",
"this",
"authentication",
"request",
"to",
"an",
"XML",
"element",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/AuthnRequest.php#L787-L881 |
simplesamlphp/saml2 | src/SAML2/AuthnRequest.php | AuthnRequest.addSubject | private function addSubject(DOMElement $root) : void
{
// If there is no nameId (encrypted or not) there is nothing to create a subject for
if ($this->nameId === null && $this->encryptedNameId === null) {
return;
}
$subject = $root->ownerDocument->createElementNS(Constan... | php | private function addSubject(DOMElement $root) : void
{
// If there is no nameId (encrypted or not) there is nothing to create a subject for
if ($this->nameId === null && $this->encryptedNameId === null) {
return;
}
$subject = $root->ownerDocument->createElementNS(Constan... | [
"private",
"function",
"addSubject",
"(",
"DOMElement",
"$",
"root",
")",
":",
"void",
"{",
"// If there is no nameId (encrypted or not) there is nothing to create a subject for",
"if",
"(",
"$",
"this",
"->",
"nameId",
"===",
"null",
"&&",
"$",
"this",
"->",
"encrypt... | Add a Subject-node to the assertion.
@param \DOMElement $root The assertion element we should add the subject to.
@return void | [
"Add",
"a",
"Subject",
"-",
"node",
"to",
"the",
"assertion",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/AuthnRequest.php#L890-L911 |
simplesamlphp/saml2 | src/SAML2/AuthnRequest.php | AuthnRequest.addConditions | private function addConditions(DOMElement $root) : void
{
if ($this->audiences !== []) {
$document = $root->ownerDocument;
$conditions = $document->createElementNS(Constants::NS_SAML, 'saml:Conditions');
$root->appendChild($conditions);
$ar = $document->crea... | php | private function addConditions(DOMElement $root) : void
{
if ($this->audiences !== []) {
$document = $root->ownerDocument;
$conditions = $document->createElementNS(Constants::NS_SAML, 'saml:Conditions');
$root->appendChild($conditions);
$ar = $document->crea... | [
"private",
"function",
"addConditions",
"(",
"DOMElement",
"$",
"root",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"audiences",
"!==",
"[",
"]",
")",
"{",
"$",
"document",
"=",
"$",
"root",
"->",
"ownerDocument",
";",
"$",
"conditions",
"=",
... | Add a Conditions-node to the request.
@param \DOMElement $root The request element we should add the conditions to.
@return void | [
"Add",
"a",
"Conditions",
"-",
"node",
"to",
"the",
"request",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/AuthnRequest.php#L920-L933 |
simplesamlphp/saml2 | src/SAML2/XML/mdrpi/PublicationInfo.php | PublicationInfo.toXML | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->publisher, "Cannot convert PublicationInfo to XML without a publisher set.");
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Common::NS_MDRPI, 'mdrpi:PublicationInfo');
$parent->appendChild(... | php | public function toXML(DOMElement $parent) : DOMElement
{
Assert::notEmpty($this->publisher, "Cannot convert PublicationInfo to XML without a publisher set.");
$doc = $parent->ownerDocument;
$e = $doc->createElementNS(Common::NS_MDRPI, 'mdrpi:PublicationInfo');
$parent->appendChild(... | [
"public",
"function",
"toXML",
"(",
"DOMElement",
"$",
"parent",
")",
":",
"DOMElement",
"{",
"Assert",
"::",
"notEmpty",
"(",
"$",
"this",
"->",
"publisher",
",",
"\"Cannot convert PublicationInfo to XML without a publisher set.\"",
")",
";",
"$",
"doc",
"=",
"$"... | Convert this element to XML.
@param \DOMElement $parent The element we should append to.
@return \DOMElement | [
"Convert",
"this",
"element",
"to",
"XML",
"."
] | train | https://github.com/simplesamlphp/saml2/blob/09e374fe0033f4706936c59033f86bd56411b1b1/src/SAML2/XML/mdrpi/PublicationInfo.php#L178-L200 |
spiral/goridge | php-src/StreamRelay.php | StreamRelay.send | public function send($payload, int $flags = null)
{
$size = strlen($payload);
if ($flags & self::PAYLOAD_NONE && $size != 0) {
throw new Exceptions\TransportException("unable to send payload with PAYLOAD_NONE flag");
}
$body = pack('CPJ', $flags, $size, $size);
... | php | public function send($payload, int $flags = null)
{
$size = strlen($payload);
if ($flags & self::PAYLOAD_NONE && $size != 0) {
throw new Exceptions\TransportException("unable to send payload with PAYLOAD_NONE flag");
}
$body = pack('CPJ', $flags, $size, $size);
... | [
"public",
"function",
"send",
"(",
"$",
"payload",
",",
"int",
"$",
"flags",
"=",
"null",
")",
"{",
"$",
"size",
"=",
"strlen",
"(",
"$",
"payload",
")",
";",
"if",
"(",
"$",
"flags",
"&",
"self",
"::",
"PAYLOAD_NONE",
"&&",
"$",
"size",
"!=",
"0... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/StreamRelay.php#L53-L71 |
spiral/goridge | php-src/StreamRelay.php | StreamRelay.receiveSync | public function receiveSync(int &$flags = null)
{
$prefix = $this->fetchPrefix();
$flags = $prefix['flags'];
$result = null;
if ($prefix['size'] !== 0) {
$leftBytes = $prefix['size'];
//Add ability to write to stream in a future
while ($leftBytes... | php | public function receiveSync(int &$flags = null)
{
$prefix = $this->fetchPrefix();
$flags = $prefix['flags'];
$result = null;
if ($prefix['size'] !== 0) {
$leftBytes = $prefix['size'];
//Add ability to write to stream in a future
while ($leftBytes... | [
"public",
"function",
"receiveSync",
"(",
"int",
"&",
"$",
"flags",
"=",
"null",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"fetchPrefix",
"(",
")",
";",
"$",
"flags",
"=",
"$",
"prefix",
"[",
"'flags'",
"]",
";",
"$",
"result",
"=",
"null",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/StreamRelay.php#L76-L98 |
spiral/goridge | php-src/StreamRelay.php | StreamRelay.fetchPrefix | private function fetchPrefix(): array
{
$prefixBody = fread($this->in, 17);
if ($prefixBody === false) {
throw new Exceptions\PrefixException("unable to read prefix from the stream");
}
$result = unpack("Cflags/Psize/Jrevs", $prefixBody);
if (!is_array($result)) ... | php | private function fetchPrefix(): array
{
$prefixBody = fread($this->in, 17);
if ($prefixBody === false) {
throw new Exceptions\PrefixException("unable to read prefix from the stream");
}
$result = unpack("Cflags/Psize/Jrevs", $prefixBody);
if (!is_array($result)) ... | [
"private",
"function",
"fetchPrefix",
"(",
")",
":",
"array",
"{",
"$",
"prefixBody",
"=",
"fread",
"(",
"$",
"this",
"->",
"in",
",",
"17",
")",
";",
"if",
"(",
"$",
"prefixBody",
"===",
"false",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"Prefix... | @return array Prefix [flag, length]
@throws Exceptions\PrefixException | [
"@return",
"array",
"Prefix",
"[",
"flag",
"length",
"]"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/StreamRelay.php#L105-L122 |
spiral/goridge | php-src/StreamRelay.php | StreamRelay.assertMode | private function assertMode($stream, $mode): bool
{
$meta = stream_get_meta_data($stream);
return strpos($meta['mode'], $mode) !== false;
} | php | private function assertMode($stream, $mode): bool
{
$meta = stream_get_meta_data($stream);
return strpos($meta['mode'], $mode) !== false;
} | [
"private",
"function",
"assertMode",
"(",
"$",
"stream",
",",
"$",
"mode",
")",
":",
"bool",
"{",
"$",
"meta",
"=",
"stream_get_meta_data",
"(",
"$",
"stream",
")",
";",
"return",
"strpos",
"(",
"$",
"meta",
"[",
"'mode'",
"]",
",",
"$",
"mode",
")",... | Checks if stream is writable or readable.
@param resource $stream
@param string $mode
@return bool | [
"Checks",
"if",
"stream",
"is",
"writable",
"or",
"readable",
"."
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/StreamRelay.php#L132-L137 |
spiral/goridge | php-src/SocketRelay.php | SocketRelay.send | public function send($payload, int $flags = null)
{
$this->connect();
$size = strlen($payload);
if ($flags & self::PAYLOAD_NONE && $size != 0) {
throw new TransportException("unable to send payload with PAYLOAD_NONE flag");
}
$body = pack('CPJ', $flags, $size, $... | php | public function send($payload, int $flags = null)
{
$this->connect();
$size = strlen($payload);
if ($flags & self::PAYLOAD_NONE && $size != 0) {
throw new TransportException("unable to send payload with PAYLOAD_NONE flag");
}
$body = pack('CPJ', $flags, $size, $... | [
"public",
"function",
"send",
"(",
"$",
"payload",
",",
"int",
"$",
"flags",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"size",
"=",
"strlen",
"(",
"$",
"payload",
")",
";",
"if",
"(",
"$",
"flags",
"&",
"self",
":... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/SocketRelay.php#L86-L104 |
spiral/goridge | php-src/SocketRelay.php | SocketRelay.receiveSync | public function receiveSync(int &$flags = null)
{
$this->connect();
$prefix = $this->fetchPrefix();
$flags = $prefix['flags'];
$result = null;
if ($prefix['size'] !== 0) {
$readBytes = $prefix['size'];
$buffer = null;
//Add ability to wr... | php | public function receiveSync(int &$flags = null)
{
$this->connect();
$prefix = $this->fetchPrefix();
$flags = $prefix['flags'];
$result = null;
if ($prefix['size'] !== 0) {
$readBytes = $prefix['size'];
$buffer = null;
//Add ability to wr... | [
"public",
"function",
"receiveSync",
"(",
"int",
"&",
"$",
"flags",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"prefix",
"=",
"$",
"this",
"->",
"fetchPrefix",
"(",
")",
";",
"$",
"flags",
"=",
"$",
"prefix",
"[",
"'... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/SocketRelay.php#L109-L136 |
spiral/goridge | php-src/SocketRelay.php | SocketRelay.connect | public function connect(): bool
{
if ($this->isConnected()) {
return true;
}
$this->socket = $this->createSocket();
try {
if (socket_connect($this->socket, $this->address, $this->port) === false) {
throw new RelayException(socket_strerror(sock... | php | public function connect(): bool
{
if ($this->isConnected()) {
return true;
}
$this->socket = $this->createSocket();
try {
if (socket_connect($this->socket, $this->address, $this->port) === false) {
throw new RelayException(socket_strerror(sock... | [
"public",
"function",
"connect",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"isConnected",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"socket",
"=",
"$",
"this",
"->",
"createSocket",
"(",
")",
";",
"try",
"... | Ensure socket connection. Returns true if socket successfully connected
or have already been connected.
@return bool
@throws RelayException
@throws \Error When sockets are used in unsupported environment. | [
"Ensure",
"socket",
"connection",
".",
"Returns",
"true",
"if",
"socket",
"successfully",
"connected",
"or",
"have",
"already",
"been",
"connected",
"."
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/SocketRelay.php#L179-L195 |
spiral/goridge | php-src/SocketRelay.php | SocketRelay.close | public function close()
{
if (!$this->isConnected()) {
throw new RelayException("unable to close socket '{$this}', socket already closed");
}
socket_close($this->socket);
$this->socket = null;
} | php | public function close()
{
if (!$this->isConnected()) {
throw new RelayException("unable to close socket '{$this}', socket already closed");
}
socket_close($this->socket);
$this->socket = null;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isConnected",
"(",
")",
")",
"{",
"throw",
"new",
"RelayException",
"(",
"\"unable to close socket '{$this}', socket already closed\"",
")",
";",
"}",
"socket_close",
"(",
"$",
"... | Close connection.
@throws RelayException | [
"Close",
"connection",
"."
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/SocketRelay.php#L202-L210 |
spiral/goridge | php-src/SocketRelay.php | SocketRelay.fetchPrefix | private function fetchPrefix(): array
{
$prefixLength = socket_recv($this->socket, $prefixBody, 17, MSG_WAITALL);
if ($prefixBody === false || $prefixLength !== 17) {
throw new PrefixException(sprintf(
"unable to read prefix from socket: %s",
socket_strerr... | php | private function fetchPrefix(): array
{
$prefixLength = socket_recv($this->socket, $prefixBody, 17, MSG_WAITALL);
if ($prefixBody === false || $prefixLength !== 17) {
throw new PrefixException(sprintf(
"unable to read prefix from socket: %s",
socket_strerr... | [
"private",
"function",
"fetchPrefix",
"(",
")",
":",
"array",
"{",
"$",
"prefixLength",
"=",
"socket_recv",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"prefixBody",
",",
"17",
",",
"MSG_WAITALL",
")",
";",
"if",
"(",
"$",
"prefixBody",
"===",
"false",
... | @return array Prefix [flag, length]
@throws PrefixException | [
"@return",
"array",
"Prefix",
"[",
"flag",
"length",
"]"
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/SocketRelay.php#L239-L259 |
spiral/goridge | php-src/RPC.php | RPC.call | public function call(string $method, $payload, int $flags = 0)
{
$this->relay->send(
$method . pack("P", $this->seq),
Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW
);
if ($flags & Relay::PAYLOAD_RAW) {
$this->relay->send($payload, $flags);
} else {
... | php | public function call(string $method, $payload, int $flags = 0)
{
$this->relay->send(
$method . pack("P", $this->seq),
Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW
);
if ($flags & Relay::PAYLOAD_RAW) {
$this->relay->send($payload, $flags);
} else {
... | [
"public",
"function",
"call",
"(",
"string",
"$",
"method",
",",
"$",
"payload",
",",
"int",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"relay",
"->",
"send",
"(",
"$",
"method",
".",
"pack",
"(",
"\"P\"",
",",
"$",
"this",
"->",
"seq",... | @param string $method
@param mixed $payload An binary data or array of arguments for complex types.
@param int $flags Payload control flags.
@return mixed
@throws Exceptions\RelayException
@throws Exceptions\ServiceException | [
"@param",
"string",
"$method",
"@param",
"mixed",
"$payload",
"An",
"binary",
"data",
"or",
"array",
"of",
"arguments",
"for",
"complex",
"types",
".",
"@param",
"int",
"$flags",
"Payload",
"control",
"flags",
"."
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/RPC.php#L43-L84 |
spiral/goridge | php-src/RPC.php | RPC.handleBody | protected function handleBody($body, int $flags)
{
if ($flags & Relay::PAYLOAD_ERROR && $flags & Relay::PAYLOAD_RAW) {
throw new Exceptions\ServiceException("error '$body' on '{$this->relay}'");
}
if ($flags & Relay::PAYLOAD_RAW) {
return $body;
}
re... | php | protected function handleBody($body, int $flags)
{
if ($flags & Relay::PAYLOAD_ERROR && $flags & Relay::PAYLOAD_RAW) {
throw new Exceptions\ServiceException("error '$body' on '{$this->relay}'");
}
if ($flags & Relay::PAYLOAD_RAW) {
return $body;
}
re... | [
"protected",
"function",
"handleBody",
"(",
"$",
"body",
",",
"int",
"$",
"flags",
")",
"{",
"if",
"(",
"$",
"flags",
"&",
"Relay",
"::",
"PAYLOAD_ERROR",
"&&",
"$",
"flags",
"&",
"Relay",
"::",
"PAYLOAD_RAW",
")",
"{",
"throw",
"new",
"Exceptions",
"\... | Handle response body.
@param string $body
@param int $flags
@return mixed
@throws Exceptions\ServiceException | [
"Handle",
"response",
"body",
"."
] | train | https://github.com/spiral/goridge/blob/4d5c763886dd0a1e45b1a7d1f99d180cf1a7a7c4/php-src/RPC.php#L96-L107 |
themsaid/laravel-mail-preview | src/MailPreviewServiceProvider.php | MailPreviewServiceProvider.boot | public function boot()
{
$this->publishes([
__DIR__.'/config/mailpreview.php' => config_path('mailpreview.php'),
]);
if ($this->app['config']['mail.driver'] != 'preview') {
return;
}
if ($this->app['config']['mailpreview.show_link_to_preview']) {
... | php | public function boot()
{
$this->publishes([
__DIR__.'/config/mailpreview.php' => config_path('mailpreview.php'),
]);
if ($this->app['config']['mail.driver'] != 'preview') {
return;
}
if ($this->app['config']['mailpreview.show_link_to_preview']) {
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/config/mailpreview.php'",
"=>",
"config_path",
"(",
"'mailpreview.php'",
")",
",",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"app",
"[",
"'config... | Perform post-registration booting of services.
@return void | [
"Perform",
"post",
"-",
"registration",
"booting",
"of",
"services",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/MailPreviewServiceProvider.php#L15-L35 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.send | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->createEmailPreviewDirectory();
$this->cleanOldPreviews();
Session::put('mail_preview_path', basename($previewPath = $this->getPreviewFilePath($message)... | php | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->createEmailPreviewDirectory();
$this->cleanOldPreviews();
Session::put('mail_preview_path', basename($previewPath = $this->getPreviewFilePath($message)... | [
"public",
"function",
"send",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
",",
"&",
"$",
"failedRecipients",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"beforeSendPerformed",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"createEmailPreviewDirectory",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L52-L71 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.getPreviewFilePath | protected function getPreviewFilePath(Swift_Mime_SimpleMessage $message)
{
$to = str_replace(['@', '.'], ['_at_', '_'], array_keys($message->getTo())[0]);
$subject = $message->getSubject();
return $this->previewPath.'/'.str_slug($message->getDate()->getTimestamp().'_'.$to.'_'.$subject, '_'... | php | protected function getPreviewFilePath(Swift_Mime_SimpleMessage $message)
{
$to = str_replace(['@', '.'], ['_at_', '_'], array_keys($message->getTo())[0]);
$subject = $message->getSubject();
return $this->previewPath.'/'.str_slug($message->getDate()->getTimestamp().'_'.$to.'_'.$subject, '_'... | [
"protected",
"function",
"getPreviewFilePath",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"$",
"to",
"=",
"str_replace",
"(",
"[",
"'@'",
",",
"'.'",
"]",
",",
"[",
"'_at_'",
",",
"'_'",
"]",
",",
"array_keys",
"(",
"$",
"message",
"->",
... | Get the path to the email preview file.
@param \Swift_Mime_SimpleMessage $message
@return string | [
"Get",
"the",
"path",
"to",
"the",
"email",
"preview",
"file",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L80-L87 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.getHTMLPreviewContent | protected function getHTMLPreviewContent(Swift_Mime_SimpleMessage $message)
{
$messageInfo = $this->getMessageInfo($message);
return $messageInfo.$message->getBody();
} | php | protected function getHTMLPreviewContent(Swift_Mime_SimpleMessage $message)
{
$messageInfo = $this->getMessageInfo($message);
return $messageInfo.$message->getBody();
} | [
"protected",
"function",
"getHTMLPreviewContent",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"$",
"messageInfo",
"=",
"$",
"this",
"->",
"getMessageInfo",
"(",
"$",
"message",
")",
";",
"return",
"$",
"messageInfo",
".",
"$",
"message",
"->",
"... | Get the HTML content for the preview file.
@param \Swift_Mime_SimpleMessage $message
@return string | [
"Get",
"the",
"HTML",
"content",
"for",
"the",
"preview",
"file",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L96-L101 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.getMessageInfo | protected function getMessageInfo(Swift_Mime_SimpleMessage $message)
{
return sprintf(
"<!--\nFrom:%s, \nto:%s, \nreply-to:%s, \ncc:%s, \nbcc:%s, \nsubject:%s\n-->\n",
json_encode($message->getFrom()),
json_encode($message->getTo()),
json_encode($message->getR... | php | protected function getMessageInfo(Swift_Mime_SimpleMessage $message)
{
return sprintf(
"<!--\nFrom:%s, \nto:%s, \nreply-to:%s, \ncc:%s, \nbcc:%s, \nsubject:%s\n-->\n",
json_encode($message->getFrom()),
json_encode($message->getTo()),
json_encode($message->getR... | [
"protected",
"function",
"getMessageInfo",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"return",
"sprintf",
"(",
"\"<!--\\nFrom:%s, \\nto:%s, \\nreply-to:%s, \\ncc:%s, \\nbcc:%s, \\nsubject:%s\\n-->\\n\"",
",",
"json_encode",
"(",
"$",
"message",
"->",
"getFrom",... | Generate a human readable HTML comment with message info.
@param \Swift_Mime_SimpleMessage $message
@return string | [
"Generate",
"a",
"human",
"readable",
"HTML",
"comment",
"with",
"message",
"info",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L122-L133 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.createEmailPreviewDirectory | protected function createEmailPreviewDirectory()
{
if (! $this->files->exists($this->previewPath)) {
$this->files->makeDirectory($this->previewPath);
$this->files->put($this->previewPath.'/.gitignore', "*\n!.gitignore");
}
} | php | protected function createEmailPreviewDirectory()
{
if (! $this->files->exists($this->previewPath)) {
$this->files->makeDirectory($this->previewPath);
$this->files->put($this->previewPath.'/.gitignore', "*\n!.gitignore");
}
} | [
"protected",
"function",
"createEmailPreviewDirectory",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"this",
"->",
"previewPath",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"makeDirectory",
"(",
"$",
"this",
... | Create the preview directory if necessary.
@return void | [
"Create",
"the",
"preview",
"directory",
"if",
"necessary",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L140-L147 |
themsaid/laravel-mail-preview | src/PreviewTransport.php | PreviewTransport.cleanOldPreviews | private function cleanOldPreviews()
{
$oldPreviews = array_filter($this->files->files($this->previewPath), function ($file) {
return time() - $this->files->lastModified($file) > $this->lifeTime;
});
if ($oldPreviews) {
$this->files->delete($oldPreviews);
}
... | php | private function cleanOldPreviews()
{
$oldPreviews = array_filter($this->files->files($this->previewPath), function ($file) {
return time() - $this->files->lastModified($file) > $this->lifeTime;
});
if ($oldPreviews) {
$this->files->delete($oldPreviews);
}
... | [
"private",
"function",
"cleanOldPreviews",
"(",
")",
"{",
"$",
"oldPreviews",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"files",
"->",
"files",
"(",
"$",
"this",
"->",
"previewPath",
")",
",",
"function",
"(",
"$",
"file",
")",
"{",
"return",
"time",
... | Delete previews older than the given life time configuration.
@return void | [
"Delete",
"previews",
"older",
"than",
"the",
"given",
"life",
"time",
"configuration",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/PreviewTransport.php#L154-L163 |
themsaid/laravel-mail-preview | src/MailProvider.php | MailProvider.registerSwiftMailer | function registerSwiftMailer()
{
if ($this->app['config']['mail.driver'] == 'preview' || $this->app['config']['mail.preview'] == true) {
$this->registerPreviewSwiftMailer();
} else {
parent::registerSwiftMailer();
}
} | php | function registerSwiftMailer()
{
if ($this->app['config']['mail.driver'] == 'preview' || $this->app['config']['mail.preview'] == true) {
$this->registerPreviewSwiftMailer();
} else {
parent::registerSwiftMailer();
}
} | [
"function",
"registerSwiftMailer",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'mail.driver'",
"]",
"==",
"'preview'",
"||",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'mail.preview'",
"]",
"==",
"true",
"... | Register the Swift Mailer instance.
@return void | [
"Register",
"the",
"Swift",
"Mailer",
"instance",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/MailProvider.php#L17-L24 |
themsaid/laravel-mail-preview | src/MailProvider.php | MailProvider.registerPreviewSwiftMailer | protected function registerPreviewSwiftMailer()
{
$this->app->singleton('swift.mailer', function($app) {
return new Swift_Mailer(
new PreviewTransport(
$app->make('Illuminate\Filesystem\Filesystem'),
$app['config']['mailpreview.path'],
... | php | protected function registerPreviewSwiftMailer()
{
$this->app->singleton('swift.mailer', function($app) {
return new Swift_Mailer(
new PreviewTransport(
$app->make('Illuminate\Filesystem\Filesystem'),
$app['config']['mailpreview.path'],
... | [
"protected",
"function",
"registerPreviewSwiftMailer",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'swift.mailer'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Swift_Mailer",
"(",
"new",
"PreviewTransport",
"(",
"$",
"... | Register the Preview Swift Mailer instance.
@return void | [
"Register",
"the",
"Preview",
"Swift",
"Mailer",
"instance",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/MailProvider.php#L31-L42 |
themsaid/laravel-mail-preview | src/MailPreviewMiddleware.php | MailPreviewMiddleware.handle | public function handle($request, Closure $next)
{
$response = $next($request);
if (
$request->hasSession() &&
$response instanceOf Response &&
$previewPath = $request->session()->get('mail_preview_path')
) {
$this->addLinkToResponse($response,... | php | public function handle($request, Closure $next)
{
$response = $next($request);
if (
$request->hasSession() &&
$response instanceOf Response &&
$previewPath = $request->session()->get('mail_preview_path')
) {
$this->addLinkToResponse($response,... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"$",
"response",
"=",
"$",
"next",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"request",
"->",
"hasSession",
"(",
")",
"&&",
"$",
"response",
"instanceOf"... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/MailPreviewMiddleware.php#L17-L32 |
themsaid/laravel-mail-preview | src/MailPreviewMiddleware.php | MailPreviewMiddleware.addLinkToResponse | private function addLinkToResponse($response, $previewPath)
{
if (app()->runningInConsole()) {
return;
}
$content = $response->getContent();
$linkHTML = "<div id='MailPreviewDriverBox' style='
position:absolute;
top:0;
z-index:99999;
... | php | private function addLinkToResponse($response, $previewPath)
{
if (app()->runningInConsole()) {
return;
}
$content = $response->getContent();
$linkHTML = "<div id='MailPreviewDriverBox' style='
position:absolute;
top:0;
z-index:99999;
... | [
"private",
"function",
"addLinkToResponse",
"(",
"$",
"response",
",",
"$",
"previewPath",
")",
"{",
"if",
"(",
"app",
"(",
")",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"content",
"=",
"$",
"response",
"->",
"getContent",
... | Modify the response to add link to the email preview.
@param $response
@param $previewPath | [
"Modify",
"the",
"response",
"to",
"add",
"link",
"to",
"the",
"email",
"preview",
"."
] | train | https://github.com/themsaid/laravel-mail-preview/blob/15e62458aff5ffa29f2beac25c146c63bf41d83b/src/MailPreviewMiddleware.php#L40-L79 |
ares333/php-curl | src/Toolkit.php | Toolkit.onFail | function onFail($error)
{
$msg = "Curl error ($error[errorCode]). $error[errorMsg], url=" . $error['info']['url'];
if ($this->_curl->onInfo == array(
$this,
'onInfo'
)) {
$this->onInfo($msg . "\n");
} else {
echo "\n$msg\n\n";
}... | php | function onFail($error)
{
$msg = "Curl error ($error[errorCode]). $error[errorMsg], url=" . $error['info']['url'];
if ($this->_curl->onInfo == array(
$this,
'onInfo'
)) {
$this->onInfo($msg . "\n");
} else {
echo "\n$msg\n\n";
}... | [
"function",
"onFail",
"(",
"$",
"error",
")",
"{",
"$",
"msg",
"=",
"\"Curl error ($error[errorCode]). $error[errorMsg], url=\"",
".",
"$",
"error",
"[",
"'info'",
"]",
"[",
"'url'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"_curl",
"->",
"onInfo",
"==",
"a... | Output curl error information
@param array $error | [
"Output",
"curl",
"error",
"information"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L49-L60 |
ares333/php-curl | src/Toolkit.php | Toolkit.htmlEncode | function htmlEncode($html, $in = null, $out = null, $mode = 'auto')
{
$valid = array(
'auto',
'iconv',
'mb_convert_encoding'
);
if (! isset($out)) {
$out = 'UTF-8';
}
if (! in_array($mode, $valid)) {
user_error('inva... | php | function htmlEncode($html, $in = null, $out = null, $mode = 'auto')
{
$valid = array(
'auto',
'iconv',
'mb_convert_encoding'
);
if (! isset($out)) {
$out = 'UTF-8';
}
if (! in_array($mode, $valid)) {
user_error('inva... | [
"function",
"htmlEncode",
"(",
"$",
"html",
",",
"$",
"in",
"=",
"null",
",",
"$",
"out",
"=",
"null",
",",
"$",
"mode",
"=",
"'auto'",
")",
"{",
"$",
"valid",
"=",
"array",
"(",
"'auto'",
",",
"'iconv'",
",",
"'mb_convert_encoding'",
")",
";",
"if... | Html encoding transform
@param string $html
@param string $in
detect automatically if not set
@param string $out
default UTF-8
@param string $mode
auto|iconv|mb_convert_encoding
@return string | [
"Html",
"encoding",
"transform"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L194-L239 |
ares333/php-curl | src/Toolkit.php | Toolkit.between | function between($str, $start, $end = null, $greed = true)
{
if (isset($start)) {
$pos1 = strpos($str, $start);
} else {
$pos1 = 0;
}
if (isset($end)) {
if ($greed) {
$pos2 = strrpos($str, $end);
} else {
... | php | function between($str, $start, $end = null, $greed = true)
{
if (isset($start)) {
$pos1 = strpos($str, $start);
} else {
$pos1 = 0;
}
if (isset($end)) {
if ($greed) {
$pos2 = strrpos($str, $end);
} else {
... | [
"function",
"between",
"(",
"$",
"str",
",",
"$",
"start",
",",
"$",
"end",
"=",
"null",
",",
"$",
"greed",
"=",
"true",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"start",
")",
")",
"{",
"$",
"pos1",
"=",
"strpos",
"(",
"$",
"str",
",",
"$",
... | content between start and end
@param string $str
@param string $start
@param string $end
@param bool $greed
@return string | [
"content",
"between",
"start",
"and",
"end"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L250-L271 |
ares333/php-curl | src/Toolkit.php | Toolkit.formatUrl | function formatUrl($url)
{
if (! $this->isUrl($url)) {
return null;
}
$url = trim($url);
$url = str_replace(' ', '+', $url);
$parse = parse_url($url);
strtolower($parse['scheme']);
strtolower($parse['host']);
return $this->buildUrl($parse);... | php | function formatUrl($url)
{
if (! $this->isUrl($url)) {
return null;
}
$url = trim($url);
$url = str_replace(' ', '+', $url);
$parse = parse_url($url);
strtolower($parse['scheme']);
strtolower($parse['host']);
return $this->buildUrl($parse);... | [
"function",
"formatUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isUrl",
"(",
"$",
"url",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"url",
"=",
"trim",
"(",
"$",
"url",
")",
";",
"$",
"url",
"=",
"str_replace",
"(... | Clean up and format
@param string $url
@return string|null | [
"Clean",
"up",
"and",
"format"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L293-L304 |
ares333/php-curl | src/Toolkit.php | Toolkit.url2absolute | function url2absolute($url, $urlCurrent)
{
// If relative URL has a scheme, clean path and return.
$r = $this->splitUrl($url);
if ($r === FALSE)
return FALSE;
if (! empty($r['scheme'])) {
if (! empty($r['path']) && $r['path'][0] == '/')
$r['pat... | php | function url2absolute($url, $urlCurrent)
{
// If relative URL has a scheme, clean path and return.
$r = $this->splitUrl($url);
if ($r === FALSE)
return FALSE;
if (! empty($r['scheme'])) {
if (! empty($r['path']) && $r['path'][0] == '/')
$r['pat... | [
"function",
"url2absolute",
"(",
"$",
"url",
",",
"$",
"urlCurrent",
")",
"{",
"// If relative URL has a scheme, clean path and return.",
"$",
"r",
"=",
"$",
"this",
"->",
"splitUrl",
"(",
"$",
"url",
")",
";",
"if",
"(",
"$",
"r",
"===",
"FALSE",
")",
"re... | Combine a base URL and a relative URL to produce a new
absolute URL.
The base URL is often the URL of a page,
and the relative URL is a URL embedded on that page.
This function implements the "absolutize" algorithm from
the RFC3986 specification for URLs.
This function supports multi-byte characters with the UTF-8 en... | [
"Combine",
"a",
"base",
"URL",
"and",
"a",
"relative",
"URL",
"to",
"produce",
"a",
"new",
"absolute",
"URL",
".",
"The",
"base",
"URL",
"is",
"often",
"the",
"URL",
"of",
"a",
"page",
"and",
"the",
"relative",
"URL",
"is",
"a",
"URL",
"embedded",
"o... | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L515-L570 |
ares333/php-curl | src/Toolkit.php | Toolkit.urlRemoveDotSegments | function urlRemoveDotSegments($path)
{
// multi-byte character explode
$inSeg = preg_split('!/!u', $path);
$outSeg = array();
foreach ($inSeg as $seg) {
if ($seg == '' || $seg == '.')
continue;
if ($seg == '..')
array_pop($outSe... | php | function urlRemoveDotSegments($path)
{
// multi-byte character explode
$inSeg = preg_split('!/!u', $path);
$outSeg = array();
foreach ($inSeg as $seg) {
if ($seg == '' || $seg == '.')
continue;
if ($seg == '..')
array_pop($outSe... | [
"function",
"urlRemoveDotSegments",
"(",
"$",
"path",
")",
"{",
"// multi-byte character explode",
"$",
"inSeg",
"=",
"preg_split",
"(",
"'!/!u'",
",",
"$",
"path",
")",
";",
"$",
"outSeg",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"inSeg",
"as",
... | Filter out "." and ".." segments from a URL's path and return
the result.
This function implements the "remove_dot_segments" algorithm from
the RFC3986 specification for URLs.
This function supports multi-byte characters with the UTF-8 encoding,
per the URL specification.
Parameters:
path the path to filter
Return ... | [
"Filter",
"out",
".",
"and",
"..",
"segments",
"from",
"a",
"URL",
"s",
"path",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L591-L611 |
ares333/php-curl | src/Toolkit.php | Toolkit.splitUrl | protected function splitUrl($url, $decode = TRUE)
{
// Character sets from RFC3986.
$xunressub = 'a-zA-Z\d\-._~\!$&\'()*+,;=';
$xpchar = $xunressub . ':@%';
// Scheme from RFC3986.
$xscheme = '([a-zA-Z][a-zA-Z\d+-.]*)';
// User info (user + password) from RFC3986.
... | php | protected function splitUrl($url, $decode = TRUE)
{
// Character sets from RFC3986.
$xunressub = 'a-zA-Z\d\-._~\!$&\'()*+,;=';
$xpchar = $xunressub . ':@%';
// Scheme from RFC3986.
$xscheme = '([a-zA-Z][a-zA-Z\d+-.]*)';
// User info (user + password) from RFC3986.
... | [
"protected",
"function",
"splitUrl",
"(",
"$",
"url",
",",
"$",
"decode",
"=",
"TRUE",
")",
"{",
"// Character sets from RFC3986.",
"$",
"xunressub",
"=",
"'a-zA-Z\\d\\-._~\\!$&\\'()*+,;='",
";",
"$",
"xpchar",
"=",
"$",
"xunressub",
".",
"':@%'",
";",
"// Schem... | This function parses an absolute or relative URL and splits it
into individual components.
RFC3986 specifies the components of a Uniform Resource Identifier (URI).
A portion of the ABNFs are repeated here:
URI-reference = URI
/ relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = re... | [
"This",
"function",
"parses",
"an",
"absolute",
"or",
"relative",
"URL",
"and",
"splits",
"it",
"into",
"individual",
"components",
"."
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L708-L805 |
ares333/php-curl | src/Toolkit.php | Toolkit.joinUrl | protected function joinUrl($parts, $encode = TRUE)
{
if ($encode) {
if (isset($parts['user']))
$parts['user'] = rawurlencode($parts['user']);
if (isset($parts['pass']))
$parts['pass'] = rawurlencode($parts['pass']);
if (isset($parts['host']... | php | protected function joinUrl($parts, $encode = TRUE)
{
if ($encode) {
if (isset($parts['user']))
$parts['user'] = rawurlencode($parts['user']);
if (isset($parts['pass']))
$parts['pass'] = rawurlencode($parts['pass']);
if (isset($parts['host']... | [
"protected",
"function",
"joinUrl",
"(",
"$",
"parts",
",",
"$",
"encode",
"=",
"TRUE",
")",
"{",
"if",
"(",
"$",
"encode",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parts",
"[",
"'user'",
"]",
")",
")",
"$",
"parts",
"[",
"'user'",
"]",
"=",
"r... | This function joins together URL components to form a complete URL.
RFC3986 specifies the components of a Uniform Resource Identifier (URI).
This function implements the specification's "component recomposition"
algorithm for combining URI components into a full URI string.
The $parts argument is an associative array... | [
"This",
"function",
"joins",
"together",
"URL",
"components",
"to",
"form",
"a",
"complete",
"URL",
"."
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Toolkit.php#L858-L902 |
ares333/php-curl | demo/_inc.php | ErrorHandler.error2exception | static function error2exception()
{
set_error_handler(
function ($errno, $errstr, $errfile, $errline) {
$r = error_reporting();
if ($r & $errno) {
$exception = new \ErrorException($errstr, null, $errno,
$errfile, $errlin... | php | static function error2exception()
{
set_error_handler(
function ($errno, $errstr, $errfile, $errline) {
$r = error_reporting();
if ($r & $errno) {
$exception = new \ErrorException($errstr, null, $errno,
$errfile, $errlin... | [
"static",
"function",
"error2exception",
"(",
")",
"{",
"set_error_handler",
"(",
"function",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"$",
"r",
"=",
"error_reporting",
"(",
")",
";",
"if",
"(",
"$",
... | error to exception
@throws \ErrorException | [
"error",
"to",
"exception"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/demo/_inc.php#L54-L68 |
ares333/php-curl | demo/_inc.php | ErrorHandler.catchException | static function catchException($exception)
{
$str = '';
if ($exception instanceof \ErrorException) {
$str .= static::severity2string($exception->getSeverity()) . ': ';
}
$str .= $exception->__toString();
if (ini_get('display_errors')) {
echo $str . "\n... | php | static function catchException($exception)
{
$str = '';
if ($exception instanceof \ErrorException) {
$str .= static::severity2string($exception->getSeverity()) . ': ';
}
$str .= $exception->__toString();
if (ini_get('display_errors')) {
echo $str . "\n... | [
"static",
"function",
"catchException",
"(",
"$",
"exception",
")",
"{",
"$",
"str",
"=",
"''",
";",
"if",
"(",
"$",
"exception",
"instanceof",
"\\",
"ErrorException",
")",
"{",
"$",
"str",
".=",
"static",
"::",
"severity2string",
"(",
"$",
"exception",
... | deal with exception
@param \Exception $exception | [
"deal",
"with",
"exception"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/demo/_inc.php#L98-L111 |
ares333/php-curl | src/Curl.php | Curl.add | public function add(array $item, $onSuccess = null, $onFail = null, $ahead = null)
{
if (! isset($ahead)) {
$ahead = false;
}
if (! isset($item['opt'])) {
$item['opt'] = array();
}
if (! isset($item['args'])) {
$item['args'] = null;
... | php | public function add(array $item, $onSuccess = null, $onFail = null, $ahead = null)
{
if (! isset($ahead)) {
$ahead = false;
}
if (! isset($item['opt'])) {
$item['opt'] = array();
}
if (! isset($item['args'])) {
$item['args'] = null;
... | [
"public",
"function",
"add",
"(",
"array",
"$",
"item",
",",
"$",
"onSuccess",
"=",
"null",
",",
"$",
"onFail",
"=",
"null",
",",
"$",
"ahead",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"ahead",
")",
")",
"{",
"$",
"ahead",
"=",... | Add a task to the taskPool
@param array $item
array $item[opt] CURLOPT_* for current task
mixed $item[args] Args for callbacks
array $item[cache]
@param mixed $onSuccess
Callback for response
@param mixed $onFail
Callback for curl error
@param bool $ahead
@return self | [
"Add",
"a",
"task",
"to",
"the",
"taskPool"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Curl.php#L114-L187 |
ares333/php-curl | src/Curl.php | Curl.onInfo | protected function onInfo($isLast = false)
{
$now = time();
if (! isset($this->_downloadSpeedStartTime)) {
$this->_downloadSpeedStartTime = $now;
}
if (($isLast || $now - $this->_onInfoLastTime > 0) && isset($this->onInfo)) {
$this->_info['all']['taskPoolNum']... | php | protected function onInfo($isLast = false)
{
$now = time();
if (! isset($this->_downloadSpeedStartTime)) {
$this->_downloadSpeedStartTime = $now;
}
if (($isLast || $now - $this->_onInfoLastTime > 0) && isset($this->onInfo)) {
$this->_info['all']['taskPoolNum']... | [
"protected",
"function",
"onInfo",
"(",
"$",
"isLast",
"=",
"false",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_downloadSpeedStartTime",
")",
")",
"{",
"$",
"this",
"->",
"_downloadSpeedStartTim... | Call $this->onInfo
@param bool $isLast
Is last output? | [
"Call",
"$this",
"-",
">",
"onInfo"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Curl.php#L327-L359 |
ares333/php-curl | src/Curl.php | Curl.onProcess | protected function onProcess($task, $param)
{
$userRes = array();
if (isset($task['onSuccess'])) {
$userRes = call_user_func($task['onSuccess'], $param, $task['args']);
}
if (isset($userRes['cache'])) {
$task['cache'] = array_merge($task['cache'], $userRes['ca... | php | protected function onProcess($task, $param)
{
$userRes = array();
if (isset($task['onSuccess'])) {
$userRes = call_user_func($task['onSuccess'], $param, $task['args']);
}
if (isset($userRes['cache'])) {
$task['cache'] = array_merge($task['cache'], $userRes['ca... | [
"protected",
"function",
"onProcess",
"(",
"$",
"task",
",",
"$",
"param",
")",
"{",
"$",
"userRes",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"task",
"[",
"'onSuccess'",
"]",
")",
")",
"{",
"$",
"userRes",
"=",
"call_user_func",
"... | Process response
@param array $task
@param array $param | [
"Process",
"response"
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Curl.php#L435-L448 |
ares333/php-curl | src/Curl.php | Curl.cache | protected function cache($task, $data = null)
{
$config = array_merge($this->cache, $task['cache']);
if (! $config['enable']) {
return null;
}
if (! isset($config['dir'])) {
user_error('cache dir is not defined', E_USER_WARNING);
return null;
... | php | protected function cache($task, $data = null)
{
$config = array_merge($this->cache, $task['cache']);
if (! $config['enable']) {
return null;
}
if (! isset($config['dir'])) {
user_error('cache dir is not defined', E_USER_WARNING);
return null;
... | [
"protected",
"function",
"cache",
"(",
"$",
"task",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"cache",
",",
"$",
"task",
"[",
"'cache'",
"]",
")",
";",
"if",
"(",
"!",
"$",
"config",
"[",
... | Set or get file cache.
@param $task
@param array|null $data
@return mixed | [
"Set",
"or",
"get",
"file",
"cache",
"."
] | train | https://github.com/ares333/php-curl/blob/03bbc9795bafdcefc9f7e213ae3b487c238d0b01/src/Curl.php#L477-L523 |
mamuz/PhpDependencyAnalysis | src/Parser/Visitor/Required/DeclaredNamespaceCollector.php | DeclaredNamespaceCollector.leaveNode | public function leaveNode(Node $node)
{
if ($node instanceof Node\Stmt\ClassLike) {
if (!$node->name) {
return;
}
if (!$this->getAdt()->hasDeclaredGlobalNamespace()) {
throw new Error('DeclaredNamespace is already defined', $node->getLine()... | php | public function leaveNode(Node $node)
{
if ($node instanceof Node\Stmt\ClassLike) {
if (!$node->name) {
return;
}
if (!$this->getAdt()->hasDeclaredGlobalNamespace()) {
throw new Error('DeclaredNamespace is already defined', $node->getLine()... | [
"public",
"function",
"leaveNode",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"Node",
"\\",
"Stmt",
"\\",
"ClassLike",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"->",
"name",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!... | {@inheritdoc}
@throws \PhpParser\Error | [
"{"
] | train | https://github.com/mamuz/PhpDependencyAnalysis/blob/4b4e86329fb0ff8716f495beb3ba684ed1b10477/src/Parser/Visitor/Required/DeclaredNamespaceCollector.php#L39-L50 |
Vinelab/NeoEloquent | src/Migrations/DatabaseMigrationRepository.php | DatabaseMigrationRepository.log | public function log($file, $batch)
{
$record = array('migration' => $file, 'batch' => $batch);
$this->model->create($record);
} | php | public function log($file, $batch)
{
$record = array('migration' => $file, 'batch' => $batch);
$this->model->create($record);
} | [
"public",
"function",
"log",
"(",
"$",
"file",
",",
"$",
"batch",
")",
"{",
"$",
"record",
"=",
"array",
"(",
"'migration'",
"=>",
"$",
"file",
",",
"'batch'",
"=>",
"$",
"batch",
")",
";",
"$",
"this",
"->",
"model",
"->",
"create",
"(",
"$",
"r... | {@inheritDoc} | [
"{"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Migrations/DatabaseMigrationRepository.php#L64-L69 |
Vinelab/NeoEloquent | src/Migrations/DatabaseMigrationRepository.php | DatabaseMigrationRepository.getMigrations | public function getMigrations($steps)
{
$query = $this->label()->where('batch', '>=', 1);
$results = [];
$rows = $query->orderBy('batch', 'desc')
->orderBy('migration', 'desc')
->take($steps)->get();
$columns = $rows->getColumns();
foreach ($rows as... | php | public function getMigrations($steps)
{
$query = $this->label()->where('batch', '>=', 1);
$results = [];
$rows = $query->orderBy('batch', 'desc')
->orderBy('migration', 'desc')
->take($steps)->get();
$columns = $rows->getColumns();
foreach ($rows as... | [
"public",
"function",
"getMigrations",
"(",
"$",
"steps",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"label",
"(",
")",
"->",
"where",
"(",
"'batch'",
",",
"'>='",
",",
"1",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"rows",
"=",
"... | Get list of migrations.
@param int $steps
@return array | [
"Get",
"list",
"of",
"migrations",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Migrations/DatabaseMigrationRepository.php#L195-L219 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Delegate.php | Delegate.makeRelationship | protected function makeRelationship($type, $startModel, $endModel, $properties = array())
{
return $this->client
->makeRelationship()
->setType($this->type)
->setStartNode($this->start)
->setEndNode($this->end)
->setProperties($this->attributes);
... | php | protected function makeRelationship($type, $startModel, $endModel, $properties = array())
{
return $this->client
->makeRelationship()
->setType($this->type)
->setStartNode($this->start)
->setEndNode($this->end)
->setProperties($this->attributes);
... | [
"protected",
"function",
"makeRelationship",
"(",
"$",
"type",
",",
"$",
"startModel",
",",
"$",
"endModel",
",",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"client",
"->",
"makeRelationship",
"(",
")",
"->",
"setTy... | Make a new Relationship instance.
@param string $type
@param \Vinelab\NeoEloquent\Eloquent\Model $startModel
@param \Vinelab\NeoEloquent\Eloquent\Model $endModel
@param array $properties
@return \Everyman\Neo4j\Relationship | [
"Make",
"a",
"new",
"Relationship",
"instance",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Delegate.php#L67-L75 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Delegate.php | Delegate.getRealDirection | public function getRealDirection($direction)
{
if ($direction == 'in' || $direction == 'out')
{
$direction = ucfirst($direction);
} elseif ($direction == 'any')
{
$direction = 'All';
} else
{
throw new UnknownDirectionException($d... | php | public function getRealDirection($direction)
{
if ($direction == 'in' || $direction == 'out')
{
$direction = ucfirst($direction);
} elseif ($direction == 'any')
{
$direction = 'All';
} else
{
throw new UnknownDirectionException($d... | [
"public",
"function",
"getRealDirection",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"$",
"direction",
"==",
"'in'",
"||",
"$",
"direction",
"==",
"'out'",
")",
"{",
"$",
"direction",
"=",
"ucfirst",
"(",
"$",
"direction",
")",
";",
"}",
"elseif",
"("... | Get the direction value from the Neo4j
client according to the direction set on
the inheriting class,
@param string $direction
@return string
@throws UnknownDirectionException If the specified $direction is not one of in, out or inout | [
"Get",
"the",
"direction",
"value",
"from",
"the",
"Neo4j",
"client",
"according",
"to",
"the",
"direction",
"set",
"on",
"the",
"inheriting",
"class"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Delegate.php#L116-L134 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Delegate.php | Delegate.asNode | public function asNode(Model $model)
{
$node = $this->client->makeNode();
// If the key name of the model is 'id' we will need to set it properly with setId()
// since setting it as a regular property with setProperty() won't cut it.
if ($model->getKeyName() == 'id')
{
... | php | public function asNode(Model $model)
{
$node = $this->client->makeNode();
// If the key name of the model is 'id' we will need to set it properly with setId()
// since setting it as a regular property with setProperty() won't cut it.
if ($model->getKeyName() == 'id')
{
... | [
"public",
"function",
"asNode",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"client",
"->",
"makeNode",
"(",
")",
";",
"// If the key name of the model is 'id' we will need to set it properly with setId()",
"// since setting it as a regular ... | Convert a model to a Node object.
@param \Vinelab\NeoEloquent\Eloquent\Model $model
@return \Everyman\Neo4j\Node | [
"Convert",
"a",
"model",
"to",
"a",
"Node",
"object",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Delegate.php#L142-L161 |
Vinelab/NeoEloquent | src/Eloquent/Relations/MorphedByOne.php | MorphedByOne.getEdge | public function getEdge(EloquentModel $model = null, $attributes = array())
{
$model = ( ! is_null($model)) ? $model : $this->parent->{$this->relation};
// Indicate a unique relation since this only involves one other model.
$unique = true;
return new EdgeOut($this->query, $this->pa... | php | public function getEdge(EloquentModel $model = null, $attributes = array())
{
$model = ( ! is_null($model)) ? $model : $this->parent->{$this->relation};
// Indicate a unique relation since this only involves one other model.
$unique = true;
return new EdgeOut($this->query, $this->pa... | [
"public",
"function",
"getEdge",
"(",
"EloquentModel",
"$",
"model",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"model",
"=",
"(",
"!",
"is_null",
"(",
"$",
"model",
")",
")",
"?",
"$",
"model",
":",
"$",
"this",
... | Get an instance of the EdgeIn relationship.
@param \Illuminate\Database\Eloquent\Model $model
@param array $attributes
@return \Vinelab\NeoEloquent\Eloquent\Edges\EdgeOut | [
"Get",
"an",
"instance",
"of",
"the",
"EdgeIn",
"relationship",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/MorphedByOne.php#L95-L102 |
Vinelab/NeoEloquent | src/Eloquent/Relations/BelongsTo.php | BelongsTo.addConstraints | public function addConstraints()
{
if (static::$constraints)
{
/**
* For belongs to relationships, which are essentially the inverse of has one
* or has many relationships, we need to actually query on the primary key
* of the parent model matching ... | php | public function addConstraints()
{
if (static::$constraints)
{
/**
* For belongs to relationships, which are essentially the inverse of has one
* or has many relationships, we need to actually query on the primary key
* of the parent model matching ... | [
"public",
"function",
"addConstraints",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"constraints",
")",
"{",
"/**\n * For belongs to relationships, which are essentially the inverse of has one\n * or has many relationships, we need to actually query on the prim... | Set the base constraints on the relation query.
@return void | [
"Set",
"the",
"base",
"constraints",
"on",
"the",
"relation",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/BelongsTo.php#L20-L61 |
Vinelab/NeoEloquent | src/Console/Migrations/MigrateResetCommand.php | MigrateResetCommand.handle | public function handle()
{
if (! $this->confirmToProceed()) {
return;
}
$this->migrator->setConnection($this->option('database'));
$this->migrator->reset(
$this->getMigrationPaths(), $this->option('pretend')
);
// Once the migrator has run w... | php | public function handle()
{
if (! $this->confirmToProceed()) {
return;
}
$this->migrator->setConnection($this->option('database'));
$this->migrator->reset(
$this->getMigrationPaths(), $this->option('pretend')
);
// Once the migrator has run w... | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"migrator",
"->",
"setConnection",
"(",
"$",
"this",
"->",
"option",
"(",
"'database'",
"... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Console/Migrations/MigrateResetCommand.php#L53-L71 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Finder.php | Finder.firstRelation | public function firstRelation(Model $parentModel, Model $relatedModel, $type, $direction = 'any')
{
// To get a relationship between two models we will have
// to find the Path between them so first let's transform
// them to nodes.
$parent = $this->asNode($parentModel);
$rel... | php | public function firstRelation(Model $parentModel, Model $relatedModel, $type, $direction = 'any')
{
// To get a relationship between two models we will have
// to find the Path between them so first let's transform
// them to nodes.
$parent = $this->asNode($parentModel);
$rel... | [
"public",
"function",
"firstRelation",
"(",
"Model",
"$",
"parentModel",
",",
"Model",
"$",
"relatedModel",
",",
"$",
"type",
",",
"$",
"direction",
"=",
"'any'",
")",
"{",
"// To get a relationship between two models we will have",
"// to find the Path between them so fi... | Get the direct relation between two models.
@param \Vinelab\NeoEloquent\Eloquent\Model $parentModel
@param \Vinelab\NeoEloquent\Eloquent\Model $relatedModel
@param string $direction
@return \Everyman\Neo4j\Relationship | [
"Get",
"the",
"direct",
"relation",
"between",
"two",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Finder.php#L32-L60 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Finder.php | Finder.get | public function get(Model $parent, Model $related, $type = [])
{
// Get the relationships for the parent node of the given type.
$relationships = $this->getModelRelationsForType($parent, $type);
$edges = [];
// Collect the edges out of the found relationships.
foreach ($rela... | php | public function get(Model $parent, Model $related, $type = [])
{
// Get the relationships for the parent node of the given type.
$relationships = $this->getModelRelationsForType($parent, $type);
$edges = [];
// Collect the edges out of the found relationships.
foreach ($rela... | [
"public",
"function",
"get",
"(",
"Model",
"$",
"parent",
",",
"Model",
"$",
"related",
",",
"$",
"type",
"=",
"[",
"]",
")",
"{",
"// Get the relationships for the parent node of the given type.",
"$",
"relationships",
"=",
"$",
"this",
"->",
"getModelRelationsFo... | Get the edges between two models.
@param \Vinelab\NeoEloquent\Eloquent\Model $parent
@param \Vinelab\NeoEloquent\Eloquent\Model $related
@param string|array $type
@return \Illuminate\Database\Eloquent\Collection | [
"Get",
"the",
"edges",
"between",
"two",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Finder.php#L91-L108 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Finder.php | Finder.hyperFirst | public function hyperFirst($parent, $related, $morph, $type, $morphType)
{
$left = $this->first($parent, $related, $type, 'out');
$right = $this->first($related, $morph, $morphType, 'out');
$edge = new HyperEdge($this->query, $parent, $type, $related, $morphType, $morph);
if ($left... | php | public function hyperFirst($parent, $related, $morph, $type, $morphType)
{
$left = $this->first($parent, $related, $type, 'out');
$right = $this->first($related, $morph, $morphType, 'out');
$edge = new HyperEdge($this->query, $parent, $type, $related, $morphType, $morph);
if ($left... | [
"public",
"function",
"hyperFirst",
"(",
"$",
"parent",
",",
"$",
"related",
",",
"$",
"morph",
",",
"$",
"type",
",",
"$",
"morphType",
")",
"{",
"$",
"left",
"=",
"$",
"this",
"->",
"first",
"(",
"$",
"parent",
",",
"$",
"related",
",",
"$",
"t... | Get the first HyperEdge between three models.
@param \Vinelab\NeoEloquent\Eloquent\Model $parent
@param \Vinelab\NeoEloquent\Eloquent\Model $related
@param \Vinelab\NeoEloquent\Eloquent\Model $morph
@param string $type
@param string $morphType
@return \Vinelab\NeoEloquent\Eloquent\Edges\HyperEdge | [
"Get",
"the",
"first",
"HyperEdge",
"between",
"three",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Finder.php#L120-L130 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Finder.php | Finder.directionFromRelation | public function directionFromRelation(Relationship $relation, Model $parent, Model $related)
{
// We will match the ids of the parent model and the start node of the relationship
// and if they match we know that the direction is outgoing, incoming otherwise.
$node = $relation->getStartNode(... | php | public function directionFromRelation(Relationship $relation, Model $parent, Model $related)
{
// We will match the ids of the parent model and the start node of the relationship
// and if they match we know that the direction is outgoing, incoming otherwise.
$node = $relation->getStartNode(... | [
"public",
"function",
"directionFromRelation",
"(",
"Relationship",
"$",
"relation",
",",
"Model",
"$",
"parent",
",",
"Model",
"$",
"related",
")",
"{",
"// We will match the ids of the parent model and the start node of the relationship",
"// and if they match we know that the ... | Get the direction of a relationship out of a Relation instance.
@param \Everyman\Neo4j\Relationship $relation
@param \Vinelab\NeoEloquent\Eloquent\Model $parent
@param \Vinelab\NeoEloquent\Eloquent\Model $related
@return string Either 'in' or 'out' | [
"Get",
"the",
"direction",
"of",
"a",
"relationship",
"out",
"of",
"a",
"Relation",
"instance",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Finder.php#L140-L156 |
Vinelab/NeoEloquent | src/Eloquent/Edges/Finder.php | Finder.edgeFromRelationWithDirection | public function edgeFromRelationWithDirection(Relationship $relation, Model $parent, Model $related, $direction)
{
// If the direction is of type 'any' we need to figure out the relationship direction
// from the determined relation.
if ($direction == 'any')
{
$direction ... | php | public function edgeFromRelationWithDirection(Relationship $relation, Model $parent, Model $related, $direction)
{
// If the direction is of type 'any' we need to figure out the relationship direction
// from the determined relation.
if ($direction == 'any')
{
$direction ... | [
"public",
"function",
"edgeFromRelationWithDirection",
"(",
"Relationship",
"$",
"relation",
",",
"Model",
"$",
"parent",
",",
"Model",
"$",
"related",
",",
"$",
"direction",
")",
"{",
"// If the direction is of type 'any' we need to figure out the relationship direction",
... | Get the Edge instance out of a Relationship based on a direction.
@param \Everyman\Neo4j\Relationship $relation
@param string $direction
@return \Vinelab\NeoEloquent\Eloquent\Edges\Edge[In|Out] | [
"Get",
"the",
"Edge",
"instance",
"out",
"of",
"a",
"Relationship",
"based",
"on",
"a",
"direction",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Edges/Finder.php#L165-L181 |
Vinelab/NeoEloquent | src/Schema/Builder.php | Builder.label | public function label($label, Closure $callback)
{
return $this->build(
$this->createBlueprint($label, $callback)
);
} | php | public function label($label, Closure $callback)
{
return $this->build(
$this->createBlueprint($label, $callback)
);
} | [
"public",
"function",
"label",
"(",
"$",
"label",
",",
"Closure",
"$",
"callback",
")",
"{",
"return",
"$",
"this",
"->",
"build",
"(",
"$",
"this",
"->",
"createBlueprint",
"(",
"$",
"label",
",",
"$",
"callback",
")",
")",
";",
"}"
] | Create a new data defintion on label schema.
@param string $label
@param Closure $callback
@return \Vinelab\NeoEloquent\Schema\Blueprint | [
"Create",
"a",
"new",
"data",
"defintion",
"on",
"label",
"schema",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Schema/Builder.php#L60-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.