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


PHP Filesystem::exists方法代码示例

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


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

示例1: findComposer

 /**
  * Get the composer command for the environment.
  *
  * @return string
  */
 protected function findComposer()
 {
     if ($this->files->exists($this->workingPath . '/composer.phar')) {
         return 'php ' . $this->workingPath . '/composer.phar';
     }
     return 'composer';
 }
开发者ID:developeryamhi,项目名称:laravel-admin,代码行数:12,代码来源:Composer.php

示例2: save

 public function save($item, $value, $environment, $group, $namespace = null)
 {
     $path = DIR_APPLICATION . '/config/generated_overrides';
     if (!$this->files->exists($path)) {
         $this->files->makeDirectory($path, 0777);
     } elseif (!$this->files->isDirectory($path)) {
         $this->files->delete($path);
         $this->files->makeDirectory($path, 0777);
     }
     if ($namespace) {
         $path = "{$path}/{$namespace}";
         if (!$this->files->exists($path)) {
             $this->files->makeDirectory($path, 0777);
         } elseif (!$this->files->isDirectory($path)) {
             $this->files->delete($path);
             $this->files->makeDirectory($path, 0777);
         }
     }
     $file = "{$path}/{$group}.php";
     $current = array();
     if ($this->files->exists($file)) {
         $current = $this->files->getRequire($file);
     }
     array_set($current, $item, $value);
     $renderer = new Renderer($current);
     return $this->files->put($file, $renderer->render()) !== false;
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:27,代码来源:FileSaver.php

示例3: execute

 /**
  * Execute the command.
  *
  * @param  InputInterface  $input
  * @param  OutputInterface  $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setIo($input, $output);
     /** @var Repository $config */
     $config = $this->container['config'];
     $sourceRepoPath = $config['source.directory'];
     $sourceRepoUrl = $config['source.git.url'];
     $sourceRepoBranch = $config['source.git.branch'];
     $this->checkSourceRepoSettings($sourceRepoPath, $sourceRepoUrl);
     $output->writeln(["<b>steak pull configuration:</b>", " Source repository remote is <path>{$sourceRepoUrl}</path>", " Source repository branch is <path>{$sourceRepoBranch}</path>", " Path to local repository is <path>{$sourceRepoPath}</path>"], OutputInterface::VERBOSITY_VERBOSE);
     if ($this->files->exists($sourceRepoPath)) {
         $workingCopy = $this->git->workingCopy($sourceRepoPath);
         if (!$workingCopy->isCloned()) {
             throw new RuntimeException("<path>{$sourceRepoPath}</path> exists but is not a git repository.");
         }
         if ($workingCopy->getBranches()->head() != $sourceRepoBranch) {
             throw new RuntimeException("<path>{$sourceRepoPath}</path> exists but isn't on the <path>{$sourceRepoBranch}</path> branch.");
         }
         $this->git->streamOutput();
         $workingCopy->pull();
     } else {
         $output->writeln(["The source directory <path>{$sourceRepoPath}</path> does not exist.", "  Attempting clone from {$sourceRepoUrl}"]);
         $this->git->streamOutput();
         $this->git->cloneRepository($sourceRepoUrl, $sourceRepoPath, ['single-branch' => true, 'branch' => $sourceRepoBranch]);
         $output->writeln("<info>Clone complete! Edit your sources in <path>{$sourceRepoPath}</path></info>");
     }
     $output->writeln("Try <comment>steak serve</comment> to fire up the local development server...");
 }
开发者ID:parsnick,项目名称:steak,代码行数:35,代码来源:PullCommand.php

示例4: delete

 public function delete()
 {
     if (!$this->filesystem->exists($this->path)) {
         return;
     }
     $this->filesystem->deleteDirectory($this->path);
 }
开发者ID:spatie,项目名称:laravel-backup,代码行数:7,代码来源:TemporaryDirectory.php

示例5: makeViews

 /**
  * Generate a fully fleshed out controller, if the user wishes.
  */
 public function makeViews()
 {
     $valid = false;
     $indexPath = $this->getPath($this->getClassName(), 'index');
     $this->makeDirectory($indexPath);
     $createPath = $this->getPath($this->getClassName(), 'create');
     $this->makeDirectory($createPath);
     $editPath = $this->getPath($this->getClassName(), 'edit');
     $this->makeDirectory($editPath);
     if (!$this->files->exists($indexPath)) {
         if ($this->files->put($indexPath, $this->compileViewStub('index'))) {
             $valid = true;
         }
     }
     if (!$this->files->exists($createPath)) {
         if ($this->files->put($createPath, $this->compileViewStub('create'))) {
             $valid = true;
         }
     }
     if (!$this->files->exists($editPath)) {
         if ($this->files->put($editPath, $this->compileViewStub('edit'))) {
             $valid = true;
         }
     }
     $masterPath = base_path() . '/resources/views/master.blade.php';
     $stub = $this->files->get(__DIR__ . '/../stubs/views/master.stub');
     if (!$this->files->exists($masterPath)) {
         if ($this->files->put($masterPath, $this->compileViewStub('master'))) {
             $valid = true;
         }
     }
     return $valid;
 }
开发者ID:ericcallan,项目名称:Laravel-5-Generators-Extended,代码行数:36,代码来源:ViewService.php

示例6: read

 /**
  * {@inheritdoc}
  */
 public function read($sessionId)
 {
     if ($this->files->exists($path = $this->path . '/' . $sessionId)) {
         return $this->files->get($path);
     }
     return '';
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:10,代码来源:FileSessionHandler.php

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

示例8: destroy

 /**
  * @param \Exolnet\Image\Imageable $image
  * @return bool
  */
 public function destroy(Imageable $image)
 {
     if ($this->filesystem->exists($image->getImagePath())) {
         return $this->filesystem->delete($image->getImagePath());
     }
     return true;
 }
开发者ID:eXolnet,项目名称:laravel-image,代码行数:11,代码来源:FilesystemRepository.php

示例9: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->prepareDatabase();
     $env = $this->option('env');
     if ($this->files->exists(database_path(config('smart-seeder.seedsDir')))) {
         $this->migrator->setEnv($env);
     }
     //otherwise use the default environment
     $this->migrator->setConnection($this->input->getOption('database'));
     $pretend = $this->input->getOption('pretend');
     while (true) {
         $count = $this->migrator->rollback($pretend);
         // Once the migrator has run we will grab the note output and send it out to
         // the console screen, since the migrator itself functions without having
         // any instances of the OutputInterface contract passed into the class.
         foreach ($this->migrator->getNotes() as $note) {
             $this->output->writeln($note);
         }
         if ($count == 0) {
             break;
         }
     }
     $this->line("Seeds reset for {$env}");
 }
开发者ID:mtahv3,项目名称:SmartSeeder,代码行数:32,代码来源:SeedResetCommand.php

示例10: getModules

 /**
  * Modules of installed or not installed.
  *
  * @param bool $installed
  *
  * @return \Illuminate\Support\Collection
  */
 public function getModules($installed = false)
 {
     if ($this->modules->isEmpty()) {
         if ($this->files->isDirectory($this->getModulePath()) && !empty($directories = $this->files->directories($this->getModulePath()))) {
             (new Collection($directories))->each(function ($directory) use($installed) {
                 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-module' && ($name = Arr::get($package, 'name'))) {
                         $module = new Module($name);
                         $module->setAuthor(Arr::get($package, 'authors'));
                         $module->setDescription(Arr::get($package, 'description'));
                         if ($installed) {
                             $module->setInstalled($installed);
                         }
                         if ($entries = data_get($package, 'autoload.psr-4')) {
                             foreach ($entries as $namespace => $entry) {
                                 $module->setEntry($namespace . 'ModuleServiceProvider');
                             }
                         }
                         $this->modules->put($directory, $module);
                     }
                 }
             });
         }
     }
     return $this->modules;
 }
开发者ID:notadd,项目名称:framework,代码行数:34,代码来源:ModuleManager.php

示例11: lastModified

 /**
  * Return the last modified timestamp of a view.
  *
  * @param string $name
  * @return integer
  * @throws FileNotFoundException
  */
 public function lastModified($name)
 {
     if (!$this->files->exists($name)) {
         throw new FileNotFoundException("{$name} does not exist");
     }
     return $this->files->lastModified($name);
 }
开发者ID:delatbabel,项目名称:viewpages,代码行数:14,代码来源:FilesystemLoader.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $model = ucfirst($this->argument('model'));
     $path = $this->option('path');
     if (empty($path)) {
         $path = database_path(config('smart-seeder.seedDir'));
     } else {
         $path = base_path($path);
     }
     $env = $this->option('env');
     if (!empty($env)) {
         $path .= "/{$env}";
     }
     if (!$this->files->exists($path)) {
         // mode 0755 is based on the default mode Laravel use.
         $this->files->makeDirectory($path, 755, true);
     }
     $created = date('Y_m_d_His');
     $path .= "/seed_{$created}_{$model}Seeder.php";
     $fs = $this->files->get(__DIR__ . '/stubs/DatabaseSeeder.stub');
     $namespace = rtrim($this->getAppNamespace(), '\\');
     $stub = str_replace('{{seeder}}', "seed_{$created}_" . $model . 'Seeder', $fs);
     $stub = str_replace('{{namespace}}', " namespace {$namespace};", $stub);
     $stub = str_replace('{{model}}', $model, $stub);
     $this->files->put($path, $stub);
     $message = "Seed created for {$model}";
     if (!empty($env)) {
         $message .= " in environment: {$env}";
     }
     $this->line($message);
 }
开发者ID:mtahv3,项目名称:SmartSeeder,代码行数:36,代码来源:SeedMakeCommand.php

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

示例14: get

 /**
  * @param string $locale
  * @param string $group
  * @return array
  */
 public function get($locale, $group)
 {
     if ($this->fs->exists($path = $this->path . "/{$locale}/{$group}.php")) {
         return $this->fs->getRequire($path);
     }
     return [];
 }
开发者ID:bweston92,项目名称:laravel-language-overrides,代码行数:12,代码来源:FileWriter.php

示例15: logInfo

 /**
  * write log
  * @param  string $logContent [logContent]
  * @param  string $logDirPath [filepath]
  */
 public function logInfo($logContent, $logDirPath)
 {
     $filesystem = new Filesystem();
     if (!$logContent || !$logDirPath) {
         return false;
     }
     if ($this->getMailLog()) {
         // log file all path
         $logPath = $logDirPath . $this->getLogName();
         if ($filesystem->exists($logPath)) {
             // everyDay new a file
             $content = $filesystem->get($logPath);
             if ($logTime = substr($content, 1, 10)) {
                 if (Carbon::now($this->local)->toDateString() == $logTime) {
                     $filesystem->append($logPath, $logContent . PHP_EOL);
                 } else {
                     $new_log_path = $logDirPath . $logTime . $this->getLogName();
                     if (!$filesystem->exists($new_log_path)) {
                         $filesystem->move($logPath, $new_log_path);
                     }
                     $filesystem->put($logPath, $logContent);
                 }
             }
         } else {
             $filesystem->put($logPath, $logContent);
         }
     }
 }
开发者ID:mrvokia,项目名称:mailhub,代码行数:33,代码来源:MailHubLogTrait.php


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