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


PHP Path::join方法代码示例

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


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

示例1: rebuild

 /**
  * Rebuild the puli dependencies for symfony container.
  */
 protected function rebuild(InputInterface $input, OutputInterface $output)
 {
     $puli = new Puli(Path::join([getcwd(), NANBANDO_DIR]));
     $puli->start();
     /** @var EmbeddedComposerInterface $embeddedComposer */
     $embeddedComposer = $this->getApplication()->getEmbeddedComposer();
     $packageManager = $puli->getPackageManager();
     $io = new ConsoleIO($input, $output, $this->getApplication()->getHelperSet());
     $composer = $embeddedComposer->createComposer($io);
     $installationManager = $composer->getInstallationManager();
     $rootPackage = $composer->getPackage();
     $repository = $composer->getRepositoryManager()->getLocalRepository();
     $packages = [];
     foreach ($repository->getPackages() as $package) {
         $packages[$package->getName()] = $package;
     }
     foreach ($rootPackage->getRequires() as $require) {
         if (!array_key_exists($require->getTarget(), $packages)) {
             continue;
         }
         $packageManager->installPackage(Path::normalize($installationManager->getInstallPath($packages[$require->getTarget()])), $require->getTarget(), 'nanbando');
     }
     $filesystem = new Filesystem();
     $filesystem->remove(Path::join([getcwd(), NANBANDO_DIR, '.puli']));
     $discoveryManager = $puli->getDiscoveryManager();
     if (!$discoveryManager->hasRootTypeDescriptor('nanbando/bundle')) {
         $discoveryManager->addRootTypeDescriptor(new BindingTypeDescriptor(new BindingType('nanbando/bundle')), 0);
     }
     $discoveryManager->clearDiscovery();
     $discoveryManager->buildDiscovery();
     $filesystem = new Filesystem();
     $filesystem->remove(Path::join([getcwd(), NANBANDO_DIR, 'app', 'cache']));
 }
开发者ID:nanbando,项目名称:core,代码行数:36,代码来源:ReconfigureCommand.php

示例2: testCommandVersionSpecific

    /**
     * Assure that matching version-specific command files are loaded and others are ignored.
     */
    function testCommandVersionSpecific()
    {
        $path = Path::join(UNISH_SANDBOX, 'commandUnitCase');
        $major = $this->drush_major_version();
        $major_plus1 = $major + 1;
        // Write matched and unmatched files to the system search path.
        $files = array(Path::join($path, "{$major}.drush{$major}.inc"), Path::join($path, "drush{$major}/drush{$major}.drush.inc"), Path::join($path, "{$major_plus1}.drush{$major_plus1}.inc"), Path::join($path, "drush{$major_plus1}/drush{$major_plus1}.drush.inc"));
        $this->mkdir(Path::join($path, 'drush' . $major));
        $this->mkdir(Path::join($path, 'drush' . $major_plus1));
        foreach ($files as $file) {
            $contents = <<<EOD
<?php
// Written by Unish. This file is safe to delete.
\$GLOBALS['unish_foo'][] = '{$file}';
EOD;
            $return = file_put_contents($file, $contents);
        }
        drush_set_context('DRUSH_INCLUDE', array($path));
        drush_preflight();
        $loaded = drush_commandfile_list();
        $this->assertContains($files[0], $loaded);
        //Loaded a version-specific command file.
        $this->assertContains($files[1], $loaded);
        //Loaded a version-specific command directory.
        $this->assertNotContains($files[2], $loaded);
        //Did not load a mismatched version-specific command file.
        $this->assertNotContains($files[3], $loaded);
        //Did not load a a mismatched version-specific command directory.
    }
开发者ID:jibran,项目名称:drush,代码行数:32,代码来源:commandUnitTest.php

示例3: load

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  * @throws \LogicException
  * @throws BadMethodCallException
  */
 public function load($resource, $type = null)
 {
     $path = $this->locator->locate($resource);
     $this->container->addResource(new FileResource($path));
     $file = new JsonFile($path);
     $content = $file->read();
     $extension = pathinfo($resource, PATHINFO_FILENAME);
     if (array_key_exists('parameters', $content)) {
         foreach ($content['parameters'] as $name => $parameter) {
             $this->container->setParameter($name, $parameter);
         }
         unset($content['parameters']);
     }
     if (array_key_exists('imports', $content)) {
         foreach ($content['imports'] as $import) {
             $importFilename = $import;
             if (!Path::isAbsolute($importFilename)) {
                 $importFilename = Path::join([dirname($path), $import]);
             }
             $this->import($importFilename, null, false, $file);
         }
         unset($content['imports']);
     }
     $this->container->loadFromExtension($extension, $content);
 }
开发者ID:nanbando,项目名称:core,代码行数:33,代码来源:JsonLoader.php

示例4: getConfigTreeBuilder

 /**
  * {@inheritdoc}
  */
 public function getConfigTreeBuilder()
 {
     $treeBuilder = new TreeBuilder();
     $rootNode = $treeBuilder->root('nanando');
     $rootNode->children()->scalarNode('name')->defaultValue('nanbando')->end()->arrayNode('application')->addDefaultsIfNotSet()->children()->scalarNode('name')->defaultNull()->end()->scalarNode('version')->defaultNull()->end()->arrayNode('options')->prototype('scalar')->end()->end()->end()->end()->scalarNode('temp')->defaultValue(sys_get_temp_dir())->end()->arrayNode('backup')->useAttributeAsKey('name')->prototype('array')->children()->scalarNode('plugin')->end()->arrayNode('parameter')->prototype('variable')->end()->end()->end()->end()->end()->arrayNode('storage')->addDefaultsIfNotSet()->children()->scalarNode('local_directory')->defaultValue(Path::join([Path::getHomeDirectory(), 'nanbando']))->end()->scalarNode('remote_service')->end()->end()->end()->arrayNode('require')->prototype('variable')->end()->end()->arrayNode('presets')->prototype('array')->children()->scalarNode('application')->end()->scalarNode('version')->end()->arrayNode('options')->prototype('scalar')->end()->end()->arrayNode('backup')->prototype('array')->children()->scalarNode('plugin')->end()->arrayNode('parameter')->prototype('variable')->end()->end()->end()->end()->end()->end()->end()->end()->end();
     return $treeBuilder;
 }
开发者ID:nanbando,项目名称:core,代码行数:10,代码来源:Configuration.php

示例5: analyse

 /**
  * @param string $path
  * @param string|null $configFile
  * @param AbstractLogger $logger
  * @return Result
  */
 public function analyse($path, $configFile = null, AbstractLogger $logger = null)
 {
     $logger = $logger ?: new NullLogger();
     $path = Path::makeAbsolute($path, getcwd());
     if (!$configFile) {
         $configFile = Path::join([$path, '.simpspector.yml']);
     }
     $config = $this->loader->load($configFile);
     return $this->executor->run($path, $config, $logger);
 }
开发者ID:simpspector,项目名称:analyser,代码行数:16,代码来源:Analyser.php

示例6: testParameters

 public function testParameters()
 {
     $path = Path::join([DATAFIXTURES_DIR, 'config', 'test-parameters.json']);
     $this->locator->locate('test-parameters.json')->willReturn($path);
     $this->container->addResource(Argument::that(function (FileResource $resource) use($path) {
         return $resource->getResource() === $path;
     }))->shouldBeCalled();
     $this->container->loadFromExtension('test-parameters', ['name' => 'test'])->shouldBeCalled();
     $this->container->setParameter('test', 'value')->shouldBeCalled();
     $this->loader->load('test-parameters.json');
 }
开发者ID:nanbando,项目名称:core,代码行数:11,代码来源:JsonLoaderTest.php

示例7: getUris

 /**
  * {@inheritdoc}
  */
 public function getUris($sourceFile)
 {
     $uris = [];
     foreach (parent::getUris($sourceFile) as $uri) {
         foreach (array_keys($this->sizes) as $size) {
             $info = pathinfo($uri);
             $uris[] = Path::join($info['dirname'], $size . $info['basename']);
         }
     }
     return $uris;
 }
开发者ID:oscarotero,项目名称:statico,代码行数:14,代码来源:TransformedImages.php

示例8: testRestore

 public function testRestore()
 {
     $path = Path::join([DATAFIXTURES_DIR, 'backups', '13-21-2016-05-29_success.zip']);
     $nanbando = $this->getNanbando(['uploads' => ['plugin' => 'directory', 'parameter' => ['directory' => 'uploads']]]);
     $filesystem = new Filesystem(new ZipArchiveAdapter($path));
     $this->storage->open('13-21-45-2016-05-29')->willReturn($filesystem);
     $this->eventDispatcher->dispatch(Events::PRE_RESTORE_EVENT, Argument::type(PreRestoreEvent::class))->shouldBeCalled();
     $this->eventDispatcher->dispatch(Events::RESTORE_EVENT, Argument::type(RestoreEvent::class))->shouldBeCalled();
     $this->eventDispatcher->dispatch(Events::POST_RESTORE_EVENT, Argument::type(Event::class))->shouldBeCalled();
     $nanbando->restore('13-21-45-2016-05-29');
 }
开发者ID:nanbando,项目名称:core,代码行数:11,代码来源:NanbandoTest.php

示例9: createCodeSnippet

 /**
  * @param string $path
  * @param Issue $issue
  * @param int $around
  * @param bool $attr
  * @return string
  */
 public static function createCodeSnippet($path, Issue $issue, $around = 5, $attr = false)
 {
     $snippet = SnippetHelper::createSnippetByFile(Path::join($path, $issue->getFile()), $issue->getLine(), $around);
     $extension = pathinfo($issue->getFile(), PATHINFO_EXTENSION);
     $offset = max($issue->getLine() - $around, 1);
     $options = [];
     if ($attr) {
         $options = ['file' => $issue->getFile(), 'line' => $issue->getLine(), 'offset' => $offset];
     }
     return (new MarkdownBuilder())->code($snippet, $extension, $options)->getMarkdown();
 }
开发者ID:simpspector,项目名称:analyser,代码行数:18,代码来源:HighlightHelper.php

示例10: testDrushFinder

 public function testDrushFinder()
 {
     // We don't really need a real Drupal site; we could
     // create a fake site, as long as we had the right signature
     // files to allow us to bootstrap to the DRUPAL_ROOT phase.
     $this->setUpDrupal(1, TRUE);
     $globalDrushDotPhp = Path::join(UNISH_DRUSH, '../drush.php');
     // Control: test `drush --root ` ... with no site-local Drush
     $drush_location = $this->getDrushLocation();
     $this->assertEquals($globalDrushDotPhp, $drush_location);
     // We will try copying a site-local Drush to
     // all of the various locations the 'drush finder'
     // might expect to find it.
     $drush_locations = array("vendor", "../vendor", "sites/all/vendor", "sites/all");
     foreach ($drush_locations as $drush_base) {
         $drush_root = $this->create_site_local_drush($drush_base);
         // Test `drush --root ` ... with a site-local Drush
         $drush_location = $this->getDrushLocation(array('root' => $this->webroot()));
         $this->assertEquals(realpath($drush_root . '/drush.php'), realpath($drush_location));
         // Ensure that --local was NOT added
         $result = $this->drush('ev', array('return drush_get_option("local");'), array('root' => $this->webroot()));
         $output = $this->getOutput();
         $this->assertEquals("", $output);
         // Run the `drush --root` test again, this time with
         // a drush.wrapper script in place.
         $this->createDrushWrapper($drush_base);
         $drush_location = $this->getDrushLocation(array('root' => $this->webroot()));
         $this->assertEquals(realpath($drush_root . '/drush.php'), realpath($drush_location));
         // Test to see if --local was added
         $result = $this->drush('ev', array('return drush_get_option("local");'), array('root' => $this->webroot()));
         $output = $this->getOutput();
         $this->assertEquals("TRUE", $output);
         // Get rid of the symlink and site-local Drush we created
         $this->remove_site_local_drush($drush_base);
     }
     // Next, try again with a site-local Drush in a location
     // that Drush does not search.
     $mysterious_location = "path/drush/does/not/search";
     $drush_root = $this->create_site_local_drush($mysterious_location);
     // We should not find the site-local Drush without a Drush wrapper.
     $drush_location = $this->getDrushLocation(array('root' => $this->webroot()));
     $this->assertEquals($globalDrushDotPhp, $drush_location);
     $this->createDrushWrapper($mysterious_location);
     // Now that there is a Drush wrapper, we should be able to find the site-local Drush.
     $drush_location = $this->getDrushLocation(array('root' => $this->webroot()));
     $this->assertEquals(realpath($drush_root . '/drush.php'), $drush_location);
 }
开发者ID:phenaproxima,项目名称:drush,代码行数:47,代码来源:drushScriptTest.php

示例11: testJoinFailsIfInvalidPath

 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage The paths must be strings. Got: array
  */
 public function testJoinFailsIfInvalidPath()
 {
     Path::join('/path', array());
 }
开发者ID:webmozart,项目名称:path-util,代码行数:8,代码来源:PathTest.php

示例12: getLogDir

 /**
  * {@inheritdoc}
  */
 public function getLogDir()
 {
     $logDir = Path::join([getcwd(), NANBANDO_DIR, 'app', 'log']);
     $filesystem = new Filesystem();
     $filesystem->mkdir($logDir);
     return $logDir;
 }
开发者ID:nanbando,项目名称:core,代码行数:10,代码来源:Kernel.php

示例13: getCollectionDirectory

 /**
  * @param string $collection
  * @return string
  */
 protected function getCollectionDirectory($collection)
 {
     return Path::join($this->directory, strtolower($collection));
 }
开发者ID:davidbadura,项目名称:orangedb,代码行数:8,代码来源:AbstractAdapter.php

示例14: testPushExistsRemote

 public function testPushExistsRemote()
 {
     $zipPath = Path::join([DATAFIXTURES_DIR, 'backups', '13-21-2016-05-29_success.zip']);
     $file = '123-123-123';
     $path = sprintf('%s/%s.zip', $this->name, $file);
     $this->localFilesystem->readStream($path)->willReturn(file_get_contents($zipPath));
     $this->remoteFilesystem->has($path)->willReturn(true);
     $this->remoteFilesystem->putStream($path, Argument::any())->shouldNotBeCalled();
     $this->storage->push($file);
 }
开发者ID:nanbando,项目名称:core,代码行数:10,代码来源:LocalStorageTest.php

示例15: dumpFile

 public function dumpFile($file)
 {
     $database = $this->db_spec['database'];
     // $file is passed in to us usually via --result-file.  If the user
     // has set $options['result-file'] = TRUE, then we
     // will generate an SQL dump file in the same backup
     // directory that pm-updatecode uses.
     if ($file) {
         if ($file === TRUE) {
             // User did not pass a specific value for --result-file. Make one.
             $backup = drush_include_engine('version_control', 'backup');
             $backup_dir = $backup->prepare_backup_dir($database);
             if (empty($backup_dir)) {
                 $backup_dir = drush_find_tmp();
             }
             $file = Path::join($backup_dir, '@DATABASE_@DATE.sql');
         }
         $file = str_replace(array('@DATABASE', '@DATE'), array($database, gmdate('Ymd_His')), $file);
     }
     return $file;
 }
开发者ID:jibran,项目名称:drush,代码行数:21,代码来源:SqlBase.php


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