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


PHP SplFileInfo::getPathName方法代码示例

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


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

示例1: createTransferAction

 protected function createTransferAction(\SplFileInfo $file)
 {
     // Open the file for reading
     $filename = $file->getPathName();
     if (!($resource = fopen($filename, 'r'))) {
         // @codeCoverageIgnoreStart
         throw new RuntimeException("Could not open {$filename} for reading");
         // @codeCoverageIgnoreEnd
     }
     $key = $this->options['source_converter']->convert($filename);
     $body = EntityBody::factory($resource);
     // Determine how the ACL should be applied
     if ($acl = $this->options['acl']) {
         $aclType = is_string($this->options['acl']) ? 'ACL' : 'ACP';
     } else {
         $acl = 'private';
         $aclType = 'ACL';
     }
     // Use a multi-part upload if the file is larger than the cutoff size and is a regular file
     if ($body->getWrapper() == 'plainfile' && $file->getSize() >= $this->options['multipart_upload_size']) {
         $builder = UploadBuilder::newInstance()->setBucket($this->options['bucket'])->setKey($key)->setMinPartSize($this->options['multipart_upload_size'])->setOption($aclType, $acl)->setClient($this->options['client'])->setSource($body)->setConcurrency($this->options['concurrency']);
         $this->dispatch(self::BEFORE_MULTIPART_BUILD, array('builder' => $builder, 'file' => $file));
         return $builder->build();
     }
     return $this->options['client']->getCommand('PutObject', array('Bucket' => $this->options['bucket'], 'Key' => $key, 'Body' => $body, $aclType => $acl));
 }
开发者ID:mahassan,项目名称:shellneverknow,代码行数:26,代码来源:UploadSync.php

示例2: supports

 /**
  * {@inheritdoc}
  */
 public function supports(\SplFileInfo $file)
 {
     $path = $file->getPathName();
     // some fixtures are auto-generated by Symfony and may contain unused use statements
     if (false !== strpos($path, DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR) && false === strpos($path, DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR)) {
         return false;
     }
     return true;
 }
开发者ID:fabpot,项目名称:php-cs-fixer,代码行数:12,代码来源:NoUnusedImportsFixer.php

示例3: toArray

 /**
  * @return array
  */
 public function toArray()
 {
     $rows = [];
     $currentDir = getcwd() . DIRECTORY_SEPARATOR;
     /* @var $reflection ReflectionFile  */
     foreach ($this->getIterator() as $reflection) {
         $row = [];
         $file = new \SplFileInfo($reflection->getName());
         $row = array("Files" => str_replace($currentDir, "", $file->getPathName()), "Owner" => $file->getOwner(), "Group" => $file->getGroup(), "Permissions" => $file->getPerms(), "Created" => date("d.m.Y h:m:s", $file->getCTime()), "Modified" => date("d.m.Y h:m:s", $file->getMTime()));
         $rows[] = $row;
     }
     return $rows;
 }
开发者ID:slavomirkuzma,项目名称:itc-bundle,代码行数:16,代码来源:FileCollection.php

示例4: registerTables

 protected function registerTables()
 {
     $dataTables = $this->allFiles($this->dataBaseDir);
     foreach ($dataTables as $file) {
         $spl = new \SplFileInfo($file);
         if (preg_match(self::REGEXDataTableFileCheck, $spl->getFilename(), $matches)) {
             if (count($matches) != 3 || $matches[2] != $this->version) {
                 continue;
             }
             $this->tables[$matches[1]] = $spl->getPathName();
             //NON init
         }
     }
     return $this;
 }
开发者ID:kesslerdev,项目名称:laposte,代码行数:15,代码来源:ParamsDirectoryBase.php

示例5: find

 /**
  * Find method
  *
  * @param string $pattern
  * @param \SplFileInfo $fileInfo
  *
  * @return bool|\SplFileInfo
  */
 public function find($pattern, \SplFileInfo $fileInfo)
 {
     if (!is_string($pattern)) {
         throw new \InvalidArgumentException('Pattern should be an string');
     }
     $pattern = $this->createRegExp($pattern);
     $data = fopen($fileInfo->getPathName(), 'r');
     $return = false;
     while ($line = fgets($data, 1024)) {
         if (preg_match($pattern, $line)) {
             $return = $fileInfo;
         }
     }
     return $return;
 }
开发者ID:mauro-moreno,项目名称:find-bundle,代码行数:23,代码来源:Finder.php

示例6: extract

 protected function extract(\SplFileInfo $file, $directory)
 {
     $fileName = substr($file->getPathName(), strlen($directory) + 1);
     $extension = $file->getExtension();
     $messages = [];
     foreach ($this->filters[$extension] as $filterName) {
         $filter = $this->getFilter($filterName);
         $filterData = $filter->extract($file->getRealPath());
         if (!is_array($filterData)) {
             continue;
         }
         $messages = array_merge($messages, $filterData);
     }
     echo sprintf('File: %s, messages: %d', $fileName, count($messages)) . "\n";
     $this->data[$fileName] = $messages;
 }
开发者ID:bazo,项目名称:nette-translation,代码行数:16,代码来源:Extractor.php

示例7: getDatabasesFromSchema

 protected function getDatabasesFromSchema(\SplFileInfo $file)
 {
     $transformer = new \XmlToAppData(null, null, 'UTF-8');
     $config = new \QuickGeneratorConfig();
     if (file_exists($propelIni = $this->getContainer()->getParameter('kernel.root_dir') . '/config/propel.ini')) {
         foreach ($this->getProperties($propelIni) as $key => $value) {
             if (0 === strpos($key, 'propel.')) {
                 $newKey = substr($key, strlen('propel.'));
                 $j = strpos($newKey, '.');
                 while (false !== $j) {
                     $newKey = substr($newKey, 0, $j) . ucfirst(substr($newKey, $j + 1));
                     $j = strpos($newKey, '.');
                 }
                 $config->setBuildProperty($newKey, $value);
             }
         }
     }
     $transformer->setGeneratorConfig($config);
     return $transformer->parseFile($file->getPathName())->getDatabases();
 }
开发者ID:angelk,项目名称:PropelBundle,代码行数:20,代码来源:GeneratorAwareCommand.php

示例8: createDatabase

 /**
  * Overrides \Drupal\Core\Database\Connection::createDatabase().
  *
  * @param string $database
  *   The name of the database to create.
  *
  * @throws \Drupal\Core\Database\DatabaseNotFoundException
  */
 public function createDatabase($database)
 {
     // Verify the database is writable.
     $db_directory = new \SplFileInfo(dirname($database));
     if (!$db_directory->isDir() && !drupal_mkdir($db_directory->getPathName(), 0755, TRUE)) {
         throw new DatabaseNotFoundException('Unable to create database directory ' . $db_directory->getPathName());
     }
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:16,代码来源:Connection.php

示例9: init

 /**
  * Initializes the page instance variables based on a file
  *
  * @param  \SplFileInfo $file The file information for the .md file that the page represents
  * @param  string       $extension
  */
 public function init(\SplFileInfo $file, $extension = null)
 {
     $this->filePath($file->getPathName());
     $this->modified($file->getMTime());
     $this->id($this->modified() . md5($this->filePath()));
     $this->routable(true);
     $this->header();
     $this->date();
     $this->metadata();
     $this->url();
     $this->visible();
     $this->modularTwig($this->slug[0] == '_');
     $this->setPublishState();
     $this->published();
     // some extension logic
     if (empty($extension)) {
         $this->extension('.' . $file->getExtension());
     } else {
         $this->extension($extension);
     }
     // extract page language from page extension
     $language = trim(basename($this->extension(), 'md'), '.') ?: null;
     $this->language($language);
 }
开发者ID:realitygaps,项目名称:grav_ynh,代码行数:30,代码来源:Page.php

示例10: init

 /**
  * Initializes the page instance variables based on a file
  *
  * @param  \SplFileInfo $file The file information for the .md file that the page represents
  * @param  string       $extension
  *
  * @return $this
  */
 public function init(\SplFileInfo $file, $extension = null)
 {
     $config = self::getGrav()['config'];
     $this->hide_home_route = $config->get('system.home.hide_in_urls', false);
     $this->home_route = $config->get('system.home.alias');
     $this->filePath($file->getPathName());
     $this->modified($file->getMTime());
     $this->id($this->modified() . md5($this->filePath()));
     $this->routable(true);
     $this->header();
     $this->date();
     $this->metadata();
     $this->url();
     $this->visible();
     $this->modularTwig($this->slug[0] == '_');
     $this->setPublishState();
     $this->published();
     $this->urlExtension();
     // some extension logic
     if (empty($extension)) {
         $this->extension('.' . $file->getExtension());
     } else {
         $this->extension($extension);
     }
     // extract page language from page extension
     $language = trim(basename($this->extension(), 'md'), '.') ?: null;
     $this->language($language);
     return $this;
 }
开发者ID:connor-baer,项目名称:waterford-design,代码行数:37,代码来源:Page.php

示例11: writeFormType

 private function writeFormType(BundleInterface $bundle, \Table $table, \SplFileInfo $file, $force, OutputInterface $output)
 {
     $modelName = $table->getPhpName();
     $formTypeContent = file_get_contents(__DIR__ . '/../Resources/skeleton/FormType.php');
     $formTypeContent = str_replace('##NAMESPACE##', $bundle->getNamespace() . str_replace('/', '\\', self::DEFAULT_FORM_TYPE_DIRECTORY), $formTypeContent);
     $formTypeContent = str_replace('##CLASS##', $modelName . 'Type', $formTypeContent);
     $formTypeContent = str_replace('##FQCN##', sprintf('%s\\%s', $table->getNamespace(), $modelName), $formTypeContent);
     $formTypeContent = str_replace('##TYPE_NAME##', strtolower($modelName), $formTypeContent);
     $formTypeContent = $this->addFields($table, $formTypeContent);
     file_put_contents($file->getPathName(), $formTypeContent);
     $this->writeNewFile($output, $this->getRelativeFileName($file) . ($force ? ' (forced)' : ''));
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:12,代码来源:FormGenerateCommand.php

示例12: writeFormType

 /**
  * Write a FormType.
  *
  * @param BundleInterface $bundle The bundle in which the FormType will be created.
  * @param Table           $table  The table for which the FormType will be created.
  * @param \SplFileInfo    $file   File representing the FormType.
  * @param boolean         $force  Is the write forced?
  * @param OutputInterface $output An OutputInterface instance.
  */
 protected function writeFormType(BundleInterface $bundle, Table $table, \SplFileInfo $file, $force, OutputInterface $output)
 {
     $formBuilder = new FormBuilder();
     $formTypeContent = $formBuilder->buildFormType($bundle, $table, self::DEFAULT_FORM_TYPE_DIRECTORY);
     file_put_contents($file->getPathName(), $formTypeContent);
     $this->writeNewFile($output, $this->getRelativeFileName($file) . ($force ? ' (forced)' : ''));
 }
开发者ID:naldz,项目名称:cyberden,代码行数:16,代码来源:FormGenerateCommand.php

示例13: init

 /**
  * Initializes the page instance variables based on a file
  *
  * @param  \SplFileInfo $file The file information for the .md file that the page represents
  * @param  string       $extension
  */
 public function init(\SplFileInfo $file, $extension = null)
 {
     $this->filePath($file->getPathName());
     $this->modified($file->getMTime());
     $this->id($this->modified() . md5($this->filePath()));
     $this->header();
     $this->date();
     $this->metadata();
     $this->url();
     $this->visible();
     $this->modularTwig($this->slug[0] == '_');
     $this->setPublishState();
     $this->published();
     if (empty($extension)) {
         $this->extension('.' . $file->getExtension());
     } else {
         $this->extension($extension);
     }
 }
开发者ID:gabykode,项目名称:tf,代码行数:25,代码来源:Page.php

示例14: create

	/**
	 * Creates backup from full path
	 *
	 * @param SplFileInfo $fileinfo
	 * @return Backup
	 * @author : Rafał Trójniak rafal@trojniak.net
	 */
	static public function create(\SplFileInfo $fileinfo)
	{
		if(!$fileinfo->isDir()){
			throw new \RuntimeException('Supplied argument "'.addslashes($fileinfo->getPathName()).'"'.
				' is not a directory');
		}
		$name=$fileinfo->getFilename();
		$date=\DateTime::createFromFormat(\DateTime::ISO8601,$name);
		if(! $date instanceof  \DateTime){
			throw new \RuntimeException('Cannot parse date from file '.
				$fileinfo->getPathName()
				.' with format '.\DateTime::ISO8601.' and input '.$name);
               }

		return new Backup(
			$date,
			$fileinfo->getPathName()
		);
	}
开发者ID:rafaltrojniak,项目名称:backuprotate,代码行数:26,代码来源:Backup.php

示例15: process

 /**
  * {@inheritDoc}
  */
 public function process(MediaInterface $media, VariantInterface $variant, \SplFileInfo $source = NULL)
 {
     $options = $variant->getOptions();
     $result = $source;
     list($originalWidth, $originalHeight) = getimagesize($source->getPathName());
     $width = $originalWidth;
     $height = $originalHeight;
     if (is_array($options) && !empty($options)) {
         if ($this->imagine == NULL) {
             throw new ProviderProcessException(sprintf('Cannot process image "%s": Imagine library not installed or misconfigured', $media), $this, $media, $variant);
         }
         $options = $this->processOptions($options, $variant->getName(), $media->getContext());
         $destFile = sprintf('%s%s-temp-%s.%s', $this->tempDir, date('Y-m-d-h-i-s'), $source->getBasename('.' . $source->getExtension()), $options['format']);
         /**
          * @var \Imagine\Image\ImageInterface $image
          */
         $image = $this->imagine->open($source);
         if ($options['enlarge'] === TRUE || $originalWidth >= $options['width'] && $originalHeight >= $options['height']) {
             $width = $options['width'];
             $height = $options['height'];
             if ($options['resize'] == 'proportional') {
                 //calculate missing dimension
                 if ($width === NULL) {
                     $width = round($originalWidth * $height / $originalHeight);
                 } elseif ($height === NULL) {
                     $height = round($width * $originalHeight / $originalWidth);
                 }
             }
             $box = new \Imagine\Image\Box($width, $height);
             if ($options['resize'] == 'proportional' || $options['resize'] == 'stretch') {
                 $image->resize($box);
             } elseif ($options['resize'] == 'crop') {
                 $image = $image->thumbnail($box, \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND);
             }
         }
         $image->save($destFile, array('quality' => $options['quality']));
         $this->addTempFile($destFile);
         $result = new \SplFileInfo($destFile);
     }
     //set variant metadata
     $variant->setMetaValue('size', $result->getSize());
     $variant->setMetaValue('width', $width);
     $variant->setMetaValue('height', $height);
     return $result;
 }
开发者ID:jmcclell,项目名称:OryzoneMediaStorage,代码行数:48,代码来源:ImageProvider.php


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