MediaWiki master
PPCustomFrame_Hash.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Parser;
9
14// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
16
18 public $args;
19
24 public function __construct( $preprocessor, $args ) {
25 parent::__construct( $preprocessor );
26 $this->args = $args;
27 }
28
29 public function __toString() {
30 $s = 'cstmframe{';
31 $first = true;
32 foreach ( $this->args as $name => $value ) {
33 if ( $first ) {
34 $first = false;
35 } else {
36 $s .= ', ';
37 }
38 $s .= "\"$name\":\"" .
39 str_replace( '"', '\\"', $value->__toString() ) . '"';
40 }
41 $s .= '}';
42 return $s;
43 }
44
48 public function isEmpty() {
49 return !count( $this->args );
50 }
51
56 public function getArgument( $index ) {
57 return $this->args[$index] ?? false;
58 }
59
61 public function getArguments() {
62 return $this->args;
63 }
64}
65
67class_alias( PPCustomFrame_Hash::class, 'PPCustomFrame_Hash' );
Expansion frame with custom arguments.
An expansion frame, used as a context to expand the result of preprocessToObj()