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


PHP studly_case函数代码示例

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


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

示例1: anyModule

 /**
  * Call Module action
  *
  * @param $name
  * @param $action
  * @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function anyModule($name, $action)
 {
     global $app;
     $name = strtolower($name);
     if (isset($app['arxmin.modules.' . $name])) {
         $model = $app['arxmin.modules.' . $name];
     } else {
         $model = "\\Arxmin\\" . ucfirst($name);
     }
     # force format action
     $method = studly_case($action);
     if ((class_exists($model, false) || is_object($model)) && method_exists($model, $method)) {
         $params = Request::segments();
         for ($i = 0; $i <= array_search($action, $params); $i++) {
             unset($params[$i]);
         }
         if (count(Input::all())) {
             $params[] = Input::all();
         }
         $response = call_user_func_array(array($model, $method), $params);
         if (is_object($response) && method_exists($response, 'toArray')) {
             $response = $response->toArray();
         }
         return Api::responseJson($response);
     }
     return Response::json(Api::response([], 400, "method not found"), 400);
 }
开发者ID:php-arx,项目名称:arxmin,代码行数:34,代码来源:ApiController.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $studly_name = studly_case($name);
     $directive_name = strtolower(substr($studly_name, 0, 1)) . substr($studly_name, 1);
     $html = file_get_contents(__DIR__ . '/Stubs/AngularDirective/directive.html.stub');
     $js = file_get_contents(__DIR__ . '/Stubs/AngularDirective/directive.js.stub');
     $definition = file_get_contents(__DIR__ . '/Stubs/AngularDirective/definition.js.stub');
     $less = file_get_contents(__DIR__ . '/Stubs/AngularDirective/directive.less.stub');
     $js = str_replace('{{StudlyName}}', $studly_name, $js);
     $definition = str_replace('{{StudlyName}}', $studly_name, $definition);
     $definition = str_replace('{{name}}', $name, $definition);
     $definition = str_replace('{{directiveName}}', $directive_name, $definition);
     $folder = __DIR__ . '/../../../angular/directives/' . $name;
     if (is_dir($folder)) {
         $this->info('Folder already exists');
         return false;
     }
     //create folder
     File::makeDirectory($folder, 0775, true);
     //create view (.html)
     File::put($folder . '/' . $name . '.html', $html);
     //create definition (.js)
     File::put($folder . '/definition.js', $definition);
     //create controller (.js)
     File::put($folder . '/' . $name . '.js', $js);
     //create less file (.less)
     File::put($folder . '/' . $name . '.less', $less);
     $this->info('Directive created successfully.');
 }
开发者ID:geracam,项目名称:laravel5-angular-material-starter,代码行数:35,代码来源:AngularDirective.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $table_name = strtolower($this->argument('name'));
     $migration = "create_{$table_name}_table";
     // The template file is the migration that ships with the package
     $template_dir = __DIR__;
     $template_file = 'SchemaTemplate.php';
     $template_path = $template_dir . '/' . $template_file;
     // Make sure the template path exists
     if (!$this->fs->exists($template_path)) {
         return $this->error('Unable to find template: ' . $template_path);
     }
     // Set the Destination Directory
     $dest_dir = base_path() . '/database/migrations/';
     $dest_file = date("Y_m_d_His") . '_' . $migration . '.php';
     $dest_path = $dest_dir . $dest_file;
     // Make Sure the Destination Directory exists
     if (!$this->fs->isDirectory($dest_dir)) {
         return $this->error('Unable to find destination directory: ' . $dest_dir);
     }
     // Read Template File
     $template = $this->fs->get($template_path);
     // Replace what is necessary
     $classname = 'Create' . studly_case(ucfirst($table_name)) . 'Table';
     $contents = str_replace("'__meta__'", "'" . $table_name . "'", $template);
     $contents = str_replace('SchemaTemplate', $classname, $contents);
     // Write new Migration to destination
     $this->fs->put($dest_path, $contents);
     // Dump-Autoload
     //        $this->call('dump-autoload');
     $this->info($table_name . ' migration created. run "php artisan migrate" to create the table');
 }
开发者ID:RonnyLV,项目名称:eloquent-meta,代码行数:37,代码来源:CreateMetaTableCommand.php

示例4: handleRule

 /**
  * Separate rule name from parameters and pass to matcher class to evaluate.
  *
  * @return boolean
  */
 protected function handleRule($request, $rule)
 {
     $rule = explode(':', $rule);
     $params = isset($rule[1]) ? $rule[1] : null;
     $class = '\\PeterColes\\Themes\\Matchers\\' . studly_case($rule[0]);
     return (new $class())->handle($request, $params);
 }
开发者ID:petercoles,项目名称:themes,代码行数:12,代码来源:Themes.php

示例5: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $studly_name = studly_case($name);
     $js = file_get_contents(__DIR__ . '/Stubs/AngularService/service.js.stub');
     $spec = file_get_contents(__DIR__ . '/Stubs/AngularService/service.spec.js.stub');
     $js = str_replace('{{StudlyName}}', $studly_name, $js);
     $spec = str_replace('{{StudlyName}}', $studly_name, $spec);
     $folder = base_path(config('generators.source.root')) . '/' . config('generators.source.services');
     $spec_folder = base_path(config('generators.tests.source.root')) . '/' . config('generators.tests.source.services');
     //create service (.service.js)
     File::put($folder . '/' . $name . config('generators.suffix.service'), $js);
     if (!$this->option('no-spec') && config('generators.tests.enable.services')) {
         //create spec folder
         if (!File::exists($spec_folder)) {
             File::makeDirectory($spec_folder, 0775, true);
         }
         //create spec (.service.spec.js)
         File::put($spec_folder . '/' . $name . '.service.spec.js', $spec);
     }
     //import service
     $services_index = base_path(config('generators.source.root')) . '/index.services.js';
     if (config('generators.misc.auto_import') && !$this->option('no-import') && file_exists($services_index)) {
         $services = file_get_contents($services_index);
         $newService = "\r\n\t.service('{$studly_name}Service', {$studly_name}Service)";
         $module = "angular.module('app.services')";
         $services = str_replace($module, $module . $newService, $services);
         $services = 'import {' . $studly_name . "Service} from './services/{$name}.service';\n" . $services;
         file_put_contents($services_index, $services);
     }
     $this->info('Service created successfully.');
 }
开发者ID:jadjoubran,项目名称:laravel-ng-artisan-generators,代码行数:37,代码来源:AngularService.php

示例6: handle

 /**
  * Handle the command.
  *
  * Add a default Module route, language entries etc per Module
  *
  */
 public function handle()
 {
     $module = $this->module;
     $dest = $module->getPath();
     $data = ['config' => _config('builder', $module), 'vendor' => $module->getVendor(), 'module_name' => studly_case($module->getSlug())];
     $src = __DIR__ . '/../../resources/stubs/module';
     try {
         if (_config('builder.landing_page', $module)) {
             /* adding routes to the module service provider class
                (currently, just for the optional landing (home) page) */
             $this->processFile("{$dest}/src/" . $data['module_name'] . 'ModuleServiceProvider.php', ['routes' => $src . '/routes.php'], $data);
             /* adding sections to the module class
                (currently, just for the optional landing (home) page)*/
             $this->processFile("{$dest}/src/" . $data['module_name'] . 'Module.php', ['sections' => $src . '/sections.php'], $data, true);
         }
         /* generate sitemap for the module main stream */
         if ($stream_slug = _config('builder.sitemap.stream_slug', $module)) {
             $data['entity_name'] = studly_case(str_singular($stream_slug));
             $data['repository_name'] = str_plural($stream_slug);
             $this->files->parseDirectory("{$src}/config", "{$dest}/resources/config", $data);
         }
         /* adding module icon */
         $this->processVariable("{$dest}/src/" . $data['module_name'] . 'Module.php', ' "' . _config('builder.icon', $module) . '"', 'protected $icon =', ';');
     } catch (\PhpParser\Error $e) {
         die($e->getMessage());
     }
 }
开发者ID:websemantics,项目名称:entity_builder-extension,代码行数:33,代码来源:ModifyModule.php

示例7: setTable

 /**
  * Set table name
  *
  * @param  string  $table
  *
  * @return self
  */
 private function setTable($table)
 {
     $this->table = strtolower($table);
     $this->migrationName = snake_case($this->table);
     $this->className = studly_case($this->migrationName);
     return $this;
 }
开发者ID:arcanedev,项目名称:moduly,代码行数:14,代码来源:ModuleMakeMigrationHandler.php

示例8: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     /** @var \Illuminate\Config\Repository $config */
     $config = $this->app->make('config');
     $this->app->singleton('Intervention\\Image\\ImageManager', function (Application $app) {
         return new ImageManager(array('driver' => $app->config->get('imager::driver', 'gd')));
     });
     $this->app->bind('TippingCanoe\\Imager\\Repository\\Image', 'TippingCanoe\\Imager\\Repository\\DbImage');
     $this->app->singleton('TippingCanoe\\Imager\\Service', function (Application $app) use($config) {
         //
         // Amazon S3
         //
         if ($s3Config = $config->get('imager::s3')) {
             $this->app->bind('Aws\\S3\\S3Client', function (Application $app) use($s3Config) {
                 return \Aws\S3\S3Client::factory($s3Config);
             });
         }
         // Run through and call each config option as a setter on the storage method.
         $storageDrivers = [];
         foreach ($config->get('imager::storage', []) as $abstract => $driverConfig) {
             /** @var \TippingCanoe\Imager\Storage\Driver $driver */
             $driver = $app->make($abstract);
             foreach ($driverConfig as $property => $value) {
                 $setter = studly_case('set_' . $property);
                 $driver->{$setter}($value);
             }
             $storageDrivers[$abstract] = $driver;
         }
         $service = new Service($app->make('TippingCanoe\\Imager\\Repository\\Image'), $app->make('Intervention\\Image\\ImageManager'), $app, $storageDrivers);
         return $service;
     });
 }
开发者ID:tippingcanoe,项目名称:imager,代码行数:37,代码来源:ServiceProvider.php

示例9: camel_case

 function camel_case($value)
 {
     if (isset($camelCache[$value])) {
         return $camelCache[$value];
     }
     return $camelCache[$value] = lcfirst(studly_case($value));
 }
开发者ID:baocaixiong,项目名称:aliyun-mqs-lib,代码行数:7,代码来源:helpers.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->container['slug'] = strtolower($this->argument('slug'));
     $this->container['namespace'] = studly_case($this->container['slug']);
     $this->container['modelName'] = studly_case($this->argument('model'));
     $this->container['tableName'] = $this->container['slug'] . '_' . strtolower($this->container['modelName']);
     $this->container['className'] = studly_case($this->container['modelName']);
     if ($this->module->exists($this->container['slug'])) {
         $filename = $this->getDestinationFile();
         $dir = pathinfo($filename, PATHINFO_DIRNAME);
         if (!is_dir($dir)) {
             mkdir($dir, 0777, true);
             $this->line("<info>Created missing directory:</info> {$dir}");
         }
         if (file_exists($filename)) {
             $this->line('File already exist.');
             if ($this->confirm('Do you want to overwrite the file? [y|N]')) {
                 $this->createFile();
             } else {
                 return $this->info('File not overwritten.');
             }
         } else {
             $this->createFile();
         }
         return $this->line("<info>Created model for module:</info> {$filename}");
     }
     return $this->error('Module does not exist.');
 }
开发者ID:gerardreches,项目名称:platonic-generators,代码行数:33,代码来源:MakeModelCommand.php

示例11: createMigration

 /**
  * Build the class name from the migration file.
  *
  * @todo Find a better way than doing this. This feels so icky all over
  *       whenever I look back at this.
  *       Maybe I can find something that's actually in native Laravel
  *       database classes.
  *
  * @param  string  $file
  * @return Migration
  */
 private function createMigration(string $file)
 {
     $basename = str_replace('.php', '', class_basename($file));
     $filename = substr($basename, 18);
     $classname = studly_case($filename);
     return new $classname();
 }
开发者ID:thirteen,项目名称:testbench,代码行数:18,代码来源:DatabaseMigrations.php

示例12: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $studly_name = studly_case($name);
     $component_name = strtolower(substr($studly_name, 0, 1)) . substr($studly_name, 1);
     $html = file_get_contents(__DIR__ . '/Stubs/AngularComponent/component.html.stub');
     $js = file_get_contents(__DIR__ . '/Stubs/AngularComponent/component.js.stub');
     $less = file_get_contents(__DIR__ . '/Stubs/AngularComponent/component.less.stub');
     $js = str_replace('{{StudlyName}}', $studly_name, $js);
     $js = str_replace('{{name}}', $name, $js);
     $js = str_replace('{{componentName}}', $component_name, $js);
     $folder = base_path(config('generators.source.root')) . '/' . config('generators.source.components') . '/' . $name;
     if (is_dir($folder)) {
         $this->info('Folder already exists');
         return false;
     }
     //create folder
     File::makeDirectory($folder, 0775, true);
     //create view (.component.html)
     File::put($folder . '/' . $name . config('generators.prefix.componentView'), $html);
     //create component (.component.js)
     File::put($folder . '/' . $name . config('generators.prefix.component'), $js);
     //create less file (.less)
     File::put($folder . '/' . $name . '.less', $less);
     $this->info('Component created successfully.');
 }
开发者ID:edgji,项目名称:laravel-ng-artisan-generators,代码行数:31,代码来源:AngularComponent.php

示例13: mutateExtensionAttribute

 /**
  * Mutates and stores an attribute in array
  *
  * @param string $key
  * @param string $type
  * @return mixed
  */
 protected function mutateExtensionAttribute($key, $type)
 {
     $value = $this->getAttributeFromArray($key);
     $mutation = $this->{'make' . studly_case($type) . 'TypeMutation'}($value);
     $this->mutations[$key] = $mutation;
     return $mutation;
 }
开发者ID:NuclearCMS,项目名称:Hierarchy,代码行数:14,代码来源:NodeSourceExtension.php

示例14: generate

 protected function generate($type)
 {
     switch ($type) {
         case 'controller':
             $filename = studly_case(class_basename($this->getNameInput()) . ucfirst($type));
             break;
         case 'model':
             $filename = studly_case(class_basename($this->getNameInput()));
             break;
         case 'view':
             $filename = 'index.blade';
             break;
         case 'translation':
             $filename = 'example';
             break;
         case 'routes':
             $filename = 'routes';
             break;
     }
     // $suffix = ($type == 'controller') ? ucfirst($type) : '';
     $folder = $type != 'routes' ? ucfirst($type) . 's\\' . ($type === 'translation' ? 'en\\' : '') : '';
     $name = $this->parseName('Modules\\' . $this->getNameInput() . '\\' . $folder . $filename);
     if ($this->files->exists($path = $this->getPath($name))) {
         return $this->error($this->type . ' already exists!');
     }
     $this->currentStub = __DIR__ . '/stubs/' . $type . '.stub';
     $this->makeDirectory($path);
     $this->files->put($path, $this->buildClass($name));
 }
开发者ID:kamenevn,项目名称:L5Modular,代码行数:29,代码来源:ModuleMakeCommand.php

示例15: makeGroup

 /**
  * Simplify the process of routes registration
  *
  * @param Router $router
  * @param $name
  */
 protected function makeGroup(Router $router, $name)
 {
     $groupOpts = ['namespace' => $this->namespace . '\\' . studly_case($name), 'prefix' => $name, 'middleware' => ['web']];
     $router->group($groupOpts, function ($router) use($name) {
         require app_path('Http/routes/' . $name . '.php');
     });
 }
开发者ID:ionutmilica,项目名称:blogging-platform-laravel5,代码行数:13,代码来源:RouteServiceProvider.php


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