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


PHP Utility\Files类代码示例

本文整理汇总了PHP中TYPO3\Flow\Utility\Files的典型用法代码示例。如果您正苦于以下问题:PHP Files类的具体用法?PHP Files怎么用?PHP Files使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: writeComposerManifest

 /**
  * @return void
  */
 protected function writeComposerManifest()
 {
     $composerJsonFilename = Files::concatenatePaths(array($this->targetPackageData['path'], 'composer.json'));
     if (file_exists($composerJsonFilename)) {
         return;
     }
     $manifest = array();
     $nameParts = explode('.', $this->targetPackageData['packageKey']);
     $vendor = array_shift($nameParts);
     $manifest['name'] = strtolower($vendor . '/' . implode('-', $nameParts));
     switch ($this->targetPackageData['category']) {
         case 'Application':
             $manifest['type'] = 'typo3-flow-package';
             break;
         default:
             $manifest['type'] = strtolower('typo3-flow-' . $this->targetPackageData['category']);
     }
     $manifest['description'] = $this->targetPackageData['meta']['description'];
     $manifest['version'] = $this->targetPackageData['meta']['version'];
     $manifest['require'] = array('typo3/flow' => '*');
     $manifest['autoload'] = array('psr-0' => array(str_replace('.', '\\', $this->targetPackageData['packageKey']) => 'Classes'));
     if (defined('JSON_PRETTY_PRINT')) {
         file_put_contents($composerJsonFilename, json_encode($manifest, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
     } else {
         file_put_contents($composerJsonFilename, json_encode($manifest));
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:30,代码来源:Version20120920111200.php

示例2: create

 /**
  * Returns a package instance.
  *
  * @param string $packagesBasePath the base install path of packages,
  * @param string $packagePath path to package, relative to base path
  * @param string $packageKey key / name of the package
  * @param string $classesPath path to the classes directory, relative to the package path
  * @param string $manifestPath path to the package's Composer manifest, relative to package path, defaults to same path
  * @return \TYPO3\Flow\Package\PackageInterface
  * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
  */
 public function create($packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath = '')
 {
     $packagePath = Files::getNormalizedPath(Files::concatenatePaths(array($packagesBasePath, $packagePath)));
     $packageClassPathAndFilename = Files::concatenatePaths(array($packagePath, 'Classes/' . str_replace('.', '/', $packageKey) . '/Package.php'));
     $alternativeClassPathAndFilename = Files::concatenatePaths(array($packagePath, 'Classes/Package.php'));
     $packageClassPathAndFilename = @file_exists($alternativeClassPathAndFilename) ? $alternativeClassPathAndFilename : $packageClassPathAndFilename;
     if (@file_exists($packageClassPathAndFilename)) {
         require_once $packageClassPathAndFilename;
         if (substr($packagePath, 0, strlen(PATH_typo3)) === PATH_typo3 && strpos($packageKey, '.') === FALSE) {
             //TODO Remove this exception once the systextension are renamed to proper Flow naming scheme packages
             $packageClassName = 'TYPO3\\CMS\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey) . '\\Package';
         } else {
             $packageClassName = str_replace('.', '\\', $packageKey) . '\\Package';
         }
         if (!class_exists($packageClassName, FALSE)) {
             throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf('The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class called "%s".', $packageKey, $packageClassPathAndFilename, $packageClassName), 1327587092);
         }
     } else {
         $emConfPath = Files::concatenatePaths(array($packagePath, 'ext_emconf.php'));
         $packageClassName = @file_exists($emConfPath) ? 'TYPO3\\CMS\\Core\\Package\\Package' : 'TYPO3\\Flow\\Package\\Package';
     }
     /** @var $package \TYPO3\Flow\Package\PackageInterface */
     $package = new $packageClassName($this->packageManager, $packageKey, $packagePath, $classesPath, $manifestPath);
     return $package;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:36,代码来源:PackageFactory.php

示例3: execute

 /**
  * Execute this task
  *
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options Supported options: "scriptBasePath" and "scriptIdentifier"
  * @return void
  * @throws \TYPO3\Surf\Exception\InvalidConfigurationException
  * @throws \TYPO3\Surf\Exception\TaskExecutionException
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     $workspacePath = $deployment->getWorkspacePath($application);
     $scriptBasePath = isset($options['scriptBasePath']) ? $options['scriptBasePath'] : Files::concatenatePaths(array($workspacePath, 'Web'));
     if (!isset($options['scriptIdentifier'])) {
         // Generate random identifier
         $factory = new \RandomLib\Factory();
         $generator = $factory->getMediumStrengthGenerator();
         $scriptIdentifier = $generator->generateString(32, \RandomLib\Generator::CHAR_ALNUM);
         // Store the script identifier as an application option
         $application->setOption('TYPO3\\Surf\\Task\\Php\\WebOpcacheResetExecuteTask[scriptIdentifier]', $scriptIdentifier);
     } else {
         $scriptIdentifier = $options['scriptIdentifier'];
     }
     $localhost = new Node('localhost');
     $localhost->setHostname('localhost');
     $commands = array('cd ' . escapeshellarg($scriptBasePath), 'rm -f surf-opcache-reset-*');
     $this->shell->executeOrSimulate($commands, $localhost, $deployment);
     if (!$deployment->isDryRun()) {
         $scriptFilename = $scriptBasePath . '/surf-opcache-reset-' . $scriptIdentifier . '.php';
         $result = file_put_contents($scriptFilename, '<?php
             if (function_exists("opcache_reset")) {
                 opcache_reset();
             }
             @unlink(__FILE__);
             echo "success";
         ');
         if ($result === false) {
             throw new \TYPO3\Surf\Exception\TaskExecutionException('Could not write file "' . $scriptFilename . '"', 1421932414);
         }
     }
 }
开发者ID:TYPO3,项目名称:Surf,代码行数:43,代码来源:WebOpcacheResetCreateScriptTask.php

示例4: render

 /**
  * Include all JavaScript files matching the include regular expression
  * and not matching the exclude regular expression.
  *
  * @param string $include Regular expression of files to include
  * @param string $exclude Regular expression of files to exclude
  * @param string $package The package key of the resources to include or current controller package if NULL
  * @param string $subpackage The subpackage key of the resources to include or current controller subpackage if NULL
  * @param string $directory The directory inside the current subpackage. By default, the "JavaScript" directory will be used.
  * @return string
  */
 public function render($include, $exclude = NULL, $package = NULL, $subpackage = NULL, $directory = 'JavaScript')
 {
     $packageKey = $package === NULL ? $this->controllerContext->getRequest()->getControllerPackageKey() : $package;
     $subpackageKey = $subpackage === NULL ? $this->controllerContext->getRequest()->getControllerSubpackageKey() : $subpackage;
     $baseDirectory = 'resource://' . $packageKey . '/Public/' . ($subpackageKey !== NULL ? $subpackageKey . '/' : '') . $directory . '/';
     $staticJavaScriptWebBaseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/' . $packageKey . '/' . ($subpackageKey !== NULL ? $subpackageKey . '/' : '') . $directory . '/';
     $iterator = $this->iterateDirectoryRecursively($baseDirectory);
     if ($iterator === NULL) {
         return '<!-- Warning: Cannot include JavaScript because directory "' . $baseDirectory . '" does not exist. -->';
     }
     $uris = array();
     foreach ($iterator as $file) {
         $relativePath = substr($file->getPathname(), strlen($baseDirectory));
         $relativePath = \TYPO3\Flow\Utility\Files::getUnixStylePath($relativePath);
         if (!$this->patternMatchesPath($exclude, $relativePath) && $this->patternMatchesPath($include, $relativePath)) {
             $uris[] = $staticJavaScriptWebBaseUri . $relativePath;
         }
     }
     // Sadly, the aloha editor needs a predefined inclusion order, which right now matches
     // the sorted URI list. that's why we sort here...
     asort($uris);
     $output = '';
     foreach ($uris as $uri) {
         $output .= '<script src="' . $uri . '"></script>' . chr(10);
     }
     return $output;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:38,代码来源:IncludeJavaScriptViewHelper.php

示例5: postPackageUpdateAndInstall

 /**
  * Calls actions and install scripts provided by installed packages.
  *
  * @param \Composer\Script\PackageEvent $event
  * @return void
  * @throws Exception\UnexpectedOperationException
  */
 public static function postPackageUpdateAndInstall(PackageEvent $event)
 {
     $operation = $event->getOperation();
     if (!$operation instanceof \Composer\DependencyResolver\Operation\InstallOperation && !$operation instanceof \Composer\DependencyResolver\Operation\UpdateOperation) {
         throw new Exception\UnexpectedOperationException('Handling of operation with type "' . $operation->getJobType() . '" not supported', 1348750840);
     }
     $package = $operation->getJobType() === 'install' ? $operation->getPackage() : $operation->getTargetPackage();
     $packageExtraConfig = $package->getExtra();
     if (isset($packageExtraConfig['typo3/flow'])) {
         if (isset($packageExtraConfig['typo3/flow']['post-install']) && $operation->getJobType() === 'install') {
             self::runPackageScripts($packageExtraConfig['typo3/flow']['post-install']);
         } elseif (isset($packageExtraConfig['typo3/flow']['post-update']) && $operation->getJobType() === 'update') {
             self::runPackageScripts($packageExtraConfig['typo3/flow']['post-update']);
         }
         $installPath = $event->getComposer()->getInstallationManager()->getInstallPath($package);
         $relativeInstallPath = str_replace(getcwd() . '/', '', $installPath);
         if (isset($packageExtraConfig['typo3/flow']['manage-resources']) && $packageExtraConfig['typo3/flow']['manage-resources'] === TRUE) {
             if (is_dir($relativeInstallPath . '/Resources/Private/Installer/Distribution/Essentials')) {
                 Files::copyDirectoryRecursively($relativeInstallPath . '/Resources/Private/Installer/Distribution/Essentials', './', FALSE, TRUE);
             }
             if (is_dir($relativeInstallPath . '/Resources/Private/Installer/Distribution/Defaults')) {
                 Files::copyDirectoryRecursively($relativeInstallPath . '/Resources/Private/Installer/Distribution/Defaults', './', TRUE, TRUE);
             }
         }
     }
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:33,代码来源:InstallerScripts.php

示例6: addWarningsForAffectedViewHelpers

 /**
  * Add a warning for each HTML file that uses one of the f:uri.* or the f:format.json ViewHelpers
  *
  * @param string $packagePath
  * @return void
  */
 protected function addWarningsForAffectedViewHelpers($packagePath)
 {
     $foundAffectedViewHelpers = array();
     $allPathsAndFilenames = Files::readDirectoryRecursively($packagePath, NULL, TRUE);
     foreach ($allPathsAndFilenames as $pathAndFilename) {
         $pathInfo = pathinfo($pathAndFilename);
         if (!isset($pathInfo['filename']) || $pathInfo['extension'] !== 'html') {
             continue;
         }
         $fileContents = file_get_contents($pathAndFilename);
         preg_match_all('/f\\:(uri\\.[\\w]+|format\\.json)/', $fileContents, $matches, PREG_SET_ORDER);
         foreach ($matches as $match) {
             $viewHelperName = $match[1];
             if (!isset($foundAffectedViewHelpers[$viewHelperName])) {
                 $foundAffectedViewHelpers[$viewHelperName] = array();
             }
             $truncatedPathAndFilename = substr($pathAndFilename, strlen($packagePath) + 1);
             if (!in_array($truncatedPathAndFilename, $foundAffectedViewHelpers[$viewHelperName])) {
                 $foundAffectedViewHelpers[$viewHelperName][] = $truncatedPathAndFilename;
             }
         }
     }
     foreach ($foundAffectedViewHelpers as $viewHelperName => $filePathsAndNames) {
         $this->showWarning(sprintf('The behavior of the "%s" ViewHelper has been changed to produce escaped output.' . chr(10) . 'This package makes use of this ViewHelper in the following files:' . chr(10) . '- %s' . chr(10) . 'See upgrading instructions for further details.' . chr(10), $viewHelperName, implode(chr(10) . '- ', $filePathsAndNames)));
     }
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:32,代码来源:Version20150214130800.php

示例7: buildTestResource

 /**
  * @return \TYPO3\Flow\Resource\Resource
  * @throws \TYPO3\Flow\Resource\Exception
  */
 protected function buildTestResource()
 {
     $testImagePath = Files::concatenatePaths([__DIR__, 'Fixtures/Resources/Lighthouse.jpg']);
     $resource = $this->resourceManager->importResource($testImagePath);
     $asset = new \TYPO3\Media\Domain\Model\Asset($resource);
     return $asset;
 }
开发者ID:neos,项目名称:metadata-extractor,代码行数:11,代码来源:AbstractExtractorTest.php

示例8: create

 /**
  * Returns a package instance.
  *
  * @param string $packagesBasePath the base install path of packages,
  * @param string $packagePath path to package, relative to base path
  * @param string $packageKey key / name of the package
  * @param string $classesPath path to the classes directory, relative to the package path
  * @param string $manifestPath path to the package's Composer manifest, relative to package path, defaults to same path
  * @return \TYPO3\Flow\Package\PackageInterface
  * @throws Exception\CorruptPackageException
  */
 public function create($packagesBasePath, $packagePath, $packageKey, $classesPath = null, $manifestPath = null)
 {
     $absolutePackagePath = Files::concatenatePaths(array($packagesBasePath, $packagePath)) . '/';
     $absoluteManifestPath = $manifestPath === null ? $absolutePackagePath : Files::concatenatePaths(array($absolutePackagePath, $manifestPath)) . '/';
     $autoLoadDirectives = array();
     try {
         $autoLoadDirectives = (array) PackageManager::getComposerManifest($absoluteManifestPath, 'autoload');
     } catch (MissingPackageManifestException $exception) {
     }
     if (isset($autoLoadDirectives[Package::AUTOLOADER_TYPE_PSR4])) {
         $packageClassPathAndFilename = Files::concatenatePaths(array($absolutePackagePath, 'Classes', 'Package.php'));
     } else {
         $packageClassPathAndFilename = Files::concatenatePaths(array($absolutePackagePath, 'Classes', str_replace('.', '/', $packageKey), 'Package.php'));
     }
     $package = null;
     if (file_exists($packageClassPathAndFilename)) {
         require_once $packageClassPathAndFilename;
         $packageClassContents = file_get_contents($packageClassPathAndFilename);
         $packageClassName = (new PhpAnalyzer($packageClassContents))->extractFullyQualifiedClassName();
         if ($packageClassName === null) {
             throw new Exception\CorruptPackageException(sprintf('The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class.', $packageKey, $packageClassPathAndFilename), 1327587091);
         }
         $package = new $packageClassName($this->packageManager, $packageKey, $absolutePackagePath, $classesPath, $manifestPath);
         if (!$package instanceof PackageInterface) {
             throw new Exception\CorruptPackageException(sprintf('The package class of package "%s" does not implement \\TYPO3\\Flow\\Package\\PackageInterface. Check the file "%s".', $packageKey, $packageClassPathAndFilename), 1427193370);
         }
         return $package;
     }
     return new Package($this->packageManager, $packageKey, $absolutePackagePath, $classesPath, $manifestPath);
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:41,代码来源:PackageFactory.php

示例9: getProfile

 /**
  * Returns a ProfilingRun instance that has been saved as $filename.
  *
  * @param string $filename
  * @return \Sandstorm\PhpProfiler\Domain\Model\ProfilingRun
  */
 protected function getProfile($filename)
 {
     $pathAndFilename = Files::concatenatePaths(array($this->settings['profilePath'], $filename));
     $profile = unserialize(file_get_contents($pathAndFilename));
     $profile->setPathAndFilename($pathAndFilename);
     return $profile;
 }
开发者ID:sandstorm,项目名称:plumber,代码行数:13,代码来源:AbstractController.php

示例10: acquire

 /**
  * @param string $subject
  * @param boolean $exclusiveLock TRUE to, acquire an exclusive (write) lock, FALSE for a shared (read) lock.
  * @throws LockNotAcquiredException
  * @throws \TYPO3\Flow\Utility\Exception
  * @return void
  */
 public function acquire($subject, $exclusiveLock)
 {
     if ($this->isWindowsOS()) {
         return;
     }
     if (self::$temporaryDirectory === null) {
         if (Bootstrap::$staticObjectManager === null || !Bootstrap::$staticObjectManager->isRegistered(\TYPO3\Flow\Utility\Environment::class)) {
             throw new LockNotAcquiredException('Environment object could not be accessed', 1386680952);
         }
         $environment = Bootstrap::$staticObjectManager->get(\TYPO3\Flow\Utility\Environment::class);
         $temporaryDirectory = Files::concatenatePaths(array($environment->getPathToTemporaryDirectory(), 'Lock'));
         Files::createDirectoryRecursively($temporaryDirectory);
         self::$temporaryDirectory = $temporaryDirectory;
     }
     $this->lockFileName = Files::concatenatePaths(array(self::$temporaryDirectory, md5($subject)));
     if (($this->filePointer = @fopen($this->lockFileName, 'r')) === false) {
         if (($this->filePointer = @fopen($this->lockFileName, 'w')) === false) {
             throw new LockNotAcquiredException(sprintf('Lock file "%s" could not be opened', $this->lockFileName), 1386520596);
         }
     }
     if ($exclusiveLock === false && flock($this->filePointer, LOCK_SH) === true) {
         // Shared lock acquired
     } elseif ($exclusiveLock === true && flock($this->filePointer, LOCK_EX) === true) {
         // Exclusive lock acquired
     } else {
         throw new LockNotAcquiredException(sprintf('Could not lock file "%s"', $this->lockFileName), 1386520597);
     }
 }
开发者ID:rderidder,项目名称:flow-development-collection,代码行数:35,代码来源:FlockLockStrategy.php

示例11: getPathToTemporaryDirectoryReturnsAnExistingPath

 /**
  * @test
  */
 public function getPathToTemporaryDirectoryReturnsAnExistingPath()
 {
     $environment = new \TYPO3\Flow\Utility\Environment(new ApplicationContext('Testing'));
     $environment->setTemporaryDirectoryBase(\TYPO3\Flow\Utility\Files::concatenatePaths(array(sys_get_temp_dir(), 'FlowEnvironmentTest')));
     $path = $environment->getPathToTemporaryDirectory();
     $this->assertTrue(file_exists($path), 'The temporary path does not exist.');
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:10,代码来源:EnvironmentTest.php

示例12: create

 /**
  * Factory method which creates an EntityManager.
  *
  * @return \Doctrine\ORM\EntityManager
  */
 public function create()
 {
     $config = new \Doctrine\ORM\Configuration();
     $config->setClassMetadataFactoryName('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory');
     $cache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
     // must use ObjectManager in compile phase...
     $cache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine'));
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $resultCache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter();
     // must use ObjectManager in compile phase...
     $resultCache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine_Results'));
     $config->setResultCacheImpl($resultCache);
     if (class_exists($this->settings['doctrine']['sqlLogger'])) {
         $config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']());
     }
     $eventManager = $this->buildEventManager();
     $flowAnnotationDriver = $this->objectManager->get('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\Driver\\FlowAnnotationDriver');
     $config->setMetadataDriverImpl($flowAnnotationDriver);
     $proxyDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies'));
     \TYPO3\Flow\Utility\Files::createDirectoryRecursively($proxyDirectory);
     $config->setProxyDir($proxyDirectory);
     $config->setProxyNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Proxies');
     $config->setAutoGenerateProxyClasses(FALSE);
     $entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config, $eventManager);
     $flowAnnotationDriver->setEntityManager($entityManager);
     \Doctrine\DBAL\Types\Type::addType('objectarray', 'TYPO3\\Flow\\Persistence\\Doctrine\\DataTypes\\ObjectArray');
     if (isset($this->settings['doctrine']['filters']) && is_array($this->settings['doctrine']['filters'])) {
         foreach ($this->settings['doctrine']['filters'] as $filterName => $filterClass) {
             $config->addFilter($filterName, $filterClass);
             $entityManager->getFilters()->enable($filterName);
         }
     }
     return $entityManager;
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:40,代码来源:EntityManagerFactory.php

示例13: getDocumentAbsolutePath

 /**
  * @param string $filename
  * @return string
  * @throws \TYPO3\Flow\Utility\Exception
  */
 public function getDocumentAbsolutePath($filename = null)
 {
     $path = str_replace('\\', '/', get_called_class());
     $documentAbsolutePath = $this->temporaryDirectoryBase . $path . '/';
     Files::createDirectoryRecursively($documentAbsolutePath);
     return Files::getNormalizedPath($documentAbsolutePath) . $filename;
 }
开发者ID:johannessteu,项目名称:JobButler,代码行数:12,代码来源:DocumentJobTrait.php

示例14: detectFlowPackageFilePath

 /**
  * Detects if the package contains a package file and returns the path and classname.
  *
  * @param string $packageKey The package key
  * @param string $absolutePackagePath Absolute path to the package
  * @return array The path to the package file and classname for this package or an empty array if none was found.
  * @throws Exception\CorruptPackageException
  * @throws InvalidPackagePathException
  */
 public function detectFlowPackageFilePath($packageKey, $absolutePackagePath)
 {
     if (!is_dir($absolutePackagePath)) {
         throw new InvalidPackagePathException(sprintf('The given package path "%s" is not a readable directory.', $absolutePackagePath), 1445904440);
     }
     $composerManifest = ComposerUtility::getComposerManifest($absolutePackagePath);
     if (!ComposerUtility::isFlowPackageType(isset($composerManifest['type']) ? $composerManifest['type'] : '')) {
         return [];
     }
     $possiblePackageClassPaths = [Files::concatenatePaths(['Classes', 'Package.php']), Files::concatenatePaths(['Classes', str_replace('.', '/', $packageKey), 'Package.php'])];
     $foundPackageClassPaths = array_filter($possiblePackageClassPaths, function ($packageClassPathAndFilename) use($absolutePackagePath) {
         $absolutePackageClassPath = Files::concatenatePaths([$absolutePackagePath, $packageClassPathAndFilename]);
         return is_file($absolutePackageClassPath);
     });
     if ($foundPackageClassPaths === []) {
         return [];
     }
     if (count($foundPackageClassPaths) > 1) {
         throw new Exception\CorruptPackageException(sprintf('The package "%s" contains multiple possible "Package.php" files. Please make sure that only one "Package.php" exists in the autoload root(s) of your Flow package.', $packageKey), 1457454840);
     }
     $packageClassPathAndFilename = reset($foundPackageClassPaths);
     $absolutePackageClassPath = Files::concatenatePaths([$absolutePackagePath, $packageClassPathAndFilename]);
     $packageClassContents = file_get_contents($absolutePackageClassPath);
     $packageClassName = (new PhpAnalyzer($packageClassContents))->extractFullyQualifiedClassName();
     if ($packageClassName === null) {
         throw new Exception\CorruptPackageException(sprintf('The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class.', $packageKey, $packageClassPathAndFilename), 1327587091);
     }
     return ['className' => $packageClassName, 'pathAndFilename' => $packageClassPathAndFilename];
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:38,代码来源:PackageFactory.php

示例15: prepareTemporaryDirectory

 /**
  * Builds a temporary directory to work on.
  * @return void
  */
 protected function prepareTemporaryDirectory()
 {
     $this->temporaryDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array(FLOW_PATH_DATA, 'Temporary', 'Testing', str_replace('\\', '_', __CLASS__)));
     if (!file_exists($this->temporaryDirectory)) {
         \TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->temporaryDirectory);
     }
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:11,代码来源:AbstractTest.php


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