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