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


PHP Bundle::identifier方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:30,代码来源:controller.php

示例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;
 }
开发者ID:bamper,项目名称:laravel.com,代码行数:33,代码来源:controller.php

示例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();
     }
 }
开发者ID:richthegeek,项目名称:Sasshare,代码行数:33,代码来源:command.php

示例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();
     }
 }
开发者ID:laravelbook,项目名称:framework3,代码行数:17,代码来源:laravel_lite.php


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