MediaWiki  1.34.0
PPCustomFrame_Hash.php
Go to the documentation of this file.
1 <?php
26 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
28 
29  public $args;
30 
31  public function __construct( $preprocessor, $args ) {
32  parent::__construct( $preprocessor );
33  $this->args = $args;
34  }
35 
36  public function __toString() {
37  $s = 'cstmframe{';
38  $first = true;
39  foreach ( $this->args as $name => $value ) {
40  if ( $first ) {
41  $first = false;
42  } else {
43  $s .= ', ';
44  }
45  $s .= "\"$name\":\"" .
46  str_replace( '"', '\\"', $value->__toString() ) . '"';
47  }
48  $s .= '}';
49  return $s;
50  }
51 
55  public function isEmpty() {
56  return !count( $this->args );
57  }
58 
63  public function getArgument( $index ) {
64  return $this->args[$index] ?? false;
65  }
66 
67  public function getArguments() {
68  return $this->args;
69  }
70 }
PPCustomFrame_Hash\__toString
__toString()
Definition: PPCustomFrame_Hash.php:36
PPFrame_Hash
An expansion frame, used as a context to expand the result of preprocessToObj()
Definition: PPFrame_Hash.php:27
PPCustomFrame_Hash\isEmpty
isEmpty()
Definition: PPCustomFrame_Hash.php:55
$s
$s
Definition: mergeMessageFileList.php:185
PPCustomFrame_Hash\__construct
__construct( $preprocessor, $args)
Definition: PPCustomFrame_Hash.php:31
PPFrame_Hash\$preprocessor
Preprocessor $preprocessor
Definition: PPFrame_Hash.php:37
PPCustomFrame_Hash\$args
$args
Definition: PPCustomFrame_Hash.php:29
PPCustomFrame_Hash\getArgument
getArgument( $index)
Definition: PPCustomFrame_Hash.php:63
PPCustomFrame_Hash\getArguments
getArguments()
Definition: PPCustomFrame_Hash.php:67
PPCustomFrame_Hash
Expansion frame with custom arguments.
Definition: PPCustomFrame_Hash.php:27