@@ -61,43 +61,43 @@ public function normalize($data, $normalization_dis = array()) {
6161
6262 $ normalizations = array (
6363 'Address ' => array (
64- ' mixCase ' => array ('street ' , 'locality ' , 'state ' , 'country ' ),
65- ' trimWhitespace ' => array ('street ' , 'locality ' , 'state ' , 'postal_code ' , 'country ' )
64+ DefaultNormalizerTypeEnum::MixCase => array ('street ' , 'locality ' , 'state ' , 'country ' ),
65+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('street ' , 'locality ' , 'state ' , 'postal_code ' , 'country ' )
6666 ),
6767 'CoPersonRole ' => array (
68- ' mixCase ' => array ('title ' , 'o ' , 'ou ' ),
69- ' trimWhitespace ' => array ('title ' , 'o ' , 'ou ' )
68+ DefaultNormalizerTypeEnum::MixCase => array ('title ' , 'o ' , 'ou ' ),
69+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('title ' , 'o ' , 'ou ' )
7070 ),
7171 // We get passed the alias, not the model name during enrollment.
7272 // There's not an obvious generic way to figure the out, but for now this
7373 // only happens here, so we simply duplicate the rules. (CO-1550)
7474 'EnrolleeCoPersonRole ' => array (
75- ' mixCase ' => array ('title ' , 'o ' , 'ou ' ),
76- ' trimWhitespace ' => array ('title ' , 'o ' , 'ou ' )
75+ DefaultNormalizerTypeEnum::MixCase => array ('title ' , 'o ' , 'ou ' ),
76+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('title ' , 'o ' , 'ou ' )
7777 ),
7878 'EmailAddress ' => array (
7979 // Note cake validation will likely prevent this from being called
80- ' trimWhitespace ' => array ('mail ' )
80+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('mail ' )
8181 ),
8282 'Identifier ' => array (
83- ' trimWhiteSpace ' => array ('identifier ' )
83+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('identifier ' )
8484 ),
8585 'Name ' => array (
8686 // For now, we don't mix case to avoid dealing with issues like people who
8787 // go by lowercase names, or McPherson-style capitalization
88- ' trimWhitespace ' => array ('honorific ' , 'given ' , 'middle ' , 'family ' , 'suffix ' )
88+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('honorific ' , 'given ' , 'middle ' , 'family ' , 'suffix ' )
8989 ),
9090 'TelephoneNumber ' => array (
9191 // Following E.123 format, we only use spaces in telephone numbers
9292 // (the + and extension label get added by formatTelephone at rendering time)
93- ' punctuationToSpace ' => array ('country_code ' , 'area_code ' , 'number ' , 'extension ' ),
94- ' trimWhitespace ' => array ('country_code ' , 'area_code ' , 'number ' , 'extension ' )
93+ DefaultNormalizerTypeEnum::PunctuationToSpace => array ('country_code ' , 'area_code ' , 'number ' , 'extension ' ),
94+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('country_code ' , 'area_code ' , 'number ' , 'extension ' )
9595 ),
9696 'Url ' => array (
9797 // We don't normalize an http:// prefix because cake validation will prevent
9898 // a URL from being submitted without a prefix (and we wouldn't know the
9999 // protocol anyway).
100- ' trimWhitespace ' => array ('url ' )
100+ DefaultNormalizerTypeEnum::TrimWhitespace => array ('url ' )
101101 )
102102 );
103103
@@ -135,7 +135,7 @@ public function normalize($data, $normalization_dis = array()) {
135135 // We only trim whitespace since we can't say too much about the contents
136136 // of the extended attribute.
137137
138- $ normalizations [$ model ][' trimWhitespace ' ][] = $ name ;
138+ $ normalizations [$ model ][DefaultNormalizerTypeEnum::TrimWhitespace ][] = $ name ;
139139 }
140140 }
141141 }
@@ -154,7 +154,8 @@ public function normalize($data, $normalization_dis = array()) {
154154 }
155155 foreach ($ normalizations [$ model ][$ normalization ] as $ field ) {
156156 if (!empty ($ ret [$ model ][$ field ])) {
157- $ ret [$ model ][$ field ] = $ this ->$ normalization ($ ret [$ model ][$ field ], $ field );
157+ $ func = lcfirst ( (DefaultNormalizerTypeEnum::$ type )[$ normalization ] );
158+ $ ret [$ model ][$ field ] = $ this ->$ func ($ ret [$ model ][$ field ], $ field );
158159 }
159160 }
160161 }
0 commit comments