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