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