@@ 386-397 (lines=12) @@ | ||
383 | * @param string $label |
|
384 | * @return string |
|
385 | */ |
|
386 | public static function normalize_label( $label ) { |
|
387 | // remove the leading underscore(if it's there) |
|
388 | $label = preg_replace( '~^_~', '', $label ); |
|
389 | ||
390 | // remove the leading "crb_"(if it's there) |
|
391 | $label = preg_replace( '~^crb_~', '', $label ); |
|
392 | ||
393 | // split the name into words and make them capitalized |
|
394 | $label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
|
395 | ||
396 | return $label; |
|
397 | } |
|
398 | ||
399 | /** |
|
400 | * Normalize a type string representing an object type |
|
@@ 405-411 (lines=7) @@ | ||
402 | * @param string $type |
|
403 | * @return string |
|
404 | */ |
|
405 | public static function normalize_type( $type ) { |
|
406 | $normalized_type = str_replace( ' ', '_', $type ); |
|
407 | $normalized_type = preg_replace( '/[_\s]+/', '_', $normalized_type ); |
|
408 | $normalized_type = preg_replace( '/^_|_$/', '', $normalized_type ); |
|
409 | $normalized_type = strtolower( $normalized_type ); |
|
410 | return $normalized_type; |
|
411 | } |
|
412 | ||
413 | /** |
|
414 | * Convert a string representing an object type to a fully qualified class name |