idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
48,900 | protected function getPartForToken ( $ token , $ isLiteral ) { if ( $ isLiteral ) { return $ this -> partFactory -> newLiteralPart ( $ token ) ; } return $ this -> partFactory -> newToken ( $ token ) ; } | Creates and returns a \ ZBateson \ MailMimeParser \ Header \ Part \ Token out of the passed string token and returns it unless the token is an escaped literal in which case a LiteralPart is returned . |
48,901 | private function addToSplitPart ( ArrayObject $ splitParts , $ name , $ value , $ index , $ isEncoded ) { $ ret = null ; if ( ! isset ( $ splitParts [ trim ( $ name ) ] ) ) { $ ret = $ this -> partFactory -> newSplitParameterToken ( $ name ) ; $ splitParts [ $ name ] = $ ret ; } $ splitParts [ $ name ] -> addPart ( $ v... | Adds the passed parameter with the given name and value to a SplitParameterToken at the passed index . If one with the given name doesn t exist it is created . |
48,902 | private function processTokenPart ( $ tokenValue , ArrayObject $ combined , ArrayObject $ splitParts , & $ strName , & $ strCat ) { if ( $ tokenValue === ';' ) { $ combined [ ] = $ this -> getPartFor ( $ strName , $ strCat , $ splitParts ) ; $ strName = '' ; $ strCat = '' ; return true ; } elseif ( $ tokenValue === '='... | Handles parameter separator tokens during final processing . |
48,903 | private function finalizeParameterParts ( ArrayObject $ combined ) { foreach ( $ combined as $ key => $ part ) { if ( $ part instanceof SplitParameterToken ) { $ combined [ $ key ] = $ this -> partFactory -> newParameterPart ( $ part -> getName ( ) , $ part -> getValue ( ) , $ part -> getLanguage ( ) ) ; } } return $ t... | Loops over parts in the passed array creating ParameterParts out of any parsed SplitParameterTokens replacing them in the array . |
48,904 | protected function processParts ( array $ parts ) { $ combined = new ArrayObject ( ) ; $ splitParts = new ArrayObject ( ) ; $ strCat = '' ; $ strName = '' ; $ parts [ ] = $ this -> partFactory -> newToken ( ';' ) ; foreach ( $ parts as $ part ) { $ pValue = $ part -> getValue ( ) ; if ( $ part instanceof Token && $ thi... | Post processing involves creating Part \ LiteralPart or Part \ ParameterPart objects out of created Token and LiteralParts . |
48,905 | public function addChild ( PartBuilder $ partBuilder ) { $ partBuilder -> parent = $ this ; if ( ! $ this -> endBoundaryFound ) { $ this -> children [ ] = $ partBuilder ; } } | Registers the passed PartBuilder as a child of the current PartBuilder . |
48,906 | public function getMimeBoundary ( ) { if ( $ this -> mimeBoundary === false ) { $ this -> mimeBoundary = null ; $ contentType = $ this -> getContentType ( ) ; if ( $ contentType !== null ) { $ this -> mimeBoundary = $ contentType -> getValueFor ( 'boundary' ) ; } } return $ this -> mimeBoundary ; } | Returns the parsed boundary parameter of the Content - Type header if set for a multipart message part . |
48,907 | public function getStreamPartStartOffset ( ) { if ( $ this -> parent ) { return $ this -> streamPartStartPos - $ this -> parent -> streamPartStartPos ; } return $ this -> streamPartStartPos ; } | Returns the offset for this part s stream within its parent stream . |
48,908 | public function getStreamContentStartOffset ( ) { if ( $ this -> parent ) { return $ this -> streamContentStartPos - $ this -> parent -> streamPartStartPos ; } return $ this -> streamContentStartPos ; } | Returns the offset for this part s content within its part stream . |
48,909 | public function setStreamPartEndPos ( $ streamPartEndPos ) { $ this -> streamPartEndPos = $ streamPartEndPos ; if ( $ this -> parent !== null ) { $ this -> parent -> setStreamPartEndPos ( $ streamPartEndPos ) ; } } | Sets the end position of the part in the input stream and also calls parent - > setParentStreamPartEndPos to expand to parent parts . |
48,910 | protected function getAllConsumers ( ) { $ found = [ $ this ] ; do { $ current = current ( $ found ) ; $ subConsumers = $ current -> getSubConsumers ( ) ; foreach ( $ subConsumers as $ consumer ) { if ( ! in_array ( $ consumer , $ found ) ) { $ found [ ] = $ consumer ; } } } while ( next ( $ found ) !== false ) ; retur... | Returns this consumer and all unique sub consumers . |
48,911 | protected function getAllTokenSeparators ( ) { $ markers = $ this -> getTokenSeparators ( ) ; $ subConsumers = $ this -> getAllConsumers ( ) ; foreach ( $ subConsumers as $ consumer ) { $ markers = array_merge ( $ consumer -> getTokenSeparators ( ) , $ markers ) ; } return array_unique ( $ markers ) ; } | Returns a list of regular expression markers for this consumer and all sub - consumers by calling getTokenSeparators .. |
48,912 | protected function getTokenSplitPattern ( ) { $ sChars = implode ( '|' , $ this -> getAllTokenSeparators ( ) ) ; $ mimePartPattern = MimeLiteralPart :: MIME_PART_PATTERN ; return '~(' . $ mimePartPattern . '|\\\\.|' . $ sChars . ')~' ; } | Returns a regex pattern used to split the input header string . The default implementation calls getAllTokenSeparators and implodes the returned array with the regex OR | character as its glue . |
48,913 | protected function getPartForToken ( $ token , $ isLiteral ) { if ( $ isLiteral ) { return $ this -> partFactory -> newLiteralPart ( $ token ) ; } elseif ( preg_match ( '/^\s+$/' , $ token ) ) { return $ this -> partFactory -> newToken ( ' ' ) ; } return $ this -> partFactory -> newInstance ( $ token ) ; } | Constructs and returns a \ ZBateson \ MailMimeParser \ Header \ Part \ HeaderPart for the passed string token . If the token should be ignored the function must return null . |
48,914 | protected function getConsumerTokenParts ( Iterator $ tokens ) { $ token = $ tokens -> current ( ) ; $ subConsumers = $ this -> getSubConsumers ( ) ; foreach ( $ subConsumers as $ consumer ) { if ( $ consumer -> isStartToken ( $ token ) ) { $ this -> advanceToNextToken ( $ tokens , true ) ; return $ consumer -> parseTo... | Iterates through this consumer s sub - consumers checking if the current token triggers a sub - consumer s start token and passes control onto that sub - consumer s parseTokenIntoParts . If no sub - consumer is responsible for the current token calls getPartForToken and returns it in an array . |
48,915 | protected function getTokenParts ( Iterator $ tokens ) { $ token = $ tokens -> current ( ) ; if ( strlen ( $ token ) === 2 && $ token [ 0 ] === '\\' ) { return [ $ this -> getPartForToken ( substr ( $ token , 1 ) , true ) ] ; } return $ this -> getConsumerTokenParts ( $ tokens ) ; } | Returns an array of \ ZBateson \ MailMimeParser \ Header \ Part \ HeaderPart for the current token on the iterator . |
48,916 | protected function advanceToNextToken ( Iterator $ tokens , $ isStartToken ) { if ( ( $ isStartToken ) || ( $ tokens -> valid ( ) && ! $ this -> isEndToken ( $ tokens -> current ( ) ) ) ) { $ tokens -> next ( ) ; } } | Determines if the iterator should be advanced to the next token after reading tokens or finding a start token . |
48,917 | protected function parseTokensIntoParts ( Iterator $ tokens ) { $ parts = [ ] ; while ( $ tokens -> valid ( ) && ! $ this -> isEndToken ( $ tokens -> current ( ) ) ) { $ parts = array_merge ( $ parts , $ this -> getTokenParts ( $ tokens ) ) ; $ this -> advanceToNextToken ( $ tokens , false ) ; } return $ this -> proces... | Iterates over the passed token Iterator and returns an array of parsed \ ZBateson \ MailMimeParser \ Header \ Part \ HeaderPart objects . |
48,918 | private function newLimitStream ( StreamInterface $ stream , $ length , $ start ) { return new SeekingLimitStream ( $ this -> newNonClosingStream ( $ stream ) , $ length , $ start ) ; } | Creates and returns a SeekingLimitedStream . |
48,919 | protected static function setCachedInstance ( MessagePartFactory $ instance ) { if ( self :: $ instances === null ) { self :: $ instances = [ ] ; } $ class = get_called_class ( ) ; self :: $ instances [ $ class ] = $ instance ; } | Sets a cached singleton instance . |
48,920 | protected static function getCachedInstance ( ) { $ class = get_called_class ( ) ; if ( self :: $ instances === null || ! isset ( self :: $ instances [ $ class ] ) ) { return null ; } return self :: $ instances [ $ class ] ; } | Returns a cached singleton instance if one exists or null if one hasn t been created yet . |
48,921 | public function newParameterPart ( $ name , $ value , $ language = null ) { return new ParameterPart ( $ this -> charsetConverter , $ name , $ value , $ language ) ; } | Initializes and returns a new ParameterPart . |
48,922 | public function newReceivedDomainPart ( $ name , $ value , $ ehloName = null , $ hostName = null , $ hostAddress = null ) { return new ReceivedDomainPart ( $ this -> charsetConverter , $ name , $ value , $ ehloName , $ hostName , $ hostAddress ) ; } | Initializes and returns a new ReceivedDomainPart . |
48,923 | 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 , $ ... | Performs final processing on parsed parts . |
48,924 | 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 ) ;... | Performs post - processing on parsed parts . |
48,925 | 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' ) { $ consum... | Returns the consumer instance corresponding to the passed part name of a Received header . |
48,926 | protected function processParts ( array $ parts ) { $ strValue = '' ; foreach ( $ parts as $ part ) { $ strValue .= $ part -> getValue ( ) ; } return [ $ this -> partFactory -> newDatePart ( $ strValue ) ] ; } | Concatenates the passed parts and constructs a single Part \ DatePart returning it in an array with a single element . |
48,927 | public function getPart ( $ index , PartFilter $ filter = null ) { $ parts = $ this -> getAllParts ( $ filter ) ; if ( ! isset ( $ parts [ $ index ] ) ) { return null ; } return $ parts [ $ index ] ; } | Returns the part at the given 0 - based index or null if none is set . |
48,928 | public function getAllParts ( PartFilter $ filter = null ) { $ parts = $ this -> getAllNonFilteredParts ( ) ; if ( ! empty ( $ filter ) ) { return array_values ( array_filter ( $ parts , [ $ filter , 'filter' ] ) ) ; } return $ parts ; } | Returns the current part all child parts and child parts of all children optionally filtering them with the provided PartFilter . |
48,929 | public function getChild ( $ index , PartFilter $ filter = null ) { $ parts = $ this -> getChildParts ( $ filter ) ; if ( ! isset ( $ parts [ $ index ] ) ) { return null ; } return $ parts [ $ index ] ; } | Returns the direct child at the given 0 - based index or null if none is set . |
48,930 | public function getChildParts ( PartFilter $ filter = null ) { if ( $ filter !== null ) { return array_values ( array_filter ( $ this -> children , [ $ filter , 'filter' ] ) ) ; } return $ this -> children ; } | Returns all direct child parts . |
48,931 | public function getPartByMimeType ( $ mimeType , $ index = 0 ) { $ partFilter = $ this -> partFilterFactory -> newFilterFromContentType ( $ mimeType ) ; return $ this -> getPart ( $ index , $ partFilter ) ; } | Returns the part associated with the passed mime type at the passed index if it exists . |
48,932 | public function getAllPartsByMimeType ( $ mimeType ) { $ partFilter = $ this -> partFilterFactory -> newFilterFromContentType ( $ mimeType ) ; return $ this -> getAllParts ( $ partFilter ) ; } | Returns an array of all parts associated with the passed mime type if any exist or null otherwise . |
48,933 | 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 ( ) ; } } | Registers the passed part as a child of the current part . |
48,934 | 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_s... | Removes the child part from this part and returns its position or null if it wasn t found . |
48,935 | public function removeAllParts ( PartFilter $ filter = null ) { foreach ( $ this -> getAllParts ( $ filter ) as $ part ) { if ( $ part === $ this ) { continue ; } $ this -> removePart ( $ part ) ; } } | Removes all parts that are matched by the passed PartFilter . |
48,936 | public function getAttachmentPart ( $ index ) { $ attachments = $ this -> getAllAttachmentParts ( ) ; if ( ! isset ( $ attachments [ $ index ] ) ) { return null ; } return $ attachments [ $ index ] ; } | Returns the attachment part at the given 0 - based index or null if none is set . |
48,937 | 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 -> getContentDisposit... | Returns all attachment parts . |
48,938 | public function isMime ( ) { $ contentType = $ this -> getHeaderValue ( 'Content-Type' ) ; $ mimeVersion = $ this -> getHeaderValue ( 'Mime-Version' ) ; return ( $ contentType !== null || $ mimeVersion !== null ) ; } | Returns true if either a Content - Type or Mime - Version header are defined in this Message . |
48,939 | public function addAttachmentPart ( $ resource , $ mimeType , $ filename = null , $ disposition = 'attachment' ) { $ this -> messageHelperService -> getMultipartHelper ( ) -> createAndAddPartForAttachment ( $ this , $ resource , $ mimeType , $ disposition , $ filename ) ; } | Adds an attachment part for the passed raw data string or handle and given parameters . |
48,940 | 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 ... | Adds an attachment part using the passed file . |
48,941 | 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 . |
48,942 | 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... | Attaches a charset conversion filter to the attached content handle for the passed arguments . |
48,943 | private function resetCharsetStream ( ) { $ this -> charset = [ 'from' => null , 'to' => null , 'filter' => null ] ; $ this -> decodedStream -> rewind ( ) ; $ this -> charsetStream = $ this -> decodedStream ; } | Resets just the charset stream and rewinds the decodedStream . |
48,944 | 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 ; } | Resets cached encoding and charset streams and rewinds the stream . |
48,945 | 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 -> isTransferEn... | 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 . |
48,946 | public function getBinaryStream ( $ transferEncoding ) { if ( $ this -> stream === null ) { return null ; } if ( $ this -> decodedStream === null || $ this -> isTransferEncodingFilterChanged ( $ transferEncoding ) ) { $ this -> reset ( ) ; $ this -> attachTransferEncodingFilter ( $ transferEncoding ) ; } $ this -> deco... | Checks what transfer - encoding decoder stream is attached on the underlying stream and resets it if the requested arguments differ . |
48,947 | 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 ( ) ; $ stream -> detach ( ) ; $ parser = $ this -> di -> newMessageParser ( ) ; return $ parser ... | Parses the passed stream handle into a ZBateson \ MailMimeParser \ Message object and returns it . |
48,948 | 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 . |
48,949 | 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 ; } | 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 . |
48,950 | 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\... | 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 . |
48,951 | private function readPartContent ( $ handle , PartBuilder $ partBuilder ) { $ partBuilder -> setStreamContentStartPos ( ftell ( $ handle ) ) ; $ this -> findContentBoundary ( $ handle , $ partBuilder ) ; if ( $ partBuilder -> isMultiPart ( ) ) { while ( ! $ partBuilder -> isParentBoundaryFound ( ) ) { $ child = $ this ... | Reads content for a single part of a MIME message . |
48,952 | protected function read ( StreamInterface $ stream ) { $ partBuilder = $ this -> partBuilderFactory -> newPartBuilder ( $ this -> partFactoryService -> getMessageFactory ( ) ) ; $ this -> readPart ( StreamWrapper :: getResource ( $ stream ) , $ partBuilder ) ; return $ partBuilder ; } | Reads the message from the passed stream and returns a PartBuilder representing it . |
48,953 | 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 ( $ p... | Checks if the passed space part should be added to the returned parts and adds it . |
48,954 | 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 ) ) { ... | Filters out ignorable spaces between parts in the passed array . |
48,955 | 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 ; } | Returns the name of an AbstractHeader class for the passed header name . |
48,956 | public function newInstance ( $ name , $ value ) { $ class = $ this -> getClassFor ( $ name ) ; return new $ class ( $ this -> consumerService , $ name , $ value ) ; } | Creates an AbstractHeader instance for the passed header name and value and returns it . |
48,957 | public function newInstance ( PartBuilder $ partBuilder , StreamInterface $ messageStream = null ) { $ partStream = null ; $ contentStream = null ; if ( $ messageStream !== null ) { $ partStream = $ this -> streamFactory -> getLimitedPartStream ( $ messageStream , $ partBuilder ) ; $ contentStream = $ this -> streamFac... | Constructs a new NonMimePart object and returns it |
48,958 | protected function setParseHeaderValue ( AbstractConsumer $ consumer ) { parent :: setParseHeaderValue ( $ consumer ) ; foreach ( $ this -> parts as $ part ) { if ( $ part instanceof ParameterPart ) { $ this -> parameters [ strtolower ( $ part -> getName ( ) ) ] = $ part ; } } } | Overridden to assign ParameterParts to a map of lower - case parameter names to ParameterParts . |
48,959 | public function getDateTime ( ) { if ( ! empty ( $ this -> parts ) && $ this -> parts [ 0 ] instanceof DatePart ) { return $ this -> parts [ 0 ] -> getDateTime ( ) ; } return null ; } | Convenience method returning the part s DateTime object . |
48,960 | 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 ( ... | Overridden to extract all addresses into addresses array . |
48,961 | public function hasAddress ( $ email ) { foreach ( $ this -> addresses as $ addr ) { if ( strcasecmp ( $ addr -> getEmail ( ) , $ email ) === 0 ) { return true ; } } return false ; } | Returns true if an address exists with the passed email address . |
48,962 | 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 ->... | Returns a header array for the current part . |
48,963 | protected function createStream ( ) { $ stream = Psr7 \ stream_for ( ) ; $ this -> writePartHeadersTo ( $ stream ) ; $ stream -> rewind ( ) ; return $ stream ; } | Creates the underlying stream lazily when required . |
48,964 | protected function decodeMime ( $ value ) { $ pattern = self :: MIME_PART_PATTERN ; $ value = preg_replace ( "/($pattern)\\s+(?=$pattern)/" , '$1' , $ value ) ; $ aMimeParts = preg_split ( "/($pattern)/" , $ value , - 1 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ) ; $ ret = '' ; foreach ( $ aMimeParts as $ entity... | Finds and replaces mime parts with their values . |
48,965 | 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 ... | Decodes a matched mime entity part into a string and returns it after adding the string into the languages array . |
48,966 | 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... | Decodes a single mime - encoded entity . |
48,967 | public function getMessageFactory ( ) { return MessageFactory :: getInstance ( $ this -> streamFactory , $ this -> partStreamFilterManagerFactory , $ this -> partFilterFactory , $ this -> messageHelperService ) ; } | Returns the MessageFactory singleton instance . |
48,968 | public function newInstance ( PartBuilder $ partBuilder , StreamInterface $ stream = null ) { $ contentStream = null ; if ( $ stream !== null ) { $ contentStream = $ this -> streamFactory -> getLimitedContentStream ( $ stream , $ partBuilder ) ; } return new Message ( $ this -> partStreamFilterManagerFactory -> newInst... | Constructs a new Message object and returns it |
48,969 | public function getSignedMessageStream ( Message $ message ) { $ child = $ message -> getChild ( 0 ) ; if ( $ child !== null ) { return $ child -> getStream ( ) ; } return null ; } | 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 . |
48,970 | public function getMessageHelperService ( ) { if ( $ this -> messageHelperService === null ) { $ this -> messageHelperService = new MessageHelperService ( $ this -> getPartBuilderFactory ( ) ) ; $ this -> messageHelperService -> setPartFactoryService ( $ this -> getPartFactoryService ( ) ) ; } return $ this -> messageH... | Returns a MessageHelperService instance . |
48,971 | public function getPartFactoryService ( ) { if ( $ this -> partFactoryService === null ) { $ this -> partFactoryService = new PartFactoryService ( $ this -> getPartFilterFactory ( ) , $ this -> getStreamFactory ( ) , $ this -> getPartStreamFilterManagerFactory ( ) , $ this -> getMessageHelperService ( ) ) ; } return $ ... | Returns a PartFactoryService singleton . |
48,972 | public function getPartBuilderFactory ( ) { if ( $ this -> partBuilderFactory === null ) { $ this -> partBuilderFactory = new PartBuilderFactory ( $ this -> getHeaderFactory ( ) ) ; } return $ this -> partBuilderFactory ; } | Returns a PartBuilderFactory instance . |
48,973 | public function getHeaderFactory ( ) { if ( $ this -> headerFactory === null ) { $ this -> headerFactory = new HeaderFactory ( $ this -> getConsumerService ( ) ) ; } return $ this -> headerFactory ; } | Returns the header factory service instance . |
48,974 | public function getPartStreamFilterManagerFactory ( ) { if ( $ this -> partStreamFilterManagerFactory === null ) { $ this -> partStreamFilterManagerFactory = new PartStreamFilterManagerFactory ( $ this -> getStreamFactory ( ) ) ; } return $ this -> getInstance ( 'partStreamFilterManagerFactory' , __NAMESPACE__ . '\Mess... | Returns a PartStreamFilterManagerFactory . |
48,975 | public function getHeaderPartFactory ( ) { if ( $ this -> headerPartFactory === null ) { $ this -> headerPartFactory = new HeaderPartFactory ( $ this -> getCharsetConverter ( ) ) ; } return $ this -> headerPartFactory ; } | Returns the part factory service |
48,976 | public function getMimeLiteralPartFactory ( ) { if ( $ this -> mimeLiteralPartFactory === null ) { $ this -> mimeLiteralPartFactory = new MimeLiteralPartFactory ( $ this -> getCharsetConverter ( ) ) ; } return $ this -> mimeLiteralPartFactory ; } | Returns the MimeLiteralPartFactory service |
48,977 | public function getConsumerService ( ) { if ( $ this -> consumerService === null ) { $ this -> consumerService = new ConsumerService ( $ this -> getHeaderPartFactory ( ) , $ this -> getMimeLiteralPartFactory ( ) ) ; } return $ this -> consumerService ; } | Returns the header consumer service |
48,978 | protected function getPartForToken ( $ token , $ isLiteral ) { if ( preg_match ( '/^\s+$/' , $ token ) ) { return null ; } return $ this -> partFactory -> newLiteralPart ( $ token ) ; } | Returns null for whitespace and LiteralPart for anything else . |
48,979 | protected function processParts ( array $ parts ) { return array_values ( array_filter ( $ parts , function ( $ part ) { if ( empty ( $ part ) || $ part instanceof CommentPart ) { return false ; } return true ; } ) ) ; } | Overridden to filter out any found CommentPart objects . |
48,980 | public function exists ( $ name , $ offset = 0 ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; return isset ( $ this -> headerMap [ $ s ] [ $ offset ] ) ; } | Returns true if the passed header exists in this collection . |
48,981 | public function getAll ( $ name ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; $ ret = [ ] ; if ( ! empty ( $ this -> headerMap [ $ s ] ) ) { foreach ( $ this -> headerMap [ $ s ] as $ index ) { $ ret [ ] = $ this -> getByIndex ( $ index ) ; } } return $ ret ; } | Returns all headers with the passed name . |
48,982 | private function getByIndex ( $ index ) { if ( ! isset ( $ this -> headers [ $ index ] ) ) { return null ; } if ( $ this -> headerObjects [ $ index ] === null ) { $ this -> headerObjects [ $ index ] = $ this -> headerFactory -> newInstance ( $ this -> headers [ $ index ] [ 0 ] , $ this -> headers [ $ index ] [ 1 ] ) ; ... | Returns the header in the headers array at the passed 0 - based integer index . |
48,983 | public function remove ( $ name , $ offset = 0 ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; if ( isset ( $ this -> headerMap [ $ s ] [ $ offset ] ) ) { $ index = $ this -> headerMap [ $ s ] [ $ offset ] ; array_splice ( $ this -> headerMap [ $ s ] , $ offset , 1 ) ; unset ( $ this -> headers [ $ index ] ) ;... | Removes the header from the collection with the passed name . Defaults to removing the first instance of the header for a collection that contains more than one with the same passed name . |
48,984 | public function removeAll ( $ name ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; if ( ! empty ( $ this -> headerMap [ $ s ] ) ) { foreach ( $ this -> headerMap [ $ s ] as $ i ) { unset ( $ this -> headers [ $ i ] ) ; unset ( $ this -> headerObjects [ $ i ] ) ; } $ this -> headerMap [ $ s ] = [ ] ; return tru... | Removes all headers that match the passed name . |
48,985 | public function add ( $ name , $ value ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; $ this -> headers [ $ this -> nextIndex ] = [ $ name , $ value ] ; $ this -> headerObjects [ $ this -> nextIndex ] = null ; if ( ! isset ( $ this -> headerMap [ $ s ] ) ) { $ this -> headerMap [ $ s ] = [ ] ; } array_push ( ... | Adds the header to the collection . |
48,986 | public function set ( $ name , $ value , $ offset = 0 ) { $ s = $ this -> getNormalizedHeaderName ( $ name ) ; if ( ! isset ( $ this -> headerMap [ $ s ] [ $ offset ] ) ) { $ this -> add ( $ name , $ value ) ; return ; } $ i = $ this -> headerMap [ $ s ] [ $ offset ] ; $ this -> headers [ $ i ] = [ $ name , $ value ] ;... | If a header exists with the passed name and at the passed offset if more than one exists its value is updated . |
48,987 | public function getContentTransferEncoding ( $ default = '7bit' ) { static $ translated = [ 'x-uue' => 'x-uuencode' , 'uue' => 'x-uuencode' , 'uuencode' => 'x-uuencode' ] ; $ type = strtolower ( $ this -> getHeaderValue ( 'Content-Transfer-Encoding' , $ default ) ) ; if ( isset ( $ translated [ $ type ] ) ) { return $ ... | Returns the content - transfer - encoding used for this part defaulting to 7bit if not set . |
48,988 | public function getPartByContentId ( $ contentId ) { $ sanitized = preg_replace ( '/^\s*<|>\s*$/' , '' , $ contentId ) ; $ filter = $ this -> partFilterFactory -> newFilterFromArray ( [ 'headers' => [ PartFilter :: FILTER_INCLUDE => [ 'Content-ID' => $ sanitized ] ] ] ) ; return $ this -> getPart ( 0 , $ filter ) ; } | Convenience method to find a part by its Content - ID header . |
48,989 | public function getGenericHelper ( ) { if ( $ this -> genericHelper === null ) { $ this -> genericHelper = new GenericHelper ( $ this -> partFactoryService -> getMimePartFactory ( ) , $ this -> partFactoryService -> getUUEncodedPartFactory ( ) , $ this -> partBuilderFactory ) ; } return $ this -> genericHelper ; } | Returns the GenericHelper singleton |
48,990 | public function getMultipartHelper ( ) { if ( $ this -> multipartHelper === null ) { $ this -> multipartHelper = new MultipartHelper ( $ this -> partFactoryService -> getMimePartFactory ( ) , $ this -> partFactoryService -> getUUEncodedPartFactory ( ) , $ this -> partBuilderFactory , $ this -> getGenericHelper ( ) ) ; ... | Returns the MultipartHelper singleton |
48,991 | public function getPrivacyHelper ( ) { if ( $ this -> privacyHelper === null ) { $ this -> privacyHelper = new PrivacyHelper ( $ this -> partFactoryService -> getMimePartFactory ( ) , $ this -> partFactoryService -> getUUEncodedPartFactory ( ) , $ this -> partBuilderFactory , $ this -> getGenericHelper ( ) , $ this -> ... | Returns the PrivacyHelper singleton |
48,992 | public function update ( $ rawId , $ attribute ) { if ( ! $ row = $ this -> get ( $ rawId ) ) { throw new Exception ( 'Item not found.' ) ; } $ cart = $ this -> getCart ( ) ; $ this -> event -> fire ( 'shopping_cart.updating' , [ $ row , $ cart ] ) ; if ( is_array ( $ attribute ) ) { $ raw = $ this -> updateAttribute (... | Update the quantity of one row of the cart . |
48,993 | public function remove ( $ rawId ) { if ( ! $ row = $ this -> get ( $ rawId ) ) { return true ; } $ cart = $ this -> getCart ( ) ; $ this -> event -> fire ( 'shopping_cart.removing' , [ $ row , $ cart ] ) ; $ cart -> forget ( $ rawId ) ; $ this -> event -> fire ( 'shopping_cart.removed' , [ $ row , $ cart ] ) ; $ this ... | Remove a row from the cart . |
48,994 | public function get ( $ rawId ) { $ row = $ this -> getCart ( ) -> get ( $ rawId ) ; return is_null ( $ row ) ? null : new Item ( $ row ) ; } | Get a row of the cart by its ID . |
48,995 | public function destroy ( ) { $ cart = $ this -> getCart ( ) ; $ this -> event -> fire ( 'shopping_cart.destroying' , $ cart ) ; $ this -> save ( null ) ; $ this -> event -> fire ( 'shopping_cart.destroyed' , $ cart ) ; return true ; } | Clean the cart . |
48,996 | public function totalPrice ( ) { $ total = 0 ; $ cart = $ this -> getCart ( ) ; if ( $ cart -> isEmpty ( ) ) { return $ total ; } foreach ( $ cart as $ row ) { $ total += $ row -> qty * $ row -> price ; } return $ total ; } | Return total price of cart . |
48,997 | public function count ( $ totalItems = true ) { $ items = $ this -> getCart ( ) ; if ( ! $ totalItems ) { return $ items -> count ( ) ; } $ count = 0 ; foreach ( $ items as $ row ) { $ count += $ row -> qty ; } return $ count ; } | Get the number of items in the cart . |
48,998 | public function search ( array $ search ) { $ rows = new Collection ( ) ; if ( empty ( $ search ) ) { return $ rows ; } foreach ( $ this -> getCart ( ) as $ item ) { if ( array_intersect_assoc ( $ item -> intersect ( $ search ) -> toArray ( ) , $ search ) ) { $ rows -> put ( $ item -> __raw_id , $ item ) ; } } return $... | Search if the cart has a item . |
48,999 | protected function addRow ( $ id , $ name , $ qty , $ price , array $ attributes = [ ] ) { if ( ! is_numeric ( $ qty ) || $ qty < 1 ) { throw new Exception ( 'Invalid quantity.' ) ; } if ( ! is_numeric ( $ price ) || $ price < 0 ) { throw new Exception ( 'Invalid price.' ) ; } $ cart = $ this -> getCart ( ) ; $ rawId =... | Add row to the cart . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.