15 'settings' => [
'is_array',
'array' ],
16 'settings.rights' => [
'is_array',
'array' ,
'is_string',
'string' ],
17 'settings.default' => [
'is_bool',
'boolean' ],
18 'settings.hidden' => [
'is_bool',
'boolean' ],
19 'settings.skins' => [ [ __CLASS__,
'isArrayOrTrue' ],
'array or true',
'is_string',
'string' ],
20 'settings.category' => [
'is_string',
'string' ],
21 'module' => [
'is_array',
'array' ],
22 'module.scripts' => [
'is_array',
'array',
'is_string',
'string' ],
23 'module.styles' => [
'is_array',
'array',
'is_string',
'string' ],
24 'module.dependencies' => [
'is_array',
'array',
'is_string',
'string' ],
25 'module.peers' => [
'is_array',
'array',
'is_string',
'string' ],
26 'module.messages' => [
'is_array',
'array',
'is_string',
'string' ],
27 'module.type' => [
'is_string',
'string' ],
35 return is_array( $value ) || $value ===
true;
44 public function validate( array $properties, $tolerateMissing =
false ) {
45 foreach ( self::$propertyValidation as $property => $validation ) {
46 $path = explode(
'.', $property );
50 foreach (
$path as $p ) {
51 if ( !array_key_exists( $p, $val ) ) {
52 if ( $tolerateMissing ) {
63 $func = $validation[0];
64 if ( !call_user_func( $func, $val ) ) {
66 'gadgets-validate-wrongtype',
73 if ( isset( $validation[2] ) && is_array( $val ) ) {
75 $func = $validation[2];
76 foreach ( $val as $i => $v ) {
77 if ( !call_user_func( $func, $v ) ) {
79 'gadgets-validate-wrongtype',