本文整理匯總了PHP中Inflector::camel2words方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::camel2words方法的具體用法?PHP Inflector::camel2words怎麽用?PHP Inflector::camel2words使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::camel2words方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseAttributeItem
/**
* Parses and returns the attribute
*/
protected function parseAttributeItem($attribute)
{
if (is_string($attribute)) {
if (!preg_match('/^([\\w\\.]+)(:(\\w*))?(:(.*))?$/', $attribute, $matches)) {
throw new InvalidConfigException('The attribute must be specified in the format of "attribute", "attribute:format" or "attribute:format:label"');
}
$attribute = ['attribute' => $matches[1], 'format' => isset($matches[3]) ? $matches[3] : 'text', 'label' => isset($matches[5]) ? $matches[5] : null];
}
if (!is_array($attribute)) {
throw new InvalidConfigException('The attribute configuration must be an array.');
}
if (isset($attribute['columns'])) {
foreach ($attribute['columns'] as $j => $child) {
$attribute['columns'][$j] = $this->parseAttributeItem($child);
}
return $attribute;
}
if (!empty($attribute['updateAttr'])) {
$attrib = $attribute['updateAttr'];
if (ctype_alnum(str_replace('_', '', $attrib))) {
return;
} else {
throw new InvalidConfigException("The 'updateAttr' name '{$attrib}' is invalid.");
}
}
$attrib = ArrayHelper::getValue($attribute, 'attribute', '');
if ($attrib && strpos($attrib, '.') !== false) {
throw new InvalidConfigException("The attribute '{$attrib}' is invalid. You cannot directly pass relational " . "attributes in string format within '\\kartik\\widgets\\DetailView'. Instead " . "use the array format with 'attribute' property set to base field, and the " . "'value' property returning the relational data. You can also override the " . "widget 'model' settings by setting the 'viewModel' and / or 'editModel' at " . "the attribute array level.");
}
if (isset($attribute['visible']) && !$attribute['visible']) {
unset($this->attributes[$i]);
continue;
}
if (!isset($attribute['format'])) {
$attribute['format'] = 'text';
}
if (isset($attribute['attribute'])) {
$attributeName = $attribute['attribute'];
$model = !empty($attribute['viewModel']) && $attribute['viewModel'] instanceof Model ? $attribute['viewModel'] : $this->model;
if (!isset($attribute['label'])) {
$attribute['label'] = $model instanceof Model ? $model->getAttributeLabel($attributeName) : Inflector::camel2words($attributeName, true);
}
if (!array_key_exists('value', $attribute)) {
$attribute['value'] = ArrayHelper::getValue($model, $attributeName);
}
} elseif (!isset($attribute['label']) || !array_key_exists('value', $attribute)) {
if (ArrayHelper::getValue($attribute, 'group', false) || isset($attribute['columns'])) {
$attribute['value'] = '';
return $attribute;
}
throw new InvalidConfigException('The attribute configuration requires the "attribute" element to determine the value and display label.');
}
return $attribute;
}
示例2: isset
<div class="easyui-layout" data-options="fit:true">
<div region="north" border="false" style="height: 80px;">
<h1>
<?php
echo ' ' . Html::encode($this->title);
?>
<small><?php
echo \Yii::$app->controller->id . '-' . \Yii::$app->controller->action->id;
?>
</small>
</h1>
<?php
$breadcrumbs = isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [];
foreach (Yii::$app->controller->modules as $module) {
if ($module != Yii::$app) {
array_unshift($breadcrumbs, ['label' => Inflector::camel2words($module->id), 'url' => ['/' . $module->uniqueId]]);
}
}
?>
<?php
echo Breadcrumbs::widget(['tag' => 'ol', 'encodeLabels' => false, 'homeLink' => ['label' => '<i class="fa fa-dashboard"></i> Home/Dashboard', 'url' => ['/site/index']], 'links' => $breadcrumbs]);
?>
</div>
<div region="center">
<?php
echo $content;
?>
</div>
</div>
</div>
<?php