本文整理汇总了PHP中Laravel\Bundle::names方法的典型用法代码示例。如果您正苦于以下问题:PHP Bundle::names方法的具体用法?PHP Bundle::names怎么用?PHP Bundle::names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Laravel\Bundle
的用法示例。
在下文中一共展示了Bundle::names方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outstanding
/**
* Resolve all of the outstanding migrations for a bundle.
*
* @param string $bundle
* @return array
*/
public function outstanding($bundle = null)
{
$migrations = array();
// If no bundle was given to the command, we'll grab every bundle for
// the application, including the "application" bundle, which is not
// returned by "all" method on the Bundle class.
if (is_null($bundle)) {
$bundles = array_merge(Bundle::names(), array('application'));
} else {
$bundles = array($bundle);
}
foreach ($bundles as $bundle) {
// First we need to grab all of the migrations that have already
// run for this bundle, as well as all of the migration files
// for the bundle. Once we have these, we can determine which
// migrations are still outstanding.
$ran = $this->database->ran($bundle);
$files = $this->migrations($bundle);
// To find outstanding migrations, we will simply iterate over
// the migration files and add the files that do not exist in
// the array of ran migrations to the outstanding array.
foreach ($files as $key => $name) {
if (!in_array($name, $ran)) {
$migrations[] = compact('bundle', 'name');
}
}
}
return $this->resolve($migrations);
}
示例2: bundle
/**
* Generate documentation for a given bundles. If no bundles are provided
* documentation will be generated for all registered bundles.
*
* @param array $bundles
* @return void
*/
public function bundle(array $bundles = array())
{
// If no bundles are provided documentation will be generated for all
// registered bundles.
if (count($bundles) === 0) {
$bundles = Bundle::names();
}
// Remove any bundles that have not been registered, and give a
// warning for each one we come across.
$bundles = array_filter($bundles, function ($name) {
if (!Bundle::exists($name)) {
if ($name == DEFAULT_BUNDLE) {
return true;
}
echo "Bundle [{$name}] is not registered.", PHP_EOL;
return false;
}
return true;
});
// If there are no registered bundles then exit with a message
if (count($bundles) === 0) {
echo PHP_EOL, "Please register your bundles and try again.", PHP_EOL;
return;
}
// Get the options
$options = $this->config(array_map(array('Bundle', 'path'), $bundles));
// Run ApiGen
$this->apigen($options);
}
示例3: bundle
/**
* Run the tests for a given bundle.
*
* @param array $bundles
* @return void
*/
public function bundle($bundles = array())
{
if (count($bundles) == 0) {
$bundles = Bundle::names();
}
foreach ($bundles as $bundle) {
// To run PHPUnit for the application, bundles, and the framework
// from one task, we'll dynamically stub PHPUnit.xml files via
// the task and point the test suite to the correct directory
// based on what was requested.
if (is_dir($path = Bundle::path($bundle) . 'tests')) {
$this->stub($path);
$this->test();
}
}
}
示例4: find
/**
* Find a route by the route's assigned name.
*
* @param string $name
* @return array
*/
public static function find($name)
{
if (isset(static::$names[$name])) {
return static::$names[$name];
}
// If no route names have been found at all, we will assume no reverse
// routing has been done, and we will load the routes file for all of
// the bundles that are installed for the application.
if (count(static::$names) == 0) {
foreach (Bundle::names() as $bundle) {
Bundle::routes($bundle);
}
}
// To find a named route, we will iterate through every route defined
// for the application. We will cache the routes by name so we can
// load them very quickly the next time.
foreach (static::routes() as $method => $routes) {
foreach ($routes as $key => $value) {
if (isset($value['as']) and $value['as'] === $name) {
return static::$names[$name] = array($key => $value);
}
}
}
}
示例5: publish
/**
* Publish bundle assets to the public directory.
*
* @param array $bundles
* @return void
*/
public function publish($bundles)
{
if (count($bundles) == 0) {
$bundles = Bundle::names();
}
array_walk($bundles, array(IoC::resolve('bundle.publisher'), 'publish'));
}
示例6: find
public static function find($name)
{
if (isset(static::$names[$name])) {
return static::$names[$name];
}
if (count(static::$names) == 0) {
foreach (Bundle::names() as $bundle) {
Bundle::routes($bundle);
}
}
foreach (static::routes() as $method => $routes) {
foreach ($routes as $key => $value) {
if (isset($value['as']) and $value['as'] === $name) {
return static::$names[$name] = array($key => $value);
}
}
}
}