本文整理匯總了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.");
}
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}