當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filesystem\Filesystem類代碼示例

本文整理匯總了PHP中Illuminate\Filesystem\Filesystem的典型用法代碼示例。如果您正苦於以下問題:PHP Filesystem類的具體用法?PHP Filesystem怎麽用?PHP Filesystem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Filesystem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (!file_exists(base_path('resources/views/team/create.blade.php'))) {
         $this->line("\n\nPlease perform the starter command:\n");
         $this->info("\n\nphp artisan laracogs:starter\n");
         $this->line("\n\nThen one you're able to run the unit tests successfully re-run this command, to semantic ui your app :)\n");
     } else {
         $fileSystem = new Filesystem();
         $files = $fileSystem->allFiles(__DIR__ . '/../Packages/Semantic');
         $this->line("\n");
         foreach ($files as $file) {
             $this->line(str_replace(__DIR__ . '/../Packages/Semantic/', '', $file));
         }
         $this->info("\n\nThese files will be published\n");
         $result = $this->confirm('Are you sure you want to overwrite any files of the same name?');
         if ($result) {
             $this->copyPreparedFiles(__DIR__ . '/../Packages/Semantic/', base_path());
             $this->info("\nYou will need to install semantic-ui:");
             $this->comment('npm install semantic-ui');
             $this->info("\nWhen prompted, select automatic detection.");
             $this->info("\nWhen prompted, select your project location, default should be fine.");
             $this->info("\nWhen prompted, set the directory to:");
             $this->comment('semantic');
             $this->info("\nThen run:");
             $this->comment('cd semantic && gulp build');
             $this->info("\nThen run:");
             $this->comment('cd ../ && gulp');
             $this->info("\nMake sure you set the PagesController@dashboard to use the following view:");
             $this->comment("'dashboard.main'");
             $this->info("\nFinished setting up semantic-ui in your app\n\n");
         } else {
             $this->info('You cancelled the laracogs semantic');
         }
     }
 }
開發者ID:YABhq,項目名稱:Laracogs,代碼行數:40,代碼來源:Semantic.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Filesystem $files)
 {
     $langDirectory = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR);
     $diff = [];
     foreach (ModulesLoader::getRegisteredModules() as $module) {
         if (!is_dir($module->getLocalePath()) or !$module->isPublishable()) {
             continue;
         }
         $locale = $this->input->getOption('locale');
         foreach ($files->directories($module->getLocalePath()) as $localeDir) {
             foreach ($files->allFiles($localeDir) as $localeFile) {
                 $vendorFileDir = $module->getKey() . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFile->getFilename();
                 $vendorFilePath = $langDirectory . $vendorFileDir;
                 if (file_exists($vendorFilePath)) {
                     $localArray = $files->getRequire($localeFile->getRealPath());
                     $vendorArray = $files->getRequire($vendorFilePath);
                     $array = array_keys_exists_recursive($localArray, $vendorArray);
                     $arrayDiff = '';
                     foreach (array_dot($array) as $key => $value) {
                         $arrayDiff .= "{$key}: {$value}\n";
                     }
                     if (empty($arrayDiff)) {
                         continue;
                     }
                     $diff[] = ['modules' . DIRECTORY_SEPARATOR . $vendorFileDir, 'vendor' . DIRECTORY_SEPARATOR . $vendorFileDir];
                     $diff[] = new TableSeparator();
                     $diff[] = [$arrayDiff, var_export(array_merge_recursive($array, $vendorArray), true)];
                     $diff[] = new TableSeparator();
                 }
             }
         }
     }
     $this->table($this->headers, $diff);
 }
開發者ID:KodiComponents,項目名稱:module-core,代碼行數:39,代碼來源:ModuleLocaleDiffCommand.php

示例3: it_returns_the_correct_information_on_failing_to_write_to_disk

 public function it_returns_the_correct_information_on_failing_to_write_to_disk(Filesystem $filesystem)
 {
     $path = "tests/Forms/FooBarForm.php";
     $renderedContents = "Rendered Template Contents";
     $filesystem->put($path, $renderedContents)->willReturn(false);
     $this->writeTemplate($filesystem, $renderedContents, $path)->shouldReturn(['status' => 'fail', 'path' => $path]);
 }
開發者ID:GrandadEvans,項目名稱:laravel-form-validator,代碼行數:7,代碼來源:OutputBuilderSpec.php

示例4: handle

 /**
  * Handle the command.
  *
  * @param Filesystem $files
  */
 public function handle(Filesystem $files)
 {
     $path = $this->fieldType->getStoragePath();
     if ($path && $files->isDirectory(dirname($path))) {
         $files->deleteDirectory(dirname($path));
     }
 }
開發者ID:ramcda,項目名稱:markdown-field_type,代碼行數:12,代碼來源:DeleteDirectory.php

示例5: tearDown

 /**
  * Tears down the fixture, for example, close a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     $filesystem = new Filesystem();
     $filesystem->deleteDirectory(tests_path() . DIRECTORY_SEPARATOR . 'Http');
     unset($this->generator);
     parent::tearDown();
 }
開發者ID:ootatter,項目名稱:laravel-make-testcase,代碼行數:11,代碼來源:GeneratorTest.php

示例6: getExtensions

 /**
  * Extension list.
  *
  * @return \Illuminate\Support\Collection
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function getExtensions()
 {
     if ($this->extensions->isEmpty()) {
         if ($this->files->isDirectory($this->getExtensionPath()) && !empty($vendors = $this->files->directories($this->getExtensionPath()))) {
             collect($vendors)->each(function ($vendor) {
                 if ($this->files->isDirectory($vendor) && !empty($directories = $this->files->directories($vendor))) {
                     collect($directories)->each(function ($directory) {
                         if ($this->files->exists($file = $directory . DIRECTORY_SEPARATOR . 'composer.json')) {
                             $package = new Collection(json_decode($this->files->get($file), true));
                             if (Arr::get($package, 'type') == 'notadd-extension' && ($name = Arr::get($package, 'name'))) {
                                 $extension = new Extension($name);
                                 $extension->setAuthor(Arr::get($package, 'authors'));
                                 $extension->setDescription(Arr::get($package, 'description'));
                                 if ($entries = data_get($package, 'autoload.psr-4')) {
                                     foreach ($entries as $namespace => $entry) {
                                         $extension->setEntry($namespace . 'Extension');
                                     }
                                 }
                                 $this->extensions->put($directory, $extension);
                             }
                         }
                     });
                 }
             });
         }
     }
     return $this->extensions;
 }
開發者ID:notadd,項目名稱:framework,代碼行數:34,代碼來源:ExtensionManager.php

示例7:

 function it_can_have_custom_fields(Filesystem $filesystem)
 {
     $this->setPath('path/to/file.md');
     $filesystem->get('path/to/file.md')->shouldBeCalled()->willReturn("---\r\nfoofield: foo\r\nbarfield: bar\r\n---\r\nContent'");
     $this->getCustomField('foofield')->shouldBe('foo');
     $this->getCustomField('barfield')->shouldBe('bar');
 }
開發者ID:jamesflight,項目名稱:markaround,代碼行數:7,代碼來源:MarkdownFileSpec.php

示例8: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $fullPath = $this->createBaseMigration();
     $this->files->put($fullPath, $this->files->get(__DIR__ . '/stubs/notifications.stub'));
     $this->info('Migration created successfully!');
     $this->composer->dumpAutoloads();
 }
開發者ID:davidhemphill,項目名稱:framework,代碼行數:12,代碼來源:NotificationTableCommand.php

示例9: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach ($this->files->files(storage_path() . '/framework/sessions') as $file) {
         $this->files->delete($file);
     }
     $this->info('Session files deleted from storage');
 }
開發者ID:nmfzone,項目名稱:donor-darah-pmi,代碼行數:12,代碼來源:StorageSessionClear.php

示例10: findComposer

 /**
  * Get the composer command for the environment.
  *
  * @return string
  */
 protected function findComposer()
 {
     if ($this->files->exists($this->workingPath . '/composer.phar')) {
         return '"' . PHP_BINARY . '" composer.phar';
     }
     return 'composer';
 }
開發者ID:rodrigopbel,項目名稱:ong,代碼行數:12,代碼來源:Composer.php

示例11: update

 public function update($projectId, $fileId, $file, array $data)
 {
     try {
         if (is_null($file)) {
             $this->validator->setRules(['name' => 'required|max:255', 'description' => 'required']);
             $this->validator->with($data)->passesOrFail();
             $fileUpdate = $this->repository->findWhere(['project_id' => $projectId, 'id' => $fileId])->first();
             $fileUpdate->update($data, $fileId);
             return $this->find($projectId, $fileUpdate->id);
         }
         $this->validator->with($data)->passesOrFail();
         $fileUpdate = $this->repository->findWhere(['project_id' => $projectId, 'id' => $fileId])->first();
         $data['extension'] = $file->getClientOriginalExtension();
         $data['file'] = md5(date('Y-m-d H:i:s')) . "." . $data['extension'];
         $this->storage->put($data['file'], $this->filesystem->get($file));
         if ($this->storage->exists($fileUpdate->file)) {
             $this->storage->delete($fileUpdate->file);
         }
         $fileUpdate->update($data, $fileId);
         return $this->find($projectId, $fileUpdate->id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
開發者ID:netoudi,項目名稱:laravel-angularjs,代碼行數:26,代碼來源:ProjectFileService.php

示例12: jsonFileToArray

 /**
  * Grabs a json file and returns a array
  *
  * @param  string $path The path to the json file
  * @return array        The parsed array
  */
 public function jsonFileToArray($path)
 {
     // Get file contents
     $contents = $this->filesystem->get($path);
     // Return array
     return json_decode($contents, true);
 }
開發者ID:mojopollo,項目名稱:laravel-json-schema,代碼行數:13,代碼來源:MakeMigrationJson.php

示例13: loadPath

 /**
  * Load a locale from a given path.
  *
  * @param  string  $path
  * @param  string  $locale
  * @param  string  $group
  * @return array
  */
 protected function loadPath($path, $locale, $group)
 {
     if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) {
         return $this->files->getRequire($full);
     }
     return array();
 }
開發者ID:shinichi81,項目名稱:laravel4demo,代碼行數:15,代碼來源:FileLoader.php

示例14: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach (User::all() as $user) {
         if (!$user->rsaKey) {
             throw new \RuntimeException('user ' . $user->email . ' has no RSA key. Create it using key:generate:users');
         }
     }
     if (!$this->filesystem->exists(config('app.backup_key'))) {
         $this->warn('Backup key does not exist. We recommend that you create one using key:generate:master');
     }
     $entries = Entry::all();
     foreach ($entries as $entry) {
         $list = $this->accessDecider->getUserListForEntry($entry);
         if ($list->count() == 0) {
             throw new \RuntimeException('Entry #' . $entry->id . ' has no access. Share it.');
         }
     }
     foreach ($entries as $entry) {
         if ($entry->password != '') {
             continue;
         }
         echo $entry->id . '... ';
         $this->entryCrypt->encrypt($entry->password, $entry);
         echo ' encrypted!' . "\n";
     }
 }
開發者ID:vaulthq,項目名稱:vault,代碼行數:31,代碼來源:MigrateOld.php

示例15: stepDirectories

 public function stepDirectories($directory)
 {
     // Check for markers
     $alteredDirectoryName = $this->checkAndReplace($directory);
     // Move the directory and use the new name
     if ($directory !== $alteredDirectoryName) {
         exec("mv {$directory} {$alteredDirectoryName}");
         $directory = $alteredDirectoryName;
     }
     // For every file in the directory, rename and check content
     foreach ($this->files->allFiles($directory) as $file) {
         // Check for changes
         $alteredFilename = $this->checkAndReplace($file);
         // Rename file if it changed
         if ($file !== $alteredFilename) {
             rename($file, $alteredFilename);
             $file = $alteredFilename;
         }
         // Check the content in file, and rename as well
         file_put_contents($file, $this->checkAndReplace(file_get_contents($file)));
     }
     // Continue down the tree
     foreach ($this->files->directories($directory) as $childDirectory) {
         $this->stepDirectories($childDirectory);
     }
 }
開發者ID:viirre,項目名稱:laravel-module-generator,代碼行數:26,代碼來源:GenerateMakeCommand.php


注:本文中的Illuminate\Filesystem\Filesystem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。