Go to the documentation of this file.
25 use InvalidArgumentException;
29 use Wikimedia\Assert\Assert;
84 public function defineRole( $role, callable $instantiator ) {
86 throw new LogicException(
"Role $role is already defined" );
89 $this->instantiators[$role] = $instantiator;
109 function ( $role ) use ( $model, $layout ) {
125 if ( !isset( $this->handlers[$role] ) ) {
130 wfWarn( __METHOD__ .
": known but undefined slot role $role" );
135 throw new InvalidArgumentException(
"Unknown role $role" );
138 $handler = call_user_func( $this->instantiators[$role], $role );
140 Assert::postcondition(
142 "Instantiator for $role role must return a SlotRoleHandler"
145 $this->handlers[$role] = $handler;
149 return $this->handlers[$role];
194 return array_keys( $this->instantiators );
207 return array_unique( array_merge(
209 $this->roleNamesStore->getMap()
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.