|
@@ 243-254 (lines=12) @@
|
| 240 |
|
* @param string $label |
| 241 |
|
* @return string |
| 242 |
|
*/ |
| 243 |
|
public static function normalize_label( $label ) { |
| 244 |
|
// remove the leading underscore(if it's there) |
| 245 |
|
$label = preg_replace( '~^_~', '', $label ); |
| 246 |
|
|
| 247 |
|
// remove the leading "crb_"(if it's there) |
| 248 |
|
$label = preg_replace( '~^crb_~', '', $label ); |
| 249 |
|
|
| 250 |
|
// split the name into words and make them capitalized |
| 251 |
|
$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE ); |
| 252 |
|
|
| 253 |
|
return $label; |
| 254 |
|
} |
| 255 |
|
|
| 256 |
|
/** |
| 257 |
|
* Normalize a type string representing an object type |
|
@@ 262-268 (lines=7) @@
|
| 259 |
|
* @param string $type |
| 260 |
|
* @return string |
| 261 |
|
*/ |
| 262 |
|
public static function normalize_type( $type ) { |
| 263 |
|
$normalized_type = str_replace( ' ', '_', $type ); |
| 264 |
|
$normalized_type = preg_replace( '/[_\s]+/', '_', $normalized_type ); |
| 265 |
|
$normalized_type = preg_replace( '/^_|_$/', '', $normalized_type ); |
| 266 |
|
$normalized_type = strtolower( $normalized_type ); |
| 267 |
|
return $normalized_type; |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
/** |
| 271 |
|
* Convert a string representing an object type to a fully qualified class name |