當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。