本文整理汇总了PHP中Laravel\Bundle::identifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Bundle::identifier方法的具体用法?PHP Bundle::identifier怎么用?PHP Bundle::identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Laravel\Bundle
的用法示例。
在下文中一共展示了Bundle::identifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolve
/**
* Resolve a bundle and controller name to a controller instance.
*
* @param string $bundle
* @param string $controller
* @return Controller
*/
public static function resolve($bundle, $controller)
{
if (!static::load($bundle, $controller)) {
return;
}
$identifier = Bundle::identifier($bundle, $controller);
// If the controller is registered in the IoC container, we will resolve
// it out of the container. Using constructor injection on controllers
// via the container allows more flexible applications.
$resolver = 'controller: ' . $identifier;
if (IoC::registered($resolver)) {
return IoC::resolve($resolver);
}
$controller = static::format($bundle, $controller);
// If we couldn't resolve the controller out of the IoC container we'll
// format the controller name into its proper class name and load it
// by convention out of the bundle's controller directory.
if (Event::listeners(static::factory)) {
return Event::first(static::factory, $controller);
} else {
return new $controller();
}
}
示例2: resolve
/**
* Resolve a bundle and controller name to a controller instance.
*
* @param string $bundle
* @param string $controller
* @return Controller
*/
public static function resolve($bundle, $controller)
{
if (!static::load($bundle, $controller)) {
return;
}
$identifier = Bundle::identifier($bundle, $controller);
// If the controller is registered in the IoC container, we will resolve
// it out of the container. Using constructor injection on controllers
// via the container allows more flexible applications.
$resolver = 'controller: ' . $identifier;
if (IoC::registered($resolver)) {
return IoC::resolve($resolver);
}
// If we couldn't resolve the controller out of the IoC container we'll
// format the controller name into its proper class name and load it
// by convention out of the bundle's controller directory.
$controller = static::format($bundle, $controller);
$controller = new $controller();
// If the controller has specified a layout to be used when rendering
// views, we will instantiate the layout instance and set it to the
// layout property, replacing the string layout name.
if (!is_null($controller->layout)) {
$controller->layout = $controller->layout();
}
return $controller;
}
示例3: resolve
/**
* Resolve an instance of the given task name.
*
* <code>
* // Resolve an instance of a task
* $task = Command::resolve('application', 'migrate');
*
* // Resolve an instance of a task wtihin a bundle
* $task = Command::resolve('bundle', 'foo');
* </code>
*
* @param string $bundle
* @param string $task
* @return object
*/
public static function resolve($bundle, $task)
{
$identifier = Bundle::identifier($bundle, $task);
// First we'll check to see if the task has been registered in the
// application IoC container. This allows all dependencies to be
// injected into tasks for more testability.
if (IoC::registered("task: {$identifier}")) {
return IoC::resolve("task: {$identifier}");
}
// If the task file exists, we'll format the bundle and task name
// into a task class name and resolve an instance of the so that
// the requested method may be executed.
if (file_exists($path = Bundle::path($bundle) . 'tasks/' . $task . EXT)) {
require $path;
$task = static::format($bundle, $task);
return new $task();
}
}
示例4: resolve
public static function resolve($bundle, $controller)
{
if (!static::load($bundle, $controller)) {
return;
}
$identifier = Bundle::identifier($bundle, $controller);
$resolver = 'controller: ' . $identifier;
if (IoC::registered($resolver)) {
return IoC::resolve($resolver);
}
$controller = static::format($bundle, $controller);
if (Event::listeners(static::factory)) {
return Event::first(static::factory, $controller);
} else {
return new $controller();
}
}