repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
swiftmailer/swiftmailer | lib/classes/Swift/Transport/StreamBuffer.php | Swift_Transport_StreamBuffer.establishSocketConnection | private function establishSocketConnection()
{
$host = $this->params['host'];
if (!empty($this->params['protocol'])) {
$host = $this->params['protocol'].'://'.$host;
}
$timeout = 15;
if (!empty($this->params['timeout'])) {
$timeout = $this->params['tim... | php | private function establishSocketConnection()
{
$host = $this->params['host'];
if (!empty($this->params['protocol'])) {
$host = $this->params['protocol'].'://'.$host;
}
$timeout = 15;
if (!empty($this->params['timeout'])) {
$timeout = $this->params['tim... | [
"private",
"function",
"establishSocketConnection",
"(",
")",
"{",
"$",
"host",
"=",
"$",
"this",
"->",
"params",
"[",
"'host'",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"params",
"[",
"'protocol'",
"]",
")",
")",
"{",
"$",
"host",
... | Establishes a connection to a remote server. | [
"Establishes",
"a",
"connection",
"to",
"a",
"remote",
"server",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/StreamBuffer.php#L248-L282 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.sendMessage1 | protected function sendMessage1(Swift_Transport_SmtpAgent $agent)
{
$message = $this->createMessage1();
return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), [334]);
} | php | protected function sendMessage1(Swift_Transport_SmtpAgent $agent)
{
$message = $this->createMessage1();
return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), [334]);
} | [
"protected",
"function",
"sendMessage1",
"(",
"Swift_Transport_SmtpAgent",
"$",
"agent",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"createMessage1",
"(",
")",
";",
"return",
"$",
"agent",
"->",
"executeCommand",
"(",
"sprintf",
"(",
"\"AUTH %s %s\\r\\n\"... | Send our auth message and returns the response.
@return string SMTP Response | [
"Send",
"our",
"auth",
"message",
"and",
"returns",
"the",
"response",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L99-L104 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.readSubBlock | protected function readSubBlock($block)
{
// remove terminatorByte cause it's always the same
$block = substr($block, 0, -8);
$length = strlen($block);
$offset = 0;
$data = [];
while ($offset < $length) {
$blockLength = hexdec(substr(substr($block, $offse... | php | protected function readSubBlock($block)
{
// remove terminatorByte cause it's always the same
$block = substr($block, 0, -8);
$length = strlen($block);
$offset = 0;
$data = [];
while ($offset < $length) {
$blockLength = hexdec(substr(substr($block, $offse... | [
"protected",
"function",
"readSubBlock",
"(",
"$",
"block",
")",
"{",
"// remove terminatorByte cause it's always the same",
"$",
"block",
"=",
"substr",
"(",
"$",
"block",
",",
"0",
",",
"-",
"8",
")",
";",
"$",
"length",
"=",
"strlen",
"(",
"$",
"block",
... | Read the blob information in from message2.
@return array | [
"Read",
"the",
"blob",
"information",
"in",
"from",
"message2",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L145-L168 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.sendMessage3 | protected function sendMessage3($response, $username, $password, $timestamp, $client, Swift_Transport_SmtpAgent $agent, $v2 = true)
{
list($domain, $username) = $this->getDomainAndUsername($username);
//$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSS... | php | protected function sendMessage3($response, $username, $password, $timestamp, $client, Swift_Transport_SmtpAgent $agent, $v2 = true)
{
list($domain, $username) = $this->getDomainAndUsername($username);
//$challenge, $context, $targetInfoH, $targetName, $domainName, $workstation, $DNSDomainName, $DNSS... | [
"protected",
"function",
"sendMessage3",
"(",
"$",
"response",
",",
"$",
"username",
",",
"$",
"password",
",",
"$",
"timestamp",
",",
"$",
"client",
",",
"Swift_Transport_SmtpAgent",
"$",
"agent",
",",
"$",
"v2",
"=",
"true",
")",
"{",
"list",
"(",
"$",... | Send our final message with all our data.
@param string $response Message 1 response (message 2)
@param string $username
@param string $password
@param string $timestamp
@param string $client
@param bool $v2 Use version2 of the protocol
@return string | [
"Send",
"our",
"final",
"message",
"with",
"all",
"our",
"data",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L182-L203 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createMessage3 | protected function createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse)
{
// Create security buffers
$domainSec = $this->createSecurityBuffer($domain, 64);
$domainInfo = $this->readSecurityBuffer(bin2hex($domainSec));
$userSec = $this->createSecurityBuffer($us... | php | protected function createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse)
{
// Create security buffers
$domainSec = $this->createSecurityBuffer($domain, 64);
$domainInfo = $this->readSecurityBuffer(bin2hex($domainSec));
$userSec = $this->createSecurityBuffer($us... | [
"protected",
"function",
"createMessage3",
"(",
"$",
"domain",
",",
"$",
"username",
",",
"$",
"workstation",
",",
"$",
"lmResponse",
",",
"$",
"ntlmResponse",
")",
"{",
"// Create security buffers",
"$",
"domainSec",
"=",
"$",
"this",
"->",
"createSecurityBuffe... | Create our message 3.
@param string $domain
@param string $username
@param string $workstation
@param string $lmResponse
@param string $ntlmResponse
@return string | [
"Create",
"our",
"message",
"3",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L228-L255 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.getDomainAndUsername | protected function getDomainAndUsername($name)
{
if (false !== strpos($name, '\\')) {
return explode('\\', $name);
}
if (false !== strpos($name, '@')) {
list($user, $domain) = explode('@', $name);
return [$domain, $user];
}
// no domain ... | php | protected function getDomainAndUsername($name)
{
if (false !== strpos($name, '\\')) {
return explode('\\', $name);
}
if (false !== strpos($name, '@')) {
list($user, $domain) = explode('@', $name);
return [$domain, $user];
}
// no domain ... | [
"protected",
"function",
"getDomainAndUsername",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"name",
",",
"'\\\\'",
")",
")",
"{",
"return",
"explode",
"(",
"'\\\\'",
",",
"$",
"name",
")",
";",
"}",
"if",
"(",
"false",... | Get domain and username from our username.
@example DOMAIN\username
@param string $name
@return array | [
"Get",
"domain",
"and",
"username",
"from",
"our",
"username",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L284-L298 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createLMPassword | protected function createLMPassword($password, $challenge)
{
// FIRST PART
$password = $this->createByte(strtoupper($password), 14, false);
list($key1, $key2) = str_split($password, 7);
$desKey1 = $this->createDesKey($key1);
$desKey2 = $this->createDesKey($key2);
$c... | php | protected function createLMPassword($password, $challenge)
{
// FIRST PART
$password = $this->createByte(strtoupper($password), 14, false);
list($key1, $key2) = str_split($password, 7);
$desKey1 = $this->createDesKey($key1);
$desKey2 = $this->createDesKey($key2);
$c... | [
"protected",
"function",
"createLMPassword",
"(",
"$",
"password",
",",
"$",
"challenge",
")",
"{",
"// FIRST PART",
"$",
"password",
"=",
"$",
"this",
"->",
"createByte",
"(",
"strtoupper",
"(",
"$",
"password",
")",
",",
"14",
",",
"false",
")",
";",
"... | Create LMv1 response.
@param string $password
@param string $challenge
@return string | [
"Create",
"LMv1",
"response",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L308-L327 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createNTLMPassword | protected function createNTLMPassword($password, $challenge)
{
// FIRST PART
$ntlmHash = $this->createByte($this->md4Encrypt($password), 21, false);
list($key1, $key2, $key3) = str_split($ntlmHash, 7);
$desKey1 = $this->createDesKey($key1);
$desKey2 = $this->createDesKey($ke... | php | protected function createNTLMPassword($password, $challenge)
{
// FIRST PART
$ntlmHash = $this->createByte($this->md4Encrypt($password), 21, false);
list($key1, $key2, $key3) = str_split($ntlmHash, 7);
$desKey1 = $this->createDesKey($key1);
$desKey2 = $this->createDesKey($ke... | [
"protected",
"function",
"createNTLMPassword",
"(",
"$",
"password",
",",
"$",
"challenge",
")",
"{",
"// FIRST PART",
"$",
"ntlmHash",
"=",
"$",
"this",
"->",
"createByte",
"(",
"$",
"this",
"->",
"md4Encrypt",
"(",
"$",
"password",
")",
",",
"21",
",",
... | Create NTLMv1 response.
@param string $password
@param string $challenge
@return string | [
"Create",
"NTLMv1",
"response",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L337-L348 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.getCorrectTimestamp | protected function getCorrectTimestamp($time)
{
// Get our timestamp (tricky!)
$time = number_format($time, 0, '.', ''); // save microtime to string
$time = bcadd($time, '11644473600000', 0); // add epoch time
$time = bcmul($time, 10000, 0); // tenths of a microsecond.
$bina... | php | protected function getCorrectTimestamp($time)
{
// Get our timestamp (tricky!)
$time = number_format($time, 0, '.', ''); // save microtime to string
$time = bcadd($time, '11644473600000', 0); // add epoch time
$time = bcmul($time, 10000, 0); // tenths of a microsecond.
$bina... | [
"protected",
"function",
"getCorrectTimestamp",
"(",
"$",
"time",
")",
"{",
"// Get our timestamp (tricky!)",
"$",
"time",
"=",
"number_format",
"(",
"$",
"time",
",",
"0",
",",
"'.'",
",",
"''",
")",
";",
"// save microtime to string",
"$",
"time",
"=",
"bcad... | Convert a normal timestamp to a tenth of a microtime epoch time.
@param string $time
@return string | [
"Convert",
"a",
"normal",
"timestamp",
"to",
"a",
"tenth",
"of",
"a",
"microtime",
"epoch",
"time",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L357-L371 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createLMv2Password | protected function createLMv2Password($password, $username, $domain, $challenge, $client)
{
$lmPass = '00'; // by default 00
// if $password > 15 than we can't use this method
if (strlen($password) <= 15) {
$ntlmHash = $this->md4Encrypt($password);
$ntml2Hash = $this-... | php | protected function createLMv2Password($password, $username, $domain, $challenge, $client)
{
$lmPass = '00'; // by default 00
// if $password > 15 than we can't use this method
if (strlen($password) <= 15) {
$ntlmHash = $this->md4Encrypt($password);
$ntml2Hash = $this-... | [
"protected",
"function",
"createLMv2Password",
"(",
"$",
"password",
",",
"$",
"username",
",",
"$",
"domain",
",",
"$",
"challenge",
",",
"$",
"client",
")",
"{",
"$",
"lmPass",
"=",
"'00'",
";",
"// by default 00",
"// if $password > 15 than we can't use this me... | Create LMv2 response.
@param string $password
@param string $username
@param string $domain
@param string $challenge NTLM Challenge
@param string $client Random string
@return string | [
"Create",
"LMv2",
"response",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L384-L396 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createNTLMv2Hash | protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client)
{
$ntlmHash = $this->md4Encrypt($password);
$ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain));
// create blob
$blob = $this-... | php | protected function createNTLMv2Hash($password, $username, $domain, $challenge, $targetInfo, $timestamp, $client)
{
$ntlmHash = $this->md4Encrypt($password);
$ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain));
// create blob
$blob = $this-... | [
"protected",
"function",
"createNTLMv2Hash",
"(",
"$",
"password",
",",
"$",
"username",
",",
"$",
"domain",
",",
"$",
"challenge",
",",
"$",
"targetInfo",
",",
"$",
"timestamp",
",",
"$",
"client",
")",
"{",
"$",
"ntlmHash",
"=",
"$",
"this",
"->",
"m... | Create NTLMv2 response.
@param string $password
@param string $username
@param string $domain
@param string $challenge Hex values
@param string $targetInfo Hex values
@param string $timestamp
@param string $client Random bytes
@return string
@see http://davenport.sourceforge.net/ntlm.html#theNtlmResponse | [
"Create",
"NTLMv2",
"response",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L413-L424 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createSecurityBuffer | protected function createSecurityBuffer($value, $offset, $is16 = false)
{
$length = strlen(bin2hex($value));
$length = $is16 ? $length / 2 : $length;
$length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2);
return $length.$length.$this->createByte(dechex($offs... | php | protected function createSecurityBuffer($value, $offset, $is16 = false)
{
$length = strlen(bin2hex($value));
$length = $is16 ? $length / 2 : $length;
$length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2);
return $length.$length.$this->createByte(dechex($offs... | [
"protected",
"function",
"createSecurityBuffer",
"(",
"$",
"value",
",",
"$",
"offset",
",",
"$",
"is16",
"=",
"false",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"bin2hex",
"(",
"$",
"value",
")",
")",
";",
"$",
"length",
"=",
"$",
"is16",
"?",
... | Create our security buffer depending on length and offset.
@param string $value Value we want to put in
@param int $offset start of value
@param bool $is16 Do we 16bit string or not?
@return string | [
"Create",
"our",
"security",
"buffer",
"depending",
"on",
"length",
"and",
"offset",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L466-L473 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.readSecurityBuffer | protected function readSecurityBuffer($value)
{
$length = floor(hexdec(substr($value, 0, 4)) / 256) * 2;
$offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2;
return [$length, $offset];
} | php | protected function readSecurityBuffer($value)
{
$length = floor(hexdec(substr($value, 0, 4)) / 256) * 2;
$offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2;
return [$length, $offset];
} | [
"protected",
"function",
"readSecurityBuffer",
"(",
"$",
"value",
")",
"{",
"$",
"length",
"=",
"floor",
"(",
"hexdec",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"4",
")",
")",
"/",
"256",
")",
"*",
"2",
";",
"$",
"offset",
"=",
"floor",
"... | Read our security buffer to fetch length and offset of our value.
@param string $value Securitybuffer in hex
@return array array with length and offset | [
"Read",
"our",
"security",
"buffer",
"to",
"fetch",
"length",
"and",
"offset",
"of",
"our",
"value",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L482-L488 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.createByte | protected function createByte($input, $bytes = 4, $isHex = true)
{
if ($isHex) {
$byte = hex2bin(str_pad($input, $bytes * 2, '00'));
} else {
$byte = str_pad($input, $bytes, "\x00");
}
return $byte;
} | php | protected function createByte($input, $bytes = 4, $isHex = true)
{
if ($isHex) {
$byte = hex2bin(str_pad($input, $bytes * 2, '00'));
} else {
$byte = str_pad($input, $bytes, "\x00");
}
return $byte;
} | [
"protected",
"function",
"createByte",
"(",
"$",
"input",
",",
"$",
"bytes",
"=",
"4",
",",
"$",
"isHex",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"isHex",
")",
"{",
"$",
"byte",
"=",
"hex2bin",
"(",
"str_pad",
"(",
"$",
"input",
",",
"$",
"bytes",... | Right padding with 0 to certain length.
@param string $input
@param int $bytes Length of bytes
@param bool $isHex Did we provided hex value
@return string | [
"Right",
"padding",
"with",
"0",
"to",
"certain",
"length",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L529-L538 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.md5Encrypt | protected function md5Encrypt($key, $msg)
{
$blocksize = 64;
if (strlen($key) > $blocksize) {
$key = pack('H*', md5($key));
}
$key = str_pad($key, $blocksize, "\0");
$ipadk = $key ^ str_repeat("\x36", $blocksize);
$opadk = $key ^ str_repeat("\x5c", $block... | php | protected function md5Encrypt($key, $msg)
{
$blocksize = 64;
if (strlen($key) > $blocksize) {
$key = pack('H*', md5($key));
}
$key = str_pad($key, $blocksize, "\0");
$ipadk = $key ^ str_repeat("\x36", $blocksize);
$opadk = $key ^ str_repeat("\x5c", $block... | [
"protected",
"function",
"md5Encrypt",
"(",
"$",
"key",
",",
"$",
"msg",
")",
"{",
"$",
"blocksize",
"=",
"64",
";",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"$",
"blocksize",
")",
"{",
"$",
"key",
"=",
"pack",
"(",
"'H*'",
",",
"md5",
"... | MD5 Encryption.
@param string $key Encryption key
@param string $msg Message to encrypt
@return string | [
"MD5",
"Encryption",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L563-L575 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php | Swift_Transport_Esmtp_Auth_NTLMAuthenticator.md4Encrypt | protected function md4Encrypt($input)
{
$input = $this->convertTo16bit($input);
return function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
} | php | protected function md4Encrypt($input)
{
$input = $this->convertTo16bit($input);
return function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
} | [
"protected",
"function",
"md4Encrypt",
"(",
"$",
"input",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"convertTo16bit",
"(",
"$",
"input",
")",
";",
"return",
"function_exists",
"(",
"'hash'",
")",
"?",
"hex2bin",
"(",
"hash",
"(",
"'md4'",
",",
"$... | MD4 Encryption.
@param string $input
@return string
@see https://secure.php.net/manual/en/ref.hash.php | [
"MD4",
"Encryption",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L586-L591 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Preferences.php | Swift_Preferences.setQPDotEscape | public function setQPDotEscape($dotEscape)
{
$dotEscape = !empty($dotEscape);
Swift_DependencyContainer::getInstance()
->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
->withDependencies(['mime.charstream', 'mime.... | php | public function setQPDotEscape($dotEscape)
{
$dotEscape = !empty($dotEscape);
Swift_DependencyContainer::getInstance()
->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
->withDependencies(['mime.charstream', 'mime.... | [
"public",
"function",
"setQPDotEscape",
"(",
"$",
"dotEscape",
")",
"{",
"$",
"dotEscape",
"=",
"!",
"empty",
"(",
"$",
"dotEscape",
")",
";",
"Swift_DependencyContainer",
"::",
"getInstance",
"(",
")",
"->",
"register",
"(",
"'mime.qpcontentencoder'",
")",
"-... | Set the QuotedPrintable dot escaper preference.
@param bool $dotEscape
@return $this | [
"Set",
"the",
"QuotedPrintable",
"dot",
"escaper",
"preference",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Preferences.php#L89-L99 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php | Swift_Plugins_BandwidthMonitorPlugin.write | public function write($bytes)
{
$this->out += strlen($bytes);
foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
} | php | public function write($bytes)
{
$this->out += strlen($bytes);
foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
} | [
"public",
"function",
"write",
"(",
"$",
"bytes",
")",
"{",
"$",
"this",
"->",
"out",
"+=",
"strlen",
"(",
"$",
"bytes",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"mirrors",
"as",
"$",
"stream",
")",
"{",
"$",
"stream",
"->",
"write",
"(",
"$"... | Called when a message is sent so that the outgoing counter can be increased.
@param string $bytes | [
"Called",
"when",
"a",
"message",
"is",
"sent",
"so",
"that",
"the",
"outgoing",
"counter",
"can",
"be",
"increased",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php#L74-L80 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.addPart | public function addPart($body, $contentType = null, $charset = null)
{
return $this->attach((new Swift_MimePart($body, $contentType, $charset))->setEncoder($this->getEncoder()));
} | php | public function addPart($body, $contentType = null, $charset = null)
{
return $this->attach((new Swift_MimePart($body, $contentType, $charset))->setEncoder($this->getEncoder()));
} | [
"public",
"function",
"addPart",
"(",
"$",
"body",
",",
"$",
"contentType",
"=",
"null",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"attach",
"(",
"(",
"new",
"Swift_MimePart",
"(",
"$",
"body",
",",
"$",
"contentType",
... | Add a MimePart to this Message.
@param string|Swift_OutputByteStream $body
@param string $contentType
@param string $charset
@return $this | [
"Add",
"a",
"MimePart",
"to",
"this",
"Message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L72-L75 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.attachSigner | public function attachSigner(Swift_Signer $signer)
{
if ($signer instanceof Swift_Signers_HeaderSigner) {
$this->headerSigners[] = $signer;
} elseif ($signer instanceof Swift_Signers_BodySigner) {
$this->bodySigners[] = $signer;
}
return $this;
} | php | public function attachSigner(Swift_Signer $signer)
{
if ($signer instanceof Swift_Signers_HeaderSigner) {
$this->headerSigners[] = $signer;
} elseif ($signer instanceof Swift_Signers_BodySigner) {
$this->bodySigners[] = $signer;
}
return $this;
} | [
"public",
"function",
"attachSigner",
"(",
"Swift_Signer",
"$",
"signer",
")",
"{",
"if",
"(",
"$",
"signer",
"instanceof",
"Swift_Signers_HeaderSigner",
")",
"{",
"$",
"this",
"->",
"headerSigners",
"[",
"]",
"=",
"$",
"signer",
";",
"}",
"elseif",
"(",
"... | Attach a new signature handler to the message.
@return $this | [
"Attach",
"a",
"new",
"signature",
"handler",
"to",
"the",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L82-L91 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.detachSigner | public function detachSigner(Swift_Signer $signer)
{
if ($signer instanceof Swift_Signers_HeaderSigner) {
foreach ($this->headerSigners as $k => $headerSigner) {
if ($headerSigner === $signer) {
unset($this->headerSigners[$k]);
return $thi... | php | public function detachSigner(Swift_Signer $signer)
{
if ($signer instanceof Swift_Signers_HeaderSigner) {
foreach ($this->headerSigners as $k => $headerSigner) {
if ($headerSigner === $signer) {
unset($this->headerSigners[$k]);
return $thi... | [
"public",
"function",
"detachSigner",
"(",
"Swift_Signer",
"$",
"signer",
")",
"{",
"if",
"(",
"$",
"signer",
"instanceof",
"Swift_Signers_HeaderSigner",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headerSigners",
"as",
"$",
"k",
"=>",
"$",
"headerSigner",
... | Detach a signature handler from a message.
@return $this | [
"Detach",
"a",
"signature",
"handler",
"from",
"a",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L98-L119 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.doSign | protected function doSign()
{
foreach ($this->bodySigners as $signer) {
$altered = $signer->getAlteredHeaders();
$this->saveHeaders($altered);
$signer->signMessage($this);
}
foreach ($this->headerSigners as $signer) {
$altered = $signer->getAl... | php | protected function doSign()
{
foreach ($this->bodySigners as $signer) {
$altered = $signer->getAlteredHeaders();
$this->saveHeaders($altered);
$signer->signMessage($this);
}
foreach ($this->headerSigners as $signer) {
$altered = $signer->getAl... | [
"protected",
"function",
"doSign",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"bodySigners",
"as",
"$",
"signer",
")",
"{",
"$",
"altered",
"=",
"$",
"signer",
"->",
"getAlteredHeaders",
"(",
")",
";",
"$",
"this",
"->",
"saveHeaders",
"(",
"$",... | loops through signers and apply the signatures. | [
"loops",
"through",
"signers",
"and",
"apply",
"the",
"signatures",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L184-L205 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.saveMessage | protected function saveMessage()
{
$this->savedMessage = ['headers' => []];
$this->savedMessage['body'] = $this->getBody();
$this->savedMessage['children'] = $this->getChildren();
if (count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
$this->setChildr... | php | protected function saveMessage()
{
$this->savedMessage = ['headers' => []];
$this->savedMessage['body'] = $this->getBody();
$this->savedMessage['children'] = $this->getChildren();
if (count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
$this->setChildr... | [
"protected",
"function",
"saveMessage",
"(",
")",
"{",
"$",
"this",
"->",
"savedMessage",
"=",
"[",
"'headers'",
"=>",
"[",
"]",
"]",
";",
"$",
"this",
"->",
"savedMessage",
"[",
"'body'",
"]",
"=",
"$",
"this",
"->",
"getBody",
"(",
")",
";",
"$",
... | save the message before any signature is applied. | [
"save",
"the",
"message",
"before",
"any",
"signature",
"is",
"applied",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L210-L219 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.saveHeaders | protected function saveHeaders(array $altered)
{
foreach ($altered as $head) {
$lc = strtolower($head);
if (!isset($this->savedMessage['headers'][$lc])) {
$this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head);
}
}
} | php | protected function saveHeaders(array $altered)
{
foreach ($altered as $head) {
$lc = strtolower($head);
if (!isset($this->savedMessage['headers'][$lc])) {
$this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head);
}
}
} | [
"protected",
"function",
"saveHeaders",
"(",
"array",
"$",
"altered",
")",
"{",
"foreach",
"(",
"$",
"altered",
"as",
"$",
"head",
")",
"{",
"$",
"lc",
"=",
"strtolower",
"(",
"$",
"head",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
... | save the original headers. | [
"save",
"the",
"original",
"headers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L224-L233 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.restoreHeaders | protected function restoreHeaders()
{
foreach ($this->savedMessage['headers'] as $name => $savedValue) {
$headers = $this->getHeaders()->getAll($name);
foreach ($headers as $key => $value) {
if (!isset($savedValue[$key])) {
$this->getHeaders()->re... | php | protected function restoreHeaders()
{
foreach ($this->savedMessage['headers'] as $name => $savedValue) {
$headers = $this->getHeaders()->getAll($name);
foreach ($headers as $key => $value) {
if (!isset($savedValue[$key])) {
$this->getHeaders()->re... | [
"protected",
"function",
"restoreHeaders",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"savedMessage",
"[",
"'headers'",
"]",
"as",
"$",
"name",
"=>",
"$",
"savedValue",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"-... | Remove or restore altered headers. | [
"Remove",
"or",
"restore",
"altered",
"headers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L238-L249 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Message.php | Swift_Message.restoreMessage | protected function restoreMessage()
{
$this->setBody($this->savedMessage['body']);
$this->setChildren($this->savedMessage['children']);
$this->restoreHeaders();
$this->savedMessage = [];
} | php | protected function restoreMessage()
{
$this->setBody($this->savedMessage['body']);
$this->setChildren($this->savedMessage['children']);
$this->restoreHeaders();
$this->savedMessage = [];
} | [
"protected",
"function",
"restoreMessage",
"(",
")",
"{",
"$",
"this",
"->",
"setBody",
"(",
"$",
"this",
"->",
"savedMessage",
"[",
"'body'",
"]",
")",
";",
"$",
"this",
"->",
"setChildren",
"(",
"$",
"this",
"->",
"savedMessage",
"[",
"'children'",
"]"... | Restore message body. | [
"Restore",
"message",
"body",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Message.php#L254-L261 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.setCharset | public function setCharset($charset)
{
$this->charset = $charset;
$this->factory->charsetChanged($charset);
$this->notifyHeadersOfCharset($charset);
} | php | public function setCharset($charset)
{
$this->charset = $charset;
$this->factory->charsetChanged($charset);
$this->notifyHeadersOfCharset($charset);
} | [
"public",
"function",
"setCharset",
"(",
"$",
"charset",
")",
"{",
"$",
"this",
"->",
"charset",
"=",
"$",
"charset",
";",
"$",
"this",
"->",
"factory",
"->",
"charsetChanged",
"(",
"$",
"charset",
")",
";",
"$",
"this",
"->",
"notifyHeadersOfCharset",
"... | Set the charset used by these headers.
@param string $charset | [
"Set",
"the",
"charset",
"used",
"by",
"these",
"headers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L56-L61 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.addIdHeader | public function addIdHeader($name, $ids = null)
{
$this->storeHeader($name, $this->factory->createIdHeader($name, $ids));
} | php | public function addIdHeader($name, $ids = null)
{
$this->storeHeader($name, $this->factory->createIdHeader($name, $ids));
} | [
"public",
"function",
"addIdHeader",
"(",
"$",
"name",
",",
"$",
"ids",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"storeHeader",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"factory",
"->",
"createIdHeader",
"(",
"$",
"name",
",",
"$",
"ids",
")",
")... | Add a new ID header for Message-ID or Content-ID.
@param string $name
@param string|array $ids | [
"Add",
"a",
"new",
"ID",
"header",
"for",
"Message",
"-",
"ID",
"or",
"Content",
"-",
"ID",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L113-L116 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.set | public function set(Swift_Mime_Header $header, $index = 0)
{
$this->storeHeader($header->getFieldName(), $header, $index);
} | php | public function set(Swift_Mime_Header $header, $index = 0)
{
$this->storeHeader($header->getFieldName(), $header, $index);
} | [
"public",
"function",
"set",
"(",
"Swift_Mime_Header",
"$",
"header",
",",
"$",
"index",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"storeHeader",
"(",
"$",
"header",
"->",
"getFieldName",
"(",
")",
",",
"$",
"header",
",",
"$",
"index",
")",
";",
"}"
] | Set a header in the HeaderSet.
The header may be a previously fetched header via {@link get()} or it may
be one that has been created separately.
If $index is specified, the header will be inserted into the set at this
offset.
@param int $index | [
"Set",
"a",
"header",
"in",
"the",
"HeaderSet",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L166-L169 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.listAll | public function listAll()
{
$headers = $this->headers;
if ($this->canSort()) {
uksort($headers, [$this, 'sortHeaders']);
}
return array_keys($headers);
} | php | public function listAll()
{
$headers = $this->headers;
if ($this->canSort()) {
uksort($headers, [$this, 'sortHeaders']);
}
return array_keys($headers);
} | [
"public",
"function",
"listAll",
"(",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"headers",
";",
"if",
"(",
"$",
"this",
"->",
"canSort",
"(",
")",
")",
"{",
"uksort",
"(",
"$",
"headers",
",",
"[",
"$",
"this",
",",
"'sortHeaders'",
"]",
... | Return the name of all Headers.
@return array | [
"Return",
"the",
"name",
"of",
"all",
"Headers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L230-L238 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.toString | public function toString()
{
$string = '';
$headers = $this->headers;
if ($this->canSort()) {
uksort($headers, [$this, 'sortHeaders']);
}
foreach ($headers as $collection) {
foreach ($collection as $header) {
if ($this->isDisplayed($hea... | php | public function toString()
{
$string = '';
$headers = $this->headers;
if ($this->canSort()) {
uksort($headers, [$this, 'sortHeaders']);
}
foreach ($headers as $collection) {
foreach ($collection as $header) {
if ($this->isDisplayed($hea... | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"$",
"headers",
"=",
"$",
"this",
"->",
"headers",
";",
"if",
"(",
"$",
"this",
"->",
"canSort",
"(",
")",
")",
"{",
"uksort",
"(",
"$",
"headers",
",",
"[",
"$",
"... | Returns a string with a representation of all headers.
@return string | [
"Returns",
"a",
"string",
"with",
"a",
"representation",
"of",
"all",
"headers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L300-L316 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.storeHeader | private function storeHeader($name, Swift_Mime_Header $header, $offset = null)
{
if (!isset($this->headers[strtolower($name)])) {
$this->headers[strtolower($name)] = [];
}
if (!isset($offset)) {
$this->headers[strtolower($name)][] = $header;
} else {
... | php | private function storeHeader($name, Swift_Mime_Header $header, $offset = null)
{
if (!isset($this->headers[strtolower($name)])) {
$this->headers[strtolower($name)] = [];
}
if (!isset($offset)) {
$this->headers[strtolower($name)][] = $header;
} else {
... | [
"private",
"function",
"storeHeader",
"(",
"$",
"name",
",",
"Swift_Mime_Header",
"$",
"header",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"strtolower",
"(",
"$",
"name",
")",
"]",
")"... | Save a Header to the internal collection | [
"Save",
"a",
"Header",
"to",
"the",
"internal",
"collection"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L331-L341 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderSet.php | Swift_Mime_SimpleHeaderSet.notifyHeadersOfCharset | private function notifyHeadersOfCharset($charset)
{
foreach ($this->headers as $headerGroup) {
foreach ($headerGroup as $header) {
$header->setCharset($charset);
}
}
} | php | private function notifyHeadersOfCharset($charset)
{
foreach ($this->headers as $headerGroup) {
foreach ($headerGroup as $header) {
$header->setCharset($charset);
}
}
} | [
"private",
"function",
"notifyHeadersOfCharset",
"(",
"$",
"charset",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"headerGroup",
")",
"{",
"foreach",
"(",
"$",
"headerGroup",
"as",
"$",
"header",
")",
"{",
"$",
"header",
"->",
"set... | Notify all Headers of the new charset | [
"Notify",
"all",
"Headers",
"of",
"the",
"new",
"charset"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderSet.php#L378-L385 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMessage.php | Swift_Mime_SimpleMessage.setSubject | public function setSubject($subject)
{
if (!$this->setHeaderFieldModel('Subject', $subject)) {
$this->getHeaders()->addTextHeader('Subject', $subject);
}
return $this;
} | php | public function setSubject($subject)
{
if (!$this->setHeaderFieldModel('Subject', $subject)) {
$this->getHeaders()->addTextHeader('Subject', $subject);
}
return $this;
} | [
"public",
"function",
"setSubject",
"(",
"$",
"subject",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setHeaderFieldModel",
"(",
"'Subject'",
",",
"$",
"subject",
")",
")",
"{",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"->",
"addTextHeader",
"(",
"'... | Set the subject of this message.
@param string $subject
@return $this | [
"Set",
"the",
"subject",
"of",
"this",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMessage.php#L74-L81 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMessage.php | Swift_Mime_SimpleMessage.setDate | public function setDate(DateTimeInterface $dateTime)
{
if (!$this->setHeaderFieldModel('Date', $dateTime)) {
$this->getHeaders()->addDateHeader('Date', $dateTime);
}
return $this;
} | php | public function setDate(DateTimeInterface $dateTime)
{
if (!$this->setHeaderFieldModel('Date', $dateTime)) {
$this->getHeaders()->addDateHeader('Date', $dateTime);
}
return $this;
} | [
"public",
"function",
"setDate",
"(",
"DateTimeInterface",
"$",
"dateTime",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setHeaderFieldModel",
"(",
"'Date'",
",",
"$",
"dateTime",
")",
")",
"{",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"->",
"addDateH... | Set the date at which this message was created.
@return $this | [
"Set",
"the",
"date",
"at",
"which",
"this",
"message",
"was",
"created",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMessage.php#L98-L105 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMessage.php | Swift_Mime_SimpleMessage.detach | public function detach(Swift_Mime_SimpleMimeEntity $entity)
{
$newChildren = [];
foreach ($this->getChildren() as $child) {
if ($entity !== $child) {
$newChildren[] = $child;
}
}
$this->setChildren($newChildren);
return $this;
} | php | public function detach(Swift_Mime_SimpleMimeEntity $entity)
{
$newChildren = [];
foreach ($this->getChildren() as $child) {
if ($entity !== $child) {
$newChildren[] = $child;
}
}
$this->setChildren($newChildren);
return $this;
} | [
"public",
"function",
"detach",
"(",
"Swift_Mime_SimpleMimeEntity",
"$",
"entity",
")",
"{",
"$",
"newChildren",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"entity",
"!=... | Remove an already attached entity.
@return $this | [
"Remove",
"an",
"already",
"attached",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMessage.php#L537-L548 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMessage.php | Swift_Mime_SimpleMessage.becomeMimePart | protected function becomeMimePart()
{
$part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(),
$this->getCache(), $this->getIdGenerator(), $this->userCharset
);
$part->setContentType($this->userContentType);
$part->setBody($this->getBody());
... | php | protected function becomeMimePart()
{
$part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(),
$this->getCache(), $this->getIdGenerator(), $this->userCharset
);
$part->setContentType($this->userContentType);
$part->setBody($this->getBody());
... | [
"protected",
"function",
"becomeMimePart",
"(",
")",
"{",
"$",
"part",
"=",
"new",
"parent",
"(",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"->",
"newInstance",
"(",
")",
",",
"$",
"this",
"->",
"getEncoder",
"(",
")",
",",
"$",
"this",
"->",
"getCa... | Turn the body of this message into a child of itself if needed | [
"Turn",
"the",
"body",
"of",
"this",
"message",
"into",
"a",
"child",
"of",
"itself",
"if",
"needed"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMessage.php#L615-L627 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMessage.php | Swift_Mime_SimpleMessage.getTopNestingLevel | private function getTopNestingLevel()
{
$highestLevel = $this->getNestingLevel();
foreach ($this->getChildren() as $child) {
$childLevel = $child->getNestingLevel();
if ($highestLevel < $childLevel) {
$highestLevel = $childLevel;
}
}
... | php | private function getTopNestingLevel()
{
$highestLevel = $this->getNestingLevel();
foreach ($this->getChildren() as $child) {
$childLevel = $child->getNestingLevel();
if ($highestLevel < $childLevel) {
$highestLevel = $childLevel;
}
}
... | [
"private",
"function",
"getTopNestingLevel",
"(",
")",
"{",
"$",
"highestLevel",
"=",
"$",
"this",
"->",
"getNestingLevel",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"$",
"childLevel",
"=",
... | Get the highest nesting level nested inside this message | [
"Get",
"the",
"highest",
"nesting",
"level",
"nested",
"inside",
"this",
"message"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMessage.php#L630-L641 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/Headers/PathHeader.php | Swift_Mime_Headers_PathHeader.setAddress | public function setAddress($address)
{
if (null === $address) {
$this->address = null;
} elseif ('' == $address) {
$this->address = '';
} else {
$this->assertValidAddress($address);
$this->address = $address;
}
$this->setCachedV... | php | public function setAddress($address)
{
if (null === $address) {
$this->address = null;
} elseif ('' == $address) {
$this->address = '';
} else {
$this->assertValidAddress($address);
$this->address = $address;
}
$this->setCachedV... | [
"public",
"function",
"setAddress",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"address",
")",
"{",
"$",
"this",
"->",
"address",
"=",
"null",
";",
"}",
"elseif",
"(",
"''",
"==",
"$",
"address",
")",
"{",
"$",
"this",
"->",
"a... | Set the Address which should appear in this Header.
@param string $address
@throws Swift_RfcComplianceException | [
"Set",
"the",
"Address",
"which",
"should",
"appear",
"in",
"this",
"Header",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/Headers/PathHeader.php#L93-L104 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.setTimeout | public function setTimeout($timeout)
{
$this->params['timeout'] = (int) $timeout;
$this->buffer->setParam('timeout', (int) $timeout);
return $this;
} | php | public function setTimeout($timeout)
{
$this->params['timeout'] = (int) $timeout;
$this->buffer->setParam('timeout', (int) $timeout);
return $this;
} | [
"public",
"function",
"setTimeout",
"(",
"$",
"timeout",
")",
"{",
"$",
"this",
"->",
"params",
"[",
"'timeout'",
"]",
"=",
"(",
"int",
")",
"$",
"timeout",
";",
"$",
"this",
"->",
"buffer",
"->",
"setParam",
"(",
"'timeout'",
",",
"(",
"int",
")",
... | Set the connection timeout.
@param int $timeout seconds
@return $this | [
"Set",
"the",
"connection",
"timeout",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L117-L123 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.setExtensionHandlers | public function setExtensionHandlers(array $handlers)
{
$assoc = [];
foreach ($handlers as $handler) {
$assoc[$handler->getHandledKeyword()] = $handler;
}
uasort($assoc, function ($a, $b) {
return $a->getPriorityOver($b->getHandledKeyword());
});
... | php | public function setExtensionHandlers(array $handlers)
{
$assoc = [];
foreach ($handlers as $handler) {
$assoc[$handler->getHandledKeyword()] = $handler;
}
uasort($assoc, function ($a, $b) {
return $a->getPriorityOver($b->getHandledKeyword());
});
... | [
"public",
"function",
"setExtensionHandlers",
"(",
"array",
"$",
"handlers",
")",
"{",
"$",
"assoc",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"handlers",
"as",
"$",
"handler",
")",
"{",
"$",
"assoc",
"[",
"$",
"handler",
"->",
"getHandledKeyword",
"(",
... | Set ESMTP extension handlers.
@param Swift_Transport_EsmtpHandler[] $handlers
@return $this | [
"Set",
"ESMTP",
"extension",
"handlers",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L252-L265 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.doHeloCommand | protected function doHeloCommand()
{
try {
$response = $this->executeCommand(
sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
return parent::doHeloCommand();
}
if ($this->params['tls']) {... | php | protected function doHeloCommand()
{
try {
$response = $this->executeCommand(
sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
return parent::doHeloCommand();
}
if ($this->params['tls']) {... | [
"protected",
"function",
"doHeloCommand",
"(",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"executeCommand",
"(",
"sprintf",
"(",
"\"EHLO %s\\r\\n\"",
",",
"$",
"this",
"->",
"domain",
")",
",",
"[",
"250",
"]",
")",
";",
"}",
"catch... | Overridden to perform EHLO instead | [
"Overridden",
"to",
"perform",
"EHLO",
"instead"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L334-L373 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.doMailFromCommand | protected function doMailFromCommand($address)
{
$address = $this->addressEncoder->encodeString($address);
$handlers = $this->getActiveHandlers();
$params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getMailParams());
}
... | php | protected function doMailFromCommand($address)
{
$address = $this->addressEncoder->encodeString($address);
$handlers = $this->getActiveHandlers();
$params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getMailParams());
}
... | [
"protected",
"function",
"doMailFromCommand",
"(",
"$",
"address",
")",
"{",
"$",
"address",
"=",
"$",
"this",
"->",
"addressEncoder",
"->",
"encodeString",
"(",
"$",
"address",
")",
";",
"$",
"handlers",
"=",
"$",
"this",
"->",
"getActiveHandlers",
"(",
"... | Overridden to add Extension support | [
"Overridden",
"to",
"add",
"Extension",
"support"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L376-L388 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.getCapabilities | private function getCapabilities($ehloResponse)
{
$capabilities = [];
$ehloResponse = trim($ehloResponse);
$lines = explode("\r\n", $ehloResponse);
array_shift($lines);
foreach ($lines as $line) {
if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line... | php | private function getCapabilities($ehloResponse)
{
$capabilities = [];
$ehloResponse = trim($ehloResponse);
$lines = explode("\r\n", $ehloResponse);
array_shift($lines);
foreach ($lines as $line) {
if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line... | [
"private",
"function",
"getCapabilities",
"(",
"$",
"ehloResponse",
")",
"{",
"$",
"capabilities",
"=",
"[",
"]",
";",
"$",
"ehloResponse",
"=",
"trim",
"(",
"$",
"ehloResponse",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"\"\\r\\n\"",
",",
"$",
"ehloR... | Determine ESMTP capabilities by function group | [
"Determine",
"ESMTP",
"capabilities",
"by",
"function",
"group"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L406-L422 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.setHandlerParams | private function setHandlerParams()
{
foreach ($this->handlers as $keyword => $handler) {
if (array_key_exists($keyword, $this->capabilities)) {
$handler->setKeywordParams($this->capabilities[$keyword]);
}
}
} | php | private function setHandlerParams()
{
foreach ($this->handlers as $keyword => $handler) {
if (array_key_exists($keyword, $this->capabilities)) {
$handler->setKeywordParams($this->capabilities[$keyword]);
}
}
} | [
"private",
"function",
"setHandlerParams",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
"keyword",
"=>",
"$",
"handler",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"keyword",
",",
"$",
"this",
"->",
"capabilities",
")"... | Set parameters which are used by each extension handler | [
"Set",
"parameters",
"which",
"are",
"used",
"by",
"each",
"extension",
"handler"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L425-L432 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/EsmtpTransport.php | Swift_Transport_EsmtpTransport.getActiveHandlers | private function getActiveHandlers()
{
$handlers = [];
foreach ($this->handlers as $keyword => $handler) {
if (array_key_exists($keyword, $this->capabilities)) {
$handlers[] = $handler;
}
}
return $handlers;
} | php | private function getActiveHandlers()
{
$handlers = [];
foreach ($this->handlers as $keyword => $handler) {
if (array_key_exists($keyword, $this->capabilities)) {
$handlers[] = $handler;
}
}
return $handlers;
} | [
"private",
"function",
"getActiveHandlers",
"(",
")",
"{",
"$",
"handlers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"as",
"$",
"keyword",
"=>",
"$",
"handler",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"keyword",
","... | Get ESMTP handlers which are currently ok to use | [
"Get",
"ESMTP",
"handlers",
"which",
"are",
"currently",
"ok",
"to",
"use"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/EsmtpTransport.php#L435-L445 | train |
swiftmailer/swiftmailer | lib/classes/Swift/CharacterStream/ArrayCharacterStream.php | Swift_CharacterStream_ArrayCharacterStream.importByteStream | public function importByteStream(Swift_OutputByteStream $os)
{
if (!isset($this->charReader)) {
$this->charReader = $this->charReaderFactory
->getReaderFor($this->charset);
}
$startLength = $this->charReader->getInitialByteSize();
while (false !== $bytes ... | php | public function importByteStream(Swift_OutputByteStream $os)
{
if (!isset($this->charReader)) {
$this->charReader = $this->charReaderFactory
->getReaderFor($this->charset);
}
$startLength = $this->charReader->getInitialByteSize();
while (false !== $bytes ... | [
"public",
"function",
"importByteStream",
"(",
"Swift_OutputByteStream",
"$",
"os",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"charReader",
")",
")",
"{",
"$",
"this",
"->",
"charReader",
"=",
"$",
"this",
"->",
"charReaderFactory",
"->",
... | Overwrite this character stream using the byte sequence in the byte stream.
@param Swift_OutputByteStream $os output stream to read from | [
"Overwrite",
"this",
"character",
"stream",
"using",
"the",
"byte",
"sequence",
"in",
"the",
"byte",
"stream",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php#L79-L104 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.getId | public function getId()
{
$tmp = (array) $this->getHeaderFieldModel($this->getIdField());
return $this->headers->has($this->getIdField()) ? current($tmp) : $this->id;
} | php | public function getId()
{
$tmp = (array) $this->getHeaderFieldModel($this->getIdField());
return $this->headers->has($this->getIdField()) ? current($tmp) : $this->id;
} | [
"public",
"function",
"getId",
"(",
")",
"{",
"$",
"tmp",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getHeaderFieldModel",
"(",
"$",
"this",
"->",
"getIdField",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"headers",
"->",
"has",
"(",
"$",
"th... | Get the CID of this entity.
The CID will only be present in headers if a Content-ID header is present.
@return string | [
"Get",
"the",
"CID",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L200-L205 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.setId | public function setId($id)
{
if (!$this->setHeaderFieldModel($this->getIdField(), $id)) {
$this->headers->addIdHeader($this->getIdField(), $id);
}
$this->id = $id;
return $this;
} | php | public function setId($id)
{
if (!$this->setHeaderFieldModel($this->getIdField(), $id)) {
$this->headers->addIdHeader($this->getIdField(), $id);
}
$this->id = $id;
return $this;
} | [
"public",
"function",
"setId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setHeaderFieldModel",
"(",
"$",
"this",
"->",
"getIdField",
"(",
")",
",",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"->",
"addIdHeader",
"("... | Set the CID of this entity.
@param string $id
@return $this | [
"Set",
"the",
"CID",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L214-L222 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.setDescription | public function setDescription($description)
{
if (!$this->setHeaderFieldModel('Content-Description', $description)) {
$this->headers->addTextHeader('Content-Description', $description);
}
return $this;
} | php | public function setDescription($description)
{
if (!$this->setHeaderFieldModel('Content-Description', $description)) {
$this->headers->addTextHeader('Content-Description', $description);
}
return $this;
} | [
"public",
"function",
"setDescription",
"(",
"$",
"description",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"setHeaderFieldModel",
"(",
"'Content-Description'",
",",
"$",
"description",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"->",
"addTextHeader",
"(... | Set the description of this entity.
This method sets a value in the Content-ID header.
@param string $description
@return $this | [
"Set",
"the",
"description",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L245-L252 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.setChildren | public function setChildren(array $children, $compoundLevel = null)
{
// TODO: Try to refactor this logic
$compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
$immediateChildren = [];
$grandchildren = [];
$newContentType = $this->userContentType;
fo... | php | public function setChildren(array $children, $compoundLevel = null)
{
// TODO: Try to refactor this logic
$compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
$immediateChildren = [];
$grandchildren = [];
$newContentType = $this->userContentType;
fo... | [
"public",
"function",
"setChildren",
"(",
"array",
"$",
"children",
",",
"$",
"compoundLevel",
"=",
"null",
")",
"{",
"// TODO: Try to refactor this logic",
"$",
"compoundLevel",
"=",
"$",
"compoundLevel",
"??",
"$",
"this",
"->",
"getCompoundLevel",
"(",
"$",
"... | Set all children of this entity.
@param Swift_Mime_SimpleMimeEntity[] $children
@param int $compoundLevel For internal use only
@return $this | [
"Set",
"all",
"children",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L298-L355 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.getBody | public function getBody()
{
return $this->body instanceof Swift_OutputByteStream ? $this->readStream($this->body) : $this->body;
} | php | public function getBody()
{
return $this->body instanceof Swift_OutputByteStream ? $this->readStream($this->body) : $this->body;
} | [
"public",
"function",
"getBody",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"body",
"instanceof",
"Swift_OutputByteStream",
"?",
"$",
"this",
"->",
"readStream",
"(",
"$",
"this",
"->",
"body",
")",
":",
"$",
"this",
"->",
"body",
";",
"}"
] | Get the body of this entity as a string.
@return string | [
"Get",
"the",
"body",
"of",
"this",
"entity",
"as",
"a",
"string",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L362-L365 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.setEncoder | public function setEncoder(Swift_Mime_ContentEncoder $encoder)
{
if ($encoder !== $this->encoder) {
$this->clearCache();
}
$this->encoder = $encoder;
$this->setEncoding($encoder->getName());
$this->notifyEncoderChanged($encoder);
return $this;
} | php | public function setEncoder(Swift_Mime_ContentEncoder $encoder)
{
if ($encoder !== $this->encoder) {
$this->clearCache();
}
$this->encoder = $encoder;
$this->setEncoding($encoder->getName());
$this->notifyEncoderChanged($encoder);
return $this;
} | [
"public",
"function",
"setEncoder",
"(",
"Swift_Mime_ContentEncoder",
"$",
"encoder",
")",
"{",
"if",
"(",
"$",
"encoder",
"!==",
"$",
"this",
"->",
"encoder",
")",
"{",
"$",
"this",
"->",
"clearCache",
"(",
")",
";",
"}",
"$",
"this",
"->",
"encoder",
... | Set the encoder used for the body of this entity.
@return $this | [
"Set",
"the",
"encoder",
"used",
"for",
"the",
"body",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L405-L416 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.getBoundary | public function getBoundary()
{
if (!isset($this->boundary)) {
$this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
}
return $this->boundary;
} | php | public function getBoundary()
{
if (!isset($this->boundary)) {
$this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
}
return $this->boundary;
} | [
"public",
"function",
"getBoundary",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"boundary",
")",
")",
"{",
"$",
"this",
"->",
"boundary",
"=",
"'_=_swift_'",
".",
"time",
"(",
")",
".",
"'_'",
".",
"bin2hex",
"(",
"random_bytes",... | Get the boundary used to separate children in this entity.
@return string | [
"Get",
"the",
"boundary",
"used",
"to",
"separate",
"children",
"in",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L423-L430 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.bodyToString | protected function bodyToString()
{
$string = '';
if (isset($this->body) && empty($this->immediateChildren)) {
if ($this->cache->hasKey($this->cacheKey, 'body')) {
$body = $this->cache->getString($this->cacheKey, 'body');
} else {
$body = "\r\... | php | protected function bodyToString()
{
$string = '';
if (isset($this->body) && empty($this->immediateChildren)) {
if ($this->cache->hasKey($this->cacheKey, 'body')) {
$body = $this->cache->getString($this->cacheKey, 'body');
} else {
$body = "\r\... | [
"protected",
"function",
"bodyToString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"body",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"immediateChildren",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",... | Get this entire entity as a string.
@return string | [
"Get",
"this",
"entire",
"entity",
"as",
"a",
"string",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L487-L510 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleMimeEntity.php | Swift_Mime_SimpleMimeEntity.fixHeaders | protected function fixHeaders()
{
if (count($this->immediateChildren)) {
$this->setHeaderParameter('Content-Type', 'boundary',
$this->getBoundary()
);
$this->headers->remove('Content-Transfer-Encoding');
} else {
$this->setHeaderPar... | php | protected function fixHeaders()
{
if (count($this->immediateChildren)) {
$this->setHeaderParameter('Content-Type', 'boundary',
$this->getBoundary()
);
$this->headers->remove('Content-Transfer-Encoding');
} else {
$this->setHeaderPar... | [
"protected",
"function",
"fixHeaders",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"immediateChildren",
")",
")",
"{",
"$",
"this",
"->",
"setHeaderParameter",
"(",
"'Content-Type'",
",",
"'boundary'",
",",
"$",
"this",
"->",
"getBoundary",
... | Re-evaluate what content type and encoding should be used on this entity. | [
"Re",
"-",
"evaluate",
"what",
"content",
"type",
"and",
"encoding",
"should",
"be",
"used",
"on",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleMimeEntity.php#L635-L646 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php | Swift_Plugins_PopBeforeSmtpPlugin.connect | public function connect()
{
if (isset($this->connection)) {
$this->connection->connect();
} else {
if (!isset($this->socket)) {
if (!$socket = fsockopen(
$this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) {
... | php | public function connect()
{
if (isset($this->connection)) {
$this->connection->connect();
} else {
if (!isset($this->socket)) {
if (!$socket = fsockopen(
$this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) {
... | [
"public",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"connect",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",... | Connect to the POP3 host and authenticate.
@throws Swift_Plugins_Pop_Pop3Exception if connection fails | [
"Connect",
"to",
"the",
"POP3",
"host",
"and",
"authenticate",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php#L127-L155 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php | Swift_Plugins_PopBeforeSmtpPlugin.disconnect | public function disconnect()
{
if (isset($this->connection)) {
$this->connection->disconnect();
} else {
$this->command("QUIT\r\n");
if (!fclose($this->socket)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('POP3 host [%s... | php | public function disconnect()
{
if (isset($this->connection)) {
$this->connection->disconnect();
} else {
$this->command("QUIT\r\n");
if (!fclose($this->socket)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('POP3 host [%s... | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"disconnect",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"command",
"(",
"\"... | Disconnect from the POP3 host. | [
"Disconnect",
"from",
"the",
"POP3",
"host",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php#L160-L173 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.setLocalDomain | public function setLocalDomain($domain)
{
if ('[' !== substr($domain, 0, 1)) {
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$domain = '['.$domain.']';
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$domain = ... | php | public function setLocalDomain($domain)
{
if ('[' !== substr($domain, 0, 1)) {
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$domain = '['.$domain.']';
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$domain = ... | [
"public",
"function",
"setLocalDomain",
"(",
"$",
"domain",
")",
"{",
"if",
"(",
"'['",
"!==",
"substr",
"(",
"$",
"domain",
",",
"0",
",",
"1",
")",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"domain",
",",
"FILTER_VALIDATE_IP",
",",
"FILTER_FLAG_IP... | Set the name of the local domain which Swift will identify itself as.
This should be a fully-qualified domain name and should be truly the domain
you're using.
If your server does not have a domain name, use the IP address. This will
automatically be wrapped in square brackets as described in RFC 5321,
section 4.1.3.... | [
"Set",
"the",
"name",
"of",
"the",
"local",
"domain",
"which",
"Swift",
"will",
"identify",
"itself",
"as",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L71-L84 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.start | public function start()
{
if (!$this->started) {
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
if ($evt->bubbleCancelled()) {
return;
... | php | public function start()
{
if (!$this->started) {
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
if ($evt->bubbleCancelled()) {
return;
... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"if",
"(",
"$",
"evt",
"=",
"$",
"this",
"->",
"eventDispatcher",
"->",
"createTransportChangeEvent",
"(",
"$",
"this",
")",
")",
"{",
"$",
"this",
... | Start the SMTP connection. | [
"Start",
"the",
"SMTP",
"connection",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L132-L156 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.stop | public function stop()
{
if ($this->started) {
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
if ($evt->bubbleCancelled()) {
return;
... | php | public function stop()
{
if ($this->started) {
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
if ($evt->bubbleCancelled()) {
return;
... | [
"public",
"function",
"stop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"if",
"(",
"$",
"evt",
"=",
"$",
"this",
"->",
"eventDispatcher",
"->",
"createTransportChangeEvent",
"(",
"$",
"this",
")",
")",
"{",
"$",
"this",
"->",
... | Stop the SMTP connection. | [
"Stop",
"the",
"SMTP",
"connection",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L232-L258 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.doMailFromCommand | protected function doMailFromCommand($address)
{
$address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
);
} | php | protected function doMailFromCommand($address)
{
$address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
);
} | [
"protected",
"function",
"doMailFromCommand",
"(",
"$",
"address",
")",
"{",
"$",
"address",
"=",
"$",
"this",
"->",
"addressEncoder",
"->",
"encodeString",
"(",
"$",
"address",
")",
";",
"$",
"this",
"->",
"executeCommand",
"(",
"sprintf",
"(",
"\"MAIL FROM... | Send the MAIL FROM command | [
"Send",
"the",
"MAIL",
"FROM",
"command"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L370-L376 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.streamMessage | protected function streamMessage(Swift_Mime_SimpleMessage $message)
{
$this->buffer->setWriteTranslations(["\r\n." => "\r\n.."]);
try {
$message->toByteStream($this->buffer);
$this->buffer->flushBuffers();
} catch (Swift_TransportException $e) {
$this->thr... | php | protected function streamMessage(Swift_Mime_SimpleMessage $message)
{
$this->buffer->setWriteTranslations(["\r\n." => "\r\n.."]);
try {
$message->toByteStream($this->buffer);
$this->buffer->flushBuffers();
} catch (Swift_TransportException $e) {
$this->thr... | [
"protected",
"function",
"streamMessage",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"buffer",
"->",
"setWriteTranslations",
"(",
"[",
"\"\\r\\n.\"",
"=>",
"\"\\r\\n..\"",
"]",
")",
";",
"try",
"{",
"$",
"message",
"->",
"toB... | Stream the contents of the message over the buffer | [
"Stream",
"the",
"contents",
"of",
"the",
"message",
"over",
"the",
"buffer"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L394-L405 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.throwException | protected function throwException(Swift_TransportException $e)
{
if ($evt = $this->eventDispatcher->createTransportExceptionEvent($this, $e)) {
$this->eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
if (!$evt->bubbleCancelled()) {
throw $e;
}
... | php | protected function throwException(Swift_TransportException $e)
{
if ($evt = $this->eventDispatcher->createTransportExceptionEvent($this, $e)) {
$this->eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
if (!$evt->bubbleCancelled()) {
throw $e;
}
... | [
"protected",
"function",
"throwException",
"(",
"Swift_TransportException",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"evt",
"=",
"$",
"this",
"->",
"eventDispatcher",
"->",
"createTransportExceptionEvent",
"(",
"$",
"this",
",",
"$",
"e",
")",
")",
"{",
"$",
"t... | Throw a TransportException, first sending it to any listeners | [
"Throw",
"a",
"TransportException",
"first",
"sending",
"it",
"to",
"any",
"listeners"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L429-L439 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.assertResponseCode | protected function assertResponseCode($response, $wanted)
{
if (!$response) {
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
}
list($code) = sscanf($response, '%3d');
$valid = (empty($wan... | php | protected function assertResponseCode($response, $wanted)
{
if (!$response) {
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
}
list($code) = sscanf($response, '%3d');
$valid = (empty($wan... | [
"protected",
"function",
"assertResponseCode",
"(",
"$",
"response",
",",
"$",
"wanted",
")",
"{",
"if",
"(",
"!",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"throwException",
"(",
"new",
"Swift_TransportException",
"(",
"'Expected response code '",
".",
"i... | Throws an Exception if a response code is incorrect | [
"Throws",
"an",
"Exception",
"if",
"a",
"response",
"code",
"is",
"incorrect"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L442-L459 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.getFullResponse | protected function getFullResponse($seq)
{
$response = '';
try {
do {
$line = $this->buffer->readLine($seq);
$response .= $line;
} while (null !== $line && false !== $line && ' ' != $line[3]);
} catch (Swift_TransportException $e) {
... | php | protected function getFullResponse($seq)
{
$response = '';
try {
do {
$line = $this->buffer->readLine($seq);
$response .= $line;
} while (null !== $line && false !== $line && ' ' != $line[3]);
} catch (Swift_TransportException $e) {
... | [
"protected",
"function",
"getFullResponse",
"(",
"$",
"seq",
")",
"{",
"$",
"response",
"=",
"''",
";",
"try",
"{",
"do",
"{",
"$",
"line",
"=",
"$",
"this",
"->",
"buffer",
"->",
"readLine",
"(",
"$",
"seq",
")",
";",
"$",
"response",
".=",
"$",
... | Get an entire multi-line response using its sequence number | [
"Get",
"an",
"entire",
"multi",
"-",
"line",
"response",
"using",
"its",
"sequence",
"number"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L462-L477 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Transport/AbstractSmtpTransport.php | Swift_Transport_AbstractSmtpTransport.doMailTransaction | private function doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients)
{
$sent = 0;
$this->doMailFromCommand($reversePath);
foreach ($recipients as $forwardPath) {
try {
$this->doRcptToCommand($forwardPath);
++$sent... | php | private function doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients)
{
$sent = 0;
$this->doMailFromCommand($reversePath);
foreach ($recipients as $forwardPath) {
try {
$this->doRcptToCommand($forwardPath);
++$sent... | [
"private",
"function",
"doMailTransaction",
"(",
"$",
"message",
",",
"$",
"reversePath",
",",
"array",
"$",
"recipients",
",",
"array",
"&",
"$",
"failedRecipients",
")",
"{",
"$",
"sent",
"=",
"0",
";",
"$",
"this",
"->",
"doMailFromCommand",
"(",
"$",
... | Send an email to the given recipients from the given reverse path | [
"Send",
"an",
"email",
"to",
"the",
"given",
"recipients",
"from",
"the",
"given",
"reverse",
"path"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L480-L506 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderFactory.php | Swift_Mime_SimpleHeaderFactory.createIdHeader | public function createIdHeader($name, $ids = null)
{
$header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator);
if (isset($ids)) {
$header->setFieldBodyModel($ids);
}
$this->setHeaderCharset($header);
return $header;
} | php | public function createIdHeader($name, $ids = null)
{
$header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator);
if (isset($ids)) {
$header->setFieldBodyModel($ids);
}
$this->setHeaderCharset($header);
return $header;
} | [
"public",
"function",
"createIdHeader",
"(",
"$",
"name",
",",
"$",
"ids",
"=",
"null",
")",
"{",
"$",
"header",
"=",
"new",
"Swift_Mime_Headers_IdentificationHeader",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"emailValidator",
")",
";",
"if",
"(",
"isset"... | Create a new ID header for Message-ID or Content-ID.
@param string $name
@param string|array $ids
@return Swift_Mime_Header | [
"Create",
"a",
"new",
"ID",
"header",
"for",
"Message",
"-",
"ID",
"or",
"Content",
"-",
"ID",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderFactory.php#L137-L146 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderFactory.php | Swift_Mime_SimpleHeaderFactory.charsetChanged | public function charsetChanged($charset)
{
$this->charset = $charset;
$this->encoder->charsetChanged($charset);
$this->paramEncoder->charsetChanged($charset);
} | php | public function charsetChanged($charset)
{
$this->charset = $charset;
$this->encoder->charsetChanged($charset);
$this->paramEncoder->charsetChanged($charset);
} | [
"public",
"function",
"charsetChanged",
"(",
"$",
"charset",
")",
"{",
"$",
"this",
"->",
"charset",
"=",
"$",
"charset",
";",
"$",
"this",
"->",
"encoder",
"->",
"charsetChanged",
"(",
"$",
"charset",
")",
";",
"$",
"this",
"->",
"paramEncoder",
"->",
... | Notify this observer that the entity's charset has changed.
@param string $charset | [
"Notify",
"this",
"observer",
"that",
"the",
"entity",
"s",
"charset",
"has",
"changed",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderFactory.php#L172-L177 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/SimpleHeaderFactory.php | Swift_Mime_SimpleHeaderFactory.setHeaderCharset | private function setHeaderCharset(Swift_Mime_Header $header)
{
if (isset($this->charset)) {
$header->setCharset($this->charset);
}
} | php | private function setHeaderCharset(Swift_Mime_Header $header)
{
if (isset($this->charset)) {
$header->setCharset($this->charset);
}
} | [
"private",
"function",
"setHeaderCharset",
"(",
"Swift_Mime_Header",
"$",
"header",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"charset",
")",
")",
"{",
"$",
"header",
"->",
"setCharset",
"(",
"$",
"this",
"->",
"charset",
")",
";",
"}",
"}"... | Apply the charset to the Header | [
"Apply",
"the",
"charset",
"to",
"the",
"Header"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/SimpleHeaderFactory.php#L189-L194 | train |
swiftmailer/swiftmailer | lib/classes/Swift/StreamFilters/StringReplacementFilter.php | Swift_StreamFilters_StringReplacementFilter.shouldBuffer | public function shouldBuffer($buffer)
{
if ('' === $buffer) {
return false;
}
$endOfBuffer = substr($buffer, -1);
foreach ((array) $this->search as $needle) {
if (false !== strpos($needle, $endOfBuffer)) {
return true;
}
}
... | php | public function shouldBuffer($buffer)
{
if ('' === $buffer) {
return false;
}
$endOfBuffer = substr($buffer, -1);
foreach ((array) $this->search as $needle) {
if (false !== strpos($needle, $endOfBuffer)) {
return true;
}
}
... | [
"public",
"function",
"shouldBuffer",
"(",
"$",
"buffer",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"buffer",
")",
"{",
"return",
"false",
";",
"}",
"$",
"endOfBuffer",
"=",
"substr",
"(",
"$",
"buffer",
",",
"-",
"1",
")",
";",
"foreach",
"(",
"(",
... | Returns true if based on the buffer passed more bytes should be buffered.
@param string $buffer
@return bool | [
"Returns",
"true",
"if",
"based",
"on",
"the",
"buffer",
"passed",
"more",
"bytes",
"should",
"be",
"buffered",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/StreamFilters/StringReplacementFilter.php#L43-L57 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/RedirectingPlugin.php | Swift_Plugins_RedirectingPlugin.filterHeaderSet | private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
{
foreach ($headerSet->getAll($type) as $headers) {
$headers->setNameAddresses($this->filterNameAddresses($headers->getNameAddresses()));
}
} | php | private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
{
foreach ($headerSet->getAll($type) as $headers) {
$headers->setNameAddresses($this->filterNameAddresses($headers->getNameAddresses()));
}
} | [
"private",
"function",
"filterHeaderSet",
"(",
"Swift_Mime_SimpleHeaderSet",
"$",
"headerSet",
",",
"$",
"type",
")",
"{",
"foreach",
"(",
"$",
"headerSet",
"->",
"getAll",
"(",
"$",
"type",
")",
"as",
"$",
"headers",
")",
"{",
"$",
"headers",
"->",
"setNa... | Filter header set against a whitelist of regular expressions.
@param string $type | [
"Filter",
"header",
"set",
"against",
"a",
"whitelist",
"of",
"regular",
"expressions",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/RedirectingPlugin.php#L126-L131 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/RedirectingPlugin.php | Swift_Plugins_RedirectingPlugin.filterNameAddresses | private function filterNameAddresses(array $recipients)
{
$filtered = [];
foreach ($recipients as $address => $name) {
if ($this->isWhitelisted($address)) {
$filtered[$address] = $name;
}
}
return $filtered;
} | php | private function filterNameAddresses(array $recipients)
{
$filtered = [];
foreach ($recipients as $address => $name) {
if ($this->isWhitelisted($address)) {
$filtered[$address] = $name;
}
}
return $filtered;
} | [
"private",
"function",
"filterNameAddresses",
"(",
"array",
"$",
"recipients",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"recipients",
"as",
"$",
"address",
"=>",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isWhiteli... | Filtered list of addresses => name pairs.
@return array | [
"Filtered",
"list",
"of",
"addresses",
"=",
">",
"name",
"pairs",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/RedirectingPlugin.php#L138-L149 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Plugins/RedirectingPlugin.php | Swift_Plugins_RedirectingPlugin.isWhitelisted | protected function isWhitelisted($recipient)
{
if (in_array($recipient, (array) $this->recipient)) {
return true;
}
foreach ($this->whitelist as $pattern) {
if (preg_match($pattern, $recipient)) {
return true;
}
}
return f... | php | protected function isWhitelisted($recipient)
{
if (in_array($recipient, (array) $this->recipient)) {
return true;
}
foreach ($this->whitelist as $pattern) {
if (preg_match($pattern, $recipient)) {
return true;
}
}
return f... | [
"protected",
"function",
"isWhitelisted",
"(",
"$",
"recipient",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"recipient",
",",
"(",
"array",
")",
"$",
"this",
"->",
"recipient",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"$",
"this",
"... | Matches address against whitelist of regular expressions.
@return bool | [
"Matches",
"address",
"against",
"whitelist",
"of",
"regular",
"expressions",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Plugins/RedirectingPlugin.php#L156-L169 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.setSignCertificate | public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null)
{
$this->signCertificate = 'file://'.str_replace('\\', '/', realpath($certificate));
if (null !== $privateKey) {
if (is_array($privateKey)) {
$this->si... | php | public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null)
{
$this->signCertificate = 'file://'.str_replace('\\', '/', realpath($certificate));
if (null !== $privateKey) {
if (is_array($privateKey)) {
$this->si... | [
"public",
"function",
"setSignCertificate",
"(",
"$",
"certificate",
",",
"$",
"privateKey",
"=",
"null",
",",
"$",
"signOptions",
"=",
"PKCS7_DETACHED",
",",
"$",
"extraCerts",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"signCertificate",
"=",
"'file://'",
"... | Set the certificate location to use for signing.
@see https://secure.php.net/manual/en/openssl.pkcs7.flags.php
@param string $certificate
@param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead
@param int $signOptions Bitwise operator options for... | [
"Set",
"the",
"certificate",
"location",
"to",
"use",
"for",
"signing",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L78-L95 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.setEncryptCertificate | public function setEncryptCertificate($recipientCerts, $cipher = null)
{
if (is_array($recipientCerts)) {
$this->encryptCert = [];
foreach ($recipientCerts as $cert) {
$this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert));
}
} e... | php | public function setEncryptCertificate($recipientCerts, $cipher = null)
{
if (is_array($recipientCerts)) {
$this->encryptCert = [];
foreach ($recipientCerts as $cert) {
$this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert));
}
} e... | [
"public",
"function",
"setEncryptCertificate",
"(",
"$",
"recipientCerts",
",",
"$",
"cipher",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"recipientCerts",
")",
")",
"{",
"$",
"this",
"->",
"encryptCert",
"=",
"[",
"]",
";",
"foreach",
"(",
... | Set the certificate location to use for encryption.
@see https://secure.php.net/manual/en/openssl.pkcs7.flags.php
@see https://secure.php.net/manual/en/openssl.ciphers.php
@param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates.
@param int $cipher
@ret... | [
"Set",
"the",
"certificate",
"location",
"to",
"use",
"for",
"encryption",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L108-L125 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.signMessage | public function signMessage(Swift_Message $message)
{
if (null === $this->signCertificate && null === $this->encryptCert) {
return $this;
}
if ($this->signThenEncrypt) {
$this->smimeSignMessage($message);
$this->smimeEncryptMessage($message);
} el... | php | public function signMessage(Swift_Message $message)
{
if (null === $this->signCertificate && null === $this->encryptCert) {
return $this;
}
if ($this->signThenEncrypt) {
$this->smimeSignMessage($message);
$this->smimeEncryptMessage($message);
} el... | [
"public",
"function",
"signMessage",
"(",
"Swift_Message",
"$",
"message",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"signCertificate",
"&&",
"null",
"===",
"$",
"this",
"->",
"encryptCert",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
... | Change the Swift_Message to apply the signing.
@return $this | [
"Change",
"the",
"Swift_Message",
"to",
"apply",
"the",
"signing",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L204-L217 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.smimeSignMessage | protected function smimeSignMessage(Swift_Message $message)
{
// If we don't have a certificate we can't sign the message
if (null === $this->signCertificate) {
return;
}
// Work on a clone of the original message
$signMessage = clone $message;
$signMessa... | php | protected function smimeSignMessage(Swift_Message $message)
{
// If we don't have a certificate we can't sign the message
if (null === $this->signCertificate) {
return;
}
// Work on a clone of the original message
$signMessage = clone $message;
$signMessa... | [
"protected",
"function",
"smimeSignMessage",
"(",
"Swift_Message",
"$",
"message",
")",
"{",
"// If we don't have a certificate we can't sign the message",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"signCertificate",
")",
"{",
"return",
";",
"}",
"// Work on a clone ... | Sign a Swift message. | [
"Sign",
"a",
"Swift",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L232-L284 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.smimeEncryptMessage | protected function smimeEncryptMessage(Swift_Message $message)
{
// If we don't have a certificate we can't encrypt the message
if (null === $this->encryptCert) {
return;
}
// Work on a clone of the original message
$encryptMessage = clone $message;
$encr... | php | protected function smimeEncryptMessage(Swift_Message $message)
{
// If we don't have a certificate we can't encrypt the message
if (null === $this->encryptCert) {
return;
}
// Work on a clone of the original message
$encryptMessage = clone $message;
$encr... | [
"protected",
"function",
"smimeEncryptMessage",
"(",
"Swift_Message",
"$",
"message",
")",
"{",
"// If we don't have a certificate we can't encrypt the message",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"encryptCert",
")",
"{",
"return",
";",
"}",
"// Work on a clon... | Encrypt a Swift message. | [
"Encrypt",
"a",
"Swift",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L289-L341 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.copyHeaders | protected function copyHeaders(
Swift_Message $fromMessage,
Swift_Message $toMessage,
array $headers = []
) {
foreach ($headers as $header) {
$this->copyHeader($fromMessage, $toMessage, $header);
}
} | php | protected function copyHeaders(
Swift_Message $fromMessage,
Swift_Message $toMessage,
array $headers = []
) {
foreach ($headers as $header) {
$this->copyHeader($fromMessage, $toMessage, $header);
}
} | [
"protected",
"function",
"copyHeaders",
"(",
"Swift_Message",
"$",
"fromMessage",
",",
"Swift_Message",
"$",
"toMessage",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"header",
")",
"{",
"$",
"this",
"... | Copy named headers from one Swift message to another. | [
"Copy",
"named",
"headers",
"from",
"one",
"Swift",
"message",
"to",
"another",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L346-L354 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.copyHeader | protected function copyHeader(Swift_Message $fromMessage, Swift_Message $toMessage, $headerName)
{
$header = $fromMessage->getHeaders()->get($headerName);
if (!$header) {
return;
}
$headers = $toMessage->getHeaders();
switch ($header->getFieldType()) {
... | php | protected function copyHeader(Swift_Message $fromMessage, Swift_Message $toMessage, $headerName)
{
$header = $fromMessage->getHeaders()->get($headerName);
if (!$header) {
return;
}
$headers = $toMessage->getHeaders();
switch ($header->getFieldType()) {
... | [
"protected",
"function",
"copyHeader",
"(",
"Swift_Message",
"$",
"fromMessage",
",",
"Swift_Message",
"$",
"toMessage",
",",
"$",
"headerName",
")",
"{",
"$",
"header",
"=",
"$",
"fromMessage",
"->",
"getHeaders",
"(",
")",
"->",
"get",
"(",
"$",
"headerNam... | Copy a single header from one Swift message to another.
@param string $headerName | [
"Copy",
"a",
"single",
"header",
"from",
"one",
"Swift",
"message",
"to",
"another",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L361-L380 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.clearAllHeaders | protected function clearAllHeaders(Swift_Message $message)
{
$headers = $message->getHeaders();
foreach ($headers->listAll() as $header) {
$headers->removeAll($header);
}
} | php | protected function clearAllHeaders(Swift_Message $message)
{
$headers = $message->getHeaders();
foreach ($headers->listAll() as $header) {
$headers->removeAll($header);
}
} | [
"protected",
"function",
"clearAllHeaders",
"(",
"Swift_Message",
"$",
"message",
")",
"{",
"$",
"headers",
"=",
"$",
"message",
"->",
"getHeaders",
"(",
")",
";",
"foreach",
"(",
"$",
"headers",
"->",
"listAll",
"(",
")",
"as",
"$",
"header",
")",
"{",
... | Remove all headers from a Swift message. | [
"Remove",
"all",
"headers",
"from",
"a",
"Swift",
"message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L385-L391 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.streamToMime | protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
{
// Parse the stream into headers and body
list($headers, $messageStream) = $this->parseStream($fromStream);
// Get the original message headers
$messageHeaders = $message->getHeaders();
... | php | protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
{
// Parse the stream into headers and body
list($headers, $messageStream) = $this->parseStream($fromStream);
// Get the original message headers
$messageHeaders = $message->getHeaders();
... | [
"protected",
"function",
"streamToMime",
"(",
"Swift_OutputByteStream",
"$",
"fromStream",
",",
"Swift_Message",
"$",
"message",
")",
"{",
"// Parse the stream into headers and body",
"list",
"(",
"$",
"headers",
",",
"$",
"messageStream",
")",
"=",
"$",
"this",
"->... | Merges an OutputByteStream from OpenSSL to a Swift_Message. | [
"Merges",
"an",
"OutputByteStream",
"from",
"OpenSSL",
"to",
"a",
"Swift_Message",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L423-L458 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Signers/SMimeSigner.php | Swift_Signers_SMimeSigner.parseStream | protected function parseStream(Swift_OutputByteStream $emailStream)
{
$bufferLength = 78;
$headerData = '';
$headerBodySeparator = "\r\n\r\n";
$emailStream->setReadPointer(0);
// Read out the headers section from the stream to a string
while (false !== ($buffer = $e... | php | protected function parseStream(Swift_OutputByteStream $emailStream)
{
$bufferLength = 78;
$headerData = '';
$headerBodySeparator = "\r\n\r\n";
$emailStream->setReadPointer(0);
// Read out the headers section from the stream to a string
while (false !== ($buffer = $e... | [
"protected",
"function",
"parseStream",
"(",
"Swift_OutputByteStream",
"$",
"emailStream",
")",
"{",
"$",
"bufferLength",
"=",
"78",
";",
"$",
"headerData",
"=",
"''",
";",
"$",
"headerBodySeparator",
"=",
"\"\\r\\n\\r\\n\"",
";",
"$",
"emailStream",
"->",
"setR... | This message will parse the headers of a MIME email byte stream
and return an array that contains the headers as an associative
array and the email body as a string.
@return array | [
"This",
"message",
"will",
"parse",
"the",
"headers",
"of",
"a",
"MIME",
"email",
"byte",
"stream",
"and",
"return",
"an",
"array",
"that",
"contains",
"the",
"headers",
"as",
"an",
"associative",
"array",
"and",
"the",
"email",
"body",
"as",
"a",
"string"... | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Signers/SMimeSigner.php#L467-L521 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/MimePart.php | Swift_Mime_MimePart.setCharset | public function setCharset($charset)
{
$this->setHeaderParameter('Content-Type', 'charset', $charset);
if ($charset !== $this->userCharset) {
$this->clearCache();
}
$this->userCharset = $charset;
parent::charsetChanged($charset);
return $this;
} | php | public function setCharset($charset)
{
$this->setHeaderParameter('Content-Type', 'charset', $charset);
if ($charset !== $this->userCharset) {
$this->clearCache();
}
$this->userCharset = $charset;
parent::charsetChanged($charset);
return $this;
} | [
"public",
"function",
"setCharset",
"(",
"$",
"charset",
")",
"{",
"$",
"this",
"->",
"setHeaderParameter",
"(",
"'Content-Type'",
",",
"'charset'",
",",
"$",
"charset",
")",
";",
"if",
"(",
"$",
"charset",
"!==",
"$",
"this",
"->",
"userCharset",
")",
"... | Set the character set of this entity.
@param string $charset
@return $this | [
"Set",
"the",
"character",
"set",
"of",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/MimePart.php#L83-L93 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/MimePart.php | Swift_Mime_MimePart.setDelSp | public function setDelSp($delsp = true)
{
$this->setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
$this->userDelSp = $delsp;
return $this;
} | php | public function setDelSp($delsp = true)
{
$this->setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
$this->userDelSp = $delsp;
return $this;
} | [
"public",
"function",
"setDelSp",
"(",
"$",
"delsp",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"setHeaderParameter",
"(",
"'Content-Type'",
",",
"'delsp'",
",",
"$",
"delsp",
"?",
"'yes'",
":",
"null",
")",
";",
"$",
"this",
"->",
"userDelSp",
"=",
"$"... | Turn delsp on or off for this entity.
@param bool $delsp
@return $this | [
"Turn",
"delsp",
"on",
"or",
"off",
"for",
"this",
"entity",
"."
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/MimePart.php#L137-L143 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/MimePart.php | Swift_Mime_MimePart.fixHeaders | protected function fixHeaders()
{
parent::fixHeaders();
if (count($this->getChildren())) {
$this->setHeaderParameter('Content-Type', 'charset', null);
$this->setHeaderParameter('Content-Type', 'format', null);
$this->setHeaderParameter('Content-Type', 'delsp', nul... | php | protected function fixHeaders()
{
parent::fixHeaders();
if (count($this->getChildren())) {
$this->setHeaderParameter('Content-Type', 'charset', null);
$this->setHeaderParameter('Content-Type', 'format', null);
$this->setHeaderParameter('Content-Type', 'delsp', nul... | [
"protected",
"function",
"fixHeaders",
"(",
")",
"{",
"parent",
"::",
"fixHeaders",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getChildren",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"setHeaderParameter",
"(",
"'Content-Type'",
",",
... | Fix the content-type and encoding of this entity | [
"Fix",
"the",
"content",
"-",
"type",
"and",
"encoding",
"of",
"this",
"entity"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/MimePart.php#L169-L181 | train |
swiftmailer/swiftmailer | lib/classes/Swift/Mime/MimePart.php | Swift_Mime_MimePart.convertString | protected function convertString($string)
{
$charset = strtolower($this->getCharset());
if (!in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
return mb_convert_encoding($string, $charset, 'utf-8');
}
return $string;
} | php | protected function convertString($string)
{
$charset = strtolower($this->getCharset());
if (!in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
return mb_convert_encoding($string, $charset, 'utf-8');
}
return $string;
} | [
"protected",
"function",
"convertString",
"(",
"$",
"string",
")",
"{",
"$",
"charset",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"getCharset",
"(",
")",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"charset",
",",
"[",
"'utf-8'",
",",
"'iso-8859-1... | Encode charset when charset is not utf-8 | [
"Encode",
"charset",
"when",
"charset",
"is",
"not",
"utf",
"-",
"8"
] | b22e508d2db967630445c553572d1e9eb997ecef | https://github.com/swiftmailer/swiftmailer/blob/b22e508d2db967630445c553572d1e9eb997ecef/lib/classes/Swift/Mime/MimePart.php#L190-L198 | train |
yiisoft/yii | framework/web/filters/CHttpCacheFilter.php | CHttpCacheFilter.sendCacheControlHeader | protected function sendCacheControlHeader()
{
if(Yii::app()->session->isStarted)
{
Yii::app()->session->setCacheLimiter('public');
header('Pragma:',true);
}
header('Cache-Control: '.$this->cacheControl,true);
} | php | protected function sendCacheControlHeader()
{
if(Yii::app()->session->isStarted)
{
Yii::app()->session->setCacheLimiter('public');
header('Pragma:',true);
}
header('Cache-Control: '.$this->cacheControl,true);
} | [
"protected",
"function",
"sendCacheControlHeader",
"(",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"session",
"->",
"isStarted",
")",
"{",
"Yii",
"::",
"app",
"(",
")",
"->",
"session",
"->",
"setCacheLimiter",
"(",
"'public'",
")",
";",
... | Sends the cache control header to the client
@see cacheControl
@since 1.1.12 | [
"Sends",
"the",
"cache",
"control",
"header",
"to",
"the",
"client"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/filters/CHttpCacheFilter.php#L192-L200 | train |
yiisoft/yii | framework/web/renderers/CViewRenderer.php | CViewRenderer.getViewFile | protected function getViewFile($file)
{
if($this->useRuntimePath)
{
$crc=sprintf('%x', crc32(get_class($this).Yii::getVersion().dirname($file)));
$viewFile=Yii::app()->getRuntimePath().DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.$crc.DIRECTORY_SEPARATOR.basename($file);
if(!is_file($viewFile))
@mk... | php | protected function getViewFile($file)
{
if($this->useRuntimePath)
{
$crc=sprintf('%x', crc32(get_class($this).Yii::getVersion().dirname($file)));
$viewFile=Yii::app()->getRuntimePath().DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.$crc.DIRECTORY_SEPARATOR.basename($file);
if(!is_file($viewFile))
@mk... | [
"protected",
"function",
"getViewFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useRuntimePath",
")",
"{",
"$",
"crc",
"=",
"sprintf",
"(",
"'%x'",
",",
"crc32",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"Yii",
"::",
"getVersio... | Generates the resulting view file path.
@param string $file source view file path
@return string resulting view file path | [
"Generates",
"the",
"resulting",
"view",
"file",
"path",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/renderers/CViewRenderer.php#L84-L96 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.up | public function up()
{
$transaction=$this->getDbConnection()->beginTransaction();
try
{
if($this->safeUp()===false)
{
$transaction->rollback();
return false;
}
$transaction->commit();
}
catch(Exception $e)
{
echo "Exception: ".$e->getMessage().' ('.$e->getFile().':'.$e->getLine().")\... | php | public function up()
{
$transaction=$this->getDbConnection()->beginTransaction();
try
{
if($this->safeUp()===false)
{
$transaction->rollback();
return false;
}
$transaction->commit();
}
catch(Exception $e)
{
echo "Exception: ".$e->getMessage().' ('.$e->getFile().':'.$e->getLine().")\... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"transaction",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"safeUp",
"(",
")",
"===",
"false",
")",
"{",
"$"... | This method contains the logic to be executed when applying this migration.
Child classes may implement this method to provide actual migration logic.
@return boolean Returning false means, the migration will not be applied. | [
"This",
"method",
"contains",
"the",
"logic",
"to",
"be",
"executed",
"when",
"applying",
"this",
"migration",
".",
"Child",
"classes",
"may",
"implement",
"this",
"method",
"to",
"provide",
"actual",
"migration",
"logic",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L48-L67 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.down | public function down()
{
$transaction=$this->getDbConnection()->beginTransaction();
try
{
if($this->safeDown()===false)
{
$transaction->rollback();
return false;
}
$transaction->commit();
}
catch(Exception $e)
{
echo "Exception: ".$e->getMessage().' ('.$e->getFile().':'.$e->getLine()... | php | public function down()
{
$transaction=$this->getDbConnection()->beginTransaction();
try
{
if($this->safeDown()===false)
{
$transaction->rollback();
return false;
}
$transaction->commit();
}
catch(Exception $e)
{
echo "Exception: ".$e->getMessage().' ('.$e->getFile().':'.$e->getLine()... | [
"public",
"function",
"down",
"(",
")",
"{",
"$",
"transaction",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"beginTransaction",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"safeDown",
"(",
")",
"===",
"false",
")",
"{",
... | This method contains the logic to be executed when removing this migration.
Child classes may override this method if the corresponding migrations can be removed.
@return boolean Returning false means, the migration will not be applied. | [
"This",
"method",
"contains",
"the",
"logic",
"to",
"be",
"executed",
"when",
"removing",
"this",
"migration",
".",
"Child",
"classes",
"may",
"override",
"this",
"method",
"if",
"the",
"corresponding",
"migrations",
"can",
"be",
"removed",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L74-L93 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.insert | public function insert($table, $columns)
{
echo " > insert into $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->insert($table, $columns);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function insert($table, $columns)
{
echo " > insert into $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->insert($table, $columns);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"insert",
"(",
"$",
"table",
",",
"$",
"columns",
")",
"{",
"echo",
"\" > insert into $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"createCommand",
... | Creates and executes an INSERT SQL statement.
The method will properly escape the column names, and bind the values to be inserted.
@param string $table the table that new rows will be inserted into.
@param array $columns the column data (name=>value) to be inserted into the table. | [
"Creates",
"and",
"executes",
"an",
"INSERT",
"SQL",
"statement",
".",
"The",
"method",
"will",
"properly",
"escape",
"the",
"column",
"names",
"and",
"bind",
"the",
"values",
"to",
"be",
"inserted",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L174-L180 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.insertMultiple | public function insertMultiple($table, $data)
{
echo " > insert into $table ...";
$time=microtime(true);
$builder=$this->getDbConnection()->getSchema()->getCommandBuilder();
$command=$builder->createMultipleInsertCommand($table,$data);
$command->execute();
echo " done (time: ".sprintf('%.3f', microtime(... | php | public function insertMultiple($table, $data)
{
echo " > insert into $table ...";
$time=microtime(true);
$builder=$this->getDbConnection()->getSchema()->getCommandBuilder();
$command=$builder->createMultipleInsertCommand($table,$data);
$command->execute();
echo " done (time: ".sprintf('%.3f', microtime(... | [
"public",
"function",
"insertMultiple",
"(",
"$",
"table",
",",
"$",
"data",
")",
"{",
"echo",
"\" > insert into $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"builder",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")... | Creates and executes an INSERT SQL statement with multiple data.
The method will properly escape the column names, and bind the values to be inserted.
@param string $table the table that new rows will be inserted into.
@param array $data an array of various column data (name=>value) to be inserted into the table.
@sinc... | [
"Creates",
"and",
"executes",
"an",
"INSERT",
"SQL",
"statement",
"with",
"multiple",
"data",
".",
"The",
"method",
"will",
"properly",
"escape",
"the",
"column",
"names",
"and",
"bind",
"the",
"values",
"to",
"be",
"inserted",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L189-L197 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.update | public function update($table, $columns, $conditions='', $params=array())
{
echo " > update $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->update($table, $columns, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function update($table, $columns, $conditions='', $params=array())
{
echo " > update $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->update($table, $columns, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"update",
"(",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"conditions",
"=",
"''",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"echo",
"\" > update $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")"... | Creates and executes an UPDATE SQL statement.
The method will properly escape the column names and bind the values to be updated.
@param string $table the table to be updated.
@param array $columns the column data (name=>value) to be updated.
@param mixed $conditions the conditions that will be put in the WHERE part. P... | [
"Creates",
"and",
"executes",
"an",
"UPDATE",
"SQL",
"statement",
".",
"The",
"method",
"will",
"properly",
"escape",
"the",
"column",
"names",
"and",
"bind",
"the",
"values",
"to",
"be",
"updated",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L208-L214 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.delete | public function delete($table, $conditions='', $params=array())
{
echo " > delete from $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->delete($table, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function delete($table, $conditions='', $params=array())
{
echo " > delete from $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->delete($table, $conditions, $params);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"$",
"conditions",
"=",
"''",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"echo",
"\" > delete from $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"thi... | Creates and executes a DELETE SQL statement.
@param string $table the table where the data will be deleted from.
@param mixed $conditions the conditions that will be put in the WHERE part. Please
refer to {@link CDbCommand::where} on how to specify conditions.
@param array $params the parameters to be bound to the quer... | [
"Creates",
"and",
"executes",
"a",
"DELETE",
"SQL",
"statement",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L223-L229 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.createTable | public function createTable($table, $columns, $options=null)
{
echo " > create table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->createTable($table, $columns, $options);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function createTable($table, $columns, $options=null)
{
echo " > create table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->createTable($table, $columns, $options);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"createTable",
"(",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"options",
"=",
"null",
")",
"{",
"echo",
"\" > create table $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnec... | Builds and executes a SQL statement for creating a new DB table.
The columns in the new table should be specified as name-definition pairs (e.g. 'name'=>'string'),
where name stands for a column name which will be properly quoted by the method, and definition
stands for the column type which can contain an abstract D... | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"creating",
"a",
"new",
"DB",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L246-L252 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.renameTable | public function renameTable($table, $newName)
{
echo " > rename table $table to $newName ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameTable($table, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function renameTable($table, $newName)
{
echo " > rename table $table to $newName ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameTable($table, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"renameTable",
"(",
"$",
"table",
",",
"$",
"newName",
")",
"{",
"echo",
"\" > rename table $table to $newName ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"... | Builds and executes a SQL statement for renaming a DB table.
@param string $table the table to be renamed. The name will be properly quoted by the method.
@param string $newName the new table name. The name will be properly quoted by the method. | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"renaming",
"a",
"DB",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L259-L265 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.dropColumn | public function dropColumn($table, $column)
{
echo " > drop column $column from table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropColumn($table, $column);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function dropColumn($table, $column)
{
echo " > drop column $column from table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropColumn($table, $column);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"dropColumn",
"(",
"$",
"table",
",",
"$",
"column",
")",
"{",
"echo",
"\" > drop column $column from table $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",... | Builds and executes a SQL statement for dropping a DB column.
@param string $table the table whose column is to be dropped. The name will be properly quoted by the method.
@param string $column the name of the column to be dropped. The name will be properly quoted by the method. | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"dropping",
"a",
"DB",
"column",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L312-L318 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.renameColumn | public function renameColumn($table, $name, $newName)
{
echo " > rename column $name in table $table to $newName ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameColumn($table, $name, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function renameColumn($table, $name, $newName)
{
echo " > rename column $name in table $table to $newName ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->renameColumn($table, $name, $newName);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"renameColumn",
"(",
"$",
"table",
",",
"$",
"name",
",",
"$",
"newName",
")",
"{",
"echo",
"\" > rename column $name in table $table to $newName ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"ge... | Builds and executes a SQL statement for renaming a column.
@param string $table the table whose column is to be renamed. The name will be properly quoted by the method.
@param string $name the old name of the column. The name will be properly quoted by the method.
@param string $newName the new name of the column. The ... | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"renaming",
"a",
"column",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L326-L332 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.