MediaWiki  1.34.0
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 }
PPCustomFrame_DOM\$args
$args
Definition: PPCustomFrame_DOM.php:30
PPFrame_DOM\$preprocessor
Preprocessor $preprocessor
Definition: PPFrame_DOM.php:34
$s
$s
Definition: mergeMessageFileList.php:185
PPCustomFrame_DOM\__toString
__toString()
Definition: PPCustomFrame_DOM.php:37
PPCustomFrame_DOM
Expansion frame with custom arguments.
Definition: PPCustomFrame_DOM.php:28
PPCustomFrame_DOM\__construct
__construct( $preprocessor, $args)
Definition: PPCustomFrame_DOM.php:32
PPCustomFrame_DOM\getArgument
getArgument( $index)
Definition: PPCustomFrame_DOM.php:64
PPFrame_DOM
An expansion frame, used as a context to expand the result of preprocessToObj()
Definition: PPFrame_DOM.php:29
PPCustomFrame_DOM\isEmpty
isEmpty()
Definition: PPCustomFrame_DOM.php:56
PPCustomFrame_DOM\getArguments
getArguments()
Definition: PPCustomFrame_DOM.php:68