MediaWiki  master
PPCustomFrame_Hash.php
Go to the documentation of this file.
1 <?php
26 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
28 
30  public $args;
31 
36  public function __construct( $preprocessor, $args ) {
37  parent::__construct( $preprocessor );
38  $this->args = $args;
39  }
40 
41  public function __toString() {
42  $s = 'cstmframe{';
43  $first = true;
44  foreach ( $this->args as $name => $value ) {
45  if ( $first ) {
46  $first = false;
47  } else {
48  $s .= ', ';
49  }
50  $s .= "\"$name\":\"" .
51  str_replace( '"', '\\"', $value->__toString() ) . '"';
52  }
53  $s .= '}';
54  return $s;
55  }
56 
60  public function isEmpty() {
61  return !count( $this->args );
62  }
63 
68  public function getArgument( $index ) {
69  return $this->args[$index] ?? false;
70  }
71 
72  public function getArguments() {
73  return $this->args;
74  }
75 }
Expansion frame with custom arguments.
__construct( $preprocessor, $args)
An expansion frame, used as a context to expand the result of preprocessToObj()
Preprocessor $preprocessor