25use InvalidArgumentException;
29use Wikimedia\Assert\Assert;
84 public function defineRole( $role, callable $instantiator ) {
85 $role = strtolower( $role );
88 throw new LogicException(
"Role $role is already defined" );
91 $this->instantiators[$role] = $instantiator;
111 $role = strtolower( $role );
115 static function ( $role ) use ( $model, $layout, $derived ) {
131 $role = strtolower( $role );
133 if ( !isset( $this->handlers[$role] ) ) {
138 wfWarn( __METHOD__ .
": known but undefined slot role $role" );
143 throw new InvalidArgumentException(
"Unknown role $role" );
146 $handler = call_user_func( $this->instantiators[$role], $role );
148 Assert::postcondition(
150 "Instantiator for $role role must return a SlotRoleHandler"
153 $this->handlers[$role] = $handler;
157 return $this->handlers[$role];
202 return array_keys( $this->instantiators );
215 return array_unique( array_merge(
217 $this->roleNamesStore->getMap()
228 $role = strtolower( $role );
240 $role = strtolower( $role );
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Interface for objects (potentially) representing an editable wiki page.