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


PHP Bundle::name方法代码示例

本文整理汇总了PHP中Laravel\Bundle::name方法的典型用法代码示例。如果您正苦于以下问题:PHP Bundle::name方法的具体用法?PHP Bundle::name怎么用?PHP Bundle::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Laravel\Bundle的用法示例。


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

示例1: path

 /**
  * Get the path to a view on disk.
  *
  * @param $view
  *
  * @return string
  * @throws \Exception
  */
 protected function path($view)
 {
     $view = str_replace('.', '/', $view);
     $this->bundle_root = $root = Bundle::path(Bundle::name($view)) . 'views';
     $path = $root . DS . Bundle::element($view) . $this->template_ext;
     if (file_exists($path)) {
         $this->template = $view . $this->template_ext;
         return $path;
     }
     throw new \Exception("View [{$view}] does not exist.");
 }
开发者ID:SerdarSanri,项目名称:laravel-weed,代码行数:19,代码来源:view.php

示例2: path

 /**
  * Get the path to a given view on disk.
  *
  * @param  string  $view
  * @return string
  */
 protected function path($view)
 {
     $view = str_replace('.', '/', $view);
     $root = Bundle::path(Bundle::name($view)) . 'views/';
     // Views may have the normal PHP extension or the Blade PHP extension, so
     // we need to check if either of them exist in the base views directory
     // for the bundle and return the first one we find.
     foreach (array(EXT, BLADE_EXT) as $extension) {
         if (file_exists($path = $root . Bundle::element($view) . $extension)) {
             return $path;
         }
     }
     throw new \Exception("View [{$view}] does not exist.");
 }
开发者ID:richthegeek,项目名称:Sasshare,代码行数:20,代码来源:view.php

示例3: parse

 /**
  * Parse a language key into its bundle, file, and line segments.
  *
  * Language lines follow a {bundle}::{file}.{line} naming convention.
  *
  * @param  string  $key
  * @return array
  */
 protected function parse($key)
 {
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     // If there are not at least two segments in the array, it means that
     // the developer is requesting the entire language line array to be
     // returned. If that is the case, we'll make the item "null".
     if (count($segments) >= 2) {
         $line = implode('.', array_slice($segments, 1));
         return array($bundle, $segments[0], $line);
     } else {
         return array($bundle, $segments[0], null);
     }
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:22,代码来源:lang.php

示例4: parse

 /**
  * Parse a key and return its bundle, file, and key segments.
  *
  * Configuration items are named using the {bundle}::{file}.{item} convention.
  *
  * @param  string  $key
  * @return array
  */
 protected static function parse($key)
 {
     // First, we'll check the keyed cache of configuration items, as this will
     // be the fastest method of retrieving the configuration option. After an
     // item is parsed, it is always stored in the cache by its key.
     if (array_key_exists($key, static::$cache)) {
         return static::$cache[$key];
     }
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     // If there are not at least two segments in the array, it means that the
     // developer is requesting the entire configuration array to be returned.
     // If that is the case, we'll make the item field "null".
     if (count($segments) >= 2) {
         $parsed = array($bundle, $segments[0], implode('.', array_slice($segments, 1)));
     } else {
         $parsed = array($bundle, $segments[0], null);
     }
     return static::$cache[$key] = $parsed;
 }
开发者ID:richthegeek,项目名称:Sasshare,代码行数:28,代码来源:config.php

示例5: uses

 /**
  * Find the route that uses the given action.
  *
  * @param  string  $action
  * @return array
  */
 public static function uses($action)
 {
     // If the action has already been reverse routed before, we'll just
     // grab the previously found route to save time. They are cached
     // in a static array on the class.
     if (isset(static::$uses[$action])) {
         return static::$uses[$action];
     }
     Bundle::routes(Bundle::name($action));
     // To find the route, we'll simply spin through the routes looking
     // for a route with a "uses" key matching the action, and if we
     // find one, we cache and return it.
     foreach (static::routes() as $method => $routes) {
         foreach ($routes as $key => $value) {
             if (isset($value['uses']) and $value['uses'] === $action) {
                 return static::$uses[$action] = array($key => $value);
             }
         }
     }
 }
开发者ID:shawon922,项目名称:LaravelBackboneTodoMVC,代码行数:26,代码来源:router.php

示例6: get

 /**
  * Parse the filter string, returning the filter name and parameters.
  *
  * @param  string  $filter
  * @return array
  */
 public function get($filter)
 {
     // If the parameters were specified by passing an array into the collection,
     // then we will simply return those parameters. Combining passed parameters
     // with parameters specified directly in the filter attachment is not
     // currently supported by the framework.
     if (!is_null($this->parameters)) {
         return array($filter, $this->parameters());
     }
     // If no parameters were specified when the collection was created, we will
     // check the filter string itself to see if the parameters were injected
     // into the string as raw values, such as "role:admin".
     if (($colon = strpos(Bundle::element($filter), ':')) !== false) {
         $parameters = explode(',', substr(Bundle::element($filter), $colon + 1));
         // If the filter belongs to a bundle, we need to re-calculate the position
         // of the parameter colon, since we originally calculated it without the
         // bundle identifier because the identifier uses colons as well.
         if (($bundle = Bundle::name($filter)) !== DEFAULT_BUNDLE) {
             $colon = strlen($bundle . '::') + $colon;
         }
         return array(substr($filter, 0, $colon), $parameters);
     }
     // If no parameters were specified when the collection was created or
     // in the filter string, we will just return the filter name as is
     // and give back an empty array of parameters.
     return array($filter, array());
 }
开发者ID:bamper,项目名称:laravel.com,代码行数:33,代码来源:filter.php

示例7: uses

 public static function uses($action)
 {
     if (isset(static::$uses[$action])) {
         return static::$uses[$action];
     }
     Bundle::routes(Bundle::name($action));
     foreach (static::routes() as $method => $routes) {
         foreach ($routes as $key => $value) {
             if (isset($value['uses']) and $value['uses'] === $action) {
                 return static::$uses[$action] = array($key => $value);
             }
         }
     }
 }
开发者ID:laravelbook,项目名称:framework3,代码行数:14,代码来源:laravel_lite.php

示例8: parse

 protected function parse($key)
 {
     $bundle = Bundle::name($key);
     $segments = explode('.', Bundle::element($key));
     if (count($segments) >= 2) {
         $line = implode('.', array_slice($segments, 1));
         return array($bundle, $segments[0], $line);
     } else {
         return array($bundle, $segments[0], null);
     }
 }
开发者ID:laravelbook,项目名称:framework3,代码行数:11,代码来源:laravel_lite.php

示例9: isFresh

 /**
  * Returns true if the template is still fresh
  *
  * @param  string     $name  The template name
  * @param  timestamp  $time  The last modification time of the cached template
  * @return bool
  */
 public function isFresh($name, $time)
 {
     return filemtime($this->getPath(Bundle::name($name), Bundle::element($name))) < $time;
 }
开发者ID:SerdarSanri,项目名称:twig-bundle,代码行数:11,代码来源:loader.php


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