Wikimedia SlimApp
Common classes to help with creating an application using the Slim micro framework and Twig template engine.
Loading...
Searching...
No Matches
Wikimedia\Slimapp\ParsoidClient Class Reference

Simple client for sending wikitext to RESTBase to be converted into html. More...

Public Member Functions

 __construct ( $url, $cache, $logger=null)
 
 parse ( $text)
 

Protected Member Functions

 cacheGet ( $key)
 
 cachePut ( $key, $value)
 
 fetchParse ( $text)
 

Protected Attributes

 $url
 
 $cache
 
 $logger
 

Detailed Description

Simple client for sending wikitext to RESTBase to be converted into html.

The class name predates the switch from Parsoid to RESTBase as the backing API provider. RESTBase still talks to Parsoid under the covers.

Author
Bryan Davis bd808.nosp@m.@wik.nosp@m.imedi.nosp@m.a.or.nosp@m.g
See also
https://www.mediawiki.org/wiki/RESTBase
https://en.wikipedia.org/api/rest_v1/

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Slimapp\ParsoidClient::__construct ( $url,
$cache,
$logger = null )
Parameters
string$urlURL to RESTBase /transform/wikitext/to/html API
string$cacheCache directory
LoggerInterface$loggerLog channel

Member Function Documentation

◆ cacheGet()

Wikimedia\Slimapp\ParsoidClient::cacheGet ( $key)
protected
Parameters
string$keyCache key
Returns
string Cached parse result

◆ cachePut()

Wikimedia\Slimapp\ParsoidClient::cachePut ( $key,
$value )
protected
Parameters
string$keyCache key
string$valueParse result

◆ fetchParse()

Wikimedia\Slimapp\ParsoidClient::fetchParse ( $text)
protected
Parameters
string$text
Returns
string|bool False on failure, html otherwise

◆ parse()

Wikimedia\Slimapp\ParsoidClient::parse ( $text)
Parameters
string$textWikitext
Returns
string Parsed text

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