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


PHP SplFileInfo::getRelativePathName方法代码示例

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


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

示例1: createPageFile

 protected function createPageFile(DirectoryPath $repositoryPath, DirectoryPath $directoryPath, SplFileInfo $file)
 {
     $pageFile = new PageFile($repositoryPath->toAbsoluteFileString(), $directoryPath->toRelativeFileString(), $file->getRelativePathName());
     $title = $this->elasticsearchRepository->getTitle($pageFile->getAbsolutePath());
     if (empty($title)) {
         $title = $pageFile->getRelativePath()->getFileName();
     }
     $pageFile->setTitle($title);
     return $pageFile;
 }
开发者ID:terretta,项目名称:gitki.php,代码行数:10,代码来源:ElasticsearchWikiService.php

示例2: __construct

 /**
  * __construct 
  */
 protected function __construct(SplFileInfo $file, $language = 'en')
 {
     $parser = app(Parser::class);
     $this->metadata = $parser->frontmatter($file->getContents());
     $this->title = isset($this->metadata['PageTitle']) ? $this->metadata['PageTitle'] : (isset($this->metadata['Title']) ? $this->metadata['Title'] : Content::filename_to_title($file->getFilename()));
     $this->slug = Content::str_to_slug($this->title);
     if (ends_with($file->getRelativePathName(), 'index.md')) {
         $this->is_section_home = true;
     }
     $this->level = count(array_filter(explode(DIRECTORY_SEPARATOR, $file->getRelativePath())));
     $relativePath = str_replace('\\', '/', $file->getRelativePath());
     $this->is_homepage = $this->level === 0 && $this->is_section_home;
     if ($this->level > 0 && $this->is_section_home) {
         $this->path = $relativePath;
     } else {
         $relativePath = $relativePath . (ends_with($relativePath, '/') ? '' : '/');
         $this->path = $relativePath . $this->slug;
     }
     $this->language = $language;
     $this->file = $file;
     $this->order = isset($this->metadata['Order']) ? $this->metadata['Order'] : (isset($this->metadata['Sort']) ? $this->metadata['Sort'] : 0);
 }
开发者ID:avvertix,项目名称:pronto-framework,代码行数:25,代码来源:PageItem.php

示例3: setTarget

 /**
  * Determine the target path.
  *
  * @param  SplFileInfo $file
  * @return string
  */
 protected function setTarget(SplFileInfo $file)
 {
     // Page extension
     $ext = $file->getExtension();
     // Twig templates are HTML
     if (!$this->has('template') || $this->get('template') === 'none') {
         $targetExt = $ext;
     } else {
         $targetExt = 'html';
     }
     // Get clean source path
     $sourcePath = $this->getCleanPath($file->getRelativePathName());
     // Replace source extension with that of the template
     $this->target = substr($sourcePath, 0, -strlen($ext));
     $this->target .= $targetExt;
 }
开发者ID:torann,项目名称:skosh-generator,代码行数:22,代码来源:Content.php

示例4: createPageFile

 /**
  * @param DirectoryPath $repositoryPath
  * @param DirectoryPath $directoryPath
  * @param SplFileInfo   $file
  *
  * @return PageFile
  */
 protected function createPageFile(DirectoryPath $repositoryPath, DirectoryPath $directoryPath, SplFileInfo $file)
 {
     $pageFile = new PageFile($repositoryPath->toAbsoluteFileString(), $directoryPath->toRelativeFileString(), $file->getRelativePathName());
     $pageFile->setTitle($pageFile->getRelativePath()->getFileName());
     return $pageFile;
 }
开发者ID:terretta,项目名称:gitki.php,代码行数:13,代码来源:WikiService.php


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