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


PHP Bundle::path方法代码示例

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


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

示例1: globSeedFiles

 /**
  * Get all of the files at a given path.
  *
  * @param string  $path
  * @return array
  */
 protected function globSeedFiles()
 {
     if (isset($this->seedFiles)) {
         return $this->seedFiles;
     }
     // If the seeds haven't been read before, we will glob the directories and sort
     // them alphabetically just in case the developer is using numbers to make
     // the seed run in a certain order based on their database design needs.
     $folders = array(path('app') . 'seeds' . DS);
     foreach (Bundle::$bundles as $bundle) {
         $folders[] = Bundle::path($bundle['location']) . 'seeds' . DS;
     }
     $files = array();
     foreach ($folders as $folder) {
         $files = array_merge($files, glob($folder . '*.php'));
     }
     if (false !== $this->getParameter('except')) {
         $exclude = explode(',', $this->getParameter('except'));
         foreach ($files as $key => $file) {
             if (in_array(pathinfo($file, PATHINFO_FILENAME), $exclude)) {
                 unset($files[$key]);
             }
         }
     }
     sort($files);
     return $this->seedFiles = $files;
 }
开发者ID:laravelbook,项目名称:framework3,代码行数:33,代码来源:seeder.php

示例2: upgrade

 /**
  * Upgrade the given bundles for the application.
  *
  * @param  array  $bundles
  * @return void
  */
 public function upgrade($bundles)
 {
     if (count($bundles) == 0) {
         $bundles = Bundle::names();
     }
     foreach ($bundles as $name) {
         if (!Bundle::exists($name)) {
             echo "Bundle [{$name}] is not installed!";
             continue;
         }
         // First we want to retrieve the information for the bundle, such as
         // where it is currently installed. This will allow us to upgrade
         // the bundle into it's current installation path.
         $location = Bundle::path($name);
         // If the bundle exists, we will grab the data about the bundle from
         // the API so we can make the right bundle provider for the bundle,
         // since we don't know the provider used to install.
         $response = $this->retrieve($name);
         if ($response['status'] == 'not-found') {
             continue;
         }
         // Once we have the bundle information from the API, we'll simply
         // recursively delete the bundle and then re-download it using
         // the correct provider assigned to the bundle.
         File::rmdir($location);
         $this->download($response['bundle'], $location);
         echo "Bundle [{$name}] has been upgraded!" . PHP_EOL;
     }
 }
开发者ID:richthegeek,项目名称:laravel,代码行数:35,代码来源:bundler.php

示例3: stub

 /**
  * Get the stub migration with the proper class name.
  *
  * @param  string  $bundle
  * @param  string  $migration
  * @return string
  */
 protected function stub($bundle, $migration)
 {
     $stub = File::get(Bundle::path('doctrine') . 'migration_stub' . EXT);
     $prefix = Bundle::class_prefix($bundle);
     // The class name is formatted simialrly to tasks and controllers,
     // where the bundle name is prefixed to the class if it is not in
     // the default "application" bundle.
     $class = $prefix . Str::classify($migration);
     return str_replace('{{class}}', $class, $stub);
 }
开发者ID:SerdarSanri,项目名称:doctrine-bundle,代码行数:17,代码来源:migrate.php

示例4: get_files

 /**
  * Get files for comparision editing
  *
  * @param string $name
  * @param string $location
  * @param string $translation
  * @return array
  */
 public static function get_files($name, $location, $translation)
 {
     $path = \Laravel\Bundle::path($location);
     if (!is_file($path . 'language/' . $translation . '/' . $name . '.php')) {
         return null;
     }
     $language['from'] = (require $path . 'language/' . \Laravel\Config::get('language-builder::builder.base_lang') . '/' . $name . '.php');
     $language['to'] = (require $path . 'language/' . $translation . '/' . $name . '.php');
     return $language;
 }
开发者ID:acmadi,项目名称:language-builder,代码行数:18,代码来源:utilities.php

示例5: 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

示例6: bundles

 /**
  * Load all the bundles with language files and get their paths
  *
  * @param string $lang
  * @return array
  */
 public static function bundles($lang = null)
 {
     $folders = array();
     // Get the bundle languages
     if ($bundles = \Laravel\Bundle::all()) {
         foreach ($bundles as $bundle) {
             if (is_dir(\Laravel\Bundle::path($bundle['location']) . '/language/' . $lang)) {
                 $folders[] = array('path' => \Laravel\Bundle::path($bundle['location']) . 'language/', 'name' => $bundle);
             }
         }
     }
     return $folders;
 }
开发者ID:acmadi,项目名称:language-builder,代码行数:19,代码来源:dir.php

示例7: 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

示例8: 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();
         }
     }
 }
开发者ID:perryhau,项目名称:Laravel-1,代码行数:22,代码来源:runner.php

示例9: migrations

 /**
  * Grab all of the migration filenames for a bundle.
  *
  * @param  string  $bundle
  * @return array
  */
 protected function migrations($bundle)
 {
     $files = glob(Bundle::path($bundle) . 'migrations/*_*' . EXT);
     // When open_basedir is enabled, glob will return false on an
     // empty directory, so we will return an empty array in this
     // case so the application doesn't bomb out.
     if ($files === false) {
         return array();
     }
     // Once we have the array of files in the migration directory,
     // we'll take the basename of the file and remove the PHP file
     // extension, which isn't needed.
     foreach ($files as &$file) {
         $file = str_replace(EXT, '', basename($file));
     }
     // We'll also sort the files so that the earlier migrations
     // will be at the front of the array and will be resolved
     // first by this class' resolve method.
     sort($files);
     return $files;
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:27,代码来源:resolver.php

示例10: load

 /**
  * Load the file for a given controller.
  *
  * @param  string  $bundle
  * @param  string  $controller
  * @return bool
  */
 protected static function load($bundle, $controller)
 {
     $controller = strtolower(str_replace('.', '/', $controller));
     if (file_exists($path = Bundle::path($bundle) . 'controllers/' . $controller . EXT)) {
         require_once $path;
         return true;
     }
     return false;
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:16,代码来源:controller.php

示例11: path

 /**
  * Get the path to a bundle's language file.
  *
  * @param  string  $bundle
  * @param  string  $language
  * @param  string  $file
  * @return string
  */
 protected static function path($bundle, $language, $file)
 {
     return Bundle::path($bundle) . "language/{$language}/{$file}" . EXT;
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:12,代码来源:lang.php

示例12: from

 /**
  * Get the "from" location of the bundle's assets.
  *
  * @param  string  $bundle
  * @return string
  */
 protected function from($bundle)
 {
     return Bundle::path($bundle) . 'public';
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:10,代码来源:publisher.php

示例13: make

 /**
  * Generate a new migration file.
  *
  * @param  array   $arguments
  * @return string
  */
 public function make($arguments = array())
 {
     if (count($arguments) == 0) {
         throw new \Exception("I need to know what to name the migration.");
     }
     list($bundle, $migration) = Bundle::parse($arguments[0]);
     // The migration path is prefixed with the date timestamp, which
     // is a better way of ordering migrations than a simple integer
     // incrementation, since developers may start working on the
     // next migration at the same time unknowingly.
     $prefix = date('Y_m_d_His');
     $path = Bundle::path($bundle) . 'migrations' . DS;
     // If the migration directory does not exist for the bundle,
     // we will create the directory so there aren't errors when
     // when we try to write the migration file.
     if (!is_dir($path)) {
         mkdir($path);
     }
     $file = $path . $prefix . '_' . $migration . EXT;
     File::put($file, $this->stub($bundle, $migration));
     echo "Great! New migration created!";
     // Once the migration has been created, we'll return the
     // migration file name so it can be used by the task
     // consumer if necessary for futher work.
     return $file;
 }
开发者ID:Shahriar1824,项目名称:laravel-tutorial,代码行数:32,代码来源:migrator.php

示例14: autoloads

 /**
  * Register the auto-loading configuration for a bundle.
  *
  * @param  string  $bundle
  * @param  array   $config
  * @return void
  */
 protected static function autoloads($bundle, $config)
 {
     $path = rtrim(Bundle::path($bundle), DS);
     foreach ($config['autoloads'] as $type => $mappings) {
         // When registering each type of mapping we'll replace the (:bundle)
         // place-holder with the path to the bundle's root directory, so
         // the developer may dryly register the mappings.
         $mappings = array_map(function ($mapping) use($path) {
             return str_replace('(:bundle)', $path, $mapping);
         }, $mappings);
         // Once the mappings are formatted, we will call the Autoloader
         // function matching the mapping type and pass in the array of
         // mappings so they can be registered and used.
         Autoloader::$type($mappings);
     }
 }
开发者ID:richthegeek,项目名称:Sasshare,代码行数:23,代码来源:bundle.php

示例15: paths

 /**
  * Get the array of configuration paths that should be searched for a bundle.
  *
  * @param  string  $bundle
  * @return array
  */
 protected static function paths($bundle)
 {
     $paths[] = Bundle::path($bundle) . 'config/';
     // Configuration files can be made specific for a given environment. If an
     // environment has been set, we will merge the environment configuration
     // in last, so that it overrides all other options.
     if (isset($_SERVER['LARAVEL_ENV'])) {
         $paths[] = $paths[count($paths) - 1] . $_SERVER['LARAVEL_ENV'] . '/';
     }
     return $paths;
 }
开发者ID:richthegeek,项目名称:Sasshare,代码行数:17,代码来源:config.php


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