Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Parser Class Reference

HTTP Response Parser. More...

Inheritance diagram for Parser:
RegistryAware

Public Member Functions

 __construct ($data)
 Create an instance of the class with the input data.
 
 __construct ($data)
 Create an instance of the class with the input data.
 
 before_version_name ()
 
 cdata ($parser, $cdata)
 
 encoding_equals ()
 
 encoding_name ()
 
 encoding_value ()
 
 get_current_byte ()
 
 get_current_column ()
 
 get_current_line ()
 
 get_data ()
 
 get_error_code ()
 
 get_error_string ()
 
 get_value ()
 Read value.
 
 has_data ()
 Check whether there is data beyond the pointer.
 
 parse (&$data, $encoding, $url='')
 
 parse ()
 Parse the input data.
 
 parse ()
 Parse the input data.
 
 set_registry (\SimplePie\Registry $registry)
 
 set_registry (Registry $registry)
 Set the Registry into the class.
 
 skip_whitespace ()
 Advance past any whitespace.
 
 split_ns ($string)
 
 standalone_equals ()
 
 standalone_name ()
 
 standalone_value ()
 
 tag_close ($parser, $tag)
 
 tag_open ($parser, $tag, $attributes)
 
 version_equals ()
 
 version_name ()
 
 version_value ()
 

Static Public Member Functions

static prepareHeaders ($headers, $count=1)
 Prepare headers (take care of proxies headers)
 

Public Attributes

string $body = ''
 Body of the response.
 
 $current_byte
 
 $current_column
 
 $current_line
 
 $current_xhtml_construct = -1
 
 $data = []
 
 $datas = [[]]
 
 $element = ['']
 
 $encoding
 
string $encoding = 'UTF-8'
 Encoding.
 
 $error_code
 
 $error_string
 
array $headers = []
 Key/value pairs of the headers.
 
float $http_version = 0.0
 HTTP Version.
 
 $namespace = ['']
 
string $reason = ''
 Reason phrase.
 
 $separator = ' '
 
bool $standalone = false
 Standalone.
 
int $status_code = 0
 Status code.
 
string $version = '1.0'
 XML Version.
 
 $xml_base = ['']
 
 $xml_base_explicit = [false]
 
 $xml_lang = ['']
 

Protected Member Functions

 body ()
 Parse the body.
 
 chunked ()
 Parsed a "Transfer-Encoding: chunked" body.
 
 has_data ()
 Check whether there is data beyond the pointer.
 
 http_version ()
 Parse the HTTP version.
 
 is_linear_whitespace ()
 See if the next character is LWS.
 
 linear_whitespace ()
 Parse LWS, replacing consecutive LWS characters with a single space.
 
 name ()
 Parse a header name.
 
 new_line ()
 Deal with a new line, shifting data around as needed.
 
 quote ()
 See what state to move to while within quoted header values.
 
 quote_char ()
 Parse a header value while within quotes.
 
 quote_escaped ()
 Parse an escaped character within quotes.
 
 reason ()
 Parse the reason phrase.
 
 status ()
 Parse the status code.
 
 value ()
 See what state to move to while within non-quoted header values.
 
 value_char ()
 Parse a header value while outside quotes.
 

Protected Attributes

string $data = ''
 Input data.
 
int $data_length = 0
 Input data length (to avoid calling strlen() everytime this is needed)
 
string $name = ''
 Name of the hedaer currently being parsed.
 
int $position = 0
 Current position of the pointer.
 
 $registry
 
self::STATE_ * $state = self::STATE_HTTP_VERSION
 Current state of the state machine.
 
string $value = ''
 Value of the hedaer currently being parsed.
 

Detailed Description

HTTP Response Parser.

Parses the XML Declaration.

Parses XML into something sane.

@subpackage HTTP

This class can be overloaded with {

See also
SimplePie\SimplePie\set_parser_class()}

@subpackage Parsing

@subpackage Parsing

Constructor & Destructor Documentation

◆ __construct() [1/2]

Parser::__construct ( $data)

Create an instance of the class with the input data.

Parameters
string$dataInput data

◆ __construct() [2/2]

Parser::__construct ( $data)

Create an instance of the class with the input data.

Parameters
string$dataInput data

Member Function Documentation

◆ has_data() [1/2]

Parser::has_data ( )
protected

Check whether there is data beyond the pointer.

Return values
booltrue if there is further data, false if not

◆ has_data() [2/2]

Parser::has_data ( )

Check whether there is data beyond the pointer.

Return values
booltrue if there is further data, false if not

◆ is_linear_whitespace()

Parser::is_linear_whitespace ( )
protected

See if the next character is LWS.

Return values
booltrue if the next character is LWS, false if not

◆ parse() [1/2]

Parser::parse ( )

Parse the input data.

Return values
booltrue on success, false on failure

◆ parse() [2/2]

Parser::parse ( )

Parse the input data.

Return values
booltrue on success, false on failure

◆ prepareHeaders()

static Parser::prepareHeaders ( $headers,
$count = 1 )
static

Prepare headers (take care of proxies headers)

Parameters
string$headersRaw headers
integer$countRedirection count. Default to 1.
Return values
string

◆ set_registry()

RegistryAware::set_registry ( Registry $registry)
inherited

Set the Registry into the class.

Parameters
Registry$registry
Return values
void

◆ skip_whitespace()

Parser::skip_whitespace ( )

Advance past any whitespace.

Return values
intNumber of whitespace characters passed

The documentation for this class was generated from the following files: