當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SplFileInfo::getRealpath方法代碼示例

本文整理匯總了PHP中Symfony\Component\Finder\SplFileInfo::getRealpath方法的典型用法代碼示例。如果您正苦於以下問題:PHP SplFileInfo::getRealpath方法的具體用法?PHP SplFileInfo::getRealpath怎麽用?PHP SplFileInfo::getRealpath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Finder\SplFileInfo的用法示例。


在下文中一共展示了SplFileInfo::getRealpath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upload

 public function upload(File $file, $metaData)
 {
     try {
         if ($metaData['Content-Encoding']) {
             $this->client->putObject(array('Bucket' => $this->name, 'Key' => $file->getRelativePathname(), 'SourceFile' => $file->getRealpath(), 'ACL' => CannedAcl::PUBLIC_READ, 'ContentEncoding' => $metaData['Content-Encoding']));
         } else {
             $this->client->putObject(array('Bucket' => $this->name, 'Key' => $file->getRelativePathname(), 'SourceFile' => $file->getRealpath(), 'ACL' => CannedAcl::PUBLIC_READ));
         }
     } catch (InstanceProfileCredentialsException $e) {
         throw new InvalidAccessKeyIdException("The AWS Access Key Id you provided does not exist in our records.");
     }
 }
開發者ID:arvinkx,項目名稱:git-s3,代碼行數:12,代碼來源:Bucket.php

示例2: modify

 /**
  * @see ContentModifierInterface::modify()
  */
 public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
 {
     $options = $this->resolver->resolve($data);
     // retrieve target location
     $targetServicesFilepath = $this->resolveTargetFilePath($options['target'], $generatedFile->getPath());
     // build content
     $import = sprintf('<import resource="%s" />', $inflector->translate($options['resource']));
     $servicesFile = new SplFileInfo($targetServicesFilepath, '', '');
     $servicesContent = $servicesFile->getContents();
     // are services not already registered ?
     if (strpos($servicesContent, $import) !== false) {
         $this->logger->debug(sprintf('Service file "%s" is already registered into "%s". Abording.', $generatedFile->getFilename(), $targetServicesFilepath));
         return $generatedFile->getContents();
     }
     $this->filesystem->dumpFile($servicesFile->getRealpath(), str_replace('    </imports>', sprintf("        %s\n    </imports>", $import), $servicesContent));
     $this->logger->info(sprintf('file updated : %s', $servicesFile->getRealpath()));
     return $generatedFile->getContents();
 }
開發者ID:henres,項目名稱:MajoraGeneratorBundle,代碼行數:21,代碼來源:ImportXmlServicesModifier.php

示例3: modify

    /**
     * @see ContentModifierInterface::modify()
     */
    public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
    {
        $options = $this->resolver->resolve($data);
        // retrieve target location
        $targetRoutingFilepath = $this->resolveTargetFilePath($options['target'], $generatedFile->getPath());
        // build content
        $routing = sprintf('
%s:
    resource: "%s"
    %s', $inflector->translate($options['route']), $inflector->translate($options['resource']), is_null($options['prefix']) ? '' : sprintf("prefix: %s\n", $inflector->translate($options['prefix'])));
        $routingFile = new SplFileInfo($targetRoutingFilepath, '', '');
        $routingContent = $routingFile->getContents();
        // is routing not already registered ?
        if (strpos($routingContent, trim($routing)) !== false) {
            $this->logger->debug(sprintf('Routing file "%s" is already registered into "%s". Abording.', $generatedFile->getFilename(), $targetRoutingFilepath));
            return $generatedFile->getContents();
        }
        $this->filesystem->dumpFile($routingFile->getRealpath(), sprintf('%s%s', $routingContent, $routing));
        $this->logger->info(sprintf('file updated : %s', $routingFile->getRealpath()));
        return $generatedFile->getContents();
    }
開發者ID:henres,項目名稱:MajoraGeneratorBundle,代碼行數:24,代碼來源:UpdateRoutingModifier.php

示例4: computeHandleFromPath

 /**
  * Computes which configuration handle a config file should bind to.
  *
  * @param SplFileInfo $file
  *
  * @return string
  */
 protected function computeHandleFromPath(SplFileInfo $file)
 {
     // Get realpath
     $handle = $file->getRealpath();
     // Format appropriately
     $handle = str_replace($this->app['path.rocketeer.config'] . DS, null, $handle);
     $handle = str_replace('.php', null, $handle);
     $handle = str_replace(DS, '.', $handle);
     return sprintf('rocketeer::on.%s', $handle);
 }
開發者ID:marcelgwerder,項目名稱:rocketeer,代碼行數:17,代碼來源:Configuration.php

示例5: tryToLoadTest

 /**
  * Try to load and initialise a specific test.
  *
  * @param SplFileInfo $test
  *
  * @throws Exception\TestException
  */
 private function tryToLoadTest(SplFileInfo $test)
 {
     $this->output->writelnIfDebug("<info>Found {$test->getRealpath()}.</info>");
     $file = str_replace('.php', '', basename($test->getRealPath()));
     $class = '\\Phpbb\\Epv\\Tests\\Tests\\' . $file;
     $filetest = new $class($this->debug, $this->output, $this->basedir, $this->namespace, $this->titania, $this->directory);
     if (!$filetest instanceof TestInterface) {
         throw new TestException("{$class} does not implement the TestInterface, but matches the test expression.");
     }
     $this->tests[] = $filetest;
 }
開發者ID:phpbb,項目名稱:epv,代碼行數:18,代碼來源:TestRunner.php


注:本文中的Symfony\Component\Finder\SplFileInfo::getRealpath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。