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


PHP FileSystem::dumpFile方法代码示例

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


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

示例1: write

 /**
  * Write a file
  *
  * @param string $path The directory to put the file in (in the current destination)
  * @param string $content The file content
  * @param string $filename The file name
  * @param string $extension The file extension
  */
 public function write($path, $content, $extension = 'html', $filename = 'index')
 {
     $directory = sprintf('%s/%s', $this->destination, trim($path, '/'));
     $file = sprintf('%s.%s', $filename, $extension);
     if (!$this->files->exists($directory)) {
         $this->files->mkdir($directory);
     }
     $this->files->dumpFile(sprintf('%s/%s', $directory, $file), $content);
 }
开发者ID:phpillip,项目名称:phpillip,代码行数:17,代码来源:Builder.php

示例2: highlight

 /**
  * Highlight a portion of code with pygmentize
  *
  * @param string $value
  * @param string $language
  *
  * @return string
  */
 public function highlight($value, $language)
 {
     $path = tempnam($this->tmp, 'pyg');
     if ($language === 'php' && substr($value, 0, 5) !== '<?php') {
         $value = '<?php ' . PHP_EOL . $value;
     }
     $this->files->dumpFile($path, $value);
     $value = $this->pygmentize($path, $language);
     unlink($path);
     if (preg_match('#^<div class="highlight"><pre>#', $value) && preg_match('#</pre></div>$#', $value)) {
         return substr($value, 28, strlen($value) - 40);
     }
     return $value;
 }
开发者ID:phpillip,项目名称:phpillip,代码行数:22,代码来源:Pygments.php

示例3: testCleanUp

 public function testCleanUp()
 {
     $fs = new FileSystem();
     $fs->dumpFile($this->tmpDir . '/dummy-file', 'Dummy content.');
     $dw = new FilesystemDataWriter(new Filesystem(), $this->tmpDir);
     $dw->setUp();
     $this->assertFileNotExists($this->tmpDir . '/dummy-file');
 }
开发者ID:spress,项目名称:spress-core,代码行数:8,代码来源:FilesystemDataWriterTest.php

示例4: save

 public function save()
 {
     $items = array();
     foreach ($this->instances as $key => $instance) {
         $items[$key] = $this->encodeItem($instance);
     }
     $this->fs->dumpFile($this->getFile(), $this->encodeDocument($items), $this->getFileMode());
 }
开发者ID:eileenmcnaughton,项目名称:amp,代码行数:8,代码来源:FileRepository.php

示例5: setSystemCrontab

 protected function setSystemCrontab(OutputInterface $output, $newContents)
 {
     $tempCronFileName = '/tmp/madrak_io_easy_cron_deployment.cron.' . time();
     $filesystem = new FileSystem();
     $filesystem->dumpFile($tempCronFileName, $newContents);
     $process = new Process('crontab ' . $tempCronFileName);
     try {
         $process->mustRun();
         return $process->getOutput();
     } catch (ProcessFailedException $e) {
         $this->outputFormattedBlock($output, ['Error!', 'There was an error while attempting to overwrite the existing crontab list.', $e->getMessage()], 'error');
         exit;
     }
 }
开发者ID:MadrakIO,项目名称:easy-cron-deployment-bundle,代码行数:14,代码来源:AbstractCronCommand.php

示例6: generate

 /**
  * @param FormMetadata $formMetadata
  * @return string
  */
 public function generate(FormMetadata $formMetadata)
 {
     $formMetadata->setCode($this->view->render('templates/class.php.twig', ['form' => $formMetadata]));
     $this->fileSystem->mkdir($formMetadata->classDirectory());
     $this->fileSystem->dumpFile($formMetadata->classFilename(), $formMetadata->code());
 }
开发者ID:comphppuebla,项目名称:easy-forms,代码行数:10,代码来源:FormGenerator.php

示例7: writeDrushAlias

 /**
  * Writes a local drush alias file.
  */
 public function writeDrushAlias()
 {
     $drush_alias_file_path = "{$_SERVER['HOME']}/.drush/{$this->app->name}.aliases.drushrc.php";
     $drush_alias_file = array();
     $drush_alias_file[] = '<?php';
     foreach ($this->app->environments as $environment_name => $environment) {
         $factory = new self($environment, $this->app);
         $path = "/source/" . $environment['document_root'];
         $drush_alias_file[] = '// DO NOT EDIT. This is generated by Terra. Any changes will be overridden when the environment is re-enabled.';
         $drush_alias_file[] = "\$aliases['{$environment_name}'] = array(";
         $drush_alias_file[] = "  'uri' => '{$factory->getHost()}:{$factory->getPort()}',";
         $drush_alias_file[] = "  'root' => '{$path}',";
         $drush_alias_file[] = "  'remote-host' => '{$factory->getHost()}',";
         $drush_alias_file[] = "  'remote-user' => 'root',";
         $drush_alias_file[] = "  'ssh-options' => '-p {$factory->getDrushPort()}',";
         $drush_alias_file[] = ');';
     }
     $fs = new FileSystem();
     try {
         $fs->dumpFile($drush_alias_file_path, implode("\n", $drush_alias_file));
         return true;
     } catch (IOException $e) {
         return false;
     }
 }
开发者ID:EclipseGc,项目名称:terra-app,代码行数:28,代码来源:EnvironmentFactory.php

示例8: writeConfig

 /**
  * Write the docker-compose.yml file.
  * @return bool
  */
 public function writeConfig()
 {
     // Create the app/environment folder
     $fs = new FileSystem();
     try {
         $fs->mkdir($this->getDockerComposePath());
     } catch (IOExceptionInterface $e) {
         return FALSE;
     }
     // Create the environments docker-compose file.
     $dumper = new Dumper();
     try {
         $fs->remove($this->getDockerComposePath() . '/docker-compose.yml');
         $fs->dumpFile($this->getDockerComposePath() . '/docker-compose.yml', $dumper->dump($this->getDockerComposeArray(), 10));
         return TRUE;
     } catch (IOExceptionInterface $e) {
         return FALSE;
     }
 }
开发者ID:rabellamy,项目名称:terra-app,代码行数:23,代码来源:EnvironmentFactory.php

示例9: save

 public function save()
 {
     $this->load();
     $this->fs->dumpFile($this->getFile(), Yaml::dump($this->data), $this->getFileMode());
 }
开发者ID:eileenmcnaughton,项目名称:amp,代码行数:5,代码来源:ConfigRepository.php

示例10: writeBehatYamlFiles

 /**
  * Install Behat yaml files.
  *
  * @codeCoverageIgnore
  */
 protected function writeBehatYamlFiles()
 {
     $filesystem = new FileSystem();
     try {
         $filesystem->dumpFile($this->settings->getBaseDir() . '/behat.yml', $this->twig->render('behat.yml.dist', $this->settings->getArrayCopy()));
         $filesystem->dumpFile($this->settings->getBaseDir() . '/behat.dev.yml', $this->twig->render('behat.dev.yml.dist', $this->settings->getArrayCopy()));
     } catch (IOException $e) {
         $this->output->writeln(sprintf('<error>Could not write behat config file, error: "%s"</error>', $e->getMessage()));
         return;
     }
     $this->output->writeln('Behat configuration files are written');
 }
开发者ID:thangnvaltplus,项目名称:qa-tools-1,代码行数:17,代码来源:BehatConfigurator.php


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