Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Mocks\MockPageContent Class Reference
+ Inheritance diagram for Wikimedia\Parsoid\Mocks\MockPageContent:
+ Collaboration diagram for Wikimedia\Parsoid\Mocks\MockPageContent:

Public Member Functions

 __construct (array $data)
 
 getRoles ()
 Return the roles available in this page.
Returns
string[]

 
 hasRole (string $role)
 Determine whether the page contains a role.
Parameters
string$role
Returns
bool

 
 getModel (string $role)
 Fetch the content model for a role.
Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

 
 getFormat (string $role)
 Fetch the content format for a role.
Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

 
 getContent (string $role)
 Fetch the content for a role.
Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

 

Public Attributes

 $data = []
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Mocks\MockPageContent::__construct ( array $data)
Parameters
array$dataPage content data. Keys are roles, values are arrays or strings. A string value is considered as an array [ 'content' => $value ]. Array keys are:
  • content: (string) The slot's content.
  • contentmodel: (string, default 'wikitext') The slot's content model.
  • contentformat: (string, default 'text/x-wiki') The slot's content format.
  • redirect: (string, optional) The redirect target (same format as PageConfig::getTitle), if this content is a redirect.

Member Function Documentation

◆ getContent()

Wikimedia\Parsoid\Mocks\MockPageContent::getContent ( string $role)

Fetch the content for a role.

Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

Reimplemented from Wikimedia\Parsoid\Config\PageContent.

◆ getFormat()

Wikimedia\Parsoid\Mocks\MockPageContent::getFormat ( string $role)

Fetch the content format for a role.

Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

Reimplemented from Wikimedia\Parsoid\Config\PageContent.

◆ getModel()

Wikimedia\Parsoid\Mocks\MockPageContent::getModel ( string $role)

Fetch the content model for a role.

Parameters
string$role
Returns
string
Exceptions
InvalidArgumentExceptionif the role doesn't exist

Reimplemented from Wikimedia\Parsoid\Config\PageContent.

◆ getRoles()

Wikimedia\Parsoid\Mocks\MockPageContent::getRoles ( )

Return the roles available in this page.

Returns
string[]

Reimplemented from Wikimedia\Parsoid\Config\PageContent.

◆ hasRole()

Wikimedia\Parsoid\Mocks\MockPageContent::hasRole ( string $role)

Determine whether the page contains a role.

Parameters
string$role
Returns
bool

Reimplemented from Wikimedia\Parsoid\Config\PageContent.


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