当前位置: 首页>>代码示例>>PHP>>正文


PHP camel_case函数代码示例

本文整理汇总了PHP中camel_case函数的典型用法代码示例。如果您正苦于以下问题:PHP camel_case函数的具体用法?PHP camel_case怎么用?PHP camel_case使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了camel_case函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createEntity

 /**
  * @param array $data
  * @return CampaignEmail
  */
 public function createEntity($data = array())
 {
     $final = [];
     foreach ($data as $key => $value) {
         $newKey = camel_case($key);
         // sort out dates
         if ($newKey == 'createdAt') {
             $value = new DateTime($value);
         }
         if ($newKey == 'updatedAt') {
             $value = new DateTime($value);
         }
         // sort out emails
         if ($newKey == 'emailAddress') {
             $value = new Email($value);
         }
         if ($newKey == 'variables') {
             if (!is_array($value)) {
                 $value = json_decode($value, true);
             }
         }
         $final[$newKey] = $value;
     }
     return new CampaignEmail($final);
 }
开发者ID:alistairshaw,项目名称:ambitiousmail-relay,代码行数:29,代码来源:CampaignEmailFactory.php

示例2: __get

 /**
  * Map to get.
  *
  * @param $name
  * @return mixed
  */
 public function __get($name)
 {
     if ($this->has($name)) {
         return $this->get($name);
     }
     return call_user_func([$this, camel_case($name)]);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:13,代码来源:Collection.php

示例3: build

 /**
  * @param \stdClass|array $parameters
  */
 public function build($parameters)
 {
     foreach ($parameters as $property => $value) {
         $property = camel_case($property);
         $this->{$property} = $value;
     }
 }
开发者ID:ContemporaryVA,项目名称:Entity,代码行数:10,代码来源:Entity.php

示例4: geoip

 /**
  * Get an instance of the current geoip.
  *
  * @return \PulkitJalan\GeoIP\GeoIP
  */
 function geoip($key = null)
 {
     if (is_null($key)) {
         return app('geoip');
     }
     return app('geoip')->{'get' . ucwords(camel_case($key))}();
 }
开发者ID:josezenem,项目名称:geoip,代码行数:12,代码来源:helpers.php

示例5: render

 /**
  * Render a Field.
  *
  * @param string $type
  * @param string $attribute
  * @param string $field
  * @param string $options
  *
  * @return \Illuminate\Http\Response
  */
 public function render($action, $type, $attribute, $value = null, $options = [])
 {
     if (!isset($type)) {
         throw new \Exception('Field Type cannot be empty or undefined.');
     }
     return call_user_func_array([$this->create($type, $attribute, $value, $options), camel_case('render_' . $action)], []);
 }
开发者ID:laravelflare,项目名称:fields,代码行数:17,代码来源:FieldManager.php

示例6: doGenerateMethods

 private function doGenerateMethods()
 {
     $methodPostfix = ucfirst(camel_case(preg_replace('~2~', '_to_', $this->table)));
     $this->info('Routes:');
     $getRoute = "Route::get('" . $this->trimAdminPrefix($this->getRequestUri) . "', 'TableAdminController@show" . $methodPostfix . "');";
     $postRoute = "Route::post('" . $this->trimAdminPrefix($this->postRequestUri) . "', 'TableAdminController@handle" . $methodPostfix . "');";
     $this->line($getRoute);
     $this->line($postRoute);
     $this->info('Methods:');
     $showMethod = 'public function show' . $methodPostfix . '()' . PHP_EOL;
     $showMethod .= '{' . PHP_EOL;
     $showMethod .= '    $options = array(' . PHP_EOL;
     $showMethod .= "        'url'      => '" . $this->getRequestUri . "'," . PHP_EOL;
     $showMethod .= "        'def_name' => '" . $this->definition . "'," . PHP_EOL;
     $showMethod .= '    );' . PHP_EOL;
     $showMethod .= '    list($table, $form) = Jarboe::table($options);' . PHP_EOL . PHP_EOL;
     $showMethod .= "    return View::make('admin::table', compact('table', 'form'));" . PHP_EOL;
     $showMethod .= '} // end show' . $methodPostfix . PHP_EOL . PHP_EOL;
     echo $showMethod;
     $postMethod = 'public function handle' . $methodPostfix . '()' . PHP_EOL;
     $postMethod .= '{' . PHP_EOL;
     $postMethod .= '    $options = array(' . PHP_EOL;
     $postMethod .= "        'url'      => '" . $this->getRequestUri . "'," . PHP_EOL;
     $postMethod .= "        'def_name' => '" . $this->definition . "'," . PHP_EOL;
     $postMethod .= '    );' . PHP_EOL . PHP_EOL;
     $postMethod .= '    return Jarboe::table($options);' . PHP_EOL;
     $postMethod .= '} // end handle' . $methodPostfix . PHP_EOL;
     echo $postMethod;
 }
开发者ID:OlesKashchenko,项目名称:Jarboe,代码行数:29,代码来源:CreateDefinitionArtisanCommand.php

示例7: handle

 public function handle()
 {
     if ($this->option('only-state')) {
         $this->input->setOption('template', 0);
         $this->input->setOption('controller', 0);
         $this->input->setOption('abstract', 1);
     }
     $state = $this->argument('state');
     $abstractOption = $this->option('abstract');
     $templateOption = $this->option('template');
     $controllerOption = $this->option('controller');
     $statePieces = explode('.', $state);
     $path = 'src/application/' . str_replace('.', '/', $state);
     $absolutePath = public_path($path);
     $controller = implode(array_map(function ($piece) {
         return ucfirst(camel_case($piece));
     }, $statePieces)) . 'Ctrl';
     $name = end($statePieces);
     $variables = compact('name', 'state', 'absolutePath', 'path', 'controller', 'abstractOption', 'templateOption', 'controllerOption');
     if (!file_exists($absolutePath) && $this->confirm('The folder does not exist, shall I create it?')) {
         mkdir($absolutePath);
     }
     $this->make('.html', $variables);
     $this->make('.controller.js', $variables);
     $this->make('.state.js', $variables);
 }
开发者ID:IonutBajescu,项目名称:laravel-angular-scaffoldings,代码行数:26,代码来源:MakeCommand.php

示例8: apply

 public function apply($builder, RepositoryInterface $repository)
 {
     $fieldsSearchable = $repository->getFieldsSearchable();
     $search = $this->request->get(config('repository.criteria.params.search', 'search'), null);
     $searchFields = $this->request->get(config('repository.criteria.params.searchFields', 'searchFields'), null);
     $filter = $this->request->get(config('repository.criteria.params.filter', 'filter'), null);
     $orderBy = $this->request->get(config('repository.criteria.params.orderBy', 'orderBy'), null);
     $sortedBy = $this->request->get(config('repository.criteria.params.sortedBy', 'sortedBy'), 'asc');
     $sortedBy = !empty($sortedBy) ? $sortedBy : 'asc';
     if ($search && is_array($fieldsSearchable) && count($fieldsSearchable)) {
         $searchFields = is_array($searchFields) || is_null($searchFields) ? $searchFields : explode(';', $searchFields);
         $fields = $this->parserFieldsSearch($fieldsSearchable, $searchFields);
         $isFirstField = true;
         $searchData = $this->parserSearchData($search);
         $search = $this->parserSearchValue($search);
         $modelForceAndWhere = false;
         $builder = $builder->where(function ($query) use($fields, $search, $searchData, $isFirstField, $modelForceAndWhere) {
             foreach ($fields as $field => $condition) {
                 if (is_numeric($field)) {
                     $field = $condition;
                     $condition = '=';
                 }
                 $value = null;
                 $condition = trim(strtolower($condition));
                 if (isset($searchData[$field])) {
                     $value = $condition == 'like' ? "%{$searchData[$field]}%" : $searchData[$field];
                 } else {
                     if (!is_null($search)) {
                         $value = $condition == 'like' ? "%{$search}%" : $search;
                     }
                 }
                 if ($isFirstField || $modelForceAndWhere) {
                     if (!is_null($value)) {
                         $query->where($field, $condition, $value);
                         $isFirstField = false;
                     }
                 } else {
                     if (!is_null($value)) {
                         $query->orWhere($field, $condition, $value);
                     }
                 }
             }
         });
     }
     if (isset($orderBy) && in_array(strtolower($sortedBy), ['asc', 'desc'])) {
         $builder = $builder->orderBy($orderBy, $sortedBy);
     }
     if (isset($filter) && !empty($filter)) {
         if (is_string($filter)) {
             foreach (array_unique(explode(',', $filter)) as $filter) {
                 // eg. filter 'hot' 会调用方法 'filterHot'
                 $method_name = camel_case('filter_' . $filter);
                 if (method_exists($this, $method_name)) {
                     $builder = call_user_func([$this, $method_name], $builder);
                 }
             }
         }
     }
     return $builder;
 }
开发者ID:royalwang,项目名称:phphub-server,代码行数:60,代码来源:BaseCriteria.php

示例9: create

 /**
  * Create a new form.
  *
  * @param  string  $model
  * @param  array  $columns
  * @param  string  $view
  * @return void
  */
 public function create($model, $columns = [], $view = 'form')
 {
     $model = $this->sanitize($model);
     $this->writeLangFiles($columns, $model);
     $stub = $this->getStub('form.blade.stub');
     $el = [];
     foreach ($columns as $col) {
         $col['field'] = $this->sanitize($col['field'], '/[^a-zA-Z0-9_-]/');
         switch ($col['type']) {
             case 'text':
             case 'mediumText':
             case 'longText':
                 $inputStub = $this->getStub('form-textarea.stub');
                 break;
             case 'boolean':
             case 'tinyInteger':
                 $inputStub = $this->getStub('form-checkbox.stub');
                 break;
             case 'string':
             default:
                 $inputStub = $this->getStub('form-input.stub');
                 break;
         }
         $el[] = $this->prepare($inputStub, ['field_name' => $col['field'], 'camel_model' => camel_case(strtolower($model)), 'plural_lower_model' => strtolower(Str::plural($model))]);
     }
     $content = $this->prepare($stub, ['columns' => implode("\n\t\t\t\t", $el), 'camel_model' => camel_case(strtolower($model)), 'plural_lower_model' => strtolower(Str::plural($model))]);
     $filePath = $this->path . '/themes/admin/default/packages/' . $this->extension->lowerVendor . '/' . $this->extension->lowerName . '/views/' . Str::plural(strtolower($model)) . '/';
     $this->ensureDirectory($filePath);
     $this->files->put($filePath . $view . '.blade.php', $content);
 }
开发者ID:sohailaammarocs,项目名称:lfc,代码行数:38,代码来源:FormGenerator.php

示例10: __construct

 /**
  * Creates a new Lavary\Menu\MenuItem instance.
  *
  * @param  string  $title
  * @param  string  $url
  * @param  array  $attributes
  * @param  int  $parent
  * @param  \Lavary\Menu\Menu  $builder
  * @return void
  */
 public function __construct($builder, $id, $title, $options)
 {
     $this->builder = $builder;
     $this->id = $id;
     $this->title = $title;
     $this->nickname = camel_case($title);
     $this->attributes = $this->builder->extractAttributes($options);
     $this->parent = is_array($options) && isset($options['parent']) ? $options['parent'] : null;
     // Storing path options with each link instance.
     if (!is_array($options)) {
         $path = array('url' => $options);
     } elseif (isset($options['raw']) && $options['raw'] == true) {
         $path = null;
     } else {
         $path = array_only($options, array('url', 'route', 'action', 'secure'));
     }
     if (!is_null($path)) {
         $path['prefix'] = $this->builder->getLastGroupPrefix();
     }
     $this->link = $path ? new Link($path) : null;
     // If the item's URL is the same as request URI,
     // activate the item and it's parent nodes too.
     if (true === \Config::get('laravel-menu::options.auto_activate')) {
         if (\Request::url() == $this->url()) {
             $this->activate();
         }
     }
 }
开发者ID:eric925,项目名称:laravel-menu,代码行数:38,代码来源:Item.php

示例11: createEntity

 /**
  * @param array $data
  * @return Campaign
  */
 public function createEntity($data = array())
 {
     $final = [];
     foreach ($data as $key => $value) {
         $newKey = camel_case($key);
         // sort out dates
         if ($newKey == 'createdAt') {
             $value = new DateTime($value);
         }
         if ($newKey == 'updatedAt') {
             $value = new DateTime($value);
         }
         // sort out emails
         if ($newKey == 'fromEmail') {
             $value = new Email($value);
         }
         if ($newKey == 'replyToEmail') {
             if ($value) {
                 $value = new Email($value);
             } else {
                 continue;
             }
         }
         if ($newKey == 'bounceEmail') {
             if ($value) {
                 $value = new Email($value);
             } else {
                 continue;
             }
         }
         $final[$newKey] = $value;
     }
     return new Campaign($final);
 }
开发者ID:alistairshaw,项目名称:ambitiousmail-relay,代码行数:38,代码来源:CampaignFactory.php

示例12: validateName

 /**
  * Check if name is not snake case.
  *
  * @param string $name
  * @param string $definedClass
  * @return boolean
  */
 public function validateName($name, $definedClass)
 {
     if ($name != camel_case($name)) {
         throw new Exception('Name "' . $name . '" (defined in class "' . $definedClass . '") is not a camel case name.');
     }
     return true;
 }
开发者ID:proai,项目名称:laravel-datamapper,代码行数:14,代码来源:EntityValidator.php

示例13: setUpModel

 protected function setUpModel(\Illuminate\Http\Request $request)
 {
     $uri = $request->route()->uri();
     $modelSlug = strpos($uri, '/') ? substr($uri, 0, strpos($uri, '/')) : $uri;
     $modelName = ucfirst(camel_case(str_singular($modelSlug)));
     $modules = new \Ormic\Modules();
     $module = $modules->getModuleOfModel($modelName);
     if ($module) {
         $modelClass = 'Ormic\\modules\\' . $module . '\\Model\\' . $modelName;
         $viewName = snake_case($module) . '::' . snake_case($modelName) . '.' . $this->currentAction;
     } else {
         $modelClass = 'Ormic\\Model\\' . $modelName;
         $viewName = snake_case($modelName) . '.' . $this->currentAction;
     }
     $this->model = new $modelClass();
     $this->model->setUser($this->user);
     try {
         $this->view = view($viewName);
     } catch (\InvalidArgumentException $ex) {
         try {
             $this->view = view('models.' . $this->currentAction);
         } catch (\InvalidArgumentException $ex) {
             // Still no view; give up.
             $this->view = view();
         }
     }
     $this->view->title = ucwords(str_replace('-', ' ', $modelSlug));
     $this->view->modelSlug = $modelSlug;
     $this->view->columns = $this->model->getColumns();
     $this->view->record = $this->model;
 }
开发者ID:samwilson,项目名称:ormic,代码行数:31,代码来源:ModelsController.php

示例14: listData

 /**
  * @param $query
  *
  * @return mixed
  */
 public function listData($query)
 {
     foreach ($this->search as $column => $search) {
         $query = $query->{'of' . ucfirst(camel_case(str_replace('.', '_', $column)))}($search);
     }
     return $query->orderBy($this->sort, $this->sortDirection)->select($this->tableName . '.*')->paginate($this->limit);
 }
开发者ID:arminsam,项目名称:SimpleUserManagement,代码行数:12,代码来源:DataTableTrait.php

示例15: stepsBeforeFilter

 public function stepsBeforeFilter(Route $route)
 {
     $routeStep = $this->getStepFromRoute($route);
     $this->stepSessionKey($route);
     $currentStep = $this->getCurrentStep();
     $state = 'complete';
     $this->stepsData = [];
     foreach ($this->steps as $step) {
         if ($step == $routeStep) {
             if ($state == 'disabled') {
                 return $this->stepNotAllowed();
             }
             $class = 'active';
             $state = 'disabled';
         }
         if ($step == $currentStep && $state != 'disabled') {
             $class = 'active';
             $state = 'disabled';
         } elseif ($step != $routeStep) {
             $class = $state;
         }
         $this->stepsData[$step] = ['class' => $class, 'action' => get_class() . '@get' . ucfirst(camel_case($step))];
     }
     $this->setCurrentStep($routeStep);
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:25,代码来源:StepController.php


注:本文中的camel_case函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。