MediaWiki master
ReplayMinifierState.php
Go to the documentation of this file.
1<?php
2
4
5use LogicException;
6use Wikimedia\Minify\MinifierState;
7
18class ReplayMinifierState extends MinifierState {
19
20 protected array $calls = [];
21
25 public function replayOn( MinifierState $otherMinifier ): void {
26 foreach ( $this->calls as [ $method, $args ] ) {
27 $otherMinifier->$method( ...$args );
28 }
29 }
30
31 public function outputFile( string $file ) {
32 $this->calls[] = [ __FUNCTION__, func_get_args() ];
33 return $this;
34 }
35
36 public function sourceRoot( string $url ) {
37 throw new LogicException( "Not implemented" );
38 }
39
40 public function addSourceFile( string $url, string $source, bool $bundle = false ) {
41 $this->calls[] = [ __FUNCTION__, func_get_args() ];
42 return $this;
43 }
44
45 public function setErrorHandler( $onError ) {
46 throw new LogicException( "Not implemented" );
47 }
48
49 protected function minify( string $source ): string {
50 throw new LogicException( "Not implemented" );
51 }
52
53 public function addOutput( string $output ) {
54 $this->calls[] = [ __FUNCTION__, func_get_args() ];
55 return $this;
56 }
57
58 public function ensureNewline() {
59 $this->calls[] = [ __FUNCTION__, func_get_args() ];
60 return $this;
61 }
62
63 public function getMinifiedOutput() {
64 throw new LogicException( "Not implemented" );
65 }
66
67}
Fake minifier that buffers additions to later replay to multiple another minifiers.
addSourceFile(string $url, string $source, bool $bundle=false)
replayOn(MinifierState $otherMinifier)
Replay all supported method calls from this minifier on another minifier.
$source