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


PHP Path::getHomeDirectory方法代码示例

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


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

示例1: 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

示例2: testGetHomeDirectoryForWindows

 public function testGetHomeDirectoryForWindows()
 {
     putenv('HOME=');
     putenv('HOMEDRIVE=C:');
     putenv('HOMEPATH=/users/webmozart');
     $this->assertEquals('C:/users/webmozart', Path::getHomeDirectory());
 }
开发者ID:webmozart,项目名称:path-util,代码行数:7,代码来源:PathTest.php

示例3: getenv

<?php

set_time_limit(0);
define('NANBANDO_DIR', getenv('NANBANDO_DIR') ?: '.nanbando');
use Dflydev\EmbeddedComposer\Core\EmbeddedComposerBuilder;
use Nanbando\Application\Application;
use Nanbando\Application\Kernel;
use Puli\Discovery\JsonDiscovery;
use Symfony\Component\Console\Input\ArgvInput;
use Webmozart\PathUtil\Path;
$input = new ArgvInput();
if ($projectDir = $input->getParameterOption('--root-dir')) {
    if (false !== strpos($projectDir, '~') && function_exists('posix_getuid')) {
        $info = posix_getpwuid(posix_getuid());
        $projectDir = str_replace('~', $info['dir'], $projectDir);
    }
    if (!is_dir($projectDir)) {
        throw new \InvalidArgumentException(sprintf('Specified project directory %s does not exist', $projectDir));
    }
    chdir($projectDir);
}
$discovery = new JsonDiscovery(Path::join([getcwd(), NANBANDO_DIR, '.puli', 'bindings.json']));
$embeddedComposerBuilder = new EmbeddedComposerBuilder($classLoader);
$embeddedComposer = $embeddedComposerBuilder->setComposerFilename('nanbando.json')->setVendorDirectory(NANBANDO_DIR)->build();
$embeddedComposer->processAdditionalAutoloads();
$kernel = new Kernel('prod', true, Path::getHomeDirectory(), $discovery);
$kernel->boot();
$input = $kernel->getContainer()->get('input');
$output = $kernel->getContainer()->get('output');
$application = new Application($kernel, $embeddedComposer);
$application->run($input, $output);
开发者ID:nanbando,项目名称:core,代码行数:31,代码来源:nanbando.php


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