Move FSFile classes to /fsfile
[mediawiki.git] / includes / tidy / RaggettInternalHHVM.php
blobbb83d6a325b43ce16e481a4232be6f8e8fbe9938
1 <?php
3 namespace MediaWiki\Tidy;
5 class RaggettInternalHHVM extends RaggettBase {
6 /**
7 * Use the HTML tidy extension to use the tidy library in-process,
8 * saving the overhead of spawning a new process.
10 * @param string $text HTML to check
11 * @param bool $stderr Whether to read result from error status instead of output
12 * @param int &$retval Exit code (-1 on internal error)
13 * @return string|null
15 protected function cleanWrapped( $text, $stderr = false, &$retval = null ) {
16 if ( $stderr ) {
17 throw new \Exception( "\$stderr cannot be used with RaggettInternalHHVM" );
19 $cleansource = tidy_repair_string( $text, $this->config['tidyConfigFile'], 'utf8' );
20 if ( $cleansource === false ) {
21 $cleansource = null;
22 $retval = -1;
23 } else {
24 $retval = 0;
27 return $cleansource;