本文整理汇总了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;
}
示例2: testGetHomeDirectoryForWindows
public function testGetHomeDirectoryForWindows()
{
putenv('HOME=');
putenv('HOMEDRIVE=C:');
putenv('HOMEPATH=/users/webmozart');
$this->assertEquals('C:/users/webmozart', Path::getHomeDirectory());
}
示例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);