本文整理汇总了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.");
}
示例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.");
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
}
示例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());
}
示例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);
}
}
}
}
示例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);
}
}
示例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;
}