當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。