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;
109 $role = strtolower( $role );
113 function ( $role ) use ( $model, $layout ) {
129 $role = strtolower( $role );
131 if ( !isset( $this->handlers[$role] ) ) {
136 wfWarn( __METHOD__ .
": known but undefined slot role $role" );
141 throw new InvalidArgumentException(
"Unknown role $role" );
144 $handler = call_user_func( $this->instantiators[$role], $role );
146 Assert::postcondition(
148 "Instantiator for $role role must return a SlotRoleHandler"
151 $this->handlers[$role] = $handler;
155 return $this->handlers[$role];
200 return array_keys( $this->instantiators );
213 return array_unique( array_merge(
215 $this->roleNamesStore->getMap()
226 $role = strtolower( $role );
238 $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.