repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
zbateson/mail-mime-parser
src/Header/Consumer/ReceivedConsumer.php
ReceivedConsumer.getSubConsumers
protected function getSubConsumers() { return [ $this->consumerService->getSubReceivedConsumer('from'), $this->consumerService->getSubReceivedConsumer('by'), $this->consumerService->getSubReceivedConsumer('via'), $this->consumerService->getSubReceivedConsumer('with'), $this->consumerService->getSubReceivedConsumer('id'), $this->consumerService->getSubReceivedConsumer('for'), $this->consumerService->getSubReceivedConsumer('date'), $this->consumerService->getCommentConsumer() ]; }
php
protected function getSubConsumers() { return [ $this->consumerService->getSubReceivedConsumer('from'), $this->consumerService->getSubReceivedConsumer('by'), $this->consumerService->getSubReceivedConsumer('via'), $this->consumerService->getSubReceivedConsumer('with'), $this->consumerService->getSubReceivedConsumer('id'), $this->consumerService->getSubReceivedConsumer('for'), $this->consumerService->getSubReceivedConsumer('date'), $this->consumerService->getCommentConsumer() ]; }
[ "protected", "function", "getSubConsumers", "(", ")", "{", "return", "[", "$", "this", "->", "consumerService", "->", "getSubReceivedConsumer", "(", "'from'", ")", ",", "$", "this", "->", "consumerService", "->", "getSubReceivedConsumer", "(", "'by'", ")", ",", ...
Returns two {@see Received/DomainConsumer} instances, with FROM and BY as part names, and 4 {@see Received/GenericReceivedConsumer} instances for VIA, WITH, ID, and FOR part names, and 1 {@see Received/ReceivedDateConsumer} for the date/time stamp, and one {@see CommentConsumer} to consume any comments. @return AbstractConsumer[] the sub-consumers
[ "Returns", "two", "{", "@see", "Received", "/", "DomainConsumer", "}", "instances", "with", "FROM", "and", "BY", "as", "part", "names", "and", "4", "{", "@see", "Received", "/", "GenericReceivedConsumer", "}", "instances", "for", "VIA", "WITH", "ID", "and", ...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/ReceivedConsumer.php#L68-L80
zbateson/mail-mime-parser
src/Header/Consumer/ReceivedConsumer.php
ReceivedConsumer.advanceToNextToken
protected function advanceToNextToken(Iterator $tokens, $isStartToken) { if ($isStartToken) { $tokens->next(); } elseif ($tokens->valid() && !$this->isEndToken($tokens->current())) { foreach ($this->getSubConsumers() as $consumer) { if ($consumer->isStartToken($tokens->current())) { return; } } $tokens->next(); } }
php
protected function advanceToNextToken(Iterator $tokens, $isStartToken) { if ($isStartToken) { $tokens->next(); } elseif ($tokens->valid() && !$this->isEndToken($tokens->current())) { foreach ($this->getSubConsumers() as $consumer) { if ($consumer->isStartToken($tokens->current())) { return; } } $tokens->next(); } }
[ "protected", "function", "advanceToNextToken", "(", "Iterator", "$", "tokens", ",", "$", "isStartToken", ")", "{", "if", "(", "$", "isStartToken", ")", "{", "$", "tokens", "->", "next", "(", ")", ";", "}", "elseif", "(", "$", "tokens", "->", "valid", "...
Overridden to /not/ advance when the end token matches a start token for a sub-consumer. @param Iterator $tokens @param bool $isStartToken
[ "Overridden", "to", "/", "not", "/", "advance", "when", "the", "end", "token", "matches", "a", "start", "token", "for", "a", "sub", "-", "consumer", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/ReceivedConsumer.php#L101-L113
zbateson/mail-mime-parser
src/Header/Consumer/ReceivedConsumer.php
ReceivedConsumer.processParts
protected function processParts(array $parts) { $ret = []; foreach ($parts as $part) { if ($part instanceof Token) { continue; } $ret[] = $part; } return $ret; }
php
protected function processParts(array $parts) { $ret = []; foreach ($parts as $part) { if ($part instanceof Token) { continue; } $ret[] = $part; } return $ret; }
[ "protected", "function", "processParts", "(", "array", "$", "parts", ")", "{", "$", "ret", "=", "[", "]", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "{", "if", "(", "$", "part", "instanceof", "Token", ")", "{", "continue", ";", "}",...
Overridden to combine all part values into a single string and return it as an array with a single element. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return \ZBateson\MailMimeParser\Header\Part\HeaderPart[]| \ZBateson\MailMimeParser\Header\Part\ReceivedDomainPart[]| \ZBateson\MailMimeParser\Header\Part\ReceivedPart[]| \ZBateson\MailMimeParser\Header\Part\DatePart[]| \ZBateson\MailMimeParser\Header\Part\CommentPart[]|array
[ "Overridden", "to", "combine", "all", "part", "values", "into", "a", "single", "string", "and", "return", "it", "as", "an", "array", "with", "a", "single", "element", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/ReceivedConsumer.php#L126-L136
zbateson/mail-mime-parser
src/Message/Part/Factory/MessagePartFactory.php
MessagePartFactory.setCachedInstance
protected static function setCachedInstance(MessagePartFactory $instance) { if (self::$instances === null) { self::$instances = []; } $class = get_called_class(); self::$instances[$class] = $instance; }
php
protected static function setCachedInstance(MessagePartFactory $instance) { if (self::$instances === null) { self::$instances = []; } $class = get_called_class(); self::$instances[$class] = $instance; }
[ "protected", "static", "function", "setCachedInstance", "(", "MessagePartFactory", "$", "instance", ")", "{", "if", "(", "self", "::", "$", "instances", "===", "null", ")", "{", "self", "::", "$", "instances", "=", "[", "]", ";", "}", "$", "class", "=", ...
Sets a cached singleton instance. @param MessagePartFactory $instance
[ "Sets", "a", "cached", "singleton", "instance", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/Factory/MessagePartFactory.php#L59-L66
zbateson/mail-mime-parser
src/Message/Part/Factory/MessagePartFactory.php
MessagePartFactory.getCachedInstance
protected static function getCachedInstance() { $class = get_called_class(); if (self::$instances === null || !isset(self::$instances[$class])) { return null; } return self::$instances[$class]; }
php
protected static function getCachedInstance() { $class = get_called_class(); if (self::$instances === null || !isset(self::$instances[$class])) { return null; } return self::$instances[$class]; }
[ "protected", "static", "function", "getCachedInstance", "(", ")", "{", "$", "class", "=", "get_called_class", "(", ")", ";", "if", "(", "self", "::", "$", "instances", "===", "null", "||", "!", "isset", "(", "self", "::", "$", "instances", "[", "$", "c...
Returns a cached singleton instance if one exists, or null if one hasn't been created yet. @return MessagePartFactory
[ "Returns", "a", "cached", "singleton", "instance", "if", "one", "exists", "or", "null", "if", "one", "hasn", "t", "been", "created", "yet", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/Factory/MessagePartFactory.php#L74-L81
zbateson/mail-mime-parser
src/Message/Part/Factory/MessagePartFactory.php
MessagePartFactory.getInstance
public static function getInstance( StreamFactory $sdf, PartStreamFilterManagerFactory $psf, PartFilterFactory $pf = null, MessageHelperService $mhs = null ) { $instance = static::getCachedInstance(); if ($instance === null) { $ref = new ReflectionClass(get_called_class()); $n = $ref->getConstructor()->getNumberOfParameters(); $args = []; for ($i = 0; $i < $n; ++$i) { $args[] = func_get_arg($i); } $instance = $ref->newInstanceArgs($args); static::setCachedInstance($instance); } return $instance; }
php
public static function getInstance( StreamFactory $sdf, PartStreamFilterManagerFactory $psf, PartFilterFactory $pf = null, MessageHelperService $mhs = null ) { $instance = static::getCachedInstance(); if ($instance === null) { $ref = new ReflectionClass(get_called_class()); $n = $ref->getConstructor()->getNumberOfParameters(); $args = []; for ($i = 0; $i < $n; ++$i) { $args[] = func_get_arg($i); } $instance = $ref->newInstanceArgs($args); static::setCachedInstance($instance); } return $instance; }
[ "public", "static", "function", "getInstance", "(", "StreamFactory", "$", "sdf", ",", "PartStreamFilterManagerFactory", "$", "psf", ",", "PartFilterFactory", "$", "pf", "=", "null", ",", "MessageHelperService", "$", "mhs", "=", "null", ")", "{", "$", "instance",...
Returns the singleton instance for the class. @param StreamFactory $sdf @param PartStreamFilterManagerFactory $psf @param PartFilterFactory $pf @param MessageHelperService $mhs @return MessagePartFactory
[ "Returns", "the", "singleton", "instance", "for", "the", "class", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/Factory/MessagePartFactory.php#L92-L110
zbateson/mail-mime-parser
src/Header/Part/HeaderPartFactory.php
HeaderPartFactory.newParameterPart
public function newParameterPart($name, $value, $language = null) { return new ParameterPart($this->charsetConverter, $name, $value, $language); }
php
public function newParameterPart($name, $value, $language = null) { return new ParameterPart($this->charsetConverter, $name, $value, $language); }
[ "public", "function", "newParameterPart", "(", "$", "name", ",", "$", "value", ",", "$", "language", "=", "null", ")", "{", "return", "new", "ParameterPart", "(", "$", "this", "->", "charsetConverter", ",", "$", "name", ",", "$", "value", ",", "$", "la...
Initializes and returns a new ParameterPart. @param string $name @param string $value @param string $language @return \ZBateson\MailMimeParser\Header\Part\ParameterPart
[ "Initializes", "and", "returns", "a", "new", "ParameterPart", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Part/HeaderPartFactory.php#L146-L149
zbateson/mail-mime-parser
src/Header/Part/HeaderPartFactory.php
HeaderPartFactory.newReceivedDomainPart
public function newReceivedDomainPart( $name, $value, $ehloName = null, $hostName = null, $hostAddress = null ) { return new ReceivedDomainPart( $this->charsetConverter, $name, $value, $ehloName, $hostName, $hostAddress ); }
php
public function newReceivedDomainPart( $name, $value, $ehloName = null, $hostName = null, $hostAddress = null ) { return new ReceivedDomainPart( $this->charsetConverter, $name, $value, $ehloName, $hostName, $hostAddress ); }
[ "public", "function", "newReceivedDomainPart", "(", "$", "name", ",", "$", "value", ",", "$", "ehloName", "=", "null", ",", "$", "hostName", "=", "null", ",", "$", "hostAddress", "=", "null", ")", "{", "return", "new", "ReceivedDomainPart", "(", "$", "th...
Initializes and returns a new ReceivedDomainPart. @param string $name @param string $value @param string $ehloName @param string $hostName @param string $hostAddress @return \ZBateson\MailMimeParser\Header\Part\ReceivedDomainPart
[ "Initializes", "and", "returns", "a", "new", "ReceivedDomainPart", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Part/HeaderPartFactory.php#L173-L188
zbateson/mail-mime-parser
src/Header/Consumer/AddressConsumer.php
AddressConsumer.getSubConsumers
protected function getSubConsumers() { return [ $this->consumerService->getAddressGroupConsumer(), $this->consumerService->getCommentConsumer(), $this->consumerService->getQuotedStringConsumer(), ]; }
php
protected function getSubConsumers() { return [ $this->consumerService->getAddressGroupConsumer(), $this->consumerService->getCommentConsumer(), $this->consumerService->getQuotedStringConsumer(), ]; }
[ "protected", "function", "getSubConsumers", "(", ")", "{", "return", "[", "$", "this", "->", "consumerService", "->", "getAddressGroupConsumer", "(", ")", ",", "$", "this", "->", "consumerService", "->", "getCommentConsumer", "(", ")", ",", "$", "this", "->", ...
Returns the following as sub-consumers: - \ZBateson\MailMimeParser\Header\Consumer\AddressGroupConsumer - \ZBateson\MailMimeParser\Header\Consumer\CommentConsumer - \ZBateson\MailMimeParser\Header\Consumer\QuotedStringConsumer @return AbstractConsumer[] the sub-consumers
[ "Returns", "the", "following", "as", "sub", "-", "consumers", ":", "-", "\\", "ZBateson", "\\", "MailMimeParser", "\\", "Header", "\\", "Consumer", "\\", "AddressGroupConsumer", "-", "\\", "ZBateson", "\\", "MailMimeParser", "\\", "Header", "\\", "Consumer", "...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/AddressConsumer.php#L44-L51
zbateson/mail-mime-parser
src/Header/Consumer/AddressConsumer.php
AddressConsumer.processSinglePart
private function processSinglePart(HeaderPart $part, &$strName, &$strValue) { $pValue = $part->getValue(); if ($part instanceof Token) { if ($pValue === '<') { $strName = $strValue; $strValue = ''; return; } elseif ($pValue === '>') { return; } } $strValue .= $pValue; }
php
private function processSinglePart(HeaderPart $part, &$strName, &$strValue) { $pValue = $part->getValue(); if ($part instanceof Token) { if ($pValue === '<') { $strName = $strValue; $strValue = ''; return; } elseif ($pValue === '>') { return; } } $strValue .= $pValue; }
[ "private", "function", "processSinglePart", "(", "HeaderPart", "$", "part", ",", "&", "$", "strName", ",", "&", "$", "strValue", ")", "{", "$", "pValue", "=", "$", "part", "->", "getValue", "(", ")", ";", "if", "(", "$", "part", "instanceof", "Token", ...
Checks if the passed part represents the beginning or end of an address part (less than/greater than characters) and either appends the value of the part to the passed $strValue, or sets up $strName @param HeaderPart $part @param string $strName @param string $strValue
[ "Checks", "if", "the", "passed", "part", "represents", "the", "beginning", "or", "end", "of", "an", "address", "part", "(", "less", "than", "/", "greater", "than", "characters", ")", "and", "either", "appends", "the", "value", "of", "the", "part", "to", ...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/AddressConsumer.php#L101-L114
zbateson/mail-mime-parser
src/Header/Consumer/AddressConsumer.php
AddressConsumer.processParts
protected function processParts(array $parts) { $strName = ''; $strValue = ''; foreach ($parts as $part) { if ($part instanceof AddressGroupPart) { return [ $this->partFactory->newAddressGroupPart( $part->getAddresses(), $strValue ) ]; } $this->processSinglePart($part, $strName, $strValue); } return [$this->partFactory->newAddressPart($strName, $strValue)]; }
php
protected function processParts(array $parts) { $strName = ''; $strValue = ''; foreach ($parts as $part) { if ($part instanceof AddressGroupPart) { return [ $this->partFactory->newAddressGroupPart( $part->getAddresses(), $strValue ) ]; } $this->processSinglePart($part, $strName, $strValue); } return [$this->partFactory->newAddressPart($strName, $strValue)]; }
[ "protected", "function", "processParts", "(", "array", "$", "parts", ")", "{", "$", "strName", "=", "''", ";", "$", "strValue", "=", "''", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "{", "if", "(", "$", "part", "instanceof", "AddressG...
Performs final processing on parsed parts. AddressConsumer's implementation looks for tokens representing the beginning of an address part, to create a Part\AddressPart out of a name/address pair, or assign the name part to a parsed Part\AddressGroupPart returned from its AddressGroupConsumer sub-consumer. The returned array consists of a single element - either a Part\AddressPart or a Part\AddressGroupPart. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return \ZBateson\MailMimeParser\Header\Part\HeaderPart[]|array
[ "Performs", "final", "processing", "on", "parsed", "parts", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/AddressConsumer.php#L130-L146
zbateson/mail-mime-parser
src/Header/Consumer/AddressGroupConsumer.php
AddressGroupConsumer.processParts
protected function processParts(array $parts) { $emails = []; foreach ($parts as $part) { if ($part instanceof AddressGroupPart) { $emails = array_merge($emails, $part->getAddresses()); continue; } $emails[] = $part; } $group = $this->partFactory->newAddressGroupPart($emails); return [$group]; }
php
protected function processParts(array $parts) { $emails = []; foreach ($parts as $part) { if ($part instanceof AddressGroupPart) { $emails = array_merge($emails, $part->getAddresses()); continue; } $emails[] = $part; } $group = $this->partFactory->newAddressGroupPart($emails); return [$group]; }
[ "protected", "function", "processParts", "(", "array", "$", "parts", ")", "{", "$", "emails", "=", "[", "]", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "{", "if", "(", "$", "part", "instanceof", "AddressGroupPart", ")", "{", "$", "ema...
Performs post-processing on parsed parts. AddressGroupConsumer returns an array with a single Part\AddressGroupPart element with all email addresses from this and any sub-groups. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return AddressGroupPart[]|array
[ "Performs", "post", "-", "processing", "on", "parsed", "parts", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/AddressGroupConsumer.php#L72-L84
zbateson/mail-mime-parser
src/Header/Consumer/ConsumerService.php
ConsumerService.getSubReceivedConsumer
public function getSubReceivedConsumer($partName) { if (empty($this->receivedConsumers[$partName])) { $consumer = null; if ($partName === 'from' || $partName === 'by') { $consumer = new DomainConsumer($this, $this->partFactory, $partName); } else if ($partName === 'date') { $consumer = new ReceivedDateConsumer($this, $this->partFactory); } else { $consumer = new GenericReceivedConsumer($this, $this->partFactory, $partName); } $this->receivedConsumers[$partName] = $consumer; } return $this->receivedConsumers[$partName]; }
php
public function getSubReceivedConsumer($partName) { if (empty($this->receivedConsumers[$partName])) { $consumer = null; if ($partName === 'from' || $partName === 'by') { $consumer = new DomainConsumer($this, $this->partFactory, $partName); } else if ($partName === 'date') { $consumer = new ReceivedDateConsumer($this, $this->partFactory); } else { $consumer = new GenericReceivedConsumer($this, $this->partFactory, $partName); } $this->receivedConsumers[$partName] = $consumer; } return $this->receivedConsumers[$partName]; }
[ "public", "function", "getSubReceivedConsumer", "(", "$", "partName", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "receivedConsumers", "[", "$", "partName", "]", ")", ")", "{", "$", "consumer", "=", "null", ";", "if", "(", "$", "partName", "=...
Returns the consumer instance corresponding to the passed part name of a Received header. @param string $partName @return \ZBateson\MailMimeParser\Header\Consumer\Received\FromConsumer
[ "Returns", "the", "consumer", "instance", "corresponding", "to", "the", "passed", "part", "name", "of", "a", "Received", "header", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/ConsumerService.php#L159-L173
zbateson/mail-mime-parser
src/Header/Consumer/DateConsumer.php
DateConsumer.processParts
protected function processParts(array $parts) { $strValue = ''; foreach ($parts as $part) { $strValue .= $part->getValue(); } return [$this->partFactory->newDatePart($strValue)]; }
php
protected function processParts(array $parts) { $strValue = ''; foreach ($parts as $part) { $strValue .= $part->getValue(); } return [$this->partFactory->newDatePart($strValue)]; }
[ "protected", "function", "processParts", "(", "array", "$", "parts", ")", "{", "$", "strValue", "=", "''", ";", "foreach", "(", "$", "parts", "as", "$", "part", ")", "{", "$", "strValue", ".=", "$", "part", "->", "getValue", "(", ")", ";", "}", "re...
Concatenates the passed parts and constructs a single Part\DatePart, returning it in an array with a single element. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return \ZBateson\MailMimeParser\Header\Part\HeaderPart[]|array
[ "Concatenates", "the", "passed", "parts", "and", "constructs", "a", "single", "Part", "\\", "DatePart", "returning", "it", "in", "an", "array", "with", "a", "single", "element", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/DateConsumer.php#L36-L43
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getAllNonFilteredParts
protected function getAllNonFilteredParts() { $parts = [ $this ]; foreach ($this->children as $part) { if ($part instanceof MimePart) { $parts = array_merge( $parts, $part->getAllNonFilteredParts() ); } else { array_push($parts, $part); } } return $parts; }
php
protected function getAllNonFilteredParts() { $parts = [ $this ]; foreach ($this->children as $part) { if ($part instanceof MimePart) { $parts = array_merge( $parts, $part->getAllNonFilteredParts() ); } else { array_push($parts, $part); } } return $parts; }
[ "protected", "function", "getAllNonFilteredParts", "(", ")", "{", "$", "parts", "=", "[", "$", "this", "]", ";", "foreach", "(", "$", "this", "->", "children", "as", "$", "part", ")", "{", "if", "(", "$", "part", "instanceof", "MimePart", ")", "{", "...
Returns all parts, including the current object, and all children below it (including children of children, etc...) @return MessagePart[]
[ "Returns", "all", "parts", "including", "the", "current", "object", "and", "all", "children", "below", "it", "(", "including", "children", "of", "children", "etc", "...", ")" ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L68-L82
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getPart
public function getPart($index, PartFilter $filter = null) { $parts = $this->getAllParts($filter); if (!isset($parts[$index])) { return null; } return $parts[$index]; }
php
public function getPart($index, PartFilter $filter = null) { $parts = $this->getAllParts($filter); if (!isset($parts[$index])) { return null; } return $parts[$index]; }
[ "public", "function", "getPart", "(", "$", "index", ",", "PartFilter", "$", "filter", "=", "null", ")", "{", "$", "parts", "=", "$", "this", "->", "getAllParts", "(", "$", "filter", ")", ";", "if", "(", "!", "isset", "(", "$", "parts", "[", "$", ...
Returns the part at the given 0-based index, or null if none is set. Note that the first part returned is the current part itself. This is often desirable for queries with a PartFilter, e.g. looking for a MessagePart with a specific Content-Type that may be satisfied by the current part. @param int $index @param PartFilter $filter @return MessagePart
[ "Returns", "the", "part", "at", "the", "given", "0", "-", "based", "index", "or", "null", "if", "none", "is", "set", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L96-L103
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getAllParts
public function getAllParts(PartFilter $filter = null) { $parts = $this->getAllNonFilteredParts(); if (!empty($filter)) { return array_values(array_filter( $parts, [ $filter, 'filter' ] )); } return $parts; }
php
public function getAllParts(PartFilter $filter = null) { $parts = $this->getAllNonFilteredParts(); if (!empty($filter)) { return array_values(array_filter( $parts, [ $filter, 'filter' ] )); } return $parts; }
[ "public", "function", "getAllParts", "(", "PartFilter", "$", "filter", "=", "null", ")", "{", "$", "parts", "=", "$", "this", "->", "getAllNonFilteredParts", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "filter", ")", ")", "{", "return", "array_va...
Returns the current part, all child parts, and child parts of all children optionally filtering them with the provided PartFilter. The first part returned is always the current MimePart. This is often desirable as it may be a valid MimePart for the provided PartFilter. @param PartFilter $filter an optional filter @return MessagePart[]
[ "Returns", "the", "current", "part", "all", "child", "parts", "and", "child", "parts", "of", "all", "children", "optionally", "filtering", "them", "with", "the", "provided", "PartFilter", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L115-L125
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getChild
public function getChild($index, PartFilter $filter = null) { $parts = $this->getChildParts($filter); if (!isset($parts[$index])) { return null; } return $parts[$index]; }
php
public function getChild($index, PartFilter $filter = null) { $parts = $this->getChildParts($filter); if (!isset($parts[$index])) { return null; } return $parts[$index]; }
[ "public", "function", "getChild", "(", "$", "index", ",", "PartFilter", "$", "filter", "=", "null", ")", "{", "$", "parts", "=", "$", "this", "->", "getChildParts", "(", "$", "filter", ")", ";", "if", "(", "!", "isset", "(", "$", "parts", "[", "$",...
Returns the direct child at the given 0-based index, or null if none is set. @param int $index @param PartFilter $filter @return MessagePart
[ "Returns", "the", "direct", "child", "at", "the", "given", "0", "-", "based", "index", "or", "null", "if", "none", "is", "set", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L149-L156
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getChildParts
public function getChildParts(PartFilter $filter = null) { if ($filter !== null) { return array_values(array_filter($this->children, [ $filter, 'filter' ])); } return $this->children; }
php
public function getChildParts(PartFilter $filter = null) { if ($filter !== null) { return array_values(array_filter($this->children, [ $filter, 'filter' ])); } return $this->children; }
[ "public", "function", "getChildParts", "(", "PartFilter", "$", "filter", "=", "null", ")", "{", "if", "(", "$", "filter", "!==", "null", ")", "{", "return", "array_values", "(", "array_filter", "(", "$", "this", "->", "children", ",", "[", "$", "filter",...
Returns all direct child parts. If a PartFilter is provided, the PartFilter is applied before returning. @param PartFilter $filter @return MessagePart[]
[ "Returns", "all", "direct", "child", "parts", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L166-L172
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getPartByMimeType
public function getPartByMimeType($mimeType, $index = 0) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getPart($index, $partFilter); }
php
public function getPartByMimeType($mimeType, $index = 0) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getPart($index, $partFilter); }
[ "public", "function", "getPartByMimeType", "(", "$", "mimeType", ",", "$", "index", "=", "0", ")", "{", "$", "partFilter", "=", "$", "this", "->", "partFilterFactory", "->", "newFilterFromContentType", "(", "$", "mimeType", ")", ";", "return", "$", "this", ...
Returns the part associated with the passed mime type, at the passed index, if it exists. @param string $mimeType @param int $index @return MessagePart|null
[ "Returns", "the", "part", "associated", "with", "the", "passed", "mime", "type", "at", "the", "passed", "index", "if", "it", "exists", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L193-L197
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getAllPartsByMimeType
public function getAllPartsByMimeType($mimeType) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getAllParts($partFilter); }
php
public function getAllPartsByMimeType($mimeType) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getAllParts($partFilter); }
[ "public", "function", "getAllPartsByMimeType", "(", "$", "mimeType", ")", "{", "$", "partFilter", "=", "$", "this", "->", "partFilterFactory", "->", "newFilterFromContentType", "(", "$", "mimeType", ")", ";", "return", "$", "this", "->", "getAllParts", "(", "$...
Returns an array of all parts associated with the passed mime type if any exist or null otherwise. @param string $mimeType @return MessagePart[] or null
[ "Returns", "an", "array", "of", "all", "parts", "associated", "with", "the", "passed", "mime", "type", "if", "any", "exist", "or", "null", "otherwise", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L206-L210
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.getCountOfPartsByMimeType
public function getCountOfPartsByMimeType($mimeType) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getPartCount($partFilter); }
php
public function getCountOfPartsByMimeType($mimeType) { $partFilter = $this->partFilterFactory->newFilterFromContentType($mimeType); return $this->getPartCount($partFilter); }
[ "public", "function", "getCountOfPartsByMimeType", "(", "$", "mimeType", ")", "{", "$", "partFilter", "=", "$", "this", "->", "partFilterFactory", "->", "newFilterFromContentType", "(", "$", "mimeType", ")", ";", "return", "$", "this", "->", "getPartCount", "(",...
Returns the number of parts matching the passed $mimeType @param string $mimeType @return int
[ "Returns", "the", "number", "of", "parts", "matching", "the", "passed", "$mimeType" ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L218-L222
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.addChild
public function addChild(MessagePart $part, $position = null) { if ($part !== $this) { $part->parent = $this; array_splice( $this->children, ($position === null) ? count($this->children) : $position, 0, [ $part ] ); $this->onChange(); } }
php
public function addChild(MessagePart $part, $position = null) { if ($part !== $this) { $part->parent = $this; array_splice( $this->children, ($position === null) ? count($this->children) : $position, 0, [ $part ] ); $this->onChange(); } }
[ "public", "function", "addChild", "(", "MessagePart", "$", "part", ",", "$", "position", "=", "null", ")", "{", "if", "(", "$", "part", "!==", "$", "this", ")", "{", "$", "part", "->", "parent", "=", "$", "this", ";", "array_splice", "(", "$", "thi...
Registers the passed part as a child of the current part. If the $position parameter is non-null, adds the part at the passed position index. @param MessagePart $part @param int $position
[ "Registers", "the", "passed", "part", "as", "a", "child", "of", "the", "current", "part", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L233-L245
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.removePart
public function removePart(MessagePart $part) { $parent = $part->getParent(); if ($this !== $parent && $parent !== null) { return $parent->removePart($part); } else { $position = array_search($part, $this->children, true); if ($position !== false && is_int($position)) { array_splice($this->children, $position, 1); $this->onChange(); return $position; } } return null; }
php
public function removePart(MessagePart $part) { $parent = $part->getParent(); if ($this !== $parent && $parent !== null) { return $parent->removePart($part); } else { $position = array_search($part, $this->children, true); if ($position !== false && is_int($position)) { array_splice($this->children, $position, 1); $this->onChange(); return $position; } } return null; }
[ "public", "function", "removePart", "(", "MessagePart", "$", "part", ")", "{", "$", "parent", "=", "$", "part", "->", "getParent", "(", ")", ";", "if", "(", "$", "this", "!==", "$", "parent", "&&", "$", "parent", "!==", "null", ")", "{", "return", ...
Removes the child part from this part and returns its position or null if it wasn't found. Note that if the part is not a direct child of this part, the returned position is its index within its parent (calls removePart on its direct parent). @param MessagePart $part @return int or null if not found
[ "Removes", "the", "child", "part", "from", "this", "part", "and", "returns", "its", "position", "or", "null", "if", "it", "wasn", "t", "found", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L258-L272
zbateson/mail-mime-parser
src/Message/Part/ParentPart.php
ParentPart.removeAllParts
public function removeAllParts(PartFilter $filter = null) { foreach ($this->getAllParts($filter) as $part) { if ($part === $this) { continue; } $this->removePart($part); } }
php
public function removeAllParts(PartFilter $filter = null) { foreach ($this->getAllParts($filter) as $part) { if ($part === $this) { continue; } $this->removePart($part); } }
[ "public", "function", "removeAllParts", "(", "PartFilter", "$", "filter", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getAllParts", "(", "$", "filter", ")", "as", "$", "part", ")", "{", "if", "(", "$", "part", "===", "$", "this", ")", ...
Removes all parts that are matched by the passed PartFilter. Note: the current part will not be removed. Although the function naming matches getAllParts, which returns the current part, it also doesn't only remove direct children like getChildParts. Internally this function uses getAllParts but the current part is filtered out if returned. @param \ZBateson\MailMimeParser\Message\PartFilter $filter
[ "Removes", "all", "parts", "that", "are", "matched", "by", "the", "passed", "PartFilter", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentPart.php#L284-L292
zbateson/mail-mime-parser
src/Message.php
Message.getAttachmentPart
public function getAttachmentPart($index) { $attachments = $this->getAllAttachmentParts(); if (!isset($attachments[$index])) { return null; } return $attachments[$index]; }
php
public function getAttachmentPart($index) { $attachments = $this->getAllAttachmentParts(); if (!isset($attachments[$index])) { return null; } return $attachments[$index]; }
[ "public", "function", "getAttachmentPart", "(", "$", "index", ")", "{", "$", "attachments", "=", "$", "this", "->", "getAllAttachmentParts", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "attachments", "[", "$", "index", "]", ")", ")", "{", "return...
Returns the attachment part at the given 0-based index, or null if none is set. @param int $index @return MessagePart
[ "Returns", "the", "attachment", "part", "at", "the", "given", "0", "-", "based", "index", "or", "null", "if", "none", "is", "set", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L140-L147
zbateson/mail-mime-parser
src/Message.php
Message.getAllAttachmentParts
public function getAllAttachmentParts() { $parts = $this->getAllParts( $this->partFilterFactory->newFilterFromArray([ 'multipart' => PartFilter::FILTER_EXCLUDE ]) ); return array_values(array_filter( $parts, function ($part) { return !( $part->isTextPart() && $part->getContentDisposition() === 'inline' ); } )); }
php
public function getAllAttachmentParts() { $parts = $this->getAllParts( $this->partFilterFactory->newFilterFromArray([ 'multipart' => PartFilter::FILTER_EXCLUDE ]) ); return array_values(array_filter( $parts, function ($part) { return !( $part->isTextPart() && $part->getContentDisposition() === 'inline' ); } )); }
[ "public", "function", "getAllAttachmentParts", "(", ")", "{", "$", "parts", "=", "$", "this", "->", "getAllParts", "(", "$", "this", "->", "partFilterFactory", "->", "newFilterFromArray", "(", "[", "'multipart'", "=>", "PartFilter", "::", "FILTER_EXCLUDE", "]", ...
Returns all attachment parts. "Attachments" are any non-multipart, non-signature and any text or html html part witha Content-Disposition set to 'attachment'. @return MessagePart[]
[ "Returns", "all", "attachment", "parts", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L157-L173
zbateson/mail-mime-parser
src/Message.php
Message.getTextStream
public function getTextStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $textPart = $this->getTextPart($index); if ($textPart !== null) { return $textPart->getContentStream($charset); } return null; }
php
public function getTextStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $textPart = $this->getTextPart($index); if ($textPart !== null) { return $textPart->getContentStream($charset); } return null; }
[ "public", "function", "getTextStream", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "textPart", "=", "$", "this", "->", "getTextPart", "(", "$", "index", ")", ";", "if", "(", "$", "tex...
Returns a Psr7 Stream for the 'inline' text/plain content at the passed $index, or null if unavailable. @param int $index @param string $charset @return StreamInterface
[ "Returns", "a", "Psr7", "Stream", "for", "the", "inline", "text", "/", "plain", "content", "at", "the", "passed", "$index", "or", "null", "if", "unavailable", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L193-L200
zbateson/mail-mime-parser
src/Message.php
Message.getTextResourceHandle
public function getTextResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $textPart = $this->getTextPart($index); if ($textPart !== null) { return $textPart->getContentResourceHandle($charset); } return null; }
php
public function getTextResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $textPart = $this->getTextPart($index); if ($textPart !== null) { return $textPart->getContentResourceHandle($charset); } return null; }
[ "public", "function", "getTextResourceHandle", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "textPart", "=", "$", "this", "->", "getTextPart", "(", "$", "index", ")", ";", "if", "(", "$"...
Returns a resource handle for the 'inline' text/plain content at the passed $index, or null if unavailable. @param int $index @param string $charset @return resource
[ "Returns", "a", "resource", "handle", "for", "the", "inline", "text", "/", "plain", "content", "at", "the", "passed", "$index", "or", "null", "if", "unavailable", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L210-L217
zbateson/mail-mime-parser
src/Message.php
Message.getTextContent
public function getTextContent($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $part = $this->getTextPart($index); if ($part !== null) { return $part->getContent($charset); } return null; }
php
public function getTextContent($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $part = $this->getTextPart($index); if ($part !== null) { return $part->getContent($charset); } return null; }
[ "public", "function", "getTextContent", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "part", "=", "$", "this", "->", "getTextPart", "(", "$", "index", ")", ";", "if", "(", "$", "part",...
Returns the content of the inline text/plain part at the given index. Reads the entire stream content into a string and returns it. Returns null if the message doesn't have an inline text part. @param int $index @param string $charset @return string
[ "Returns", "the", "content", "of", "the", "inline", "text", "/", "plain", "part", "at", "the", "given", "index", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L229-L236
zbateson/mail-mime-parser
src/Message.php
Message.getHtmlStream
public function getHtmlStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $htmlPart = $this->getHtmlPart($index); if ($htmlPart !== null) { return $htmlPart->getContentStream($charset); } return null; }
php
public function getHtmlStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $htmlPart = $this->getHtmlPart($index); if ($htmlPart !== null) { return $htmlPart->getContentStream($charset); } return null; }
[ "public", "function", "getHtmlStream", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "htmlPart", "=", "$", "this", "->", "getHtmlPart", "(", "$", "index", ")", ";", "if", "(", "$", "htm...
Returns a Psr7 Stream for the 'inline' text/html content at the passed $index, or null if unavailable. @param int $index @param string $charset @return StreamInterface
[ "Returns", "a", "Psr7", "Stream", "for", "the", "inline", "text", "/", "html", "content", "at", "the", "passed", "$index", "or", "null", "if", "unavailable", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L246-L253
zbateson/mail-mime-parser
src/Message.php
Message.getHtmlResourceHandle
public function getHtmlResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $htmlPart = $this->getHtmlPart($index); if ($htmlPart !== null) { return $htmlPart->getContentResourceHandle($charset); } return null; }
php
public function getHtmlResourceHandle($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $htmlPart = $this->getHtmlPart($index); if ($htmlPart !== null) { return $htmlPart->getContentResourceHandle($charset); } return null; }
[ "public", "function", "getHtmlResourceHandle", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "htmlPart", "=", "$", "this", "->", "getHtmlPart", "(", "$", "index", ")", ";", "if", "(", "$"...
Returns a resource handle for the 'inline' text/html content at the passed $index, or null if unavailable. @param int $index @param string $charset @return resource
[ "Returns", "a", "resource", "handle", "for", "the", "inline", "text", "/", "html", "content", "at", "the", "passed", "$index", "or", "null", "if", "unavailable", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L263-L270
zbateson/mail-mime-parser
src/Message.php
Message.getHtmlContent
public function getHtmlContent($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $part = $this->getHtmlPart($index); if ($part !== null) { return $part->getContent($charset); } return null; }
php
public function getHtmlContent($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET) { $part = $this->getHtmlPart($index); if ($part !== null) { return $part->getContent($charset); } return null; }
[ "public", "function", "getHtmlContent", "(", "$", "index", "=", "0", ",", "$", "charset", "=", "MailMimeParser", "::", "DEFAULT_CHARSET", ")", "{", "$", "part", "=", "$", "this", "->", "getHtmlPart", "(", "$", "index", ")", ";", "if", "(", "$", "part",...
Returns the content of the inline text/html part at the given index. Reads the entire stream content into a string and returns it. Returns null if the message doesn't have an inline html part. @param int $index @param string $charset @return string
[ "Returns", "the", "content", "of", "the", "inline", "text", "/", "html", "part", "at", "the", "given", "index", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L282-L289
zbateson/mail-mime-parser
src/Message.php
Message.isMime
public function isMime() { $contentType = $this->getHeaderValue('Content-Type'); $mimeVersion = $this->getHeaderValue('Mime-Version'); return ($contentType !== null || $mimeVersion !== null); }
php
public function isMime() { $contentType = $this->getHeaderValue('Content-Type'); $mimeVersion = $this->getHeaderValue('Mime-Version'); return ($contentType !== null || $mimeVersion !== null); }
[ "public", "function", "isMime", "(", ")", "{", "$", "contentType", "=", "$", "this", "->", "getHeaderValue", "(", "'Content-Type'", ")", ";", "$", "mimeVersion", "=", "$", "this", "->", "getHeaderValue", "(", "'Mime-Version'", ")", ";", "return", "(", "$",...
Returns true if either a Content-Type or Mime-Version header are defined in this Message. @return bool
[ "Returns", "true", "if", "either", "a", "Content", "-", "Type", "or", "Mime", "-", "Version", "header", "are", "defined", "in", "this", "Message", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L297-L302
zbateson/mail-mime-parser
src/Message.php
Message.setTextPart
public function setTextPart($resource, $charset = 'UTF-8') { $this->messageHelperService ->getMultipartHelper() ->setContentPartForMimeType( $this, 'text/plain', $resource, $charset ); }
php
public function setTextPart($resource, $charset = 'UTF-8') { $this->messageHelperService ->getMultipartHelper() ->setContentPartForMimeType( $this, 'text/plain', $resource, $charset ); }
[ "public", "function", "setTextPart", "(", "$", "resource", ",", "$", "charset", "=", "'UTF-8'", ")", "{", "$", "this", "->", "messageHelperService", "->", "getMultipartHelper", "(", ")", "->", "setContentPartForMimeType", "(", "$", "this", ",", "'text/plain'", ...
Sets the text/plain part of the message to the passed $stringOrHandle, either creating a new part if one doesn't exist for text/plain, or assigning the value of $stringOrHandle to an existing text/plain part. The optional $charset parameter is the charset for saving to. $stringOrHandle is expected to be in UTF-8 regardless of the target charset. @param string|resource|StreamInterface $resource @param string $charset
[ "Sets", "the", "text", "/", "plain", "part", "of", "the", "message", "to", "the", "passed", "$stringOrHandle", "either", "creating", "a", "new", "part", "if", "one", "doesn", "t", "exist", "for", "text", "/", "plain", "or", "assigning", "the", "value", "...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L316-L323
zbateson/mail-mime-parser
src/Message.php
Message.setHtmlPart
public function setHtmlPart($resource, $charset = 'UTF-8') { $this->messageHelperService ->getMultipartHelper() ->setContentPartForMimeType( $this, 'text/html', $resource, $charset ); }
php
public function setHtmlPart($resource, $charset = 'UTF-8') { $this->messageHelperService ->getMultipartHelper() ->setContentPartForMimeType( $this, 'text/html', $resource, $charset ); }
[ "public", "function", "setHtmlPart", "(", "$", "resource", ",", "$", "charset", "=", "'UTF-8'", ")", "{", "$", "this", "->", "messageHelperService", "->", "getMultipartHelper", "(", ")", "->", "setContentPartForMimeType", "(", "$", "this", ",", "'text/html'", ...
Sets the text/html part of the message to the passed $stringOrHandle, either creating a new part if one doesn't exist for text/html, or assigning the value of $stringOrHandle to an existing text/html part. The optional $charset parameter is the charset for saving to. $stringOrHandle is expected to be in UTF-8 regardless of the target charset. @param string|resource|StreamInterface $resource @param string $charset
[ "Sets", "the", "text", "/", "html", "part", "of", "the", "message", "to", "the", "passed", "$stringOrHandle", "either", "creating", "a", "new", "part", "if", "one", "doesn", "t", "exist", "for", "text", "/", "html", "or", "assigning", "the", "value", "of...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L337-L344
zbateson/mail-mime-parser
src/Message.php
Message.addAttachmentPart
public function addAttachmentPart($resource, $mimeType, $filename = null, $disposition = 'attachment') { $this->messageHelperService ->getMultipartHelper() ->createAndAddPartForAttachment($this, $resource, $mimeType, $disposition, $filename); }
php
public function addAttachmentPart($resource, $mimeType, $filename = null, $disposition = 'attachment') { $this->messageHelperService ->getMultipartHelper() ->createAndAddPartForAttachment($this, $resource, $mimeType, $disposition, $filename); }
[ "public", "function", "addAttachmentPart", "(", "$", "resource", ",", "$", "mimeType", ",", "$", "filename", "=", "null", ",", "$", "disposition", "=", "'attachment'", ")", "{", "$", "this", "->", "messageHelperService", "->", "getMultipartHelper", "(", ")", ...
Adds an attachment part for the passed raw data string or handle and given parameters. @param string|resource|StreamInterface $resource @param string $mimeType @param string $filename @param string $disposition
[ "Adds", "an", "attachment", "part", "for", "the", "passed", "raw", "data", "string", "or", "handle", "and", "given", "parameters", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L421-L426
zbateson/mail-mime-parser
src/Message.php
Message.addAttachmentPartFromFile
public function addAttachmentPartFromFile($filePath, $mimeType, $filename = null, $disposition = 'attachment') { $handle = Psr7\stream_for(fopen($filePath, 'r')); if ($filename === null) { $filename = basename($filePath); } $this->addAttachmentPart($handle, $mimeType, $filename, $disposition); }
php
public function addAttachmentPartFromFile($filePath, $mimeType, $filename = null, $disposition = 'attachment') { $handle = Psr7\stream_for(fopen($filePath, 'r')); if ($filename === null) { $filename = basename($filePath); } $this->addAttachmentPart($handle, $mimeType, $filename, $disposition); }
[ "public", "function", "addAttachmentPartFromFile", "(", "$", "filePath", ",", "$", "mimeType", ",", "$", "filename", "=", "null", ",", "$", "disposition", "=", "'attachment'", ")", "{", "$", "handle", "=", "Psr7", "\\", "stream_for", "(", "fopen", "(", "$"...
Adds an attachment part using the passed file. Essentially creates a file stream and uses it. @param string $filePath @param string $mimeType @param string $filename @param string $disposition
[ "Adds", "an", "attachment", "part", "using", "the", "passed", "file", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L438-L445
zbateson/mail-mime-parser
src/Message.php
Message.setAsMultipartSigned
public function setAsMultipartSigned($micalg, $protocol) { $this ->messageHelperService ->getPrivacyHelper() ->setMessageAsMultipartSigned($this, $micalg, $protocol); }
php
public function setAsMultipartSigned($micalg, $protocol) { $this ->messageHelperService ->getPrivacyHelper() ->setMessageAsMultipartSigned($this, $micalg, $protocol); }
[ "public", "function", "setAsMultipartSigned", "(", "$", "micalg", ",", "$", "protocol", ")", "{", "$", "this", "->", "messageHelperService", "->", "getPrivacyHelper", "(", ")", "->", "setMessageAsMultipartSigned", "(", "$", "this", ",", "$", "micalg", ",", "$"...
Turns the message into a multipart/signed message, moving the actual message into a child part, sets the content-type of the main message to multipart/signed and adds an empty signature part as well. After calling setAsMultipartSigned, call getSignedMessageAsString to return a @param string $micalg The Message Integrity Check algorithm being used @param string $protocol The mime-type of the signature body
[ "Turns", "the", "message", "into", "a", "multipart", "/", "signed", "message", "moving", "the", "actual", "message", "into", "a", "child", "part", "sets", "the", "content", "-", "type", "of", "the", "main", "message", "to", "multipart", "/", "signed", "and...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message.php#L526-L532
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.setStream
public function setStream(StreamInterface $stream = null) { $this->stream = $stream; $this->decodedStream = null; $this->charsetStream = null; }
php
public function setStream(StreamInterface $stream = null) { $this->stream = $stream; $this->decodedStream = null; $this->charsetStream = null; }
[ "public", "function", "setStream", "(", "StreamInterface", "$", "stream", "=", "null", ")", "{", "$", "this", "->", "stream", "=", "$", "stream", ";", "$", "this", "->", "decodedStream", "=", "null", ";", "$", "this", "->", "charsetStream", "=", "null", ...
Sets the URL used to open the content resource handle. The function also closes the currently attached handle if any. @param StreamInterface $stream
[ "Sets", "the", "URL", "used", "to", "open", "the", "content", "resource", "handle", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L83-L88
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.attachTransferEncodingFilter
protected function attachTransferEncodingFilter($transferEncoding) { if ($this->decodedStream !== null) { $this->encoding['type'] = $transferEncoding; $assign = null; switch ($transferEncoding) { case 'base64': $assign = $this->streamFactory->newBase64Stream($this->decodedStream); break; case 'x-uuencode': $assign = $this->streamFactory->newUUStream($this->decodedStream); break; case 'quoted-printable': $assign = $this->streamFactory->newQuotedPrintableStream($this->decodedStream); break; } if ($assign !== null) { $this->decodedStream = new CachingStream($assign); } } }
php
protected function attachTransferEncodingFilter($transferEncoding) { if ($this->decodedStream !== null) { $this->encoding['type'] = $transferEncoding; $assign = null; switch ($transferEncoding) { case 'base64': $assign = $this->streamFactory->newBase64Stream($this->decodedStream); break; case 'x-uuencode': $assign = $this->streamFactory->newUUStream($this->decodedStream); break; case 'quoted-printable': $assign = $this->streamFactory->newQuotedPrintableStream($this->decodedStream); break; } if ($assign !== null) { $this->decodedStream = new CachingStream($assign); } } }
[ "protected", "function", "attachTransferEncodingFilter", "(", "$", "transferEncoding", ")", "{", "if", "(", "$", "this", "->", "decodedStream", "!==", "null", ")", "{", "$", "this", "->", "encoding", "[", "'type'", "]", "=", "$", "transferEncoding", ";", "$"...
Attaches a decoding filter to the attached content handle, for the passed $transferEncoding. @param string $transferEncoding
[ "Attaches", "a", "decoding", "filter", "to", "the", "attached", "content", "handle", "for", "the", "passed", "$transferEncoding", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L123-L143
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.attachCharsetFilter
protected function attachCharsetFilter($fromCharset, $toCharset) { if ($this->charsetStream !== null) { $this->charsetStream = new CachingStream($this->streamFactory->newCharsetStream( $this->charsetStream, $fromCharset, $toCharset )); $this->charset['from'] = $fromCharset; $this->charset['to'] = $toCharset; } }
php
protected function attachCharsetFilter($fromCharset, $toCharset) { if ($this->charsetStream !== null) { $this->charsetStream = new CachingStream($this->streamFactory->newCharsetStream( $this->charsetStream, $fromCharset, $toCharset )); $this->charset['from'] = $fromCharset; $this->charset['to'] = $toCharset; } }
[ "protected", "function", "attachCharsetFilter", "(", "$", "fromCharset", ",", "$", "toCharset", ")", "{", "if", "(", "$", "this", "->", "charsetStream", "!==", "null", ")", "{", "$", "this", "->", "charsetStream", "=", "new", "CachingStream", "(", "$", "th...
Attaches a charset conversion filter to the attached content handle, for the passed arguments. @param string $fromCharset the character set the content is encoded in @param string $toCharset the target encoding to return
[ "Attaches", "a", "charset", "conversion", "filter", "to", "the", "attached", "content", "handle", "for", "the", "passed", "arguments", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L152-L163
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.resetCharsetStream
private function resetCharsetStream() { $this->charset = [ 'from' => null, 'to' => null, 'filter' => null ]; $this->decodedStream->rewind(); $this->charsetStream = $this->decodedStream; }
php
private function resetCharsetStream() { $this->charset = [ 'from' => null, 'to' => null, 'filter' => null ]; $this->decodedStream->rewind(); $this->charsetStream = $this->decodedStream; }
[ "private", "function", "resetCharsetStream", "(", ")", "{", "$", "this", "->", "charset", "=", "[", "'from'", "=>", "null", ",", "'to'", "=>", "null", ",", "'filter'", "=>", "null", "]", ";", "$", "this", "->", "decodedStream", "->", "rewind", "(", ")"...
Resets just the charset stream, and rewinds the decodedStream.
[ "Resets", "just", "the", "charset", "stream", "and", "rewinds", "the", "decodedStream", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L168-L177
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.reset
public function reset() { $this->encoding = [ 'type' => null, 'filter' => null ]; $this->charset = [ 'from' => null, 'to' => null, 'filter' => null ]; $this->stream->rewind(); $this->decodedStream = $this->stream; $this->charsetStream = $this->stream; }
php
public function reset() { $this->encoding = [ 'type' => null, 'filter' => null ]; $this->charset = [ 'from' => null, 'to' => null, 'filter' => null ]; $this->stream->rewind(); $this->decodedStream = $this->stream; $this->charsetStream = $this->stream; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "encoding", "=", "[", "'type'", "=>", "null", ",", "'filter'", "=>", "null", "]", ";", "$", "this", "->", "charset", "=", "[", "'from'", "=>", "null", ",", "'to'", "=>", "null", ",", ...
Resets cached encoding and charset streams, and rewinds the stream.
[ "Resets", "cached", "encoding", "and", "charset", "streams", "and", "rewinds", "the", "stream", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L182-L196
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.getContentStream
public function getContentStream($transferEncoding, $fromCharset, $toCharset) { if ($this->stream === null) { return null; } if (empty($fromCharset) || empty($toCharset)) { return $this->getBinaryStream($transferEncoding); } if ($this->charsetStream === null || $this->isTransferEncodingFilterChanged($transferEncoding) || $this->isCharsetFilterChanged($fromCharset, $toCharset)) { if ($this->charsetStream === null || $this->isTransferEncodingFilterChanged($transferEncoding)) { $this->reset(); $this->attachTransferEncodingFilter($transferEncoding); } $this->resetCharsetStream(); $this->attachCharsetFilter($fromCharset, $toCharset); } $this->charsetStream->rewind(); return $this->charsetStream; }
php
public function getContentStream($transferEncoding, $fromCharset, $toCharset) { if ($this->stream === null) { return null; } if (empty($fromCharset) || empty($toCharset)) { return $this->getBinaryStream($transferEncoding); } if ($this->charsetStream === null || $this->isTransferEncodingFilterChanged($transferEncoding) || $this->isCharsetFilterChanged($fromCharset, $toCharset)) { if ($this->charsetStream === null || $this->isTransferEncodingFilterChanged($transferEncoding)) { $this->reset(); $this->attachTransferEncodingFilter($transferEncoding); } $this->resetCharsetStream(); $this->attachCharsetFilter($fromCharset, $toCharset); } $this->charsetStream->rewind(); return $this->charsetStream; }
[ "public", "function", "getContentStream", "(", "$", "transferEncoding", ",", "$", "fromCharset", ",", "$", "toCharset", ")", "{", "if", "(", "$", "this", "->", "stream", "===", "null", ")", "{", "return", "null", ";", "}", "if", "(", "empty", "(", "$",...
Checks what transfer-encoding decoder stream and charset conversion stream are currently attached on the underlying stream, and resets them if the requested arguments differ from the currently assigned ones. @param string $transferEncoding @param string $fromCharset the character set the content is encoded in @param string $toCharset the target encoding to return @return StreamInterface
[ "Checks", "what", "transfer", "-", "encoding", "decoder", "stream", "and", "charset", "conversion", "stream", "are", "currently", "attached", "on", "the", "underlying", "stream", "and", "resets", "them", "if", "the", "requested", "arguments", "differ", "from", "...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L208-L229
zbateson/mail-mime-parser
src/Message/Part/PartStreamFilterManager.php
PartStreamFilterManager.getBinaryStream
public function getBinaryStream($transferEncoding) { if ($this->stream === null) { return null; } if ($this->decodedStream === null || $this->isTransferEncodingFilterChanged($transferEncoding)) { $this->reset(); $this->attachTransferEncodingFilter($transferEncoding); } $this->decodedStream->rewind(); return $this->decodedStream; }
php
public function getBinaryStream($transferEncoding) { if ($this->stream === null) { return null; } if ($this->decodedStream === null || $this->isTransferEncodingFilterChanged($transferEncoding)) { $this->reset(); $this->attachTransferEncodingFilter($transferEncoding); } $this->decodedStream->rewind(); return $this->decodedStream; }
[ "public", "function", "getBinaryStream", "(", "$", "transferEncoding", ")", "{", "if", "(", "$", "this", "->", "stream", "===", "null", ")", "{", "return", "null", ";", "}", "if", "(", "$", "this", "->", "decodedStream", "===", "null", "||", "$", "this...
Checks what transfer-encoding decoder stream is attached on the underlying stream, and resets it if the requested arguments differ. @param string $transferEncoding @return StreamInterface
[ "Checks", "what", "transfer", "-", "encoding", "decoder", "stream", "is", "attached", "on", "the", "underlying", "stream", "and", "resets", "it", "if", "the", "requested", "arguments", "differ", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/PartStreamFilterManager.php#L238-L250
zbateson/mail-mime-parser
src/MailMimeParser.php
MailMimeParser.parse
public function parse($handleOrString) { $stream = Psr7\stream_for($handleOrString); $copy = Psr7\stream_for(fopen('php://temp', 'r+')); Psr7\copy_to_stream($stream, $copy); $copy->rewind(); // don't close it when $stream gets destroyed $stream->detach(); $parser = $this->di->newMessageParser(); return $parser->parse($copy); }
php
public function parse($handleOrString) { $stream = Psr7\stream_for($handleOrString); $copy = Psr7\stream_for(fopen('php://temp', 'r+')); Psr7\copy_to_stream($stream, $copy); $copy->rewind(); // don't close it when $stream gets destroyed $stream->detach(); $parser = $this->di->newMessageParser(); return $parser->parse($copy); }
[ "public", "function", "parse", "(", "$", "handleOrString", ")", "{", "$", "stream", "=", "Psr7", "\\", "stream_for", "(", "$", "handleOrString", ")", ";", "$", "copy", "=", "Psr7", "\\", "stream_for", "(", "fopen", "(", "'php://temp'", ",", "'r+'", ")", ...
Parses the passed stream handle into a ZBateson\MailMimeParser\Message object and returns it. Internally, the message is first copied to a temp stream (with php://temp which may keep it in memory or write it to disk) and its stream is used. That way if the message is too large to hold in memory it can be written to a temporary file if need be. @param resource|string $handleOrString the resource handle to the input stream of the mime message, or a string containing a mime message @return \ZBateson\MailMimeParser\Message
[ "Parses", "the", "passed", "stream", "handle", "into", "a", "ZBateson", "\\", "MailMimeParser", "\\", "Message", "object", "and", "returns", "it", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/MailMimeParser.php#L62-L74
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.parse
public function parse(StreamInterface $stream) { $partBuilder = $this->read($stream); return $partBuilder->createMessagePart($stream); }
php
public function parse(StreamInterface $stream) { $partBuilder = $this->read($stream); return $partBuilder->createMessagePart($stream); }
[ "public", "function", "parse", "(", "StreamInterface", "$", "stream", ")", "{", "$", "partBuilder", "=", "$", "this", "->", "read", "(", "$", "stream", ")", ";", "return", "$", "partBuilder", "->", "createMessagePart", "(", "$", "stream", ")", ";", "}" ]
Parses the passed stream into a ZBateson\MailMimeParser\Message object and returns it. @param StreamInterface $stream the stream to parse the message from @return \ZBateson\MailMimeParser\Message
[ "Parses", "the", "passed", "stream", "into", "a", "ZBateson", "\\", "MailMimeParser", "\\", "Message", "object", "and", "returns", "it", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L63-L67
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.addRawHeaderToPart
private function addRawHeaderToPart($header, PartBuilder $partBuilder) { if ($header !== '' && strpos($header, ':') !== false) { $a = explode(':', $header, 2); $partBuilder->addHeader($a[0], trim($a[1])); } }
php
private function addRawHeaderToPart($header, PartBuilder $partBuilder) { if ($header !== '' && strpos($header, ':') !== false) { $a = explode(':', $header, 2); $partBuilder->addHeader($a[0], trim($a[1])); } }
[ "private", "function", "addRawHeaderToPart", "(", "$", "header", ",", "PartBuilder", "$", "partBuilder", ")", "{", "if", "(", "$", "header", "!==", "''", "&&", "strpos", "(", "$", "header", ",", "':'", ")", "!==", "false", ")", "{", "$", "a", "=", "e...
Ensures the header isn't empty and contains a colon separator character, then splits it and calls $partBuilder->addHeader. @param string $header @param PartBuilder $partBuilder
[ "Ensures", "the", "header", "isn", "t", "empty", "and", "contains", "a", "colon", "separator", "character", "then", "splits", "it", "and", "calls", "$partBuilder", "-", ">", "addHeader", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L76-L82
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readLine
private function readLine($handle) { $size = 4096; $ret = $line = fgets($handle, $size); while (strlen($line) === $size - 1 && substr($line, -1) !== "\n") { $line = fgets($handle, $size); } return $ret; }
php
private function readLine($handle) { $size = 4096; $ret = $line = fgets($handle, $size); while (strlen($line) === $size - 1 && substr($line, -1) !== "\n") { $line = fgets($handle, $size); } return $ret; }
[ "private", "function", "readLine", "(", "$", "handle", ")", "{", "$", "size", "=", "4096", ";", "$", "ret", "=", "$", "line", "=", "fgets", "(", "$", "handle", ",", "$", "size", ")", ";", "while", "(", "strlen", "(", "$", "line", ")", "===", "$...
Reads a line of up to 4096 characters. If the line is larger than that, the remaining characters in the line are read and discarded, and only the first 4096 characters are returned. @param resource $handle @return string
[ "Reads", "a", "line", "of", "up", "to", "4096", "characters", ".", "If", "the", "line", "is", "larger", "than", "that", "the", "remaining", "characters", "in", "the", "line", "are", "read", "and", "discarded", "and", "only", "the", "first", "4096", "char...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L92-L100
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readBoundaryLine
private function readBoundaryLine($handle, &$lineSeparatorLength = 0) { $size = 2048; $isCut = false; $line = fgets($handle, $size); while (strlen($line) === $size - 1 && substr($line, -1) !== "\n") { $line = fgets($handle, $size); $isCut = true; } $ret = rtrim($line, "\r\n"); $lineSeparatorLength = strlen($line) - strlen($ret); return ($isCut) ? '' : $ret; }
php
private function readBoundaryLine($handle, &$lineSeparatorLength = 0) { $size = 2048; $isCut = false; $line = fgets($handle, $size); while (strlen($line) === $size - 1 && substr($line, -1) !== "\n") { $line = fgets($handle, $size); $isCut = true; } $ret = rtrim($line, "\r\n"); $lineSeparatorLength = strlen($line) - strlen($ret); return ($isCut) ? '' : $ret; }
[ "private", "function", "readBoundaryLine", "(", "$", "handle", ",", "&", "$", "lineSeparatorLength", "=", "0", ")", "{", "$", "size", "=", "2048", ";", "$", "isCut", "=", "false", ";", "$", "line", "=", "fgets", "(", "$", "handle", ",", "$", "size", ...
Reads a line of 2048 characters. If the line is larger than that, the remaining characters in the line are read and discarded, and only the first part is returned. This method is identical to readLine, except it calculates the number of characters that make up the line's new line characters (e.g. 2 for "\r\n" or 1 for "\n"). @param resource $handle @param int $lineSeparatorLength @return string
[ "Reads", "a", "line", "of", "2048", "characters", ".", "If", "the", "line", "is", "larger", "than", "that", "the", "remaining", "characters", "in", "the", "line", "are", "read", "and", "discarded", "and", "only", "the", "first", "part", "is", "returned", ...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L115-L127
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readHeaders
protected function readHeaders($handle, PartBuilder $partBuilder) { $header = ''; do { $line = $this->readLine($handle); if (empty($line) || $line[0] !== "\t" && $line[0] !== ' ') { $this->addRawHeaderToPart($header, $partBuilder); $header = ''; } else { $line = "\r\n" . $line; } $header .= rtrim($line, "\r\n"); } while ($header !== ''); }
php
protected function readHeaders($handle, PartBuilder $partBuilder) { $header = ''; do { $line = $this->readLine($handle); if (empty($line) || $line[0] !== "\t" && $line[0] !== ' ') { $this->addRawHeaderToPart($header, $partBuilder); $header = ''; } else { $line = "\r\n" . $line; } $header .= rtrim($line, "\r\n"); } while ($header !== ''); }
[ "protected", "function", "readHeaders", "(", "$", "handle", ",", "PartBuilder", "$", "partBuilder", ")", "{", "$", "header", "=", "''", ";", "do", "{", "$", "line", "=", "$", "this", "->", "readLine", "(", "$", "handle", ")", ";", "if", "(", "empty",...
Reads header lines up to an empty line, adding them to the passed $partBuilder. @param resource $handle the resource handle to read from @param PartBuilder $partBuilder the current part to add headers to
[ "Reads", "header", "lines", "up", "to", "an", "empty", "line", "adding", "them", "to", "the", "passed", "$partBuilder", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L136-L149
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.findContentBoundary
private function findContentBoundary($handle, PartBuilder $partBuilder) { // last separator before a boundary belongs to the boundary, and is not // part of the current part while (!feof($handle)) { $endPos = ftell($handle) - $this->lastLineSeparatorLength; $line = $this->readBoundaryLine($handle, $this->lastLineSeparatorLength); if ($line !== '' && $partBuilder->setEndBoundaryFound($line)) { $partBuilder->setStreamPartAndContentEndPos($endPos); return; } } $partBuilder->setStreamPartAndContentEndPos(ftell($handle)); $partBuilder->setEof(); }
php
private function findContentBoundary($handle, PartBuilder $partBuilder) { // last separator before a boundary belongs to the boundary, and is not // part of the current part while (!feof($handle)) { $endPos = ftell($handle) - $this->lastLineSeparatorLength; $line = $this->readBoundaryLine($handle, $this->lastLineSeparatorLength); if ($line !== '' && $partBuilder->setEndBoundaryFound($line)) { $partBuilder->setStreamPartAndContentEndPos($endPos); return; } } $partBuilder->setStreamPartAndContentEndPos(ftell($handle)); $partBuilder->setEof(); }
[ "private", "function", "findContentBoundary", "(", "$", "handle", ",", "PartBuilder", "$", "partBuilder", ")", "{", "// last separator before a boundary belongs to the boundary, and is not", "// part of the current part", "while", "(", "!", "feof", "(", "$", "handle", ")", ...
Reads lines from the passed $handle, calling $partBuilder->setEndBoundaryFound with the passed line until it returns true or the stream is at EOF. setEndBoundaryFound returns true if the passed line matches a boundary for the $partBuilder itself or any of its parents. Once a boundary is found, setStreamPartAndContentEndPos is called with the passed $handle's read pos before the boundary and its line separator were read. @param resource $handle @param PartBuilder $partBuilder
[ "Reads", "lines", "from", "the", "passed", "$handle", "calling", "$partBuilder", "-", ">", "setEndBoundaryFound", "with", "the", "passed", "line", "until", "it", "returns", "true", "or", "the", "stream", "is", "at", "EOF", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L166-L180
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readUUEncodedOrPlainTextMessage
protected function readUUEncodedOrPlainTextMessage($handle, PartBuilder $partBuilder) { $partBuilder->setStreamContentStartPos(ftell($handle)); $part = $partBuilder; while (!feof($handle)) { $start = ftell($handle); $line = trim($this->readLine($handle)); if (preg_match('/^begin ([0-7]{3}) (.*)$/', $line, $matches)) { $part = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getUUEncodedPartFactory() ); $part->setStreamPartStartPos($start); // 'begin' line is part of the content $part->setStreamContentStartPos($start); $part->setProperty('mode', $matches[1]); $part->setProperty('filename', $matches[2]); $partBuilder->addChild($part); } $part->setStreamPartAndContentEndPos(ftell($handle)); } $partBuilder->setStreamPartEndPos(ftell($handle)); }
php
protected function readUUEncodedOrPlainTextMessage($handle, PartBuilder $partBuilder) { $partBuilder->setStreamContentStartPos(ftell($handle)); $part = $partBuilder; while (!feof($handle)) { $start = ftell($handle); $line = trim($this->readLine($handle)); if (preg_match('/^begin ([0-7]{3}) (.*)$/', $line, $matches)) { $part = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getUUEncodedPartFactory() ); $part->setStreamPartStartPos($start); // 'begin' line is part of the content $part->setStreamContentStartPos($start); $part->setProperty('mode', $matches[1]); $part->setProperty('filename', $matches[2]); $partBuilder->addChild($part); } $part->setStreamPartAndContentEndPos(ftell($handle)); } $partBuilder->setStreamPartEndPos(ftell($handle)); }
[ "protected", "function", "readUUEncodedOrPlainTextMessage", "(", "$", "handle", ",", "PartBuilder", "$", "partBuilder", ")", "{", "$", "partBuilder", "->", "setStreamContentStartPos", "(", "ftell", "(", "$", "handle", ")", ")", ";", "$", "part", "=", "$", "par...
Reads content for a non-mime message. If there are uuencoded attachment parts in the message (denoted by 'begin' lines), those parts are read and added to the passed $partBuilder as children. @param resource $handle @param PartBuilder $partBuilder @return string
[ "Reads", "content", "for", "a", "non", "-", "mime", "message", ".", "If", "there", "are", "uuencoded", "attachment", "parts", "in", "the", "message", "(", "denoted", "by", "begin", "lines", ")", "those", "parts", "are", "read", "and", "added", "to", "the...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L191-L212
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readPartContent
private function readPartContent($handle, PartBuilder $partBuilder) { $partBuilder->setStreamContentStartPos(ftell($handle)); $this->findContentBoundary($handle, $partBuilder); if ($partBuilder->isMultiPart()) { while (!$partBuilder->isParentBoundaryFound()) { $child = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getMimePartFactory() ); $partBuilder->addChild($child); $this->readPart($handle, $child); } } }
php
private function readPartContent($handle, PartBuilder $partBuilder) { $partBuilder->setStreamContentStartPos(ftell($handle)); $this->findContentBoundary($handle, $partBuilder); if ($partBuilder->isMultiPart()) { while (!$partBuilder->isParentBoundaryFound()) { $child = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getMimePartFactory() ); $partBuilder->addChild($child); $this->readPart($handle, $child); } } }
[ "private", "function", "readPartContent", "(", "$", "handle", ",", "PartBuilder", "$", "partBuilder", ")", "{", "$", "partBuilder", "->", "setStreamContentStartPos", "(", "ftell", "(", "$", "handle", ")", ")", ";", "$", "this", "->", "findContentBoundary", "("...
Reads content for a single part of a MIME message. If the part being read is in turn a multipart part, readPart is called on it recursively to read its headers and content. The start/end positions of the part's content are set on the passed $partBuilder, which in turn sets the end position of the part and its parents. @param resource $handle @param PartBuilder $partBuilder
[ "Reads", "content", "for", "a", "single", "part", "of", "a", "MIME", "message", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L227-L240
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.readPart
protected function readPart($handle, PartBuilder $partBuilder) { $partBuilder->setStreamPartStartPos(ftell($handle)); if ($partBuilder->canHaveHeaders()) { $this->readHeaders($handle, $partBuilder); $this->lastLineSeparatorLength = 0; } if ($partBuilder->getParent() === null && !$partBuilder->isMime()) { $this->readUUEncodedOrPlainTextMessage($handle, $partBuilder); } else { $this->readPartContent($handle, $partBuilder); } }
php
protected function readPart($handle, PartBuilder $partBuilder) { $partBuilder->setStreamPartStartPos(ftell($handle)); if ($partBuilder->canHaveHeaders()) { $this->readHeaders($handle, $partBuilder); $this->lastLineSeparatorLength = 0; } if ($partBuilder->getParent() === null && !$partBuilder->isMime()) { $this->readUUEncodedOrPlainTextMessage($handle, $partBuilder); } else { $this->readPartContent($handle, $partBuilder); } }
[ "protected", "function", "readPart", "(", "$", "handle", ",", "PartBuilder", "$", "partBuilder", ")", "{", "$", "partBuilder", "->", "setStreamPartStartPos", "(", "ftell", "(", "$", "handle", ")", ")", ";", "if", "(", "$", "partBuilder", "->", "canHaveHeader...
Reads a part and any of its children, into the passed $partBuilder, either by calling readUUEncodedOrPlainTextMessage or readPartContent after reading headers. @param resource $handle @param PartBuilder $partBuilder
[ "Reads", "a", "part", "and", "any", "of", "its", "children", "into", "the", "passed", "$partBuilder", "either", "by", "calling", "readUUEncodedOrPlainTextMessage", "or", "readPartContent", "after", "reading", "headers", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L250-L263
zbateson/mail-mime-parser
src/Message/MessageParser.php
MessageParser.read
protected function read(StreamInterface $stream) { $partBuilder = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getMessageFactory() ); // the remaining parts use a resource handle for better performance... // it seems fgets does much better than Psr7\readline (not specifically // measured, but difference in running tests is big) $this->readPart(StreamWrapper::getResource($stream), $partBuilder); return $partBuilder; }
php
protected function read(StreamInterface $stream) { $partBuilder = $this->partBuilderFactory->newPartBuilder( $this->partFactoryService->getMessageFactory() ); // the remaining parts use a resource handle for better performance... // it seems fgets does much better than Psr7\readline (not specifically // measured, but difference in running tests is big) $this->readPart(StreamWrapper::getResource($stream), $partBuilder); return $partBuilder; }
[ "protected", "function", "read", "(", "StreamInterface", "$", "stream", ")", "{", "$", "partBuilder", "=", "$", "this", "->", "partBuilderFactory", "->", "newPartBuilder", "(", "$", "this", "->", "partFactoryService", "->", "getMessageFactory", "(", ")", ")", ...
Reads the message from the passed stream and returns a PartBuilder representing it. @param StreamInterface $stream @return PartBuilder
[ "Reads", "the", "message", "from", "the", "passed", "stream", "and", "returns", "a", "PartBuilder", "representing", "it", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageParser.php#L272-L282
zbateson/mail-mime-parser
src/Header/Consumer/GenericConsumer.php
GenericConsumer.addSpaceToRetParts
private function addSpaceToRetParts( array $parts, array &$retParts, $curIndex, HeaderPart &$spacePart, HeaderPart $lastPart ) { $nextPart = $parts[$curIndex]; if ($this->shouldAddSpace($nextPart, $lastPart)) { $retParts[] = $spacePart; $spacePart = null; } }
php
private function addSpaceToRetParts( array $parts, array &$retParts, $curIndex, HeaderPart &$spacePart, HeaderPart $lastPart ) { $nextPart = $parts[$curIndex]; if ($this->shouldAddSpace($nextPart, $lastPart)) { $retParts[] = $spacePart; $spacePart = null; } }
[ "private", "function", "addSpaceToRetParts", "(", "array", "$", "parts", ",", "array", "&", "$", "retParts", ",", "$", "curIndex", ",", "HeaderPart", "&", "$", "spacePart", ",", "HeaderPart", "$", "lastPart", ")", "{", "$", "nextPart", "=", "$", "parts", ...
Loops over the $parts array from the current position, checks if the space should be added, then adds it to $retParts and returns. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $retParts @param int $curIndex @param \ZBateson\MailMimeParser\Header\Part\HeaderPart $spacePart @param \ZBateson\MailMimeParser\Header\Part\HeaderPart $lastPart
[ "Loops", "over", "the", "$parts", "array", "from", "the", "current", "position", "checks", "if", "the", "space", "should", "be", "added", "then", "adds", "it", "to", "$retParts", "and", "returns", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/GenericConsumer.php#L101-L113
zbateson/mail-mime-parser
src/Header/Consumer/GenericConsumer.php
GenericConsumer.addSpaces
private function addSpaces(array $parts, array &$retParts, $curIndex, HeaderPart &$spacePart = null) { $lastPart = end($retParts); if ($spacePart !== null && $curIndex < count($parts) && $parts[$curIndex]->getValue() !== '' && $lastPart !== false) { $this->addSpaceToRetParts($parts, $retParts, $curIndex, $spacePart, $lastPart); } }
php
private function addSpaces(array $parts, array &$retParts, $curIndex, HeaderPart &$spacePart = null) { $lastPart = end($retParts); if ($spacePart !== null && $curIndex < count($parts) && $parts[$curIndex]->getValue() !== '' && $lastPart !== false) { $this->addSpaceToRetParts($parts, $retParts, $curIndex, $spacePart, $lastPart); } }
[ "private", "function", "addSpaces", "(", "array", "$", "parts", ",", "array", "&", "$", "retParts", ",", "$", "curIndex", ",", "HeaderPart", "&", "$", "spacePart", "=", "null", ")", "{", "$", "lastPart", "=", "end", "(", "$", "retParts", ")", ";", "i...
Checks if the passed space part should be added to the returned parts and adds it. Never adds a space if it's the first part, otherwise only add it if either part isn't set to ignore the space @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $retParts @param int $curIndex @param \ZBateson\MailMimeParser\Header\Part\HeaderPart $spacePart
[ "Checks", "if", "the", "passed", "space", "part", "should", "be", "added", "to", "the", "returned", "parts", "and", "adds", "it", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/GenericConsumer.php#L127-L133
zbateson/mail-mime-parser
src/Header/Consumer/GenericConsumer.php
GenericConsumer.filterIgnoredSpaces
protected function filterIgnoredSpaces(array $parts) { $partsFiltered = array_values(array_filter($parts)); $retParts = []; $spacePart = null; $count = count($partsFiltered); for ($i = 0; $i < $count; ++$i) { $part = $partsFiltered[$i]; if ($this->isSpaceToken($part)) { $spacePart = $part; continue; } $this->addSpaces($partsFiltered, $retParts, $i, $spacePart); $retParts[] = $part; } // ignore trailing spaces return $retParts; }
php
protected function filterIgnoredSpaces(array $parts) { $partsFiltered = array_values(array_filter($parts)); $retParts = []; $spacePart = null; $count = count($partsFiltered); for ($i = 0; $i < $count; ++$i) { $part = $partsFiltered[$i]; if ($this->isSpaceToken($part)) { $spacePart = $part; continue; } $this->addSpaces($partsFiltered, $retParts, $i, $spacePart); $retParts[] = $part; } // ignore trailing spaces return $retParts; }
[ "protected", "function", "filterIgnoredSpaces", "(", "array", "$", "parts", ")", "{", "$", "partsFiltered", "=", "array_values", "(", "array_filter", "(", "$", "parts", ")", ")", ";", "$", "retParts", "=", "[", "]", ";", "$", "spacePart", "=", "null", ";...
Filters out ignorable spaces between parts in the passed array. Spaces with parts on either side of it that specify they can be ignored are filtered out. filterIgnoredSpaces is called from within processParts, and if needed by an implementing class that overrides processParts, must be specifically called. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return \ZBateson\MailMimeParser\Header\Part\HeaderPart[]
[ "Filters", "out", "ignorable", "spaces", "between", "parts", "in", "the", "passed", "array", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/GenericConsumer.php#L157-L174
zbateson/mail-mime-parser
src/Header/Consumer/GenericConsumer.php
GenericConsumer.processParts
protected function processParts(array $parts) { $strValue = ''; $filtered = $this->filterIgnoredSpaces($parts); foreach ($filtered as $part) { $strValue .= $part->getValue(); } return [$this->partFactory->newLiteralPart($strValue)]; }
php
protected function processParts(array $parts) { $strValue = ''; $filtered = $this->filterIgnoredSpaces($parts); foreach ($filtered as $part) { $strValue .= $part->getValue(); } return [$this->partFactory->newLiteralPart($strValue)]; }
[ "protected", "function", "processParts", "(", "array", "$", "parts", ")", "{", "$", "strValue", "=", "''", ";", "$", "filtered", "=", "$", "this", "->", "filterIgnoredSpaces", "(", "$", "parts", ")", ";", "foreach", "(", "$", "filtered", "as", "$", "pa...
Overridden to combine all part values into a single string and return it as an array with a single element. @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts @return \ZBateson\MailMimeParser\Header\Part\LiteralPart[]|array
[ "Overridden", "to", "combine", "all", "part", "values", "into", "a", "single", "string", "and", "return", "it", "as", "an", "array", "with", "a", "single", "element", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Consumer/GenericConsumer.php#L183-L191
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.copyHeader
public function copyHeader(ParentHeaderPart $from, ParentHeaderPart $to, $header, $default = null) { $fromHeader = $from->getHeader($header); $set = ($fromHeader !== null) ? $fromHeader->getRawValue() : $default; if ($set !== null) { $to->setRawHeader($header, $set); } }
php
public function copyHeader(ParentHeaderPart $from, ParentHeaderPart $to, $header, $default = null) { $fromHeader = $from->getHeader($header); $set = ($fromHeader !== null) ? $fromHeader->getRawValue() : $default; if ($set !== null) { $to->setRawHeader($header, $set); } }
[ "public", "function", "copyHeader", "(", "ParentHeaderPart", "$", "from", ",", "ParentHeaderPart", "$", "to", ",", "$", "header", ",", "$", "default", "=", "null", ")", "{", "$", "fromHeader", "=", "$", "from", "->", "getHeader", "(", "$", "header", ")",...
Copies the passed $header from $from, to $to or sets the header to $default if it doesn't exist in $from. @param ParentHeaderPart $from @param ParentHeaderPart $to @param string $header @param string $default
[ "Copies", "the", "passed", "$header", "from", "$from", "to", "$to", "or", "sets", "the", "header", "to", "$default", "if", "it", "doesn", "t", "exist", "in", "$from", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L49-L56
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.removeContentHeadersAndContent
public function removeContentHeadersAndContent(ParentHeaderPart $part) { foreach (self::$contentHeaders as $header) { $part->removeHeader($header); } $part->detachContentStream(); }
php
public function removeContentHeadersAndContent(ParentHeaderPart $part) { foreach (self::$contentHeaders as $header) { $part->removeHeader($header); } $part->detachContentStream(); }
[ "public", "function", "removeContentHeadersAndContent", "(", "ParentHeaderPart", "$", "part", ")", "{", "foreach", "(", "self", "::", "$", "contentHeaders", "as", "$", "header", ")", "{", "$", "part", "->", "removeHeader", "(", "$", "header", ")", ";", "}", ...
Removes Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the passed part, then detaches its content stream. @param ParentHeaderPart $part
[ "Removes", "Content", "-", "*", "headers", "(", "permanent", "ones", "as", "defined", "in", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc4021#section", "-", "2", ".", "2", ")", "from", "the", "passed", "part", "then", "...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L65-L71
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.copyContentHeadersAndContent
public function copyContentHeadersAndContent(ParentHeaderPart $from, ParentHeaderPart $to, $move = false) { $this->copyHeader($from, $to, 'Content-Type', 'text/plain; charset=utf-8'); if ($from->getHeader('Content-Type') === null) { $this->copyHeader($from, $to, 'Content-Transfer-Encoding', 'quoted-printable'); } else { $this->copyHeader($from, $to, 'Content-Transfer-Encoding'); } $rem = array_diff(self::$contentHeaders, [ 'Content-Type', 'Content-Transfer-Encoding']); foreach ($rem as $header) { $this->copyHeader($from, $to, $header); } if ($from->hasContent()) { $to->attachContentStream($from->getContentStream(), MailMimeParser::DEFAULT_CHARSET); } if ($move) { $this->removeContentHeadersAndContent($from); } }
php
public function copyContentHeadersAndContent(ParentHeaderPart $from, ParentHeaderPart $to, $move = false) { $this->copyHeader($from, $to, 'Content-Type', 'text/plain; charset=utf-8'); if ($from->getHeader('Content-Type') === null) { $this->copyHeader($from, $to, 'Content-Transfer-Encoding', 'quoted-printable'); } else { $this->copyHeader($from, $to, 'Content-Transfer-Encoding'); } $rem = array_diff(self::$contentHeaders, [ 'Content-Type', 'Content-Transfer-Encoding']); foreach ($rem as $header) { $this->copyHeader($from, $to, $header); } if ($from->hasContent()) { $to->attachContentStream($from->getContentStream(), MailMimeParser::DEFAULT_CHARSET); } if ($move) { $this->removeContentHeadersAndContent($from); } }
[ "public", "function", "copyContentHeadersAndContent", "(", "ParentHeaderPart", "$", "from", ",", "ParentHeaderPart", "$", "to", ",", "$", "move", "=", "false", ")", "{", "$", "this", "->", "copyHeader", "(", "$", "from", ",", "$", "to", ",", "'Content-Type'"...
Copies Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the $from header into the $to header. If the Content-Type header isn't defined in $from, defaults to text/plain with utf-8 and quoted-printable. @param ParentHeaderPart $from @param ParentHeaderPart $to @param bool $move
[ "Copies", "Content", "-", "*", "headers", "(", "permanent", "ones", "as", "defined", "in", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc4021#section", "-", "2", ".", "2", ")", "from", "the", "$from", "header", "into", "...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L84-L102
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.createNewContentPartFrom
public function createNewContentPartFrom(ParentHeaderPart $part) { $mime = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $this->copyContentHeadersAndContent($part, $mime, true); return $mime; }
php
public function createNewContentPartFrom(ParentHeaderPart $part) { $mime = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $this->copyContentHeadersAndContent($part, $mime, true); return $mime; }
[ "public", "function", "createNewContentPartFrom", "(", "ParentHeaderPart", "$", "part", ")", "{", "$", "mime", "=", "$", "this", "->", "partBuilderFactory", "->", "newPartBuilder", "(", "$", "this", "->", "mimePartFactory", ")", "->", "createMessagePart", "(", "...
Creates a new content part from the passed part, allowing the part to be used for something else (e.g. changing a non-mime message to a multipart mime message). @param ParentHeaderPart $part @return MimePart the newly-created MimePart
[ "Creates", "a", "new", "content", "part", "from", "the", "passed", "part", "allowing", "the", "part", "to", "be", "used", "for", "something", "else", "(", "e", ".", "g", ".", "changing", "a", "non", "-", "mime", "message", "to", "a", "multipart", "mime...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L112-L117
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.movePartContentAndChildren
public function movePartContentAndChildren(ParentHeaderPart $from, ParentHeaderPart $to) { $this->copyContentHeadersAndContent($from, $to, true); foreach ($from->getChildParts() as $child) { $from->removePart($child); $to->addChild($child); } }
php
public function movePartContentAndChildren(ParentHeaderPart $from, ParentHeaderPart $to) { $this->copyContentHeadersAndContent($from, $to, true); foreach ($from->getChildParts() as $child) { $from->removePart($child); $to->addChild($child); } }
[ "public", "function", "movePartContentAndChildren", "(", "ParentHeaderPart", "$", "from", ",", "ParentHeaderPart", "$", "to", ")", "{", "$", "this", "->", "copyContentHeadersAndContent", "(", "$", "from", ",", "$", "to", ",", "true", ")", ";", "foreach", "(", ...
Copies type headers (Content-Type, Content-Disposition, Content-Transfer-Encoding) from the $from MimePart to $to. Attaches the content resource handle of $from to $to, and loops over child parts, removing them from $from and adding them to $to. @param ParentHeaderPart $from @param ParentHeaderPart $to
[ "Copies", "type", "headers", "(", "Content", "-", "Type", "Content", "-", "Disposition", "Content", "-", "Transfer", "-", "Encoding", ")", "from", "the", "$from", "MimePart", "to", "$to", ".", "Attaches", "the", "content", "resource", "handle", "of", "$from"...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L128-L135
zbateson/mail-mime-parser
src/Message/Helper/GenericHelper.php
GenericHelper.replacePart
public function replacePart(Message $message, ParentHeaderPart $part, ParentHeaderPart $replacement) { $position = $message->removePart($replacement); if ($part === $message) { $this->movePartContentAndChildren($replacement, $part); return; } $parent = $part->getParent(); $parent->addChild($replacement, $position); }
php
public function replacePart(Message $message, ParentHeaderPart $part, ParentHeaderPart $replacement) { $position = $message->removePart($replacement); if ($part === $message) { $this->movePartContentAndChildren($replacement, $part); return; } $parent = $part->getParent(); $parent->addChild($replacement, $position); }
[ "public", "function", "replacePart", "(", "Message", "$", "message", ",", "ParentHeaderPart", "$", "part", ",", "ParentHeaderPart", "$", "replacement", ")", "{", "$", "position", "=", "$", "message", "->", "removePart", "(", "$", "replacement", ")", ";", "if...
Replaces the $part ParentHeaderPart with $replacement. Essentially removes $part from its parent, and adds $replacement in its same position. If $part is this Message, then $part can't be removed and replaced, and instead $replacement's type headers are copied to $message, and any children below $replacement are added directly below $message. @param Message $message @param ParentHeaderPart $part @param ParentHeaderPart $replacement
[ "Replaces", "the", "$part", "ParentHeaderPart", "with", "$replacement", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/GenericHelper.php#L149-L158
zbateson/mail-mime-parser
src/Header/HeaderFactory.php
HeaderFactory.getClassFor
private function getClassFor($name) { $test = strtolower($name); foreach ($this->types as $class => $matchers) { foreach ($matchers as $matcher) { if ($test === $matcher) { return $class; } } } return $this->genericType; }
php
private function getClassFor($name) { $test = strtolower($name); foreach ($this->types as $class => $matchers) { foreach ($matchers as $matcher) { if ($test === $matcher) { return $class; } } } return $this->genericType; }
[ "private", "function", "getClassFor", "(", "$", "name", ")", "{", "$", "test", "=", "strtolower", "(", "$", "name", ")", ";", "foreach", "(", "$", "this", "->", "types", "as", "$", "class", "=>", "$", "matchers", ")", "{", "foreach", "(", "$", "mat...
Returns the name of an AbstractHeader class for the passed header name. @param string $name @return string
[ "Returns", "the", "name", "of", "an", "AbstractHeader", "class", "for", "the", "passed", "header", "name", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/HeaderFactory.php#L101-L112
zbateson/mail-mime-parser
src/Header/HeaderFactory.php
HeaderFactory.newInstance
public function newInstance($name, $value) { $class = $this->getClassFor($name); return new $class($this->consumerService, $name, $value); }
php
public function newInstance($name, $value) { $class = $this->getClassFor($name); return new $class($this->consumerService, $name, $value); }
[ "public", "function", "newInstance", "(", "$", "name", ",", "$", "value", ")", "{", "$", "class", "=", "$", "this", "->", "getClassFor", "(", "$", "name", ")", ";", "return", "new", "$", "class", "(", "$", "this", "->", "consumerService", ",", "$", ...
Creates an AbstractHeader instance for the passed header name and value, and returns it. @param string $name @param string $value @return \ZBateson\MailMimeParser\Header\AbstractHeader
[ "Creates", "an", "AbstractHeader", "instance", "for", "the", "passed", "header", "name", "and", "value", "and", "returns", "it", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/HeaderFactory.php#L122-L126
zbateson/mail-mime-parser
src/Message/Part/Factory/NonMimePartFactory.php
NonMimePartFactory.newInstance
public function newInstance(PartBuilder $partBuilder, StreamInterface $messageStream = null) { $partStream = null; $contentStream = null; if ($messageStream !== null) { $partStream = $this->streamFactory->getLimitedPartStream($messageStream, $partBuilder); $contentStream = $this->streamFactory->getLimitedContentStream($messageStream, $partBuilder); } return new NonMimePart( $this->partStreamFilterManagerFactory->newInstance(), $this->streamFactory, $partStream, $contentStream ); }
php
public function newInstance(PartBuilder $partBuilder, StreamInterface $messageStream = null) { $partStream = null; $contentStream = null; if ($messageStream !== null) { $partStream = $this->streamFactory->getLimitedPartStream($messageStream, $partBuilder); $contentStream = $this->streamFactory->getLimitedContentStream($messageStream, $partBuilder); } return new NonMimePart( $this->partStreamFilterManagerFactory->newInstance(), $this->streamFactory, $partStream, $contentStream ); }
[ "public", "function", "newInstance", "(", "PartBuilder", "$", "partBuilder", ",", "StreamInterface", "$", "messageStream", "=", "null", ")", "{", "$", "partStream", "=", "null", ";", "$", "contentStream", "=", "null", ";", "if", "(", "$", "messageStream", "!...
Constructs a new NonMimePart object and returns it @param PartBuilder $partBuilder @param StreamInterface $messageStream @return \ZBateson\MailMimeParser\Message\Part\NonMimePart
[ "Constructs", "a", "new", "NonMimePart", "object", "and", "returns", "it" ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/Factory/NonMimePartFactory.php#L27-L41
zbateson/mail-mime-parser
src/Header/ParameterHeader.php
ParameterHeader.setParseHeaderValue
protected function setParseHeaderValue(AbstractConsumer $consumer) { parent::setParseHeaderValue($consumer); foreach ($this->parts as $part) { if ($part instanceof ParameterPart) { $this->parameters[strtolower($part->getName())] = $part; } } }
php
protected function setParseHeaderValue(AbstractConsumer $consumer) { parent::setParseHeaderValue($consumer); foreach ($this->parts as $part) { if ($part instanceof ParameterPart) { $this->parameters[strtolower($part->getName())] = $part; } } }
[ "protected", "function", "setParseHeaderValue", "(", "AbstractConsumer", "$", "consumer", ")", "{", "parent", "::", "setParseHeaderValue", "(", "$", "consumer", ")", ";", "foreach", "(", "$", "this", "->", "parts", "as", "$", "part", ")", "{", "if", "(", "...
Overridden to assign ParameterParts to a map of lower-case parameter names to ParameterParts. @param AbstractConsumer $consumer
[ "Overridden", "to", "assign", "ParameterParts", "to", "a", "map", "of", "lower", "-", "case", "parameter", "names", "to", "ParameterParts", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/ParameterHeader.php#L44-L52
zbateson/mail-mime-parser
src/Header/ParameterHeader.php
ParameterHeader.getValueFor
public function getValueFor($name, $defaultValue = null) { if (!$this->hasParameter($name)) { return $defaultValue; } return $this->parameters[strtolower($name)]->getValue(); }
php
public function getValueFor($name, $defaultValue = null) { if (!$this->hasParameter($name)) { return $defaultValue; } return $this->parameters[strtolower($name)]->getValue(); }
[ "public", "function", "getValueFor", "(", "$", "name", ",", "$", "defaultValue", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "hasParameter", "(", "$", "name", ")", ")", "{", "return", "$", "defaultValue", ";", "}", "return", "$", "this"...
Returns the value of the parameter with the given name, or $defaultValue if not set. @param string $name @param string $defaultValue @return string
[ "Returns", "the", "value", "of", "the", "parameter", "with", "the", "given", "name", "or", "$defaultValue", "if", "not", "set", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/ParameterHeader.php#L73-L79
zbateson/mail-mime-parser
src/Header/DateHeader.php
DateHeader.getDateTime
public function getDateTime() { if (!empty($this->parts) && $this->parts[0] instanceof DatePart) { return $this->parts[0]->getDateTime(); } return null; }
php
public function getDateTime() { if (!empty($this->parts) && $this->parts[0] instanceof DatePart) { return $this->parts[0]->getDateTime(); } return null; }
[ "public", "function", "getDateTime", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "parts", ")", "&&", "$", "this", "->", "parts", "[", "0", "]", "instanceof", "DatePart", ")", "{", "return", "$", "this", "->", "parts", "[", "0", ...
Convenience method returning the part's DateTime object. @return \DateTime
[ "Convenience", "method", "returning", "the", "part", "s", "DateTime", "object", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/DateHeader.php#L35-L41
zbateson/mail-mime-parser
src/Message/Part/ParentHeaderPart.php
ParentHeaderPart.getHeaderValue
public function getHeaderValue($name, $defaultValue = null) { $header = $this->getHeader($name); if ($header !== null) { return $header->getValue(); } return $defaultValue; }
php
public function getHeaderValue($name, $defaultValue = null) { $header = $this->getHeader($name); if ($header !== null) { return $header->getValue(); } return $defaultValue; }
[ "public", "function", "getHeaderValue", "(", "$", "name", ",", "$", "defaultValue", "=", "null", ")", "{", "$", "header", "=", "$", "this", "->", "getHeader", "(", "$", "name", ")", ";", "if", "(", "$", "header", "!==", "null", ")", "{", "return", ...
Returns the string value for the header with the given $name. Note that mime headers aren't case sensitive. @param string $name @param string $defaultValue @return string
[ "Returns", "the", "string", "value", "for", "the", "header", "with", "the", "given", "$name", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentHeaderPart.php#L134-L141
zbateson/mail-mime-parser
src/Message/Part/ParentHeaderPart.php
ParentHeaderPart.getHeaderParameter
public function getHeaderParameter($header, $param, $defaultValue = null) { $obj = $this->getHeader($header); if ($obj && $obj instanceof ParameterHeader) { return $obj->getValueFor($param, $defaultValue); } return $defaultValue; }
php
public function getHeaderParameter($header, $param, $defaultValue = null) { $obj = $this->getHeader($header); if ($obj && $obj instanceof ParameterHeader) { return $obj->getValueFor($param, $defaultValue); } return $defaultValue; }
[ "public", "function", "getHeaderParameter", "(", "$", "header", ",", "$", "param", ",", "$", "defaultValue", "=", "null", ")", "{", "$", "obj", "=", "$", "this", "->", "getHeader", "(", "$", "header", ")", ";", "if", "(", "$", "obj", "&&", "$", "ob...
Returns a parameter of the header $header, given the parameter named $param. Only headers of type \ZBateson\MailMimeParser\Header\ParameterHeader have parameters. Content-Type and Content-Disposition are examples of headers with parameters. "Charset" is a common parameter of Content-Type. @param string $header @param string $param @param string $defaultValue @return string
[ "Returns", "a", "parameter", "of", "the", "header", "$header", "given", "the", "parameter", "named", "$param", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentHeaderPart.php#L157-L164
zbateson/mail-mime-parser
src/Message/Part/ParentHeaderPart.php
ParentHeaderPart.setRawHeader
public function setRawHeader($name, $value, $offset = 0) { $this->headerContainer->set($name, $value, $offset); $this->onChange(); }
php
public function setRawHeader($name, $value, $offset = 0) { $this->headerContainer->set($name, $value, $offset); $this->onChange(); }
[ "public", "function", "setRawHeader", "(", "$", "name", ",", "$", "value", ",", "$", "offset", "=", "0", ")", "{", "$", "this", "->", "headerContainer", "->", "set", "(", "$", "name", ",", "$", "value", ",", "$", "offset", ")", ";", "$", "this", ...
Adds a header with the given $name and $value. An optional $offset may be passed, which will overwrite a header if one exists with the given name and offset. Otherwise a new header is added. The passed $offset may be ignored in that case if it doesn't represent the next insert position for the header with the passed name... instead it would be 'pushed' on at the next position. ```php $part = $myParentHeaderPart; $part->setRawHeader('New-Header', 'value'); echo $part->getHeaderValue('New-Header'); // 'value' $part->setRawHeader('New-Header', 'second', 4); echo is_null($part->getHeader('New-Header', 4)); // '1' (true) echo $part->getHeader('New-Header', 1) ->getValue(); // 'second' ``` A new \ZBateson\MailMimeParser\Header\AbstractHeader object is created from the passed value. No processing on the passed string is performed, and so the passed name and value must be formatted correctly according to related RFCs. In particular, be careful to encode non-ascii data, to keep lines under 998 characters in length, and to follow any special formatting required for the type of header. @param string $name @param string $value @param int $offset
[ "Adds", "a", "header", "with", "the", "given", "$name", "and", "$value", ".", "An", "optional", "$offset", "may", "be", "passed", "which", "will", "overwrite", "a", "header", "if", "one", "exists", "with", "the", "given", "name", "and", "offset", ".", "O...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentHeaderPart.php#L196-L200
zbateson/mail-mime-parser
src/Message/Part/ParentHeaderPart.php
ParentHeaderPart.addRawHeader
public function addRawHeader($name, $value) { $this->headerContainer->add($name, $value); $this->onChange(); }
php
public function addRawHeader($name, $value) { $this->headerContainer->add($name, $value); $this->onChange(); }
[ "public", "function", "addRawHeader", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "headerContainer", "->", "add", "(", "$", "name", ",", "$", "value", ")", ";", "$", "this", "->", "onChange", "(", ")", ";", "}" ]
Adds a header with the given $name and $value. Note: If a header with the passed name already exists, a new header is created with the same name. This should only be used when that is intentional - in most cases setRawHeader should be called. Creates a new \ZBateson\MailMimeParser\Header\AbstractHeader object and registers it as a header. @param string $name @param string $value
[ "Adds", "a", "header", "with", "the", "given", "$name", "and", "$value", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentHeaderPart.php#L215-L219
zbateson/mail-mime-parser
src/Message/Part/ParentHeaderPart.php
ParentHeaderPart.removeSingleHeader
public function removeSingleHeader($name, $offset = 0) { $this->headerContainer->remove($name, $offset); $this->onChange(); }
php
public function removeSingleHeader($name, $offset = 0) { $this->headerContainer->remove($name, $offset); $this->onChange(); }
[ "public", "function", "removeSingleHeader", "(", "$", "name", ",", "$", "offset", "=", "0", ")", "{", "$", "this", "->", "headerContainer", "->", "remove", "(", "$", "name", ",", "$", "offset", ")", ";", "$", "this", "->", "onChange", "(", ")", ";", ...
Removes a single header with the passed name (in cases where more than one may exist, and others should be preserved). @param string $name
[ "Removes", "a", "single", "header", "with", "the", "passed", "name", "(", "in", "cases", "where", "more", "than", "one", "may", "exist", "and", "others", "should", "be", "preserved", ")", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/ParentHeaderPart.php#L238-L242
zbateson/mail-mime-parser
src/Header/AddressHeader.php
AddressHeader.setParseHeaderValue
protected function setParseHeaderValue(AbstractConsumer $consumer) { parent::setParseHeaderValue($consumer); foreach ($this->parts as $part) { if ($part instanceof AddressPart) { $this->addresses[] = $part; } elseif ($part instanceof AddressGroupPart) { $this->addresses = array_merge($this->addresses, $part->getAddresses()); $this->groups[] = $part; } } }
php
protected function setParseHeaderValue(AbstractConsumer $consumer) { parent::setParseHeaderValue($consumer); foreach ($this->parts as $part) { if ($part instanceof AddressPart) { $this->addresses[] = $part; } elseif ($part instanceof AddressGroupPart) { $this->addresses = array_merge($this->addresses, $part->getAddresses()); $this->groups[] = $part; } } }
[ "protected", "function", "setParseHeaderValue", "(", "AbstractConsumer", "$", "consumer", ")", "{", "parent", "::", "setParseHeaderValue", "(", "$", "consumer", ")", ";", "foreach", "(", "$", "this", "->", "parts", "as", "$", "part", ")", "{", "if", "(", "...
Overridden to extract all addresses into addresses array. @param AbstractConsumer $consumer
[ "Overridden", "to", "extract", "all", "addresses", "into", "addresses", "array", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/AddressHeader.php#L54-L65
zbateson/mail-mime-parser
src/Header/AddressHeader.php
AddressHeader.hasAddress
public function hasAddress($email) { foreach ($this->addresses as $addr) { if (strcasecmp($addr->getEmail(), $email) === 0) { return true; } } return false; }
php
public function hasAddress($email) { foreach ($this->addresses as $addr) { if (strcasecmp($addr->getEmail(), $email) === 0) { return true; } } return false; }
[ "public", "function", "hasAddress", "(", "$", "email", ")", "{", "foreach", "(", "$", "this", "->", "addresses", "as", "$", "addr", ")", "{", "if", "(", "strcasecmp", "(", "$", "addr", "->", "getEmail", "(", ")", ",", "$", "email", ")", "===", "0",...
Returns true if an address exists with the passed email address. Comparison is done case insensitively. @param string $email @return boolean
[ "Returns", "true", "if", "an", "address", "exists", "with", "the", "passed", "email", "address", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/AddressHeader.php#L96-L104
zbateson/mail-mime-parser
src/Stream/HeaderStream.php
HeaderStream.getPartHeadersIterator
private function getPartHeadersIterator() { if ($this->part instanceof ParentHeaderPart) { return $this->part->getRawHeaderIterator(); } elseif ($this->part->getParent() !== null && $this->part->getParent()->isMime()) { return new ArrayIterator([ [ 'Content-Type', $this->part->getContentType() ], [ 'Content-Disposition', $this->part->getContentDisposition() ], [ 'Content-Transfer-Encoding', $this->part->getContentTransferEncoding() ] ]); } return new ArrayIterator(); }
php
private function getPartHeadersIterator() { if ($this->part instanceof ParentHeaderPart) { return $this->part->getRawHeaderIterator(); } elseif ($this->part->getParent() !== null && $this->part->getParent()->isMime()) { return new ArrayIterator([ [ 'Content-Type', $this->part->getContentType() ], [ 'Content-Disposition', $this->part->getContentDisposition() ], [ 'Content-Transfer-Encoding', $this->part->getContentTransferEncoding() ] ]); } return new ArrayIterator(); }
[ "private", "function", "getPartHeadersIterator", "(", ")", "{", "if", "(", "$", "this", "->", "part", "instanceof", "ParentHeaderPart", ")", "{", "return", "$", "this", "->", "part", "->", "getRawHeaderIterator", "(", ")", ";", "}", "elseif", "(", "$", "th...
Returns a header array for the current part. If the part is not a MimePart, Content-Type, Content-Disposition and Content-Transfer-Encoding headers are generated manually. @return array
[ "Returns", "a", "header", "array", "for", "the", "current", "part", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Stream/HeaderStream.php#L53-L65
zbateson/mail-mime-parser
src/Stream/HeaderStream.php
HeaderStream.writePartHeadersTo
public function writePartHeadersTo(StreamInterface $stream) { foreach ($this->getPartHeadersIterator() as $header) { $stream->write("${header[0]}: ${header[1]}\r\n"); } $stream->write("\r\n"); }
php
public function writePartHeadersTo(StreamInterface $stream) { foreach ($this->getPartHeadersIterator() as $header) { $stream->write("${header[0]}: ${header[1]}\r\n"); } $stream->write("\r\n"); }
[ "public", "function", "writePartHeadersTo", "(", "StreamInterface", "$", "stream", ")", "{", "foreach", "(", "$", "this", "->", "getPartHeadersIterator", "(", ")", "as", "$", "header", ")", "{", "$", "stream", "->", "write", "(", "\"${header[0]}: ${header[1]}\\r...
Writes out headers for $this->part and follows them with an empty line. @param StreamInterface $stream
[ "Writes", "out", "headers", "for", "$this", "-", ">", "part", "and", "follows", "them", "with", "an", "empty", "line", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Stream/HeaderStream.php#L72-L78
zbateson/mail-mime-parser
src/Stream/HeaderStream.php
HeaderStream.createStream
protected function createStream() { $stream = Psr7\stream_for(); $this->writePartHeadersTo($stream); $stream->rewind(); return $stream; }
php
protected function createStream() { $stream = Psr7\stream_for(); $this->writePartHeadersTo($stream); $stream->rewind(); return $stream; }
[ "protected", "function", "createStream", "(", ")", "{", "$", "stream", "=", "Psr7", "\\", "stream_for", "(", ")", ";", "$", "this", "->", "writePartHeadersTo", "(", "$", "stream", ")", ";", "$", "stream", "->", "rewind", "(", ")", ";", "return", "$", ...
Creates the underlying stream lazily when required. @return StreamInterface
[ "Creates", "the", "underlying", "stream", "lazily", "when", "required", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Stream/HeaderStream.php#L85-L91
zbateson/mail-mime-parser
src/Header/Part/MimeLiteralPart.php
MimeLiteralPart.decodeMime
protected function decodeMime($value) { $pattern = self::MIME_PART_PATTERN; // remove whitespace between two adjacent mime encoded parts $value = preg_replace("/($pattern)\\s+(?=$pattern)/", '$1', $value); // with PREG_SPLIT_DELIM_CAPTURE, matched and unmatched parts are returned $aMimeParts = preg_split("/($pattern)/", $value, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $ret = ''; foreach ($aMimeParts as $entity) { $ret .= $this->decodeSplitPart($entity); } return $ret; }
php
protected function decodeMime($value) { $pattern = self::MIME_PART_PATTERN; // remove whitespace between two adjacent mime encoded parts $value = preg_replace("/($pattern)\\s+(?=$pattern)/", '$1', $value); // with PREG_SPLIT_DELIM_CAPTURE, matched and unmatched parts are returned $aMimeParts = preg_split("/($pattern)/", $value, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $ret = ''; foreach ($aMimeParts as $entity) { $ret .= $this->decodeSplitPart($entity); } return $ret; }
[ "protected", "function", "decodeMime", "(", "$", "value", ")", "{", "$", "pattern", "=", "self", "::", "MIME_PART_PATTERN", ";", "// remove whitespace between two adjacent mime encoded parts", "$", "value", "=", "preg_replace", "(", "\"/($pattern)\\\\s+(?=$pattern)/\"", "...
Finds and replaces mime parts with their values. The method splits the token value into an array on mime-part-patterns, either replacing a mime part with its value by calling iconv_mime_decode or converts the encoding on the text part by calling convertEncoding. @param string $value @return string
[ "Finds", "and", "replaces", "mime", "parts", "with", "their", "values", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Part/MimeLiteralPart.php#L78-L90
zbateson/mail-mime-parser
src/Header/Part/MimeLiteralPart.php
MimeLiteralPart.decodeMatchedEntity
private function decodeMatchedEntity($matches) { $body = $matches[4]; if (strtoupper($matches[3]) === 'Q') { $body = quoted_printable_decode(str_replace('_', '=20', $body)); } else { $body = base64_decode($body); } $language = $matches[2]; $decoded = $this->convertEncoding($body, $matches[1], true); $this->addToLanguage($decoded, $language); return $decoded; }
php
private function decodeMatchedEntity($matches) { $body = $matches[4]; if (strtoupper($matches[3]) === 'Q') { $body = quoted_printable_decode(str_replace('_', '=20', $body)); } else { $body = base64_decode($body); } $language = $matches[2]; $decoded = $this->convertEncoding($body, $matches[1], true); $this->addToLanguage($decoded, $language); return $decoded; }
[ "private", "function", "decodeMatchedEntity", "(", "$", "matches", ")", "{", "$", "body", "=", "$", "matches", "[", "4", "]", ";", "if", "(", "strtoupper", "(", "$", "matches", "[", "3", "]", ")", "===", "'Q'", ")", "{", "$", "body", "=", "quoted_p...
Decodes a matched mime entity part into a string and returns it, after adding the string into the languages array. @param string[] $matches @return string
[ "Decodes", "a", "matched", "mime", "entity", "part", "into", "a", "string", "and", "returns", "it", "after", "adding", "the", "string", "into", "the", "languages", "array", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Part/MimeLiteralPart.php#L99-L111
zbateson/mail-mime-parser
src/Header/Part/MimeLiteralPart.php
MimeLiteralPart.decodeSplitPart
private function decodeSplitPart($entity) { if (preg_match("/^=\?([A-Za-z\-_0-9]+)\*?([A-Za-z\-_0-9]+)?\?([QBqb])\?([^\?]+)\?=$/", $entity, $matches)) { return $this->decodeMatchedEntity($matches); } $decoded = $this->convertEncoding($entity); $this->addToLanguage($decoded); return $decoded; }
php
private function decodeSplitPart($entity) { if (preg_match("/^=\?([A-Za-z\-_0-9]+)\*?([A-Za-z\-_0-9]+)?\?([QBqb])\?([^\?]+)\?=$/", $entity, $matches)) { return $this->decodeMatchedEntity($matches); } $decoded = $this->convertEncoding($entity); $this->addToLanguage($decoded); return $decoded; }
[ "private", "function", "decodeSplitPart", "(", "$", "entity", ")", "{", "if", "(", "preg_match", "(", "\"/^=\\?([A-Za-z\\-_0-9]+)\\*?([A-Za-z\\-_0-9]+)?\\?([QBqb])\\?([^\\?]+)\\?=$/\"", ",", "$", "entity", ",", "$", "matches", ")", ")", "{", "return", "$", "this", "...
Decodes a single mime-encoded entity. Unfortunately, mb_decode_header fails for many charsets on PHP 5.4 and PHP 5.5 (even if they're listed as supported). iconv_mime_decode doesn't support all charsets. Parsing out the charset and body of the encoded entity seems to be the way to go to support the most charsets. @param string $entity @return string
[ "Decodes", "a", "single", "mime", "-", "encoded", "entity", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Header/Part/MimeLiteralPart.php#L126-L134
zbateson/mail-mime-parser
src/Message/Part/Factory/PartFactoryService.php
PartFactoryService.getMessageFactory
public function getMessageFactory() { return MessageFactory::getInstance( $this->streamFactory, $this->partStreamFilterManagerFactory, $this->partFilterFactory, $this->messageHelperService ); }
php
public function getMessageFactory() { return MessageFactory::getInstance( $this->streamFactory, $this->partStreamFilterManagerFactory, $this->partFilterFactory, $this->messageHelperService ); }
[ "public", "function", "getMessageFactory", "(", ")", "{", "return", "MessageFactory", "::", "getInstance", "(", "$", "this", "->", "streamFactory", ",", "$", "this", "->", "partStreamFilterManagerFactory", ",", "$", "this", "->", "partFilterFactory", ",", "$", "...
Returns the MessageFactory singleton instance. @return MessageFactory
[ "Returns", "the", "MessageFactory", "singleton", "instance", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Part/Factory/PartFactoryService.php#L66-L74
zbateson/mail-mime-parser
src/Message/MessageFactory.php
MessageFactory.newInstance
public function newInstance(PartBuilder $partBuilder, StreamInterface $stream = null) { $contentStream = null; if ($stream !== null) { $contentStream = $this->streamFactory->getLimitedContentStream($stream, $partBuilder); } return new Message( $this->partStreamFilterManagerFactory->newInstance(), $this->streamFactory, $this->partFilterFactory, $partBuilder, $this->messageHelperService, $stream, $contentStream ); }
php
public function newInstance(PartBuilder $partBuilder, StreamInterface $stream = null) { $contentStream = null; if ($stream !== null) { $contentStream = $this->streamFactory->getLimitedContentStream($stream, $partBuilder); } return new Message( $this->partStreamFilterManagerFactory->newInstance(), $this->streamFactory, $this->partFilterFactory, $partBuilder, $this->messageHelperService, $stream, $contentStream ); }
[ "public", "function", "newInstance", "(", "PartBuilder", "$", "partBuilder", ",", "StreamInterface", "$", "stream", "=", "null", ")", "{", "$", "contentStream", "=", "null", ";", "if", "(", "$", "stream", "!==", "null", ")", "{", "$", "contentStream", "=",...
Constructs a new Message object and returns it @param PartBuilder $partBuilder @param StreamInterface $stream @return \ZBateson\MailMimeParser\Message\Part\MimePart
[ "Constructs", "a", "new", "Message", "object", "and", "returns", "it" ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/MessageFactory.php#L55-L70
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.setMessageAsMultipartSigned
public function setMessageAsMultipartSigned(Message $message, $micalg, $protocol) { if (strcasecmp($message->getContentType(), 'multipart/signed') !== 0) { $this->multipartHelper->enforceMime($message); $messagePart = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $this->genericHelper->movePartContentAndChildren($message, $messagePart); $message->addChild($messagePart); $boundary = $this->multipartHelper->getUniqueBoundary('multipart/signed'); $message->setRawHeader( 'Content-Type', "multipart/signed;\r\n\tboundary=\"$boundary\";\r\n\tmicalg=\"$micalg\"; protocol=\"$protocol\"" ); } $this->overwrite8bitContentEncoding($message); $this->ensureHtmlPartFirstForSignedMessage($message); $this->setSignature($message, 'Empty'); }
php
public function setMessageAsMultipartSigned(Message $message, $micalg, $protocol) { if (strcasecmp($message->getContentType(), 'multipart/signed') !== 0) { $this->multipartHelper->enforceMime($message); $messagePart = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $this->genericHelper->movePartContentAndChildren($message, $messagePart); $message->addChild($messagePart); $boundary = $this->multipartHelper->getUniqueBoundary('multipart/signed'); $message->setRawHeader( 'Content-Type', "multipart/signed;\r\n\tboundary=\"$boundary\";\r\n\tmicalg=\"$micalg\"; protocol=\"$protocol\"" ); } $this->overwrite8bitContentEncoding($message); $this->ensureHtmlPartFirstForSignedMessage($message); $this->setSignature($message, 'Empty'); }
[ "public", "function", "setMessageAsMultipartSigned", "(", "Message", "$", "message", ",", "$", "micalg", ",", "$", "protocol", ")", "{", "if", "(", "strcasecmp", "(", "$", "message", "->", "getContentType", "(", ")", ",", "'multipart/signed'", ")", "!==", "0...
The passed message is set as multipart/signed, and a new part is created below it with content headers, content and children copied from the message. @param Message $message @param string $micalg @param string $protocol
[ "The", "passed", "message", "is", "set", "as", "multipart", "/", "signed", "and", "a", "new", "part", "is", "created", "below", "it", "with", "content", "headers", "content", "and", "children", "copied", "from", "the", "message", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L63-L79
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.setSignature
public function setSignature(Message $message, $body) { $signedPart = $message->getSignaturePart(); if ($signedPart === null) { $signedPart = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $message->addChild($signedPart); } $signedPart->setRawHeader( 'Content-Type', $message->getHeaderParameter('Content-Type', 'protocol') ); $signedPart->setContent($body); }
php
public function setSignature(Message $message, $body) { $signedPart = $message->getSignaturePart(); if ($signedPart === null) { $signedPart = $this->partBuilderFactory->newPartBuilder($this->mimePartFactory)->createMessagePart(); $message->addChild($signedPart); } $signedPart->setRawHeader( 'Content-Type', $message->getHeaderParameter('Content-Type', 'protocol') ); $signedPart->setContent($body); }
[ "public", "function", "setSignature", "(", "Message", "$", "message", ",", "$", "body", ")", "{", "$", "signedPart", "=", "$", "message", "->", "getSignaturePart", "(", ")", ";", "if", "(", "$", "signedPart", "===", "null", ")", "{", "$", "signedPart", ...
Sets the signature of the message to $body, creating a signature part if one doesn't exist. @param Message $message @param string $body
[ "Sets", "the", "signature", "of", "the", "message", "to", "$body", "creating", "a", "signature", "part", "if", "one", "doesn", "t", "exist", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L88-L100
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.overwrite8bitContentEncoding
public function overwrite8bitContentEncoding(Message $message) { $parts = $message->getAllParts(new PartFilter([ 'headers' => [ PartFilter::FILTER_INCLUDE => [ 'Content-Transfer-Encoding' => '8bit' ] ] ])); foreach ($parts as $part) { $contentType = strtolower($part->getContentType()); if ($contentType === 'text/plain' || $contentType === 'text/html') { $part->setRawHeader('Content-Transfer-Encoding', 'quoted-printable'); } else { $part->setRawHeader('Content-Transfer-Encoding', 'base64'); } } }
php
public function overwrite8bitContentEncoding(Message $message) { $parts = $message->getAllParts(new PartFilter([ 'headers' => [ PartFilter::FILTER_INCLUDE => [ 'Content-Transfer-Encoding' => '8bit' ] ] ])); foreach ($parts as $part) { $contentType = strtolower($part->getContentType()); if ($contentType === 'text/plain' || $contentType === 'text/html') { $part->setRawHeader('Content-Transfer-Encoding', 'quoted-printable'); } else { $part->setRawHeader('Content-Transfer-Encoding', 'base64'); } } }
[ "public", "function", "overwrite8bitContentEncoding", "(", "Message", "$", "message", ")", "{", "$", "parts", "=", "$", "message", "->", "getAllParts", "(", "new", "PartFilter", "(", "[", "'headers'", "=>", "[", "PartFilter", "::", "FILTER_INCLUDE", "=>", "[",...
Loops over parts of the message and sets the content-transfer-encoding header to quoted-printable for text/* mime parts, and to base64 otherwise for parts that are '8bit' encoded. Used for multipart/signed messages which doesn't support 8bit transfer encodings. @param Message $message
[ "Loops", "over", "parts", "of", "the", "message", "and", "sets", "the", "content", "-", "transfer", "-", "encoding", "header", "to", "quoted", "-", "printable", "for", "text", "/", "*", "mime", "parts", "and", "to", "base64", "otherwise", "for", "parts", ...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L112-L127
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.ensureHtmlPartFirstForSignedMessage
public function ensureHtmlPartFirstForSignedMessage(Message $message) { $alt = $message->getPartByMimeType('multipart/alternative'); if ($alt !== null && $alt instanceof ParentPart) { $cont = $this->multipartHelper->getContentPartContainerFromAlternative('text/html', $alt); $children = $alt->getChildParts(); $pos = array_search($cont, $children, true); if ($pos !== false && $pos !== 0) { $alt->removePart($children[0]); $alt->addChild($children[0]); } } }
php
public function ensureHtmlPartFirstForSignedMessage(Message $message) { $alt = $message->getPartByMimeType('multipart/alternative'); if ($alt !== null && $alt instanceof ParentPart) { $cont = $this->multipartHelper->getContentPartContainerFromAlternative('text/html', $alt); $children = $alt->getChildParts(); $pos = array_search($cont, $children, true); if ($pos !== false && $pos !== 0) { $alt->removePart($children[0]); $alt->addChild($children[0]); } } }
[ "public", "function", "ensureHtmlPartFirstForSignedMessage", "(", "Message", "$", "message", ")", "{", "$", "alt", "=", "$", "message", "->", "getPartByMimeType", "(", "'multipart/alternative'", ")", ";", "if", "(", "$", "alt", "!==", "null", "&&", "$", "alt",...
Ensures a non-text part comes first in a signed multipart/alternative message as some clients seem to prefer the first content part if the client doesn't understand multipart/signed. @param Message $message
[ "Ensures", "a", "non", "-", "text", "part", "comes", "first", "in", "a", "signed", "multipart", "/", "alternative", "message", "as", "some", "clients", "seem", "to", "prefer", "the", "first", "content", "part", "if", "the", "client", "doesn", "t", "underst...
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L136-L148
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.getSignedMessageStream
public function getSignedMessageStream(Message $message) { $child = $message->getChild(0); if ($child !== null) { return $child->getStream(); } return null; }
php
public function getSignedMessageStream(Message $message) { $child = $message->getChild(0); if ($child !== null) { return $child->getStream(); } return null; }
[ "public", "function", "getSignedMessageStream", "(", "Message", "$", "message", ")", "{", "$", "child", "=", "$", "message", "->", "getChild", "(", "0", ")", ";", "if", "(", "$", "child", "!==", "null", ")", "{", "return", "$", "child", "->", "getStrea...
Returns a stream that can be used to read the content part of a signed message, which can be used to sign an email or verify a signature. The method simply returns the stream for the first child. No verification of whether the message is in fact a signed message is performed. Note that unlike getSignedMessageAsString, getSignedMessageStream doesn't replace new lines. @param Message $message @return \Psr\Http\Message\StreamInterface or null if the message doesn't have any children
[ "Returns", "a", "stream", "that", "can", "be", "used", "to", "read", "the", "content", "part", "of", "a", "signed", "message", "which", "can", "be", "used", "to", "sign", "an", "email", "or", "verify", "a", "signature", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L165-L172
zbateson/mail-mime-parser
src/Message/Helper/PrivacyHelper.php
PrivacyHelper.getSignedMessageAsString
public function getSignedMessageAsString(Message $message) { $stream = $this->getSignedMessageStream($message); if ($stream !== null) { return preg_replace( '/\r\n|\r|\n/', "\r\n", $stream->getContents() ); } return null; }
php
public function getSignedMessageAsString(Message $message) { $stream = $this->getSignedMessageStream($message); if ($stream !== null) { return preg_replace( '/\r\n|\r|\n/', "\r\n", $stream->getContents() ); } return null; }
[ "public", "function", "getSignedMessageAsString", "(", "Message", "$", "message", ")", "{", "$", "stream", "=", "$", "this", "->", "getSignedMessageStream", "(", "$", "message", ")", ";", "if", "(", "$", "stream", "!==", "null", ")", "{", "return", "preg_r...
Returns a string containing the entire body (content) of a signed message for verification or calculating a signature. Non-CRLF new lines are replaced to always be CRLF. @param Message $message @return string or null if the message doesn't have any children
[ "Returns", "a", "string", "containing", "the", "entire", "body", "(", "content", ")", "of", "a", "signed", "message", "for", "verification", "or", "calculating", "a", "signature", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Message/Helper/PrivacyHelper.php#L183-L194
zbateson/mail-mime-parser
src/Container.php
Container.getMessageHelperService
public function getMessageHelperService() { if ($this->messageHelperService === null) { $this->messageHelperService = new MessageHelperService( $this->getPartBuilderFactory() ); $this->messageHelperService->setPartFactoryService( $this->getPartFactoryService() ); } return $this->messageHelperService; }
php
public function getMessageHelperService() { if ($this->messageHelperService === null) { $this->messageHelperService = new MessageHelperService( $this->getPartBuilderFactory() ); $this->messageHelperService->setPartFactoryService( $this->getPartFactoryService() ); } return $this->messageHelperService; }
[ "public", "function", "getMessageHelperService", "(", ")", "{", "if", "(", "$", "this", "->", "messageHelperService", "===", "null", ")", "{", "$", "this", "->", "messageHelperService", "=", "new", "MessageHelperService", "(", "$", "this", "->", "getPartBuilderF...
Returns a MessageHelperService instance. @return MessageHelperService
[ "Returns", "a", "MessageHelperService", "instance", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L126-L137
zbateson/mail-mime-parser
src/Container.php
Container.getPartFactoryService
public function getPartFactoryService() { if ($this->partFactoryService === null) { $this->partFactoryService = new PartFactoryService( $this->getPartFilterFactory(), $this->getStreamFactory(), $this->getPartStreamFilterManagerFactory(), $this->getMessageHelperService() ); } return $this->partFactoryService; }
php
public function getPartFactoryService() { if ($this->partFactoryService === null) { $this->partFactoryService = new PartFactoryService( $this->getPartFilterFactory(), $this->getStreamFactory(), $this->getPartStreamFilterManagerFactory(), $this->getMessageHelperService() ); } return $this->partFactoryService; }
[ "public", "function", "getPartFactoryService", "(", ")", "{", "if", "(", "$", "this", "->", "partFactoryService", "===", "null", ")", "{", "$", "this", "->", "partFactoryService", "=", "new", "PartFactoryService", "(", "$", "this", "->", "getPartFilterFactory", ...
Returns a PartFactoryService singleton. @return PartFactoryService
[ "Returns", "a", "PartFactoryService", "singleton", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L157-L168
zbateson/mail-mime-parser
src/Container.php
Container.getPartBuilderFactory
public function getPartBuilderFactory() { if ($this->partBuilderFactory === null) { $this->partBuilderFactory = new PartBuilderFactory( $this->getHeaderFactory() ); } return $this->partBuilderFactory; }
php
public function getPartBuilderFactory() { if ($this->partBuilderFactory === null) { $this->partBuilderFactory = new PartBuilderFactory( $this->getHeaderFactory() ); } return $this->partBuilderFactory; }
[ "public", "function", "getPartBuilderFactory", "(", ")", "{", "if", "(", "$", "this", "->", "partBuilderFactory", "===", "null", ")", "{", "$", "this", "->", "partBuilderFactory", "=", "new", "PartBuilderFactory", "(", "$", "this", "->", "getHeaderFactory", "(...
Returns a PartBuilderFactory instance. @return PartBuilderFactory
[ "Returns", "a", "PartBuilderFactory", "instance", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L175-L183
zbateson/mail-mime-parser
src/Container.php
Container.getHeaderFactory
public function getHeaderFactory() { if ($this->headerFactory === null) { $this->headerFactory = new HeaderFactory($this->getConsumerService()); } return $this->headerFactory; }
php
public function getHeaderFactory() { if ($this->headerFactory === null) { $this->headerFactory = new HeaderFactory($this->getConsumerService()); } return $this->headerFactory; }
[ "public", "function", "getHeaderFactory", "(", ")", "{", "if", "(", "$", "this", "->", "headerFactory", "===", "null", ")", "{", "$", "this", "->", "headerFactory", "=", "new", "HeaderFactory", "(", "$", "this", "->", "getConsumerService", "(", ")", ")", ...
Returns the header factory service instance. @return \ZBateson\MailMimeParser\Header\HeaderFactory
[ "Returns", "the", "header", "factory", "service", "instance", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L190-L196
zbateson/mail-mime-parser
src/Container.php
Container.getPartStreamFilterManagerFactory
public function getPartStreamFilterManagerFactory() { if ($this->partStreamFilterManagerFactory === null) { $this->partStreamFilterManagerFactory = new PartStreamFilterManagerFactory( $this->getStreamFactory() ); } return $this->getInstance( 'partStreamFilterManagerFactory', __NAMESPACE__ . '\Message\Part\PartStreamFilterManagerFactory' ); }
php
public function getPartStreamFilterManagerFactory() { if ($this->partStreamFilterManagerFactory === null) { $this->partStreamFilterManagerFactory = new PartStreamFilterManagerFactory( $this->getStreamFactory() ); } return $this->getInstance( 'partStreamFilterManagerFactory', __NAMESPACE__ . '\Message\Part\PartStreamFilterManagerFactory' ); }
[ "public", "function", "getPartStreamFilterManagerFactory", "(", ")", "{", "if", "(", "$", "this", "->", "partStreamFilterManagerFactory", "===", "null", ")", "{", "$", "this", "->", "partStreamFilterManagerFactory", "=", "new", "PartStreamFilterManagerFactory", "(", "...
Returns a PartStreamFilterManagerFactory. @return PartStreamFilterManagerFactory
[ "Returns", "a", "PartStreamFilterManagerFactory", "." ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L216-L227
zbateson/mail-mime-parser
src/Container.php
Container.getHeaderPartFactory
public function getHeaderPartFactory() { if ($this->headerPartFactory === null) { $this->headerPartFactory = new HeaderPartFactory($this->getCharsetConverter()); } return $this->headerPartFactory; }
php
public function getHeaderPartFactory() { if ($this->headerPartFactory === null) { $this->headerPartFactory = new HeaderPartFactory($this->getCharsetConverter()); } return $this->headerPartFactory; }
[ "public", "function", "getHeaderPartFactory", "(", ")", "{", "if", "(", "$", "this", "->", "headerPartFactory", "===", "null", ")", "{", "$", "this", "->", "headerPartFactory", "=", "new", "HeaderPartFactory", "(", "$", "this", "->", "getCharsetConverter", "("...
Returns the part factory service @return \ZBateson\MailMimeParser\Header\Part\HeaderPartFactory
[ "Returns", "the", "part", "factory", "service" ]
train
https://github.com/zbateson/mail-mime-parser/blob/63bedd7d71fb3abff2381174a14637c5a4ddaa36/src/Container.php#L244-L250