當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::toProperCaps方法代碼示例

本文整理匯總了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');
 }
開發者ID:KrisJordan,項目名稱:recess,代碼行數:32,代碼來源:RecessToolsAppsController.class.php

示例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);
 }
開發者ID:amitshukla30,項目名稱:recess,代碼行數:8,代碼來源:BelongsToRelationship.class.php

示例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;
 }
開發者ID:rday,項目名稱:recess,代碼行數:8,代碼來源:HasManyRelationship.class.php

示例4: testToProperCaps

 function testToProperCaps()
 {
     $this->assertEquals('ProperCaps', Inflector::toProperCaps('properCaps'));
     $this->assertEquals('ProperCaps', Inflector::toProperCaps('proper_caps'));
 }
開發者ID:amitshukla30,項目名稱:recess,代碼行數:5,代碼來源:InflectorTest.php

示例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);
 }
開發者ID:KrisJordan,項目名稱:Recess-Framework-Model-Validations,代碼行數:6,代碼來源:ValidatesWrapper.class.php


注:本文中的Inflector::toProperCaps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。