@@ 297-308 (lines=12) @@ | ||
294 | * @param string $label |
|
295 | * @return string |
|
296 | */ |
|
297 | public static function normalize_label( $label ) { |
|
298 | // remove the leading underscore(if it's there) |
|
299 | $label = preg_replace( '~^_~', '', $label ); |
|
300 | ||
301 | // remove the leading "crb_"(if it's there) |
|
302 | $label = preg_replace( '~^crb_~', '', $label ); |
|
303 | ||
304 | // split the name into words and make them capitalized |
|
305 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
306 | ||
307 | return $label; |
|
308 | } |
|
309 | ||
310 | /** |
|
311 | * Normalize a type string representing an object type |
|
@@ 316-322 (lines=7) @@ | ||
313 | * @param string $type |
|
314 | * @return string |
|
315 | */ |
|
316 | public static function normalize_type( $type ) { |
|
317 | $normalized_type = str_replace( ' ', '_', $type ); |
|
318 | $normalized_type = preg_replace( '/[_\s]+/', '_', $normalized_type ); |
|
319 | $normalized_type = preg_replace( '/^_|_$/', '', $normalized_type ); |
|
320 | $normalized_type = strtolower( $normalized_type ); |
|
321 | return $normalized_type; |
|
322 | } |
|
323 | ||
324 | /** |
|
325 | * Convert a string representing an object type to a fully qualified class name |