MediaWiki master
PasswordDef.php
Go to the documentation of this file.
1<?php
2
4
6
16class PasswordDef extends StringDef {
17
19 public function normalizeSettings( array $settings ) {
20 $settings[ParamValidator::PARAM_SENSITIVE] = true;
21 return parent::normalizeSettings( $settings );
22 }
23
25 public function checkSettings( string $name, $settings, array $options, array $ret ): array {
26 $ret = parent::checkSettings( $name, $settings, $options, $ret );
27
28 if ( ( $settings[ParamValidator::PARAM_SENSITIVE] ?? true ) !== true &&
29 !isset( $ret['issues'][ParamValidator::PARAM_SENSITIVE] )
30 ) {
31 $ret['issues'][ParamValidator::PARAM_SENSITIVE] =
32 'Cannot set PARAM_SENSITIVE to false for password-type parameters';
33 }
34
35 return $ret;
36 }
37
38}
Service for formatting and validating API parameters.
const PARAM_SENSITIVE
(bool) Indicate that the parameter's value should not be logged.
Type definition for "password" types.
normalizeSettings(array $settings)
Normalize a settings array.to override array
checkSettings(string $name, $settings, array $options, array $ret)
Validate a parameter settings array.This is intended for validation of parameter settings during unit...
Type definition for string types.
Definition StringDef.php:24