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


PHP SplFileInfo::getFilename方法代码示例

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


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

示例1: handle

 /**
  * Convert a blade view into a site page.
  *
  * @param SplFileInfo $file
  *
  * @return void
  */
 public function handle(SplFileInfo $file, $viewsData)
 {
     $this->viewsData = $viewsData;
     $this->file = $file;
     $this->viewPath = $this->getViewPath();
     $this->directory = $this->getDirectoryPrettyName();
     $this->appendViewInformationToData();
     $content = $this->getFileContent();
     $this->filesystem->put(sprintf('%s/%s', $this->prepareAndGetDirectory(), ends_with($file->getFilename(), ['.blade.php', 'md']) ? 'index.html' : $file->getFilename()), $content);
     // copy images to public folder
     foreach ($file->images as $media) {
         $copyFrom = ORCA_CONTENT_DIR . "/{$file->getRelativePath()}/{$media}";
         $copyTo = "{$this->directory}/{$media}";
         if (!$this->filesystem->copy($copyFrom, $copyTo)) {
             echo "failed to copy {$media}...\n";
         }
     }
     // copy documents
     foreach ($file->documents as $media) {
         $copyFrom = ORCA_CONTENT_DIR . "/{$file->getRelativePath()}/{$media}";
         $copyTo = "{$this->directory}/{$media}";
         if (!$this->filesystem->copy($copyFrom, $copyTo)) {
             echo "failed to copy {$media}...\n";
         }
     }
 }
开发者ID:tao,项目名称:orca,代码行数:33,代码来源:BlogPostHandler.php

示例2: put

 public function put($src, $dest)
 {
     if (false === file_exists($src)) {
         throw new \InvalidArgumentException(sprintf('Resource \'%s\' does not exist', $src));
     }
     if (is_file($src) && is_dir($dest)) {
         $dest = $dest . DIRECTORY_SEPARATOR . basename($src);
     }
     if (is_file($src)) {
         $file = new \SplFileInfo($src);
         $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_PUT, new TransporterEvent($this, array('dest' => $dest, 'src' => $file->getPathname())));
         $pwd = dirname($dest);
         if (!is_dir($pwd)) {
             $this->mkdir($pwd);
         }
         copy($file->getPathname(), $dest);
     } else {
         if (!$this->exists($dest)) {
             $this->mkdir($dest);
         }
         $finder = new Finder();
         $test = $finder->in($src)->depth('== 0');
         foreach ($test as $file) {
             $this->put(rtrim($src, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file->getFilename(), rtrim($dest, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file->getFilename());
         }
     }
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:27,代码来源:FileTransporter.php

示例3: __construct

 /**
  * __construct 
  */
 protected function __construct(SplFileInfo $file, $relativePath = null)
 {
     $this->title = Content::filename_to_title($file->getFilename());
     $this->slug = Content::str_to_slug($file->getFilename());
     $relativePath = !is_null($relativePath) && !empty($relativePath) ? $relativePath : $file->getRelativePath();
     $this->path = $relativePath . (ends_with($relativePath, '/') ? '' : '/') . $this->slug;
     $this->file = $file;
 }
开发者ID:avvertix,项目名称:pronto-framework,代码行数:11,代码来源:SectionItem.php

示例4: getFileContent

 /**
  * Get the content of the file after rendering.
  *
  * @param SplFileInfo $file
  *
  * @return string
  */
 protected function getFileContent()
 {
     if (ends_with($this->file->getFilename(), '.blade.php')) {
         return $this->renderBlade();
     } elseif (ends_with($this->file->getFilename(), '.md')) {
         return $this->renderMarkdown();
     }
     return $this->file->getContents();
 }
开发者ID:tao,项目名称:orca,代码行数:16,代码来源:BaseHandler.php

示例5: detectSystem

 /**
  * try to verify a search result
  *
  * @param   SplFileInfo  $file  file to examine
  *
  * @return  bool|System
  */
 public function detectSystem(SplFileInfo $file)
 {
     if ($file->getFilename() == "system.info" && stripos($file->getContents(), 'project = "drupal"') !== false) {
         $path = new \SplFileInfo(dirname(dirname($file->getPath())));
         return new System($this->getName(), $path);
     }
     if ($file->getFilename() == "system.info.yml" && stripos($file->getContents(), "project: 'drupal'") !== false) {
         $path = new \SplFileInfo(dirname(dirname(dirname($file->getPath()))));
         return new System($this->getName(), $path);
     }
     return false;
 }
开发者ID:antondollmaier,项目名称:cmsscanner,代码行数:19,代码来源:DrupalAdapter.php

示例6: handle

 /**
  * Convert a blade view into a site page.
  *
  * @param SplFileInfo $file
  *
  * @return void
  */
 public function handle(SplFileInfo $file, $channels)
 {
     $this->file = $file;
     $this->viewPath = $this->getViewPath();
     $this->directory = $this->getDirectoryPrettyName();
     $this->appendViewInformationToData();
     foreach ($channels as $channel => $values) {
         if ($channel == $this->viewPath) {
             $this->prepareBlogIndexViewData($this->viewsData[$values['container']], $values['paginationView'], $values['paginationContainer'], $channel);
         }
     }
     $content = $this->getFileContent();
     $this->filesystem->put(sprintf('%s/%s', $this->prepareAndGetDirectory(), ends_with($file->getFilename(), ['.blade.php', 'md']) ? 'index.html' : $file->getFilename()), $content);
 }
开发者ID:tao,项目名称:orca,代码行数:21,代码来源:PageHandler.php

示例7: __construct

 /**
  * Create our second level request for posting items
  *
  * @param Api         $api
  * @param SplFileInfo $file
  * @param bool        $method
  */
 public function __construct(Api $api, SplFileInfo $file, $method)
 {
     $data = $api->getResponse()->json();
     parent::__construct($api->getApiKey(), $api->getApiSecret(), $api->getHttps());
     $this->path = sprintf('%s://%s%s', $data['link']['protocol'], $data['link']['address'], $data['link']['path']);
     $this->setGet('key', $data['link']['query']['key'])->setGet('token', $data['link']['query']['token'])->setPost('file', '@' . $file->getPath() . '/' . $file->getFilename());
 }
开发者ID:lsv,项目名称:jwapi,代码行数:14,代码来源:Upload.php

示例8: processFile

 private function processFile(SplFileInfo $path)
 {
     $relativeDirName = dirname(str_replace($this->inPath, '', $path->getPathname()));
     $filenameParts = explode('/', $relativeDirName);
     $pdfDir = array_pop($filenameParts);
     $restaurant = array_pop($filenameParts);
     $outDir = $this->outPath . '/' . $relativeDirName;
     if (!is_dir($outDir)) {
         mkdir($outDir, 0777, true);
     }
     $outFilename = $outDir . '/' . str_replace('.pdf', '-%03d.png', $path->getFilename());
     $convertCommand = "gm convert -density 300 \"{$path->getPathname()}\" -resize '1280x1280>' +profile '*' +adjoin \"{$outFilename}\"";
     $this->output->writeln("Processing {$path->getPathname()}");
     // convert directory
     exec($convertCommand);
     // create csv file
     $finder = new Finder();
     $finder->files()->name('*.png')->in($outDir);
     /** @type SplFileInfo $file */
     $index = 1;
     $this->output->writeln("-- " . $finder->count() . " images");
     foreach ($finder as $file) {
         if (!isset($this->outCsv[$restaurant])) {
             $this->outCsv[$restaurant] = [];
         }
         $this->outCsv[$restaurant][] = ['restaurant' => $restaurant, 'pdf' => $path->getRelativePathname(), 'page' => $index, 'image' => $relativeDirName . '/' . $file->getFilename(), 'folder' => $relativeDirName];
         $index++;
     }
 }
开发者ID:survos,项目名称:remote,代码行数:29,代码来源:PdfToJpgCommand.php

示例9: modify

 /**
  * @see ContentModifierInterface::modify()
  */
 public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
 {
     $options = $this->resolver->resolve($data);
     // retrieve target location
     $targetConfigFilepath = $this->resolveTargetFilePath($options['target'], $generatedFile->getPath());
     $emBundleDefinition = sprintf('
                 %s:
                     type: yml
                     dir: %s
                     prefix: %s
                     alias: %s
                     ', $options['bundle'], $options['relative_schema_directory'], $options['prefix'], $options['alias']);
     $configsFile = new SplFileInfo($targetConfigFilepath, '', '');
     $configsContent = $configsFile->getContents();
     // are configs not already registered ?
     if (strpos($configsContent, trim($emBundleDefinition)) !== false) {
         $this->logger->debug(sprintf('Config file "%s" is already registered into "%s". Abording.', $generatedFile->getFilename(), $targetConfigFilepath));
         return $generatedFile->getContents();
     }
     $this->filesystem->dumpFile($configsFile->getPathname(), str_replace(sprintf('
     entity_managers:
         %s:
             mappings:', $options['em']), sprintf('
     entity_managers:
         %s:
             mappings:%s', $options['em'], $emBundleDefinition), $configsContent));
     $this->logger->info(sprintf('file updated : %s', $configsFile->getPathname()));
     return $generatedFile->getContents();
 }
开发者ID:henres,项目名称:MajoraGeneratorBundle,代码行数:32,代码来源:RegisterDoctrineEmModifier.php

示例10: uploadFile

 private function uploadFile(File $file)
 {
     if ($file->getFilename() == 'config.yml') {
         return;
     }
     $this->output->writeln('Uploading ' . $file->getRelativePathname());
     $this->bucket->upload($file);
 }
开发者ID:schickling,项目名称:git-s3,代码行数:8,代码来源:DeployCommand.php

示例11: verifyFrontMatterSeparatorExists

 /**
  * @param SplFileInfo $file
  *
  * @return void
  *
  * @throws InvalidContentFile
  */
 protected function verifyFrontMatterSeparatorExists(SplFileInfo $file)
 {
     $content = $file->getContents();
     $fileName = $file->getFilename();
     if (false === strpos($content, FrontMatter::SEPARATOR)) {
         throw new InvalidContentFile("Missing '---' deliminator in " . $fileName);
     }
 }
开发者ID:jtallant,项目名称:skimpy-engine,代码行数:15,代码来源:Validator.php

示例12: addSchemaToList

 /**
  * @param \Symfony\Component\Finder\SplFileInfo $schemaFile
  * @param array $schemaFiles
  *
  * @return array
  */
 private function addSchemaToList(SplFileInfo $schemaFile, array $schemaFiles)
 {
     $fileIdentifier = $schemaFile->getFilename();
     if (!isset($schemaFiles[$fileIdentifier])) {
         $schemaFiles[$fileIdentifier] = [];
     }
     $schemaFiles[$fileIdentifier][] = $schemaFile;
     return $schemaFiles;
 }
开发者ID:spryker,项目名称:Propel,代码行数:15,代码来源:PropelGroupedSchemaFinder.php

示例13: parseConfigFile

 /**
  * Parses a .platform.app.yaml file.
  *
  * @param \Symfony\Component\Finder\SplFileInfo $configFile
  *      The file to parse.
  *
  * @return array|null
  *      An array of configurations found in the file or null.
  */
 private function parseConfigFile(SplFileInfo $configFile)
 {
     $yaml = new Parser();
     try {
         return $yaml->parse($configFile->getContents());
     } catch (ParseException $e) {
         printf('Unable to parse the platform configuration file: %s', $configFile->getFilename());
     }
     return null;
 }
开发者ID:comm-press,项目名称:environment-manager,代码行数:19,代码来源:PlatformConfigParser.php

示例14:

 function it_should_filter_by_not_name(SplFileInfo $file1, SplFileInfo $file2)
 {
     $file1->getFilename()->willReturn('file.php');
     $file2->getFilename()->willReturn('file.png');
     $result = $this->notName('*.png');
     $result->shouldBeAnInstanceOf('GrumPHP\\Collection\\FilesCollection');
     $result->count()->shouldBe(1);
     $files = $result->toArray();
     $files[0]->shouldBe($file1);
 }
开发者ID:kientrunghuynh,项目名称:grumphp,代码行数:10,代码来源:FilesCollectionSpec.php

示例15: __construct

 public function __construct(SplFileInfo $file)
 {
     $this->file = $file;
     $this->path = str_replace('\\', '/', $file->getRelativePath());
     $this->filename = $file->getFilename();
     list($this->type, $this->vendor) = explode('/', $this->path);
     $matches = $this->parseFilename($this->filename);
     $this->package = $matches['package'];
     $this->version = $matches['version'];
 }
开发者ID:ssteinerx,项目名称:release-belt,代码行数:10,代码来源:Release.php


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