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


PHP Filesystem::files方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     foreach ($this->files->files(storage_path() . '/views') as $file) {
         $this->files->delete($file);
     }
     $this->info('Views deleted from cache');
 }
开发者ID:sohelrana820,项目名称:mario-gomez,代码行数:12,代码来源:ViewsCommand.php

示例2: importTranslations

 public function importTranslations($replace = false)
 {
     $counter = 0;
     foreach ($this->files->directories($this->app->langPath()) as $langPath) {
         $locale = basename($langPath);
         foreach ($this->files->files($langPath) as $file) {
             $info = pathinfo($file);
             $group = $info['filename'];
             if (in_array($group, $this->config['exclude_groups'])) {
                 continue;
             }
             $translations = \Lang::getLoader()->load($locale, $group);
             if ($translations && is_array($translations)) {
                 foreach (array_dot($translations) as $key => $value) {
                     $value = (string) $value;
                     $translation = Translation::firstOrNew(array('locale' => $locale, 'group' => $group, 'key' => $key));
                     // Check if the database is different then the files
                     $newStatus = $translation->value === $value ? Translation::STATUS_SAVED : Translation::STATUS_CHANGED;
                     if ($newStatus !== (int) $translation->status) {
                         $translation->status = $newStatus;
                     }
                     // Only replace when empty, or explicitly told so
                     if ($replace || !$translation->value) {
                         $translation->value = $value;
                     }
                     $translation->save();
                     $counter++;
                 }
             }
         }
     }
     return $counter;
 }
开发者ID:txandy,项目名称:laravel-translation-manager,代码行数:33,代码来源:Manager.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach ($this->files->files(storage_path() . '/logs') as $file) {
         $this->files->delete($file);
     }
     $this->info('Log files deleted from storage');
 }
开发者ID:nmfzone,项目名称:donor-darah-pmi,代码行数:12,代码来源:StorageLogsClear.php

示例4: doNotOverwriteFile

 /**
  * Do not overwrite a migration file
  *
  * @access protected
  * @param string $filePath
  * @param string $name
  * @return void
  */
 protected function doNotOverwriteFile($filePath, $name)
 {
     foreach ($this->file->files($filePath) as $file) {
         if (strpos($file, $name) !== false) {
             throw new FileExistsException($file);
         }
     }
 }
开发者ID:ardyn,项目名称:zipcode,代码行数:16,代码来源:MigrationPublisher.php

示例5: deleteFilesOlderThanMinutes

 /**
  * @param int $minutes
  *
  * @return \Illuminate\Support\Collection
  */
 public function deleteFilesOlderThanMinutes(int $minutes) : Collection
 {
     $timeInPast = Carbon::now()->subMinutes($minutes);
     return collect($this->filesystem->files($this->directory))->filter(function ($file) use($timeInPast) {
         return Carbon::createFromTimestamp(filemtime($file))->lt($timeInPast);
     })->each(function ($file) {
         $this->filesystem->delete($file);
     });
 }
开发者ID:spatie,项目名称:laravel-directory-cleanup,代码行数:14,代码来源:DirectoryCleaner.php

示例6: firstRound

 /**
  * First round
  * @param $path
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function firstRound($path)
 {
     foreach ($this->file->files($path) as $file) {
         //Extension .php
         if (preg_match("|\\.php\$|", $file)) {
             $this->handle($this->file->get($file));
         }
     }
 }
开发者ID:thytanium,项目名称:model-generator,代码行数:14,代码来源:ModelGenerator.php

示例7: getCatalogs

 /**
  * @return array
  */
 public function getCatalogs()
 {
     $result = array();
     foreach ($this->filesystem->directories($this->getLangDir()) as $langPath) {
         foreach ($this->filesystem->files($langPath) as $file) {
             $catalog = str_replace($langPath . '/', '', $file);
             $catalog = preg_replace('/\\.php$/', '', $catalog);
             $result[$catalog] = $catalog;
         }
     }
     return array_keys($result);
 }
开发者ID:jlaso,项目名称:tradukoj-laravel,代码行数:15,代码来源:Manager.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $countries = $this->files->directories($this->path);
     $cities = [];
     foreach ($countries as $countryDirectory) {
         $states = $this->files->files($countryDirectory);
         $country = $this->last(explode(DIRECTORY_SEPARATOR, $countryDirectory));
         foreach ($states as $stateDirectory) {
             list($state, $_) = explode('.', $this->last(explode(DIRECTORY_SEPARATOR, $stateDirectory)));
             $data = $this->loader->load($country, $state, 'en');
             foreach ($data as $key => $name) {
                 $cities[] = ['name' => $name, 'code' => "{$country} {$state} {$key}", 'state_id' => "{$country} {$state}"];
             }
         }
     }
     $cities = Collection::make($cities);
     $hash = md5($cities->toJson());
     if (!$this->option('force') && $hash === $this->hash) {
         $this->line('No new city.');
         return false;
     }
     $cityCodes = $cities->pluck('code');
     $stateCodes = $cities->pluck('state_id')->unique();
     $stateIds = Collection::make(DB::table($this->states)->whereIn('code', $stateCodes)->pluck('id', 'code'));
     $cities = $cities->map(function ($item) use($stateIds) {
         $item['state_id'] = $stateIds->get($item['state_id']);
         return $item;
     });
     $existingCityIDs = Collection::make(DB::table($this->cities)->whereIn('code', $cityCodes)->pluck('id', 'code'));
     $cities = $cities->map(function ($item) use($existingCityIDs) {
         if ($existingCityIDs->has($item['code'])) {
             $item['id'] = $existingCityIDs->get($item['code']);
         }
         return $item;
     });
     $cities = $cities->groupBy(function ($item) {
         return array_has($item, 'id') ? 'update' : 'create';
     });
     DB::transaction(function () use($cities, $hash) {
         $create = Collection::make($cities->get('create'));
         $update = Collection::make($cities->get('update'));
         foreach ($create->chunk(static::QUERY_LIMIT) as $entries) {
             DB::table($this->cities)->insert($entries->toArray());
         }
         foreach ($update as $entries) {
             DB::table($this->cities)->where('id', $entries['id'])->update($entries);
         }
         $this->line("{$create->count()} cities created. {$update->count()} cities updated.");
         $this->files->put(storage_path(static::INSTALL_HISTORY), $hash);
     });
     return true;
 }
开发者ID:znck,项目名称:cities,代码行数:57,代码来源:UpdateCitiesCommand.php

示例9: migrate

 /**
  * Run package database migrations.
  * Thanks http://stackoverflow.com/questions/27759301/setting-up-integration-tests-in-a-laravel-package
  *
  * @return void
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     $packageMigrations = $fileSystem->files(__DIR__ . "/../../src/Migrations");
     $laravelMigrations = $fileSystem->files(__DIR__ . "/../../vendor/laravel/laravel/database/migrations");
     $migrationFiles = array_merge($laravelMigrations, $packageMigrations);
     foreach ($migrationFiles as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
 }
开发者ID:PYuen1029,项目名称:friendly,代码行数:19,代码来源:DatabaseTestCase.php

示例10: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     \DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) {
         $this->filesystem->requireOnce($file);
         $migrationClass = $this->classFinder->findClass($file);
         $migration = new $migrationClass();
         $migration->down();
         $migration->up();
     }
     $this->info("Merx tables migrated.");
     \DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
开发者ID:RemiCollin,项目名称:merx,代码行数:18,代码来源:MigrateDb.php

示例11: findAvailableTemplates

 /**
  * @param Theme $theme
  *
  * @return array
  */
 public function findAvailableTemplates(Theme $theme)
 {
     $files = $this->filesystem->files($theme->getTemplateDirectory());
     $templates = [];
     if (is_array($files)) {
         foreach ($files as $filename) {
             if (pathinfo($filename, PATHINFO_EXTENSION) === 'php') {
                 $templates[] = basename($filename, '.php');
             }
         }
     }
     return $templates;
 }
开发者ID:boomcms,项目名称:boom-core,代码行数:18,代码来源:Manager.php

示例12: findAvailableTemplates

 public function findAvailableTemplates(Theme $theme)
 {
     $files = $this->filesystem->files($theme->getTemplateDirectory());
     $templates = [];
     if (is_array($files)) {
         foreach ($files as $file) {
             if (strpos($file, '.php') !== false) {
                 $file = str_replace($theme->getTemplateDirectory() . '/', '', $file);
                 $templates[] = str_replace('.php', '', $file);
             }
         }
     }
     return $templates;
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:14,代码来源:Manager.php

示例13: migrate

 /**
  * run package database migrations
  *
  * @return void
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . "/migrations") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
     foreach ($fileSystem->files(__DIR__ . "/seeds") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->run();
     }
 }
开发者ID:chalcedonyt,项目名称:laravel-cos-processor,代码行数:20,代码来源:TestFileGenerator.php

示例14: create

 /**
  * @param string $config
  * @return ImageManager->response
  */
 public function create($config = 'default')
 {
     $this->backgrounds = $this->files->files(base_path() . "/resources/assets/Captcha/backgrounds");
     $this->fonts = $this->files->files(base_path() . "/resources/assets/Captcha/fonts");
     $this->configure($config);
     $this->text = $this->generate();
     $this->canvas = $this->imageManager->canvas($this->width, $this->height, $this->bgColor);
     if ($this->bgImage) {
         $this->image = $this->imageManager->make($this->background())->resize($this->width, $this->height);
         $this->canvas->insert($this->image);
     } else {
         $this->image = $this->canvas;
     }
     if ($this->contrast != 0) {
         $this->image->contrast($this->contrast);
     }
     $this->text();
     $this->lines();
     if ($this->sharpen) {
         $this->image->sharpen($this->sharpen);
     }
     if ($this->invert) {
         $this->image->invert($this->invert);
     }
     if ($this->blur) {
         $this->image->blur($this->blur);
     }
     return $this->image->response('png', $this->quality);
 }
开发者ID:Ryangr0,项目名称:infinity-next,代码行数:33,代码来源:Captcha.php

示例15: parseDir

 private function parseDir($dir)
 {
     $items = array();
     $files = $this->files->files($dir);
     foreach ($files as $file) {
         $name = basename($file);
         $name = str_replace('.php', '', $name);
         $items[$name] = (require $file);
     }
     $dirs = $this->files->directories($dir);
     foreach ($dirs as $dir) {
         $name = basename($dir);
         $items[$name] = $this->parseDir($dir);
     }
     return $items;
 }
开发者ID:jildertmiedema,项目名称:translation-check,代码行数:16,代码来源:TranslationCheck.php


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