|
@@ 286-297 (lines=12) @@
|
| 283 |
|
* @param string $label |
| 284 |
|
* @return string |
| 285 |
|
*/ |
| 286 |
|
public static function normalize_label( $label ) { |
| 287 |
|
// remove the leading underscore(if it's there) |
| 288 |
|
$label = preg_replace( '~^_~', '', $label ); |
| 289 |
|
|
| 290 |
|
// remove the leading "crb_"(if it's there) |
| 291 |
|
$label = preg_replace( '~^crb_~', '', $label ); |
| 292 |
|
|
| 293 |
|
// split the name into words and make them capitalized |
| 294 |
|
$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
| 295 |
|
|
| 296 |
|
return $label; |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
/** |
| 300 |
|
* Normalize a type string representing an object type |
|
@@ 305-311 (lines=7) @@
|
| 302 |
|
* @param string $type |
| 303 |
|
* @return string |
| 304 |
|
*/ |
| 305 |
|
public static function normalize_type( $type ) { |
| 306 |
|
$normalized_type = str_replace( ' ', '_', $type ); |
| 307 |
|
$normalized_type = preg_replace( '/[_\s]+/', '_', $normalized_type ); |
| 308 |
|
$normalized_type = preg_replace( '/^_|_$/', '', $normalized_type ); |
| 309 |
|
$normalized_type = strtolower( $normalized_type ); |
| 310 |
|
return $normalized_type; |
| 311 |
|
} |
| 312 |
|
|
| 313 |
|
/** |
| 314 |
|
* Convert a string representing an object type to a fully qualified class name |