PHP Class PHPHtmlParser\Content

显示文件 Open project: paquettg/php-html-parser Class Usage Examples

Protected Properties

Property Type Description
$attr
$blank string The following 4 strings are tags that are important to us.
$content string The content string.
$equal
$pos integer The current position we are in the content.
$size integer The size of the content.
$slash

Public Methods

Method Description
__construct ( $content ) Content constructor.
char ( integer $char = null ) : string Gets the current character we are at.
copyByToken ( string $token, boolean $char = false, boolean $escape = false ) : string Copies the content until it reaches the token string.,
copyUntil ( string $string, boolean $char = false, boolean $escape = false ) : string Copy the content until we find the given string.
copyUntilUnless ( string $string, string $unless ) : string Copies the content until the string is found and return it unless the 'unless' is found in the substring.
fastForward ( integer $count ) Moves the current position forward.
getPosition ( ) : integer Returns the current position of the content.
rewind ( integer $count ) Moves the current position backward.
skip ( string $string, boolean $copy = false ) Skip a given set of characters.
skipByToken ( string $token, boolean $copy = false ) : null | string Skip a given token of pre-defined characters.

Method Details

__construct() public method

Content constructor.
public __construct ( $content )
$content

char() public method

Gets the current character we are at.
public char ( integer $char = null ) : string
$char integer
return string

copyByToken() public method

Copies the content until it reaches the token string.,
public copyByToken ( string $token, boolean $char = false, boolean $escape = false ) : string
$token string
$char boolean
$escape boolean
return string

copyUntil() public method

Copy the content until we find the given string.
public copyUntil ( string $string, boolean $char = false, boolean $escape = false ) : string
$string string
$char boolean
$escape boolean
return string

copyUntilUnless() public method

Copies the content until the string is found and return it unless the 'unless' is found in the substring.
public copyUntilUnless ( string $string, string $unless ) : string
$string string
$unless string
return string

fastForward() public method

Moves the current position forward.
public fastForward ( integer $count )
$count integer

getPosition() public method

Returns the current position of the content.
public getPosition ( ) : integer
return integer

rewind() public method

Moves the current position backward.
public rewind ( integer $count )
$count integer

skip() public method

Skip a given set of characters.
public skip ( string $string, boolean $copy = false )
$string string
$copy boolean

skipByToken() public method

Skip a given token of pre-defined characters.
public skipByToken ( string $token, boolean $copy = false ) : null | string
$token string
$copy boolean
return null | string

Property Details

$attr protected_oe property

protected $attr

$blank protected_oe property

The following 4 strings are tags that are important to us.
protected string $blank
return string

$content protected_oe property

The content string.
protected string $content
return string

$equal protected_oe property

protected $equal

$pos protected_oe property

The current position we are in the content.
protected int $pos
return integer

$size protected_oe property

The size of the content.
protected int $size
return integer

$slash protected_oe property

protected $slash