本文整理匯總了PHP中Inflector::toProperCaps方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::toProperCaps方法的具體用法?PHP Inflector::toProperCaps怎麽用?PHP Inflector::toProperCaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::toProperCaps方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateApp
private function generateApp()
{
Library::import('recess.lang.Inflector');
$appName = $this->request->post['appName'];
$programmaticName = Inflector::toProperCaps($this->request->post['programmaticName']);
$camelProgrammaticName = Inflector::toCamelCaps($programmaticName);
$this->applicationClass = $programmaticName . 'Application';
$this->applicationFullClass = $camelProgrammaticName . '.' . $this->applicationClass;
$this->appName = $appName;
$routesPrefix = $this->request->post['routingPrefix'];
if (substr($routesPrefix, -1) != '/') {
$routesPrefix .= '/';
}
$appDir = $_ENV['dir.apps'] . $camelProgrammaticName;
$this->messages = array();
$this->messages[] = $this->tryCreatingDirectory($appDir, 'application');
$appReplacements = array('appName' => $appName, 'programmaticName' => $programmaticName, 'camelProgrammaticName' => $camelProgrammaticName, 'routesPrefix' => $routesPrefix);
$this->messages[] = $this->tryGeneratingFile('Application Class', $this->application->codeTemplatesDir . 'Application.template.php', $appDir . '/' . $programmaticName . 'Application.class.php', $appReplacements);
$this->messages[] = $this->tryCreatingDirectory($appDir . '/models', 'models');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/controllers', 'controllers');
$this->messages[] = $this->tryGeneratingFile('Home Controller', $this->application->codeTemplatesDir . 'scaffolding/controllers/HomeController.template.php', $appDir . '/controllers/' . $programmaticName . 'HomeController.class.php', $appReplacements);
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views', 'views');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/parts', 'common parts');
$this->messages[] = $this->tryGeneratingFile('Navigation Part', $this->application->codeTemplatesDir . 'scaffolding/views/parts/navigation.part.template.php', $appDir . '/views/parts/navigation.part.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Style Part', $this->application->codeTemplatesDir . 'scaffolding/views/parts/style.part.template.php', $appDir . '/views/parts/style.part.php', $appReplacements);
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/home', 'home views');
$this->messages[] = $this->tryCreatingDirectory($appDir . '/views/layouts', 'layouts');
$this->messages[] = $this->tryGeneratingFile('Home Template', $this->application->codeTemplatesDir . 'scaffolding/views/home/index.template.php', $appDir . '/views/home/index.html.php', $appReplacements);
$this->messages[] = $this->tryGeneratingFile('Master Layout', $this->application->codeTemplatesDir . 'scaffolding/views/master.layout.template.php', $appDir . '/views/layouts/master.layout.php', $appReplacements);
$scaffolding_dir = $this->application->codeTemplatesDir . 'scaffolding';
$this->messages[] = $this->tryCopyDirectory($scaffolding_dir . '/public', $appDir . '/public');
}
示例2: init
function init($modelClassName, $relationshipName)
{
$this->localClass = $modelClassName;
$this->name = $relationshipName;
$this->onDelete = Relationship::NULLIFY;
$this->foreignKey = Inflector::toCamelCaps($relationshipName) . 'Id';
$this->foreignClass = Inflector::toProperCaps($relationshipName);
}
示例3: init
function init($modelClassName, $relationshipName)
{
$this->localClass = $modelClassName;
$this->name = $relationshipName;
$this->foreignKey = Inflector::toCamelCaps($modelClassName) . 'Id';
$this->foreignClass = Inflector::toSingular(Inflector::toProperCaps($relationshipName));
$this->onDelete = Relationship::UNSPECIFIED;
}
示例4: testToProperCaps
function testToProperCaps()
{
$this->assertEquals('ProperCaps', Inflector::toProperCaps('properCaps'));
$this->assertEquals('ProperCaps', Inflector::toProperCaps('proper_caps'));
}
示例5: labelForObjectProperty
public static function labelForObjectProperty($object, $field)
{
$descriptor = Model::getDescriptor(get_class($object));
$property = isset($descriptor->properties[$field]) ? $descriptor->properties[$field] : new stdClass();
return isset($property->label) ? $property->label : Inflector::toProperCaps($field);
}