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