本文整理汇总了PHP中Hubzero\Utility\String::splitCamel方法的典型用法代码示例。如果您正苦于以下问题:PHP String::splitCamel方法的具体用法?PHP String::splitCamel怎么用?PHP String::splitCamel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hubzero\Utility\String
的用法示例。
在下文中一共展示了String::splitCamel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Method to instantiate the form field object.
*
* @param object $form The form to attach to the form field object.
* @return void
*/
public function __construct($form = null)
{
// If there is a form passed into the constructor set the form and form control properties.
if ($form instanceof Form) {
$this->form = $form;
$this->formControl = $form->getFormControl();
}
// Detect the field type if not set
if (!isset($this->type)) {
// Get the reflection info
$r = new ReflectionClass($this);
// Is it namespaced?
if ($r->inNamespace()) {
// It is! This makes things easy.
$this->type = $r->getShortName();
} else {
// We'll assume a CamelCased name
// Split by words and take the last one
$parts = String::splitCamel(get_class($this));
if ($parts[0] == 'J') {
$this->type = ucfirst($parts[count($parts) - 1], '_');
} else {
$this->type = ucfirst($parts[0], '_') . ucfirst($parts[count($parts) - 1], '_');
}
}
}
}