enabled = true; $this->autoCreateActions = $config['actions']; $this->genPattern = new Pattern( 'genPattern', $config['genPattern'] ); if ( isset( $config['matchPattern'] ) ) { $this->matchPattern = new Pattern( 'matchPattern', $config['matchPattern'] ); } else { $this->matchPattern = $this->genPattern; } $this->serialProviderConfig = $config['serialProvider']; $this->serialMappingConfig = $config['serialMapping']; } } public function isEnabled() { return $this->enabled; } public function isAutoCreateAction( string $action ) { if ( $action === 'create' ) { $action = 'edit'; } return $this->enabled && in_array( $action, $this->autoCreateActions, true ); } public function isReservedName( string $name ) { return $this->enabled && $this->matchPattern->isMatch( $name ); } public function getPlaceholderName(): string { if ( $this->enabled ) { return $this->genPattern->generate( '*' ); } else { throw new MWException( __METHOD__ . ' is disabled' ); } } /** * @internal For TempUserCreator only * @return Pattern */ public function getGeneratorPattern(): Pattern { if ( $this->enabled ) { return $this->genPattern; } else { throw new MWException( __METHOD__ . ' is disabled' ); } } /** * @internal For TempUserCreator only * @return array */ public function getSerialProviderConfig(): array { return $this->serialProviderConfig; } /** * @internal For TempUserCreator only * @return array */ public function getSerialMappingConfig(): array { return $this->serialMappingConfig; } }