本文整理汇总了PHP中Laravel\Bundle::class_prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Bundle::class_prefix方法的具体用法?PHP Bundle::class_prefix怎么用?PHP Bundle::class_prefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Laravel\Bundle
的用法示例。
在下文中一共展示了Bundle::class_prefix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stub
/**
* Get the stub migration with the proper class name.
*
* @param string $bundle
* @param string $migration
* @return string
*/
protected function stub($bundle, $migration)
{
$stub = File::get(Bundle::path('doctrine') . 'migration_stub' . EXT);
$prefix = Bundle::class_prefix($bundle);
// The class name is formatted simialrly to tasks and controllers,
// where the bundle name is prefixed to the class if it is not in
// the default "application" bundle.
$class = $prefix . Str::classify($migration);
return str_replace('{{class}}', $class, $stub);
}
示例2: resolve
/**
* Resolve an array of migration instances.
*
* @param array $migrations
* @return array
*/
protected function resolve($migrations)
{
$instances = array();
foreach ($migrations as $migration) {
$migration = (array) $migration;
// The migration array contains the bundle name, so we will get the
// path to the bundle's migrations and resolve an instance of the
// migration using the name.
$bundle = $migration['bundle'];
$path = Bundle::path($bundle) . 'migrations/';
// Migrations are not resolved through the auto-loader, so we will
// manually instantiate the migration class instances for each of
// the migration names we're given.
$name = $migration['name'];
require_once $path . $name . EXT;
// Since the migration name will begin with the numeric ID, we'll
// slice off the ID so we are left with the migration class name.
// The IDs are for sorting when resolving outstanding migrations.
//
// Migrations that exist within bundles other than the default
// will be prefixed with the bundle name to avoid any possible
// naming collisions with other bundle's migrations.
$prefix = Bundle::class_prefix($bundle);
$class = $prefix . \Laravel\Str::classify(substr($name, 18));
$migration = new $class();
// When adding to the array of instances, we will actually
// add the migration instance, the bundle, and the name.
// This allows the migrator to log the bundle and name
// when the migration is executed.
$instances[] = compact('bundle', 'name', 'migration');
}
// At this point the migrations are only sorted within their
// bundles so we need to resort them by name to ensure they
// are in a consistent order.
usort($instances, function ($a, $b) {
return strcmp($a['name'], $b['name']);
});
return $instances;
}
示例3: format
/**
* Format a bundle and controller identifier into the controller's class name.
*
* @param string $bundle
* @param string $controller
* @return string
*/
protected static function format($bundle, $controller)
{
return Bundle::class_prefix($bundle) . Str::classify($controller) . '_Controller';
}
示例4: format
/**
* Format a bundle and task into a task class name.
*
* @param string $bundle
* @param string $task
* @return string
*/
protected static function format($bundle, $task)
{
$prefix = Bundle::class_prefix($bundle);
return '\\' . $prefix . Str::classify($task) . '_Task';
}
示例5: format
/**
* Format a bundle and controller identifier into the Form's or Page's class name.
*
* @param string $bundle
* @param string $controller
*
* @return string
*/
protected static function format($bundle, $path, $type)
{
return Bundle::class_prefix($bundle) . Str::classify($path) . '_' . ucfirst($type);
}
示例6: stub
/**
* Get the stub migration with the proper class name.
*
* @param string $bundle
* @param string $migration
* @return string
*/
protected function stub($bundle, $migration)
{
$stub = File::get(path('sys') . 'cli/tasks/migrate/stub' . EXT);
// The class name is formatted simialrly to tasks and controllers,
// where the bundle name is prefixed to the class if it is not in
// the default bundle.
$class = Bundle::class_prefix($bundle) . Str::classify($migration);
return str_replace('{{class}}', $class, $stub);
}