TypeParser
in package
Class for parsing RFC 2045 Content-Type Header Fields.
Table of Contents
Methods
- parse() : void
- Parse a mime-type and set the class variables.
- parseStringPart() : array{'string': string, 'comment': string|null, 'delimiter_matched': bool, 'end_offset': int}
- Parses a part of the content MIME type string.
Methods
parse()
Parse a mime-type and set the class variables.
public
static parse(string $typeString, Type $type) : void
Parameters
- $typeString : string
-
MIME type string to parse.
- $type : Type
-
The Type object to receive the components.
Tags
parseStringPart()
Parses a part of the content MIME type string.
public
static parseStringPart(string $string, int $offset, string $delimiter) : array{'string': string, 'comment': string|null, 'delimiter_matched': bool, 'end_offset': int}
Splits string and comment until a delimiter is found.
Parameters
- $string : string
-
Input string.
- $offset : int
-
Offset to start parsing from.
- $delimiter : string
-
Stop parsing when delimiter found.
Return values
array{'string': string, 'comment': string|null, 'delimiter_matched': bool, 'end_offset': int} —An array with the following keys: 'string' - the uncommented part of $string 'comment' - the comment part of $string 'delimiter_matched' - true if a $delimiter stopped the parsing, false otherwise 'end_offset' - the last position parsed in $string.