|
@@ 336-347 (lines=12) @@
|
| 333 |
|
* @param string $label |
| 334 |
|
* @return string |
| 335 |
|
*/ |
| 336 |
|
public static function normalize_label( $label ) { |
| 337 |
|
// remove the leading underscore(if it's there) |
| 338 |
|
$label = preg_replace( '~^_~', '', $label ); |
| 339 |
|
|
| 340 |
|
// remove the leading "crb_"(if it's there) |
| 341 |
|
$label = preg_replace( '~^crb_~', '', $label ); |
| 342 |
|
|
| 343 |
|
// split the name into words and make them capitalized |
| 344 |
|
$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
| 345 |
|
|
| 346 |
|
return $label; |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
/** |
| 350 |
|
* Normalize a type string representing an object type |
|
@@ 355-361 (lines=7) @@
|
| 352 |
|
* @param string $type |
| 353 |
|
* @return string |
| 354 |
|
*/ |
| 355 |
|
public static function normalize_type( $type ) { |
| 356 |
|
$normalized_type = str_replace( ' ', '_', $type ); |
| 357 |
|
$normalized_type = preg_replace( '/[_\s]+/', '_', $normalized_type ); |
| 358 |
|
$normalized_type = preg_replace( '/^_|_$/', '', $normalized_type ); |
| 359 |
|
$normalized_type = strtolower( $normalized_type ); |
| 360 |
|
return $normalized_type; |
| 361 |
|
} |
| 362 |
|
|
| 363 |
|
/** |
| 364 |
|
* Convert a string representing an object type to a fully qualified class name |