Merge "Drop zh-tw message "saveprefs""
[lhc/web/wiklou.git] / includes / tidy / RaggettInternalHHVM.php
1 <?php
2
3 namespace MediaWiki\Tidy;
4
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.
9 *
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
14 */
15 protected function cleanWrapped( $text, $stderr = false, &$retval = null ) {
16 if ( $stderr ) {
17 throw new Exception( "\$stderr cannot be used with RaggettInternalHHVM" );
18 }
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;
25 }
26
27 return $cleansource;
28 }
29 }