当前位置: 首页>>代码示例>>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;未经允许,请勿转载。